diff --git a/include/MySQL_Thread.h b/include/MySQL_Thread.h index cfb2ce1c2..0d72ecb16 100644 --- a/include/MySQL_Thread.h +++ b/include/MySQL_Thread.h @@ -171,6 +171,9 @@ class MySQL_Thread unsigned long long mysql_backend_buffers_bytes; unsigned long long mysql_frontend_buffers_bytes; unsigned long long mysql_session_internal_bytes; + unsigned long long ConnPool_get_conn_immediate; + unsigned long long ConnPool_get_conn_success; + unsigned long long ConnPool_get_conn_failure; unsigned int active_transactions; } status_variables; @@ -368,6 +371,9 @@ class MySQL_Threads_Handler unsigned long long get_mysql_backend_buffers_bytes(); unsigned long long get_mysql_frontend_buffers_bytes(); unsigned long long get_mysql_session_internal_bytes(); + unsigned long long get_ConnPool_get_conn_immediate(); + unsigned long long get_ConnPool_get_conn_success(); + unsigned long long get_ConnPool_get_conn_failure(); iface_info *MLM_find_iface_from_fd(int fd) { return MLM->find_iface_from_fd(fd); } diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 53c2b6954..587842c49 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -2170,9 +2170,14 @@ void MySQL_Session::handler___client_DSS_QUERY_SENT___server_DSS_NOT_INITIALIZED mc=thread->get_MyConn_local(mybe->hostgroup_id); // experimental , #644 if (mc==NULL) { mc=MyHGM->get_MyConn_from_pool(mybe->hostgroup_id); + } else { + thread->status_variables.ConnPool_get_conn_immediate++; } if (mc) { mybe->server_myds->attach_connection(mc); + thread->status_variables.ConnPool_get_conn_success++; + } else { + thread->status_variables.ConnPool_get_conn_failure++; } // } proxy_debug(PROXY_DEBUG_MYSQL_CONNECTION, 5, "Sess=%p -- server_myds=%p -- MySQL_Connection %p\n", this, mybe->server_myds, mybe->server_myds->myconn); diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 6d924a924..a81b21b5b 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -2178,6 +2178,9 @@ MySQL_Thread::MySQL_Thread() { status_variables.mysql_backend_buffers_bytes=0; status_variables.mysql_frontend_buffers_bytes=0; status_variables.mysql_session_internal_bytes=0; + status_variables.ConnPool_get_conn_immediate=0; + status_variables.ConnPool_get_conn_success=0; + status_variables.ConnPool_get_conn_failure=0; status_variables.active_transactions=0; } @@ -2405,6 +2408,24 @@ SQLite3_result * MySQL_Threads_Handler::SQL3_GlobalStatus() { result->add_row(pta); } } + { // ConnPool_get_conn_immediate + pta[0]=(char *)"ConnPool_get_conn_immediate"; + sprintf(buf,"%llu",get_ConnPool_get_conn_immediate()); + pta[1]=buf; + result->add_row(pta); + } + { // ConnPool_get_conn_success + pta[0]=(char *)"ConnPool_get_conn_success"; + sprintf(buf,"%llu",get_ConnPool_get_conn_success()); + pta[1]=buf; + result->add_row(pta); + } + { // ConnPool_get_conn_failure + pta[0]=(char *)"ConnPool_get_conn_failure"; + sprintf(buf,"%llu",get_ConnPool_get_conn_failure()); + pta[1]=buf; + result->add_row(pta); + } free(pta); return result; } @@ -2809,3 +2830,42 @@ void MySQL_Thread::return_local_connections() { MyHGM->push_MyConn_to_pool_array(ca); free(ca); } + +unsigned long long MySQL_Threads_Handler::get_ConnPool_get_conn_immediate() { + unsigned long long q=0; + unsigned int i; + for (i=0;istatus_variables.ConnPool_get_conn_immediate,0); + } + } + return q; +} + +unsigned long long MySQL_Threads_Handler::get_ConnPool_get_conn_success() { + unsigned long long q=0; + unsigned int i; + for (i=0;istatus_variables.ConnPool_get_conn_success,0); + } + } + return q; +} + +unsigned long long MySQL_Threads_Handler::get_ConnPool_get_conn_failure() { + unsigned long long q=0; + unsigned int i; + for (i=0;istatus_variables.ConnPool_get_conn_failure,0); + } + } + return q; +}