|
|
|
|
@ -546,25 +546,25 @@ void * monitor_read_only_thread(void *arg) {
|
|
|
|
|
if (!GloMTH) return NULL; // quick exit during shutdown/restart
|
|
|
|
|
|
|
|
|
|
mmsd->mysql=GloMyMon->My_Conn_Pool->get_connection(mmsd->hostname, mmsd->port);
|
|
|
|
|
unsigned long long start_time=mysql_thr->curtime;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mmsd->t1=start_time;
|
|
|
|
|
|
|
|
|
|
unsigned long long start_time=mysql_thr->curtime;
|
|
|
|
|
bool crc=false;
|
|
|
|
|
if (mmsd->mysql==NULL) { // we don't have a connection, let's create it
|
|
|
|
|
bool rc;
|
|
|
|
|
rc=mmsd->create_new_connection();
|
|
|
|
|
crc=true;
|
|
|
|
|
if (rc==false) {
|
|
|
|
|
goto __exit_monitor_read_only_thread;
|
|
|
|
|
if (mmsd->mysql==NULL) {
|
|
|
|
|
mmsd->mysql=GloMyMon->My_Conn_Pool->get_connection(mmsd->hostname, mmsd->port);
|
|
|
|
|
|
|
|
|
|
mmsd->t1=start_time;
|
|
|
|
|
if (mmsd->mysql==NULL) { // we don't have a connection, let's create it
|
|
|
|
|
bool rc;
|
|
|
|
|
rc=mmsd->create_new_connection();
|
|
|
|
|
crc=true;
|
|
|
|
|
if (rc==false) {
|
|
|
|
|
goto __exit_monitor_read_only_thread;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mmsd->t1=monotonic_time();
|
|
|
|
|
mmsd->async_exit_status=mysql_query_start(&mmsd->interr,mmsd->mysql,"SHOW GLOBAL VARIABLES LIKE 'read_only'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mmsd->t1=monotonic_time();
|
|
|
|
|
//async_exit_status=mysql_change_user_start(&ret_bool, mysql,"msandbox2","msandbox2","information_schema");
|
|
|
|
|
//mmsd->async_exit_status=mysql_ping_start(&mmsd->interr,mmsd->mysql);
|
|
|
|
|
mmsd->async_exit_status=mysql_query_start(&mmsd->interr,mmsd->mysql,"SHOW GLOBAL VARIABLES LIKE 'read_only'");
|
|
|
|
|
start_time=mmsd->t1;
|
|
|
|
|
while (mmsd->async_exit_status) {
|
|
|
|
|
mmsd->async_exit_status=wait_for_mysql(mmsd->mysql, mmsd->async_exit_status);
|
|
|
|
|
unsigned long long now=monotonic_time();
|
|
|
|
|
@ -1223,6 +1223,13 @@ void * MySQL_Monitor::monitor_read_only() {
|
|
|
|
|
// perror("Thread creation monitor_read_only_thread");
|
|
|
|
|
//}
|
|
|
|
|
WorkItem* item;
|
|
|
|
|
{ // try to initialize it here
|
|
|
|
|
mmsd->mysql=GloMyMon->My_Conn_Pool->get_connection(mmsd->hostname, mmsd->port);
|
|
|
|
|
if (mmsd->mysql) {
|
|
|
|
|
mmsd->t1=monotonic_time();
|
|
|
|
|
mmsd->async_exit_status=mysql_query_start(&mmsd->interr,mmsd->mysql,"SHOW GLOBAL VARIABLES LIKE 'read_only'");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
item=new WorkItem(mmsd,monitor_read_only_thread);
|
|
|
|
|
GloMyMon->queue.add(item);
|
|
|
|
|
}
|
|
|
|
|
|