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:
@ -136,6 +136,7 @@ typedef struct server
|
||||
bool is_active; /**< Server is active and has not been "destroyed" */
|
||||
bool proxy_protocol; /**< Send proxy-protocol header to backend when connecting client sessions. */
|
||||
int last_event; /**< The last event that occurred on this server */
|
||||
bool active_event; /**< Event observed when MaxScale was active */
|
||||
int64_t triggered_at; /**< Time when the last event was triggered */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t server_chk_tail;
|
||||
|
||||
Reference in New Issue
Block a user