Replication lag support in server struct
Replication lag support in server struct and configuration
This commit is contained in:
@ -32,6 +32,7 @@
|
|||||||
* 11/05/14 Massimiliano Pinto Added version_string support to service
|
* 11/05/14 Massimiliano Pinto Added version_string support to service
|
||||||
* 19/05/14 Mark Riddoch Added unique names from section headers
|
* 19/05/14 Mark Riddoch Added unique names from section headers
|
||||||
* 23/05/14 Massimiliano Pinto Added automatic set of maxscale-id: first listening ipv4_raw + port + pid
|
* 23/05/14 Massimiliano Pinto Added automatic set of maxscale-id: first listening ipv4_raw + port + pid
|
||||||
|
* 28/05/14 Massimiliano Pinto Added detect_replication_lag parameter
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -496,6 +497,7 @@ int error_count = 0;
|
|||||||
char *user;
|
char *user;
|
||||||
char *passwd;
|
char *passwd;
|
||||||
unsigned long interval = 0;
|
unsigned long interval = 0;
|
||||||
|
int replication_heartbeat = 0;
|
||||||
|
|
||||||
module = config_get_value(obj->parameters, "module");
|
module = config_get_value(obj->parameters, "module");
|
||||||
servers = config_get_value(obj->parameters, "servers");
|
servers = config_get_value(obj->parameters, "servers");
|
||||||
@ -505,6 +507,10 @@ int error_count = 0;
|
|||||||
interval = strtoul(config_get_value(obj->parameters, "monitor_interval"), NULL, 10);
|
interval = strtoul(config_get_value(obj->parameters, "monitor_interval"), NULL, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config_get_value(obj->parameters, "detect_replication_lag")) {
|
||||||
|
replication_heartbeat = atoi(config_get_value(obj->parameters, "detect_replication_lag"));
|
||||||
|
}
|
||||||
|
|
||||||
if (module)
|
if (module)
|
||||||
{
|
{
|
||||||
obj->element = monitor_alloc(obj->object, module);
|
obj->element = monitor_alloc(obj->object, module);
|
||||||
@ -524,6 +530,10 @@ int error_count = 0;
|
|||||||
if (interval > 0)
|
if (interval > 0)
|
||||||
monitorSetInterval(obj->element, interval);
|
monitorSetInterval(obj->element, interval);
|
||||||
|
|
||||||
|
/* set replication heartbeat */
|
||||||
|
if(replication_heartbeat == 1)
|
||||||
|
monitorSetReplicationHeartbeat(obj->element, replication_heartbeat);
|
||||||
|
|
||||||
/* get the servers to monitor */
|
/* get the servers to monitor */
|
||||||
s = strtok(servers, ",");
|
s = strtok(servers, ",");
|
||||||
while (s)
|
while (s)
|
||||||
@ -1108,6 +1118,7 @@ static char *service_params[] =
|
|||||||
"enable_root_user",
|
"enable_root_user",
|
||||||
"max_slave_connections",
|
"max_slave_connections",
|
||||||
"version_string",
|
"version_string",
|
||||||
|
"detect_replication_lag,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* 17/05/14 Mark Riddoch Addition of unique_name
|
* 17/05/14 Mark Riddoch Addition of unique_name
|
||||||
* 20/05/14 Massimiliano Pinto Addition of server_string
|
* 20/05/14 Massimiliano Pinto Addition of server_string
|
||||||
* 21/05/14 Massimiliano Pinto Addition of node_id
|
* 21/05/14 Massimiliano Pinto Addition of node_id
|
||||||
|
* 28/05/14 Massimiliano Pinto Addition of rlagd and node_ts fields
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -73,6 +74,8 @@ SERVER *server;
|
|||||||
server->unique_name = NULL;
|
server->unique_name = NULL;
|
||||||
server->server_string = NULL;
|
server->server_string = NULL;
|
||||||
server->node_id = -1;
|
server->node_id = -1;
|
||||||
|
server->rlag = -1;
|
||||||
|
server->node_ts = -1;
|
||||||
|
|
||||||
spinlock_acquire(&server_spin);
|
spinlock_acquire(&server_spin);
|
||||||
server->next = allServers;
|
server->next = allServers;
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
* 18/05/14 Mark Riddoch Addition of unique_name field
|
* 18/05/14 Mark Riddoch Addition of unique_name field
|
||||||
* 20/05/14 Massimiliano Pinto Addition of server_string field
|
* 20/05/14 Massimiliano Pinto Addition of server_string field
|
||||||
* 20/05/14 Massimiliano Pinto Addition of node_id field
|
* 20/05/14 Massimiliano Pinto Addition of node_id field
|
||||||
|
* 23/05/14 Massimiliano Pinto Addition of rlag and node_ts fields
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -66,6 +67,8 @@ typedef struct server {
|
|||||||
struct server *nextdb; /**< Next server in list attached to a service */
|
struct server *nextdb; /**< Next server in list attached to a service */
|
||||||
char *server_string; /**< Server version string, i.e. MySQL server version */
|
char *server_string; /**< Server version string, i.e. MySQL server version */
|
||||||
long node_id; /**< Node id, server_id for M/S or local_index for Galera */
|
long node_id; /**< Node id, server_id for M/S or local_index for Galera */
|
||||||
|
int rlag; /**< Replication Lag for Master / Slave replication */
|
||||||
|
unsigned long node_ts; /**< Last timestamp set from M/S monitor module */
|
||||||
} SERVER;
|
} SERVER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user