Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replica_rac2: remove unlocked pending updates read
In `ProcessPiggybackedAdmittedAtLeaderRaftMuLocked`, we swap the pending updates map with another one before releasing the mutex, in order to minimize the time holding a mutex. Subsequently, the method would then check if the updates map was empty by calling `len()`, performing a read. When the updates map was not empty, the read was against a map which was now only referenced in this function, because a new map was swapped in under the lock. When the updates map was empty, the map isn't swapped out and is referenced by the receiver struct instance, reading a ref without locking. Return whether the updates map was empty, to avoid racing when reading the length of the shared ref empty map. Part of: #130187 Release note: None
- Loading branch information