Skip to content

Commit

Permalink
storage: rely on pebble for log message in case of write stall
Browse files Browse the repository at this point in the history
In case of a write stall, CRDB logs out details re: the write stall. By
default, CRDB logs at fatal level & then crashes. Before this commit, tho the
pebble event had a String method, it was not used in the CRDB log message.
This means adding additional context to the pebble event will not add the
context to the CRDB logs, unless a CRDB change is made in addition to a pebble
change. With this commit, the log message calls the pebble event's String
method.

Release note (ops change): CRDB log message in case of write stall has been
adjusted slightly.
  • Loading branch information
joshimhoff committed Jan 24, 2023
1 parent 1f2ead2 commit c48e3c7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import (
"github.com/cockroachdb/pebble/replay"
"github.com/cockroachdb/pebble/sstable"
"github.com/cockroachdb/pebble/vfs"
"github.com/cockroachdb/redact"
humanize "github.com/dustin/go-humanize"
)

Expand Down Expand Up @@ -1067,11 +1066,9 @@ func (p *Pebble) makeMetricEtcEventListener(ctx context.Context) pebble.EventLis
// Note that the below log messages go to the main cockroach log, not
// the pebble-specific log.
if fatalOnExceeded {
log.Fatalf(ctx, "disk stall detected: pebble unable to write to %s in %.2f seconds",
info.Path, redact.Safe(info.Duration.Seconds()))
log.Fatalf(ctx, "file write stall detected: %s", info)
} else {
log.Errorf(ctx, "disk stall detected: pebble unable to write to %s in %.2f seconds",
info.Path, redact.Safe(info.Duration.Seconds()))
log.Errorf(ctx, "file write stall detected: %s", info)
}
return
}
Expand Down

0 comments on commit c48e3c7

Please sign in to comment.