From abff6a82db42cd126d2b64af56e9acfcd644b771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 30 Aug 2016 21:39:04 +0200 Subject: [PATCH] =?UTF-8?q?Add=20connection=20attributes=20for=20proxysql?= =?UTF-8?q?=E2=86=92mysql=20connections?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/MySQL_Monitor.cpp | 1 + lib/MySQL_Session.cpp | 1 + lib/mysql_connection.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index ae4d710b3..b24d91970 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -518,6 +518,7 @@ bool MySQL_Monitor_State_Data::create_new_connection() { mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, &timeout); // mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, &timeout); // mysql_options(mysql, MYSQL_OPT_WRITE_TIMEOUT, &timeout); + mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "program_name", "proxysql_monitor"); MYSQL *myrc=NULL; if (port) { myrc=mysql_real_connect(mysql, hostname, mysql_thread___monitor_username, mysql_thread___monitor_password, NULL, port, NULL, 0); diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 5914be64b..83f0f5be9 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -41,6 +41,7 @@ static void * kill_query_thread(void *arg) { KillArgs *ka=(KillArgs *)arg; MYSQL *mysql; mysql=mysql_init(NULL); + mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "program_name", "proxysql_killer"); if (!mysql) { goto __exit_kill_query_thread; } diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index a4aaecda7..201f9364a 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -316,6 +316,7 @@ void MySQL_Connection::connect_start() { mysql=mysql_init(NULL); assert(mysql); mysql_options(mysql, MYSQL_OPT_NONBLOCK, 0); + mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "program_name", "proxysql"); if (parent->use_ssl) { mysql_ssl_set(mysql, mysql_thread___ssl_p2s_key, mysql_thread___ssl_p2s_cert, mysql_thread___ssl_p2s_ca, NULL, mysql_thread___ssl_p2s_cipher); }