Skip to content

Commit

Permalink
Unselectable flag race fix (#1773)
Browse files Browse the repository at this point in the history
In short, we could get in a state where `IsReplica` could be true, but we couldn't use it because it was unselectable via this path, especially on a reconnect race. This caused failures in other Sentinel testing, specifically the `NoConnectionAvailable` variety on `DemandMaster` sanity check gets, because we had a replica, it was connected, but the flags said we couldn't use it. That should _never_ be the case and this additional check at the flag set site ensures it.

In testing, it looked like this (local changes here are logging this condition):

![image](https://user-images.githubusercontent.com/454813/122651716-abf78100-d108-11eb-931e-a28daa76efa6.png)
  • Loading branch information
NickCraver authored Jun 19, 2021
1 parent ae22e1c commit e61484c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/StackExchange.Redis/ConnectionMultiplexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,7 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, LogP
var preferred = await NominatePreferredMaster(log, servers, useTieBreakers, tieBreakers, masters).ObserveErrors().ForAwait();
foreach (var master in masters)
{
if (master == preferred)
if (master == preferred || master.IsReplica)
{
master.ClearUnselectable(UnselectableFlags.RedundantMaster);
}
Expand Down

0 comments on commit e61484c

Please sign in to comment.