From fc2995de3aee2272762e59533642c3d47a97d4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Thu, 28 Dec 2017 15:35:38 +0100 Subject: [PATCH] Compile ProxySQL with Connector-C 3.0.2 #1126 --- include/MySQL_Protocol.h | 2 +- include/proxysql.h | 4 ++-- lib/ClickHouse_Server.cpp | 2 +- lib/MySQL_HostGroups_Manager.cpp | 10 +++++----- lib/MySQL_Monitor.cpp | 2 +- lib/MySQL_Protocol.cpp | 4 ++-- lib/MySQL_Session.cpp | 8 ++++---- lib/MySQL_Thread.cpp | 16 ++++++++-------- lib/ProxySQL_Admin.cpp | 2 +- lib/ProxySQL_Cluster.cpp | 12 ++++++------ lib/mysql_connection.cpp | 8 ++++---- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/MySQL_Protocol.h b/include/MySQL_Protocol.h index d11bbfe79..10d5950f1 100644 --- a/include/MySQL_Protocol.h +++ b/include/MySQL_Protocol.h @@ -71,7 +71,7 @@ class MySQL_Protocol { // - a pointer to unsigned int, used to return the size of the packet if not NULL // for now, they all return true bool generate_pkt_OK(bool send, void **ptr, unsigned int *len, uint8_t sequence_id, unsigned int affected_rows, uint64_t last_insert_id, uint16_t status, uint16_t warnings, char *msg); - bool generate_pkt_ERR(bool send, void **ptr, unsigned int *len, uint8_t sequence_id, uint16_t error_code, char *sql_state, char *sql_message); + bool generate_pkt_ERR(bool send, void **ptr, unsigned int *len, uint8_t sequence_id, uint16_t error_code, char *sql_state, const char *sql_message); bool generate_pkt_EOF(bool send, void **ptr, unsigned int *len, uint8_t sequence_id, uint16_t warnings, uint16_t status, MySQL_ResultSet *myrs=NULL); // bool generate_COM_INIT_DB(bool send, void **ptr, unsigned int *len, char *schema); //bool generate_COM_PING(bool send, void **ptr, unsigned int *len); diff --git a/include/proxysql.h b/include/proxysql.h index 114349515..7f00706ff 100644 --- a/include/proxysql.h +++ b/include/proxysql.h @@ -50,11 +50,11 @@ #if !defined(__FreeBSD__) && !defined(__APPLE__) #define HAVE_BOOL -#include "my_global.h" +#include "ma_global.h" //#include "my_pthread.h" #endif #include "mysql.h" -#include "mysql_com.h" +#include "mariadb_com.h" #include "proxysql_mem.h" diff --git a/lib/ClickHouse_Server.cpp b/lib/ClickHouse_Server.cpp index f959a56ec..8eaddfd2f 100644 --- a/lib/ClickHouse_Server.cpp +++ b/lib/ClickHouse_Server.cpp @@ -2799,7 +2799,7 @@ ProxySQL_Admin::~ProxySQL_Admin() { // it is mostly informative void ClickHouse_Server::dump_mysql_collations() { - const CHARSET_INFO * c = compiled_charsets; + const MARIADB_CHARSET_INFO * c = mariadb_compiled_charsets; char buf[1024]; char *query=(char *)"INSERT INTO mysql_collations VALUES (%d, \"%s\", \"%s\", \"\")"; SQLite_General_DB->execute("DELETE FROM mysql_collations"); diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 84ce70b65..8e8465e5d 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -76,7 +76,7 @@ static void * HGCU_thread_run() { for (i=0;i<(int)l;i++) { myconn->reset(); myconn=(MySQL_Connection *)conn_array->index(i); - if (myconn->mysql->net.vio && myconn->mysql->net.fd && myconn->mysql->net.buff) { + if (myconn->mysql->net.pvio && myconn->mysql->net.fd && myconn->mysql->net.buff) { MySQL_Connection_userinfo *userinfo = myconn->userinfo; char *auth_password = NULL; if (userinfo->password) { @@ -88,7 +88,7 @@ static void * HGCU_thread_run() { } //async_exit_status = mysql_change_user_start(&ret_bool,mysql,_ui->username, auth_password, _ui->schemaname); statuses[i]=mysql_change_user_start(&ret[i], myconn->mysql, myconn->userinfo->username, auth_password, myconn->userinfo->schemaname); - if (myconn->mysql->net.vio==NULL || myconn->mysql->net.fd==0 || myconn->mysql->net.buff==NULL) { + if (myconn->mysql->net.pvio==NULL || myconn->mysql->net.fd==0 || myconn->mysql->net.buff==NULL) { statuses[i]=0; ret[i]=1; } } else { @@ -115,12 +115,12 @@ static void * HGCU_thread_run() { usleep(50); for (i=0;i<(int)conn_array->len;i++) { myconn=(MySQL_Connection *)conn_array->index(i); - if (myconn->mysql->net.vio && myconn->mysql->net.fd && myconn->mysql->net.buff) { + if (myconn->mysql->net.pvio && myconn->mysql->net.fd && myconn->mysql->net.buff) { statuses[i]=wait_for_mysql(myconn->mysql, statuses[i]); - if (myconn->mysql->net.vio && myconn->mysql->net.fd && myconn->mysql->net.buff) { + if (myconn->mysql->net.pvio && myconn->mysql->net.fd && myconn->mysql->net.buff) { if ((statuses[i] & MYSQL_WAIT_TIMEOUT) == 0) { statuses[i]=mysql_change_user_cont(&ret[i], myconn->mysql, statuses[i]); - if (myconn->mysql->net.vio==NULL || myconn->mysql->net.fd==0 || myconn->mysql->net.buff==NULL ) { + if (myconn->mysql->net.pvio==NULL || myconn->mysql->net.fd==0 || myconn->mysql->net.buff==NULL ) { statuses[i]=0; ret[i]=1; } } diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 912b97c10..14b981889 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -102,7 +102,7 @@ static int wait_for_mysql(MYSQL *mysql, int status) { } static void close_mysql(MYSQL *my) { - if (my->net.vio) { + if (my->net.pvio) { char buff[5]; mysql_hdr myhdr; myhdr.pkt_id=0; diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index 9a7646477..0bade1ae3 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -384,7 +384,7 @@ int MySQL_Protocol::parse_mysql_pkt(PtrSize_t *PS_entry, MySQL_Data_Stream *__my // } cmd=*payload; switch (cmd) { - case MYSQL_COM_QUERY: + case COM_QUERY: if (pkt_com_query(payload, hdr.pkt_length)==PKT_PARSED) { //*states=STATE_CLIENT_COM_QUERY; return PKT_PARSED; @@ -494,7 +494,7 @@ bool MySQL_Protocol::generate_pkt_EOF(bool send, void **ptr, unsigned int *len, return true; } -bool MySQL_Protocol::generate_pkt_ERR(bool send, void **ptr, unsigned int *len, uint8_t sequence_id, uint16_t error_code, char *sql_state, char *sql_message) { +bool MySQL_Protocol::generate_pkt_ERR(bool send, void **ptr, unsigned int *len, uint8_t sequence_id, uint16_t error_code, char *sql_state, const char *sql_message) { if ((*myds)->sess->mirror==true) { return true; } diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 60eb12f1a..cd987524e 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -15,8 +15,8 @@ #define EXPMARIA -extern const CHARSET_INFO * proxysql_find_charset_name(const char * const name); -extern CHARSET_INFO * proxysql_find_charset_collate_names(const char *csname, const char *collatename); +extern const MARIADB_CHARSET_INFO * proxysql_find_charset_name(const char * const name); +extern MARIADB_CHARSET_INFO * proxysql_find_charset_collate_names(const char *csname, const char *collatename); extern MySQL_Authentication *GloMyAuth; extern ProxySQL_Admin *GloAdmin; @@ -722,7 +722,7 @@ bool MySQL_Session::handler_special_queries(PtrSize_t *pkt) { char *csname=trim_spaces_and_quotes_in_place(unstripped); bool collation_specified = false; //unsigned int charsetnr = 0; - const CHARSET_INFO * c; + const MARIADB_CHARSET_INFO * c; char * collation_name = NULL; if (strcasestr(csname," COLLATE ")) { collation_specified = true; @@ -3711,7 +3711,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C delete re; delete opt2; if (rc) { - const CHARSET_INFO * c; + const MARIADB_CHARSET_INFO * c; if (s3.length()) { c = proxysql_find_charset_collate_names(s2.c_str(), s3.c_str()); } else { diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 953e82f4a..aa35399b1 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -28,8 +28,8 @@ extern MySQL_Threads_Handler *GloMTH; extern MySQL_Monitor *GloMyMon; extern MySQL_Logger *GloMyLogger; -const CHARSET_INFO * proxysql_find_charset_nr(unsigned int nr) { - const CHARSET_INFO * c = compiled_charsets; +const MARIADB_CHARSET_INFO * proxysql_find_charset_nr(unsigned int nr) { + const MARIADB_CHARSET_INFO * c = mariadb_compiled_charsets; do { if (c->nr == nr) { return c; @@ -39,8 +39,8 @@ const CHARSET_INFO * proxysql_find_charset_nr(unsigned int nr) { return NULL; } -CHARSET_INFO * proxysql_find_charset_name(const char *name) { - CHARSET_INFO *c = (CHARSET_INFO *)compiled_charsets; +MARIADB_CHARSET_INFO * proxysql_find_charset_name(const char *name) { + MARIADB_CHARSET_INFO *c = (MARIADB_CHARSET_INFO *)mariadb_compiled_charsets; do { if (!strcasecmp(c->csname, name)) { return c; @@ -50,8 +50,8 @@ CHARSET_INFO * proxysql_find_charset_name(const char *name) { return NULL; } -CHARSET_INFO * proxysql_find_charset_collate_names(const char *csname, const char *collatename) { - CHARSET_INFO *c = (CHARSET_INFO *)compiled_charsets; +MARIADB_CHARSET_INFO * proxysql_find_charset_collate_names(const char *csname, const char *collatename) { + MARIADB_CHARSET_INFO *c = (MARIADB_CHARSET_INFO *)mariadb_compiled_charsets; do { if (!strcasecmp(c->csname, csname) && !strcasecmp(c->name, collatename)) { return c; @@ -818,7 +818,7 @@ char * MySQL_Threads_Handler::get_variable(char *name) { // this is the public f } } if (!strcasecmp(name,"default_charset")) { - const CHARSET_INFO *c = proxysql_find_charset_nr(variables.default_charset); + const MARIADB_CHARSET_INFO *c = proxysql_find_charset_nr(variables.default_charset); if (!c) { proxy_error("Not existing charset number %u\n", variables.default_charset); assert(c); @@ -1790,7 +1790,7 @@ bool MySQL_Threads_Handler::set_variable(char *name, char *value) { // this is t } if (!strcasecmp(name,"default_charset")) { if (vallen) { - CHARSET_INFO * c=proxysql_find_charset_name(value); + MARIADB_CHARSET_INFO * c=proxysql_find_charset_name(value); if (c) { variables.default_charset=c->nr; return true; diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index 5dad4c3fc..a2b8ef906 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -3694,7 +3694,7 @@ ProxySQL_Admin::~ProxySQL_Admin() { // This function is used only used to export what collations are available // it is mostly informative void ProxySQL_Admin::dump_mysql_collations() { - const CHARSET_INFO * c = compiled_charsets; + const MARIADB_CHARSET_INFO * c = mariadb_compiled_charsets; char buf[1024]; char *query=(char *)"INSERT INTO mysql_collations VALUES (%d, \"%s\", \"%s\", \"\")"; admindb->execute("DELETE FROM mysql_collations"); diff --git a/lib/ProxySQL_Cluster.cpp b/lib/ProxySQL_Cluster.cpp index 5b3c0d95b..205d64aea 100644 --- a/lib/ProxySQL_Cluster.cpp +++ b/lib/ProxySQL_Cluster.cpp @@ -165,7 +165,7 @@ void * ProxySQL_Cluster_Monitor_thread(void *args) { if (glovars.shutdown == 0) { // we arent' shutting down, but the query failed } - if (conn->net.vio) { + if (conn->net.pvio) { mysql_close(conn); } } else { @@ -181,7 +181,7 @@ void * ProxySQL_Cluster_Monitor_thread(void *args) { } __exit_monitor_thread: //if (conn) { - if (conn->net.vio) { + if (conn->net.pvio) { mysql_close(conn); } proxy_info("Cluster: closing thread for peer %s:%d\n", node->hostname, node->port); @@ -635,7 +635,7 @@ void ProxySQL_Cluster::pull_mysql_query_rules_from_peer() { } __exit_pull_mysql_query_rules_from_peer: if (conn) { - if (conn->net.vio) { + if (conn->net.pvio) { mysql_close(conn); } } @@ -716,7 +716,7 @@ void ProxySQL_Cluster::pull_mysql_users_from_peer() { } __exit_pull_mysql_users_from_peer: if (conn) { - if (conn->net.vio) { + if (conn->net.pvio) { mysql_close(conn); } } @@ -861,7 +861,7 @@ void ProxySQL_Cluster::pull_mysql_servers_from_peer() { } __exit_pull_mysql_servers_from_peer: if (conn) { - if (conn->net.vio) { + if (conn->net.pvio) { mysql_close(conn); } } @@ -935,7 +935,7 @@ void ProxySQL_Cluster::pull_proxysql_servers_from_peer() { } __exit_pull_proxysql_servers_from_peer: if (conn) { - if (conn->net.vio) { + if (conn->net.pvio) { mysql_close(conn); } } diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index 39c09f945..e864b97b5 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -3,7 +3,7 @@ #include "SpookyV2.h" #include -extern const CHARSET_INFO * proxysql_find_charset_nr(unsigned int nr); +extern const MARIADB_CHARSET_INFO * proxysql_find_charset_nr(unsigned int nr); #define PROXYSQL_USE_RESULT @@ -386,7 +386,7 @@ void MySQL_Connection::connect_start() { } unsigned int timeout= 1; mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (void *)&timeout); - const CHARSET_INFO * c = proxysql_find_charset_nr(mysql_thread___default_charset); + const MARIADB_CHARSET_INFO * c = proxysql_find_charset_nr(mysql_thread___default_charset); if (!c) { proxy_error("Not existing charset number %u\n", mysql_thread___default_charset); assert(0); @@ -476,7 +476,7 @@ void MySQL_Connection::set_autocommit_cont(short event) { void MySQL_Connection::set_names_start() { PROXY_TRACE(); - const CHARSET_INFO * c = proxysql_find_charset_nr(options.charset); + const MARIADB_CHARSET_INFO * c = proxysql_find_charset_nr(options.charset); if (!c) { proxy_error("Not existing charset number %u\n", options.charset); assert(0); @@ -1612,7 +1612,7 @@ void MySQL_Connection::optimize() { // if avoids that a QUIT command stops forever // FIXME: currently doesn't support encryption and compression void MySQL_Connection::close_mysql() { - if ((send_quit) && (mysql->net.vio)) { + if ((send_quit) && (mysql->net.pvio)) { char buff[5]; mysql_hdr myhdr; myhdr.pkt_id=0;