From ae916cc41df7283b6b02090177ee54ac1ca40c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sun, 24 Jul 2016 15:02:01 +0000 Subject: [PATCH] Revert "Perf improvement on Monitor" This reverts commit 6737295c3cfaa003287ceb5a4b91e16a4dc9fecb. --- lib/MySQL_Monitor.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 1f2878cb2..4f484af8a 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -385,24 +385,23 @@ void * monitor_ping_thread(void *arg) { mysql_thr->refresh_variables(); 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; bool crc=false; - 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_ping_thread; - } + 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_ping_thread; } - mmsd->t1=monotonic_time(); - mmsd->async_exit_status=mysql_ping_start(&mmsd->interr,mmsd->mysql); } - start_time=mmsd->t1; + + 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); while (mmsd->async_exit_status) { mmsd->async_exit_status=wait_for_mysql(mmsd->mysql, mmsd->async_exit_status); unsigned long long now=monotonic_time(); @@ -1003,13 +1002,6 @@ void * MySQL_Monitor::monitor_ping() { MySQL_Monitor_State_Data *mmsd = new MySQL_Monitor_State_Data(r->fields[0],atoi(r->fields[1]), NULL, atoi(r->fields[2])); mmsd->mondb=monitordb; 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_ping_start(&mmsd->interr,mmsd->mysql); - } - } item=new WorkItem(mmsd,monitor_ping_thread); GloMyMon->queue.add(item); }