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: remove lastToReplica and lastFromReplica from raftMu #95861

Merged

Conversation

nvanbenschoten
Copy link
Member

@nvanbenschoten nvanbenschoten commented Jan 25, 2023

Extracted from #94165 without modification.


In 410ef29, we moved these fields from under the Replica.mu to under the Replica.raftMu. This was done to avoid lock contention.

In this commit, we move these fields under their own mutex so that they can be accessed without holding the raftMu. This allows us to send Raft messages from other goroutines.

The commit also switches from calling RawNode.ReportUnreachable directly in sendRaftMessage to using the more flexible unreachablesMu set, which defers the call to ReportUnreachable until the next Raft tick. As a result, the commit closes #84246.

Release note: None
Epic: None

@nvanbenschoten nvanbenschoten requested review from tbg and a team January 25, 2023 20:20
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner January 25, 2023 20:20
@blathers-crl
Copy link

blathers-crl bot commented Jan 25, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

In 410ef29, we moved these fields from under the Replica.mu to under the
Replica.raftMu. This was done to avoid lock contention.

In this commit, we move these fields under their own mutex so that they
can be accessed without holding the raftMu. This allows us to send Raft
messages from other goroutines.

The commit also switches from calling RawNode.ReportUnreachable directly
in sendRaftMessage to using the more flexible unreachablesMu set, which
defers the call to ReportUnreachable until the next Raft tick. As a result,
the commit closes cockroachdb#84246.

Release note: None
Epic: None
@nvanbenschoten
Copy link
Member Author

TFTR!

bors r+

@craig craig bot merged commit ed9928f into cockroachdb:master Jan 26, 2023
@craig
Copy link
Contributor

craig bot commented Jan 26, 2023

Build succeeded:

@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/lastSeenRepls branch January 26, 2023 22:08
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.

kvserver: consider removing unreachablesMu
3 participants