server.h:added macro SERVER_IS_ROOT_MASTER for finding valid candidate for root master
readwritesplit.c: wrote open three if conditions in get_root_master_bref for clarity
This commit is contained in:
VilhoRaatikka
2014-09-16 14:49:04 +03:00
parent 7300e58787
commit 48c25155f5
2 changed files with 17 additions and 5 deletions

View File

@ -123,7 +123,15 @@ typedef struct server {
*/
#define SERVER_IS_MASTER(server) \
(((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE|SERVER_MAINT)) == (SERVER_RUNNING|SERVER_MASTER))
/**
* Is the server valid candidate for root master. The server must be running,
* marked as master and not have maintenance bit set.
*/
#define SERVER_IS_ROOT_MASTER(server) \
(((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_MAINT)) == (SERVER_RUNNING|SERVER_MASTER))
/**
* Is the server a slave? The server must be both running and marked as a slave
* in order for the macro to return true
*/