Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-19.1: stats: don't spam log with warning messages #36435

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pkg/sql/stats/automatic_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ var DefaultRefreshInterval = time.Minute
// any effect.
var DefaultAsOfTime = 30 * time.Second

// bufferedChanFullLogLimiter is used to minimize spamming the log with
// "buffered channel is full" errors.
var bufferedChanFullLogLimiter = log.Every(time.Second)

// Constants for automatic statistics collection.
// TODO(rytaft): Should these constants be configurable?
const (
Expand Down Expand Up @@ -357,9 +361,11 @@ func (r *Refresher) NotifyMutation(tableID sqlbase.ID, rowsAffected int) {
case r.mutations <- mutation{tableID: tableID, rowsAffected: rowsAffected}:
default:
// Don't block if there is no room in the buffered channel.
log.Warningf(context.TODO(),
"buffered channel is full. Unable to refresh stats for table %d with %d rows affected",
tableID, rowsAffected)
if bufferedChanFullLogLimiter.ShouldLog() {
log.Warningf(context.TODO(),
"buffered channel is full. Unable to refresh stats for table %d with %d rows affected",
tableID, rowsAffected)
}
}
}

Expand Down