You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
152205: kvserver: rm unnecessary Replica.mu locking r=arulajmani a=pav-kv
This PR removes the unnecessary `Replica.mu.RLock()` in `Store.tryGetReplica()`. This function is on the critical path - every raft message [processing](https://github.com/cockroachdb/cockroach/blob/d1af030c8b9894306710132a253bd7c2c9145623/pkg/kv/kvserver/store_raft.go#L699) calls it. So this should have a non-zero performance impact.
Presumably, `Replica.mu` used to be locked for reading `destroyStatus`, but the latter can be read with only `raftMu` held. To emphasize that this field can be read under either mutex, this PR also moves `destroyStatus` from the `Replica.mu` to `Replica.shMu` section.
Technically, `destroyStatus` doesn't fit either of `Replica.{mu,shMu}` sections, because it must be mutated with also `readOnlyCmdMu` locked. But `shMu` is strictly closer by semantics.
Epic: none
Release note: none
Co-authored-by: Pavel Kalinnikov <[email protected]>
0 commit comments