Skip to content

kv: remove lastToReplica and lastFromReplica from raftMu#95861

Merged
craig[bot] merged 1 commit into
cockroachdb:masterfrom
nvb:nvanbenschoten/lastSeenRepls
Jan 26, 2023
Merged

kv: remove lastToReplica and lastFromReplica from raftMu#95861
craig[bot] merged 1 commit into
cockroachdb:masterfrom
nvb:nvanbenschoten/lastSeenRepls

Conversation

@nvb

@nvb nvb commented Jan 25, 2023

Copy link
Copy Markdown
Contributor

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

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

blathers-crl Bot commented Jan 25, 2023

Copy link
Copy Markdown

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
Copy Markdown
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
@nvb nvb force-pushed the nvanbenschoten/lastSeenRepls branch from a1ca4e1 to 1fff781 Compare January 26, 2023 16:38
@nvb

nvb commented Jan 26, 2023

Copy link
Copy Markdown
Contributor Author

TFTR!

bors r+

@craig craig Bot merged commit ed9928f into cockroachdb:master Jan 26, 2023
@craig

craig Bot commented Jan 26, 2023

Copy link
Copy Markdown
Contributor

Build succeeded:

@nvb nvb 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