Merge branch 'v1.2.2-669' into v1.2.2

pull/679/head
René Cannaò 10 years ago
commit 7446bf7189

@ -268,6 +268,7 @@ class MySQL_Threads_Handler
int monitor_replication_lag_timeout;
int monitor_query_interval;
int monitor_query_timeout;
int monitor_slave_lag_when_null;
char *monitor_username;
char *monitor_password;
int ping_interval_server_msec;

@ -766,6 +766,7 @@ __thread int mysql_thread___monitor_replication_lag_interval;
__thread int mysql_thread___monitor_replication_lag_timeout;
__thread int mysql_thread___monitor_query_interval;
__thread int mysql_thread___monitor_query_timeout;
__thread int mysql_thread___monitor_slave_lag_when_null;
__thread char * mysql_thread___monitor_username;
__thread char * mysql_thread___monitor_password;
@ -845,6 +846,7 @@ extern __thread int mysql_thread___monitor_replication_lag_interval;
extern __thread int mysql_thread___monitor_replication_lag_timeout;
extern __thread int mysql_thread___monitor_query_interval;
extern __thread int mysql_thread___monitor_query_timeout;
extern __thread int mysql_thread___monitor_slave_lag_when_null;
extern __thread char * mysql_thread___monitor_username;
extern __thread char * mysql_thread___monitor_password;

@ -801,7 +801,8 @@ __exit_monitor_replication_lag_thread:
if (j>-1) {
MYSQL_ROW row=mysql_fetch_row(mmsd->result);
if (row) {
repl_lag=-1;
repl_lag=-1; // this is old behavior
repl_lag=mysql_thread___monitor_slave_lag_when_null; // new behavior, see 669
if (row[j]) { // if Seconds_Behind_Master is not NULL
repl_lag=atoi(row[j]);
}

@ -178,6 +178,7 @@ static char * mysql_thread_variables_names[]= {
(char *)"monitor_password",
(char *)"monitor_query_interval",
(char *)"monitor_query_timeout",
(char *)"monitor_slave_lag_when_null",
(char *)"monitor_writer_is_also_reader",
(char *)"max_allowed_packet",
(char *)"max_transaction_time",
@ -255,6 +256,7 @@ MySQL_Threads_Handler::MySQL_Threads_Handler() {
variables.monitor_replication_lag_timeout=1000;
variables.monitor_query_interval=60000;
variables.monitor_query_timeout=100;
variables.monitor_slave_lag_when_null=60;
variables.monitor_username=strdup((char *)"monitor");
variables.monitor_password=strdup((char *)"monitor");
variables.monitor_writer_is_also_reader=true;
@ -454,6 +456,7 @@ int MySQL_Threads_Handler::get_variable_int(char *name) {
if (!strcasecmp(name,"monitor_replication_lag_timeout")) return (int)variables.monitor_replication_lag_timeout;
if (!strcasecmp(name,"monitor_query_interval")) return (int)variables.monitor_query_interval;
if (!strcasecmp(name,"monitor_query_timeout")) return (int)variables.monitor_query_timeout;
if (!strcasecmp(name,"monitor_slave_lag_when_null")) return (int)variables.monitor_slave_lag_when_null;
if (!strcasecmp(name,"monitor_writer_is_also_reader")) return (int)variables.monitor_writer_is_also_reader;
}
if (!strcasecmp(name,"shun_on_failures")) return (int)variables.shun_on_failures;
@ -601,6 +604,10 @@ char * MySQL_Threads_Handler::get_variable(char *name) { // this is the public f
sprintf(intbuf,"%d",variables.monitor_query_timeout);
return strdup(intbuf);
}
if (!strcasecmp(name,"monitor_slave_lag_when_null")) {
sprintf(intbuf,"%d",variables.monitor_slave_lag_when_null);
return strdup(intbuf);
}
if (!strcasecmp(name,"monitor_writer_is_also_reader")) {
return strdup((variables.monitor_writer_is_also_reader ? "true" : "false"));
}
@ -913,6 +920,15 @@ bool MySQL_Threads_Handler::set_variable(char *name, char *value) { // this is t
return false;
}
}
if (!strcasecmp(name,"monitor_slave_lag_when_null")) {
int intv=atoi(value);
if (intv >= 100 && intv <= 600*1000) {
variables.monitor_slave_lag_when_null=intv;
return true;
} else {
return false;
}
}
if (!strcasecmp(name,"monitor_writer_is_also_reader")) {
if (strcasecmp(value,"true")==0 || strcasecmp(value,"1")==0) {
variables.monitor_writer_is_also_reader=true;
@ -2087,6 +2103,7 @@ void MySQL_Thread::refresh_variables() {
mysql_thread___monitor_replication_lag_timeout=GloMTH->get_variable_int((char *)"monitor_replication_lag_timeout");
mysql_thread___monitor_query_interval=GloMTH->get_variable_int((char *)"monitor_query_interval");
mysql_thread___monitor_query_timeout=GloMTH->get_variable_int((char *)"monitor_query_timeout");
mysql_thread___monitor_slave_lag_when_null=GloMTH->get_variable_int((char *)"monitor_slave_lag_when_null");
if (mysql_thread___init_connect) free(mysql_thread___init_connect);
mysql_thread___init_connect=GloMTH->get_variable_string((char *)"init_connect");

Loading…
Cancel
Save