cockroachdb / cockroachdb/cockroach
singleflight: take advantage of WithCancelCause during WaitForResult
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Now that go lang supports CancelWithCause (https://pkg.go.dev/context#WithCancelCause) inside we can make the logging for singleflights much better. Right now if during an RPC if the remote connection is severed we can end up with excessive logging inside: https://github.com/cockroachdb/cockroach/blob/ec8f0a2c75091c926419376ad1d2f97a4afb58af/pkg/util/syncutil/singleflight/singleflight.go#L247
See https://github.com/cockroachdb/cockroach/issues/134201 for an example. To avoid this lets look a the cause and be more selective about **when** we should log during singleflight cancellations.
Jira issue: CRDB-44139
Epic CRDB-60948
Contributor guide
Assessment
This issue has not been assessed yet.