Skip to content

Commit

Permalink
storage: close over disk slow event listener
Browse files Browse the repository at this point in the history
When addressing an interface change in a recent vendor bump (cockroachdb#102882), a
closure over the existing event listener (passed in via `opts`) was
removed in favor of instantiating Pebble's event listener directly. This
had the effect of dropping disk slow events.

Revert to using a function that closed over the `opts`, making use of
the existing event listener.

Fixes: cockroachdb#103185
Fixes: cockroachdb#102946
Fixes: cockroachdb#102944
Fixes: cockroachdb#102940

Release note: None.
  • Loading branch information
nicktrav committed May 15, 2023
1 parent ac3bdf3 commit d748383
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,14 @@ func wrapFilesystemMiddleware(opts *pebble.Options) (vfs.FS, io.Closer) {
// wraps the filesystem with a layer that times all write-oriented
// operations.
fs, closer := vfs.WithDiskHealthChecks(opts.FS, diskHealthCheckInterval,
opts.EventListener.DiskSlow)
func(info vfs.DiskSlowInfo) {
opts.EventListener.DiskSlow(pebble.DiskSlowInfo{
Path: info.Path,
OpType: info.OpType,
Duration: info.Duration,
WriteSize: info.WriteSize,
})
})
// If we encounter ENOSPC, exit with an informative exit code.
fs = vfs.OnDiskFull(fs, func() {
exit.WithCode(exit.DiskFull())
Expand Down

0 comments on commit d748383

Please sign in to comment.