Remove use of timestamps in failover code
Using timestamps to detect whether MaxScale was active or passive can cause problems if multiple events happen at the same time. This can be avoided by separating events into actively observed and passively observed events. This clarifies the logic by removing the ambiguity of timestamps. As the monitoring threads are separate from the worker threads, it is prudent to use atomic operations to modify and read the state of the MaxScale. This will impose an happens-before relation between MaxScale being set into passive mode and events being classified as being passively observed.
This commit is contained in:
@ -763,10 +763,10 @@ bool runtime_alter_maxscale(const char* name, const char* value)
|
||||
if (cnf.passive && !boolval)
|
||||
{
|
||||
// This MaxScale is being promoted to the active instance
|
||||
cnf.promoted_at = hkheartbeat;
|
||||
atomic_store_int64(&cnf.promoted_at, hkheartbeat);
|
||||
}
|
||||
|
||||
cnf.passive = boolval;
|
||||
atomic_store_int32(&cnf.passive, boolval);
|
||||
rval = true;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user