Add server maintenance mode.
Maintenance mode prevents a server from having new connections made to it and stops MaxScale from monitoring a server. It is designed to allow a server to be taken out of an active cluster for maintenance. It prevents new connections and allowsg existing connections to drain away prior to performaing maintenance on the server.
This commit is contained in:
@ -35,6 +35,7 @@
|
||||
* 20/05/14 Massimiliano Pinto Addition of server_string field
|
||||
* 20/05/14 Massimiliano Pinto Addition of node_id field
|
||||
* 23/05/14 Massimiliano Pinto Addition of rlag and node_ts fields
|
||||
* 03/06/14 Mark Riddoch Addition of maintainance mode
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
@ -80,12 +81,13 @@ typedef struct server {
|
||||
#define SERVER_MASTER 0x0002 /**<< The server is a master, i.e. can handle writes */
|
||||
#define SERVER_SLAVE 0x0004 /**<< The server is a slave, i.e. can handle reads */
|
||||
#define SERVER_JOINED 0x0008 /**<< The server is joined in a Galera cluster */
|
||||
#define SERVER_MAINT 0x1000 /**<< Server is in maintenance mode */
|
||||
|
||||
/**
|
||||
* Is the server running - the macro returns true if the server is marked as running
|
||||
* regardless of it's state as a master or slave
|
||||
*/
|
||||
#define SERVER_IS_RUNNING(server) ((server)->status & SERVER_RUNNING)
|
||||
#define SERVER_IS_RUNNING(server) (((server)->status & (SERVER_RUNNING|SERVER_MAINT)) == SERVER_RUNNING)
|
||||
/**
|
||||
* Is the server marked as down - the macro returns true if the server is beleived
|
||||
* to be inoperable.
|
||||
@ -96,19 +98,24 @@ typedef struct server {
|
||||
* in order for the macro to return true
|
||||
*/
|
||||
#define SERVER_IS_MASTER(server) \
|
||||
(((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE)) == (SERVER_RUNNING|SERVER_MASTER))
|
||||
(((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE|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
|
||||
*/
|
||||
#define SERVER_IS_SLAVE(server) \
|
||||
(((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE)) == (SERVER_RUNNING|SERVER_SLAVE))
|
||||
(((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE|SERVER_MAINT)) == (SERVER_RUNNING|SERVER_SLAVE))
|
||||
|
||||
/**
|
||||
* Is the server joined Galera node? The server must be running and joined.
|
||||
*/
|
||||
#define SERVER_IS_JOINED(server) \
|
||||
(((server)->status & (SERVER_RUNNING|SERVER_JOINED)) == (SERVER_RUNNING|SERVER_JOINED))
|
||||
(((server)->status & (SERVER_RUNNING|SERVER_JOINED|SERVER_MAINT)) == (SERVER_RUNNING|SERVER_JOINED))
|
||||
|
||||
/**
|
||||
* Is the server in maintenance mode.
|
||||
*/
|
||||
#define SERVER_IN_MAINT(server) ((server)->status & SERVER_MAINT)
|
||||
|
||||
extern SERVER *server_alloc(char *, char *, unsigned short);
|
||||
extern int server_free(SERVER *);
|
||||
|
Reference in New Issue
Block a user