cockroachdb / cockroachdb/cockroach

singleflight: take advantage of WithCancelCause during WaitForResult

Open
#134,562 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement T-sql-foundations
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.