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

kvserver: get Stats and GCHint under same RLock #110652

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

pav-kv
Copy link
Collaborator

@pav-kv pav-kv commented Sep 14, 2023

Before this commit, makeMVCCGCQueueScore unlocked Replica.mu between reading ReplicaState.Stats and ReplicaState.GCHint. The GC scoring function uses both fields, we would like them to be in sync. The unlock makes it possible for Stats and GCHint to correspond to different states of the Replica.

This commit moves both reads under the same RLock/RUnlock.

Epic: none
Release note: none

Before this commit, makeMVCCGCQueueScore unlocked Replica.mu between
reading ReplicaState.Stats and ReplicaState.GCHint. The GC scoring
function uses both fields, we would like them to be in sync. The unlock
makes it possible for Stats and GCHint to correspond to different states
of the Replica.

This commit moves both reads under the same RLock/RUnlock.

Epic: none
Release note: none
@pav-kv pav-kv requested a review from erikgrinaker September 14, 2023 16:11
@pav-kv pav-kv requested a review from a team as a code owner September 14, 2023 16:11
@blathers-crl
Copy link

blathers-crl bot commented Sep 14, 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

Copy link
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@pav-kv
Copy link
Collaborator Author

pav-kv commented Sep 14, 2023

bors r=erikgrinaker

@pav-kv pav-kv added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Sep 14, 2023
@craig
Copy link
Contributor

craig bot commented Sep 14, 2023

This PR was included in a batch that was canceled, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented Sep 14, 2023

Build succeeded:

@craig craig bot merged commit ee3765b into cockroachdb:master Sep 14, 2023
@pav-kv pav-kv deleted the read-replica-state-under-same-lock branch September 18, 2023 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants