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

kv: don't leak raft application tracing spans on or after ErrRemoved #54140

Merged

Conversation

nvanbenschoten
Copy link
Member

Fixes #53677.

This change ensures that we properly finish tracing spans of Raft commands that throw ErrRemoved errors in ApplySideEffects. It then ensures that we properly finish tracing spans of Raft commands that follow a command that throws an ErrRemoved. Before this, these commands would be abandoned and would never be finished. The effects of this are theoretically even worse than those fixed in the previous commit because these leaked commands could be locally proposed, so we may be abandoning a local proposer indefinitely.

It's not clear that we ever saw an instance of this. It seems rare for a local proposal to end up in the same CommittedEntries batch as a command that removes a replica because of the lease requirements, but it doesn't seem impossible, especially of the local proposal was a RequestLease request.

I was originally intending to do something more dramatic and make replicaStateMachine.ApplySideEffects responsible for acknowledging proposers in all cases, but doing so turned out to be pretty invasive so I was concerned that it would be harder to backport to v20.2 and to v20.1. I may revisit that in the future.

Release justification: low risk, high benefit changes to existing functionality.

Release justification: low risk, high benefit changes to existing
functionality.
Fixes cockroachdb#53677.

This commit ensures that we properly finish tracing spans of
Raft commands that throw ErrRemoved errors in ApplySideEffects.

I was originally intending to do something more dramatic and make
`replicaStateMachine.ApplySideEffects` responsible for acknowledging
proposers in all cases, but doing so turned out to be pretty invasive
so I was concerned that it would be harder to backport to v20.2 and
to v20.1. I may revisit that in the future.

Release justification: low risk, high benefit changes to existing
functionality.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defeat the linter and :lgtm_strong:

Reviewed 1 of 1 files at r1, 2 of 2 files at r2, 8 of 8 files at r3.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained


pkg/kv/kvserver/apply/cmd.go, line 208 at r3 (raw file):

// In the following three functions, fn is written with ctx as a 2nd param
// because callers wants to bind it to methods that has Commands (or variants)

“callers wants”

This comment is generally hard to parse

@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/applyTraceLeakPatch branch from a4ce989 to e9f5a61 Compare September 10, 2020 21:18
@nvanbenschoten
Copy link
Member Author

bors r+

@nvanbenschoten
Copy link
Member Author

bors r-

@craig
Copy link
Contributor

craig bot commented Sep 11, 2020

Canceled.

Extension of cockroachdb#53677.

This commit ensures that we properly finish tracing spans of Raft
commands that follow a command that throws a ErrRemoved. Before this
commit, these commands would be abandoned and would never be finished.
The effects of this are theoretically even worse than those fixed in the
previous commit because these leaked commands could be locally proposed,
so we may be abandoning a local proposer indefinitely.

It's not clear that we ever saw an instance of this. It seems rare for a
local proposal to end up in the same CommittedEntries batch as a command
that removes a replica because of the lease requirements, but it doesn't
seem impossible, especially of the local proposal was a RequestLease
request.

Release justification: low risk, high benefit changes to existing
functionality.
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/applyTraceLeakPatch branch from e9f5a61 to e73de8a Compare September 11, 2020 01:16
Copy link
Member Author

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r+

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)


pkg/kv/kvserver/apply/cmd.go, line 208 at r3 (raw file):

Previously, ajwerner wrote…

“callers wants”

This comment is generally hard to parse

Done. Cleaned it up a bit too.

@craig
Copy link
Contributor

craig bot commented Sep 11, 2020

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kv: raft application leaks traces on ErrRemoved
3 participants