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
Greatly reduce race condition on .MakeMaster() calls at low-latency.
This was breaking integration tests but affects all zero-latency server situations. There's a good description in code, but the basics are a race between a broadcast (which goes first) and the post-SLAVEOF reconfig (which loses) creates a situation where the proper topology isn't seen until the next reconfig time span pass.
We now prevent that broadcast (we're broadcasting to ourselves) from running on ourselves because we're about to run another one anyway. This doesn't 100% eliminate the race because there's a minute chance of a pub/sub landing between the 2 if blocks here in an external Interlock. But the chance is crazy small now, at least.
Note: the logging of *why* a reconfig didn't run is now enhanced as well. We log what was trying to run and what was blocking it in the output for much easier debugging next time.
// There's an inherent race here in zero-lantency environments (e.g. when Redis is on localhost) when a broadcast is specified
373
+
// The broadast can get back from redis and trigger a reconfigure before we get a chance to get to ReconfigureAsync() below
374
+
// This results in running an outdated reconfig and the .CompareExchange() (due to already running a reconfig) failing...making our needed reconfig a no-op.
375
+
// If we don't block *that* run, then *our* run (at low latency) gets blocked. Then we're waiting on the
376
+
// ConfigurationOptions.ConfigCheckSeconds interval to identify the current (created by this method call) topology correctly.
0 commit comments