Addition of setNetworkTimeout in galera mon
Addition of setNetworkTimeout in galera mon
This commit is contained in:
@ -31,6 +31,7 @@
|
|||||||
* 03/06/14 Mark Riddoch Add support for maintenance mode
|
* 03/06/14 Mark Riddoch Add support for maintenance mode
|
||||||
* 24/06/14 Massimiliano Pinto Added depth level 0 for each node
|
* 24/06/14 Massimiliano Pinto Added depth level 0 for each node
|
||||||
* 30/10/14 Massimiliano Pinto Added disableMasterFailback feature
|
* 30/10/14 Massimiliano Pinto Added disableMasterFailback feature
|
||||||
|
* 10/11/14 Massimiliano Pinto Added setNetworkTimeout for connect,read,write
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -53,7 +54,7 @@ extern int lm_enabled_logfiles_bitmask;
|
|||||||
|
|
||||||
static void monitorMain(void *);
|
static void monitorMain(void *);
|
||||||
|
|
||||||
static char *version_str = "V1.3.0";
|
static char *version_str = "V1.4.0";
|
||||||
|
|
||||||
MODULE_INFO info = {
|
MODULE_INFO info = {
|
||||||
MODULE_API_MONITOR,
|
MODULE_API_MONITOR,
|
||||||
@ -72,6 +73,7 @@ static void setInterval(void *, size_t);
|
|||||||
static MONITOR_SERVERS *get_candidate_master(MONITOR_SERVERS *);
|
static MONITOR_SERVERS *get_candidate_master(MONITOR_SERVERS *);
|
||||||
static MONITOR_SERVERS *set_cluster_master(MONITOR_SERVERS *, MONITOR_SERVERS *, int);
|
static MONITOR_SERVERS *set_cluster_master(MONITOR_SERVERS *, MONITOR_SERVERS *, int);
|
||||||
static void disableMasterFailback(void *, int);
|
static void disableMasterFailback(void *, int);
|
||||||
|
static void setNetworkTimeout(void *arg, int type, int value);
|
||||||
|
|
||||||
static MONITOR_OBJECT MyObject = {
|
static MONITOR_OBJECT MyObject = {
|
||||||
startMonitor,
|
startMonitor,
|
||||||
@ -81,7 +83,7 @@ static MONITOR_OBJECT MyObject = {
|
|||||||
defaultUsers,
|
defaultUsers,
|
||||||
diagnostics,
|
diagnostics,
|
||||||
setInterval,
|
setInterval,
|
||||||
NULL,
|
setNetworkTimeout,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@ -662,3 +664,56 @@ MYSQL_MONITOR *handle = (MYSQL_MONITOR *)arg;
|
|||||||
memcpy(&handle->disableMasterFailback, &disable, sizeof(int));
|
memcpy(&handle->disableMasterFailback, &disable, sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setNetworkTimeout(void *arg, int type, int value)
|
||||||
|
{
|
||||||
|
MYSQL_MONITOR *handle = (MYSQL_MONITOR *)arg;
|
||||||
|
int max_timeout = (int)(handle->interval/1000);
|
||||||
|
int new_timeout = max_timeout -1;
|
||||||
|
|
||||||
|
if (new_timeout <= 0)
|
||||||
|
new_timeout = DEFAULT_CONNECT_TIMEOUT;
|
||||||
|
|
||||||
|
switch(type) {
|
||||||
|
case MONITOR_CONNECT_TIMEOUT:
|
||||||
|
if (value < max_timeout) {
|
||||||
|
memcpy(&handle->connect_timeout, &value, sizeof(int));
|
||||||
|
} else {
|
||||||
|
memcpy(&handle->connect_timeout, &new_timeout, sizeof(int));
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"warning : Monitor Connect Timeout %i is greater than monitor interval ~%i seconds"
|
||||||
|
", lowering to %i seconds", value, max_timeout, new_timeout)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MONITOR_READ_TIMEOUT:
|
||||||
|
if (value < max_timeout) {
|
||||||
|
memcpy(&handle->read_timeout, &value, sizeof(int));
|
||||||
|
} else {
|
||||||
|
memcpy(&handle->read_timeout, &new_timeout, sizeof(int));
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"warning : Monitor Read Timeout %i is greater than monitor interval ~%i seconds"
|
||||||
|
", lowering to %i seconds", value, max_timeout, new_timeout)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MONITOR_WRITE_TIMEOUT:
|
||||||
|
if (value < max_timeout) {
|
||||||
|
memcpy(&handle->write_timeout, &value, sizeof(int));
|
||||||
|
} else {
|
||||||
|
memcpy(&handle->write_timeout, &new_timeout, sizeof(int));
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"warning : Monitor Write Timeout %i is greater than monitor interval ~%i seconds"
|
||||||
|
", lowering to %i seconds", value, max_timeout, new_timeout)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Monitor setNetworkTimeout received an unsupported action type %i", type)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user