From 8f53bed48e80ce55a66a5790a21ef909a6d5a775 Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Wed, 3 Apr 2024 10:13:58 +0000 Subject: [PATCH 1/6] use 'docker compose' instead of 'docker-compose' --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 78859c20c..a067414c0 100644 --- a/Makefile +++ b/Makefile @@ -341,9 +341,9 @@ build-%: .NOTPARALLEL: binaries/proxysql% binaries/proxysql%: - @docker-compose -p proxysql down -v --remove-orphans - @docker-compose -p proxysql up $(IMG_NAME)$(IMG_TYPE)$(IMG_COMP)_build - @docker-compose -p proxysql down -v --remove-orphans + @docker compose -p proxysql down -v --remove-orphans + @docker compose -p proxysql up $(IMG_NAME)$(IMG_TYPE)$(IMG_COMP)_build + @docker compose -p proxysql down -v --remove-orphans ### clean targets From e91bcd2c819d6d3555dc1caa6214653a107cb3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 23 Apr 2024 09:01:49 +0200 Subject: [PATCH 2/6] Move Admin 'HTTP_Server' and 'RESTAPI' init to end of phase3 - Closes #4510 Prevents invalid accesses that this modules can perform on other yet non-initialized modules during boot process. --- include/proxysql_admin.h | 14 ++ lib/ProxySQL_Admin.cpp | 324 ++++++++++++++++++++------------------- src/main.cpp | 12 +- 3 files changed, 194 insertions(+), 156 deletions(-) diff --git a/include/proxysql_admin.h b/include/proxysql_admin.h index 6906091cc..d46933a33 100644 --- a/include/proxysql_admin.h +++ b/include/proxysql_admin.h @@ -394,6 +394,8 @@ class ProxySQL_Admin { void public_add_active_users(enum cred_username_type usertype, char *user=NULL) { __add_active_users(usertype, user); } + // @brief True if all ProxySQL modules have been already started. End of 'phase3'. + bool all_modules_started; ProxySQL_Admin(); ~ProxySQL_Admin(); SQLite3DB *admindb; // in memory @@ -416,6 +418,18 @@ class ProxySQL_Admin { */ bool init(const bootstrap_info_t& bootstrap_info); void init_ldap(); + /** @brief Initializes the HTTP server. For safety should be called after 'phase3'. */ + void init_http_server(); + /** + * @brief Loads the HTTP server config to runtime if all modules are ready, no-op otherwise. + * @details Modules ready when 'all_modules_started=true'. See 'all_modules_started'. + */ + void load_http_server(); + /** + * @brief Loads the RESTAPI server config to runtime if all modules are ready, no-op otherwise. + * @details Modules ready when 'all_modules_started=true'. See 'all_modules_started'. + */ + void load_restapi_server(); bool get_read_only() { return variables.admin_read_only; } bool set_read_only(bool ro) { variables.admin_read_only=ro; return variables.admin_read_only; } bool has_variable(const char *name); diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index 17ac811b0..ae9b3e450 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -6115,6 +6115,12 @@ void ProxySQL_Admin::init_ldap() { } } +void ProxySQL_Admin::init_http_server() { + AdminHTTPServer = new ProxySQL_HTTP_Server(); + AdminHTTPServer->init(); + AdminHTTPServer->print_version(); +} + struct boot_srv_info_t { string member_id; string member_host; @@ -6381,10 +6387,6 @@ bool ProxySQL_Admin::init(const bootstrap_info_t& bootstrap_info) { cpu_timer cpt; Admin_HTTP_Server = NULL; - AdminHTTPServer = new ProxySQL_HTTP_Server(); - AdminHTTPServer->init(); - AdminHTTPServer->print_version(); - AdminRestApiServer = NULL; /* AdminRestApiServer = new ProxySQL_RESTAPI_Server(); @@ -7220,6 +7222,167 @@ void ProxySQL_Admin::load_or_update_global_settings(SQLite3DB *db) { } } +void ProxySQL_Admin::load_restapi_server() { + if (!all_modules_started) { return; } + + std::function(const httpserver::http_request&)> prometheus_callback { + [this](const httpserver::http_request& request) { + auto headers = request_headers(request); + auto serial_response = this->serial_exposer(headers); + auto http_response = make_response(serial_response); + + return http_response; + } + }; + + bool free_restapi_port = false; + + // Helper lambda taking a boolean reference as a parameter to check if 'restapi_port' is available. + // In case of port not being free or error, logs an error 'ProxySQL_RestAPI_Server' isn't able to be started. + const auto check_restapi_port = [&](bool& restapi_port_free) -> void { + int e_port_check = check_port_availability(variables.restapi_port, &restapi_port_free); + + if (restapi_port_free == false) { + if (e_port_check == -1) { + proxy_error("Unable to start 'ProxySQL_RestAPI_Server', failed to set 'SO_REUSEADDR' to check port availability.\n"); + } else { + proxy_error( + "Unable to start 'ProxySQL_RestAPI_Server', port '%d' already in use.\n", + variables.restapi_port + ); + } + } + }; + + if (variables.restapi_enabled != variables.restapi_enabled_old) { + if (variables.restapi_enabled) { + check_restapi_port(free_restapi_port); + } + + if (variables.restapi_enabled && free_restapi_port) { + AdminRestApiServer = new ProxySQL_RESTAPI_Server( + variables.restapi_port, {{"/metrics", prometheus_callback}} + ); + } else { + delete AdminRestApiServer; + AdminRestApiServer = NULL; + } + variables.restapi_enabled_old = variables.restapi_enabled; + } else { + if (variables.restapi_port != variables.restapi_port_old) { + if (AdminRestApiServer) { + delete AdminRestApiServer; + AdminRestApiServer = NULL; + } + + if (variables.restapi_enabled) { + check_restapi_port(free_restapi_port); + } + + if (variables.restapi_enabled && free_restapi_port) { + AdminRestApiServer = new ProxySQL_RESTAPI_Server( + variables.restapi_port, {{"/metrics", prometheus_callback}} + ); + } + variables.restapi_port_old = variables.restapi_port; + } + } +} + +void ProxySQL_Admin::load_http_server() { + if (!all_modules_started) { return; } + + if (variables.web_enabled != variables.web_enabled_old) { + if (variables.web_enabled) { + if (GloVars.web_interface_plugin == NULL) { + char *key_pem; + char *cert_pem; + GloVars.get_SSL_pem_mem(&key_pem, &cert_pem); + Admin_HTTP_Server = MHD_start_daemon(MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_SSL, + variables.web_port, + NULL, NULL, http_handler, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, MHD_OPTION_STRICT_FOR_CLIENT, (int) 1, + MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 4, + MHD_OPTION_NONCE_NC_SIZE, (unsigned int) 300, + MHD_OPTION_HTTPS_MEM_KEY, key_pem, + MHD_OPTION_HTTPS_MEM_CERT, cert_pem, + MHD_OPTION_END); + free(key_pem); + free(cert_pem); + } else { + if (GloWebInterface) { + int sfd = 0; + int reuseaddr = 1; + struct sockaddr_in tmp_addr; + + sfd = socket(AF_INET, SOCK_STREAM, 0); + memset(&tmp_addr, 0, sizeof(tmp_addr)); + tmp_addr.sin_family = AF_INET; + tmp_addr.sin_port = htons(variables.web_port); + tmp_addr.sin_addr.s_addr = INADDR_ANY; + + if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseaddr, sizeof(reuseaddr)) == -1) { + close(sfd); + proxy_error( + "Unable to start WebInterfacePlugin, failed to set 'SO_REUSEADDR' to check port '%d' availability.\n", + variables.web_port + ); + } else { + if (::bind(sfd, (struct sockaddr*)&tmp_addr, (socklen_t)sizeof(tmp_addr)) == -1) { + close(sfd); + proxy_error( + "Unable to start WebInterfacePlugin, port '%d' already in use.\n", + variables.web_port + ); + } else { + close(sfd); + GloWebInterface->start(variables.web_port); + } + } + } + } + } else { + if (GloVars.web_interface_plugin == NULL) { + MHD_stop_daemon(Admin_HTTP_Server); + Admin_HTTP_Server = NULL; + } else { + if (GloWebInterface) { + GloWebInterface->stop(); + } + } + } + variables.web_enabled_old = variables.web_enabled; + } else { + if (variables.web_port != variables.web_port_old) { + if (variables.web_enabled) { + if (GloVars.web_interface_plugin == NULL) { + MHD_stop_daemon(Admin_HTTP_Server); + Admin_HTTP_Server = NULL; + char *key_pem; + char *cert_pem; + GloVars.get_SSL_pem_mem(&key_pem, &cert_pem); + Admin_HTTP_Server = MHD_start_daemon(MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_SSL, + variables.web_port, + NULL, NULL, http_handler, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, MHD_OPTION_STRICT_FOR_CLIENT, (int) 1, + MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 4, + MHD_OPTION_NONCE_NC_SIZE, (unsigned int) 300, + MHD_OPTION_HTTPS_MEM_KEY, key_pem, + MHD_OPTION_HTTPS_MEM_CERT, cert_pem, + MHD_OPTION_END); + free(key_pem); + free(cert_pem); + } else { + if (GloWebInterface) { + GloWebInterface->start(variables.web_port); + } + } + } + variables.web_port_old = variables.web_port; + } + } +} + void ProxySQL_Admin::flush_admin_variables___database_to_runtime( SQLite3DB *db, bool replace, const string& checksum, const time_t epoch, bool lock ) { @@ -7308,157 +7471,8 @@ void ProxySQL_Admin::flush_admin_variables___database_to_runtime( } wrunlock(); { - std::function(const httpserver::http_request&)> prometheus_callback { - [this](const httpserver::http_request& request) { - auto headers = request_headers(request); - auto serial_response = this->serial_exposer(headers); - auto http_response = make_response(serial_response); - - return http_response; - } - }; - - bool free_restapi_port = false; - - // Helper lambda taking a boolean reference as a parameter to check if 'restapi_port' is available. - // In case of port not being free or error, logs an error 'ProxySQL_RestAPI_Server' isn't able to be started. - const auto check_restapi_port = [&](bool& restapi_port_free) -> void { - int e_port_check = check_port_availability(variables.restapi_port, &restapi_port_free); - - if (restapi_port_free == false) { - if (e_port_check == -1) { - proxy_error("Unable to start 'ProxySQL_RestAPI_Server', failed to set 'SO_REUSEADDR' to check port availability.\n"); - } else { - proxy_error( - "Unable to start 'ProxySQL_RestAPI_Server', port '%d' already in use.\n", - variables.restapi_port - ); - } - } - }; - - if (variables.restapi_enabled != variables.restapi_enabled_old) { - if (variables.restapi_enabled) { - check_restapi_port(free_restapi_port); - } - - if (variables.restapi_enabled && free_restapi_port) { - AdminRestApiServer = new ProxySQL_RESTAPI_Server( - variables.restapi_port, {{"/metrics", prometheus_callback}} - ); - } else { - delete AdminRestApiServer; - AdminRestApiServer = NULL; - } - variables.restapi_enabled_old = variables.restapi_enabled; - } else { - if (variables.restapi_port != variables.restapi_port_old) { - if (AdminRestApiServer) { - delete AdminRestApiServer; - AdminRestApiServer = NULL; - } - - if (variables.restapi_enabled) { - check_restapi_port(free_restapi_port); - } - - if (variables.restapi_enabled && free_restapi_port) { - AdminRestApiServer = new ProxySQL_RESTAPI_Server( - variables.restapi_port, {{"/metrics", prometheus_callback}} - ); - } - variables.restapi_port_old = variables.restapi_port; - } - } - if (variables.web_enabled != variables.web_enabled_old) { - if (variables.web_enabled) { - if (GloVars.web_interface_plugin == NULL) { - char *key_pem; - char *cert_pem; - GloVars.get_SSL_pem_mem(&key_pem, &cert_pem); - Admin_HTTP_Server = MHD_start_daemon(MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_SSL, - variables.web_port, - NULL, NULL, http_handler, NULL, - MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, MHD_OPTION_STRICT_FOR_CLIENT, (int) 1, - MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 4, - MHD_OPTION_NONCE_NC_SIZE, (unsigned int) 300, - MHD_OPTION_HTTPS_MEM_KEY, key_pem, - MHD_OPTION_HTTPS_MEM_CERT, cert_pem, - MHD_OPTION_END); - free(key_pem); - free(cert_pem); - } else { - if (GloWebInterface) { - int sfd = 0; - int reuseaddr = 1; - struct sockaddr_in tmp_addr; - - sfd = socket(AF_INET, SOCK_STREAM, 0); - memset(&tmp_addr, 0, sizeof(tmp_addr)); - tmp_addr.sin_family = AF_INET; - tmp_addr.sin_port = htons(variables.web_port); - tmp_addr.sin_addr.s_addr = INADDR_ANY; - - if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseaddr, sizeof(reuseaddr)) == -1) { - close(sfd); - proxy_error( - "Unable to start WebInterfacePlugin, failed to set 'SO_REUSEADDR' to check port '%d' availability.\n", - variables.web_port - ); - } else { - if (::bind(sfd, (struct sockaddr*)&tmp_addr, (socklen_t)sizeof(tmp_addr)) == -1) { - close(sfd); - proxy_error( - "Unable to start WebInterfacePlugin, port '%d' already in use.\n", - variables.web_port - ); - } else { - close(sfd); - GloWebInterface->start(variables.web_port); - } - } - } - } - } else { - if (GloVars.web_interface_plugin == NULL) { - MHD_stop_daemon(Admin_HTTP_Server); - Admin_HTTP_Server = NULL; - } else { - if (GloWebInterface) { - GloWebInterface->stop(); - } - } - } - variables.web_enabled_old = variables.web_enabled; - } else { - if (variables.web_port != variables.web_port_old) { - if (variables.web_enabled) { - if (GloVars.web_interface_plugin == NULL) { - MHD_stop_daemon(Admin_HTTP_Server); - Admin_HTTP_Server = NULL; - char *key_pem; - char *cert_pem; - GloVars.get_SSL_pem_mem(&key_pem, &cert_pem); - Admin_HTTP_Server = MHD_start_daemon(MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_SSL, - variables.web_port, - NULL, NULL, http_handler, NULL, - MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, MHD_OPTION_STRICT_FOR_CLIENT, (int) 1, - MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) 4, - MHD_OPTION_NONCE_NC_SIZE, (unsigned int) 300, - MHD_OPTION_HTTPS_MEM_KEY, key_pem, - MHD_OPTION_HTTPS_MEM_CERT, cert_pem, - MHD_OPTION_END); - free(key_pem); - free(cert_pem); - } else { - if (GloWebInterface) { - GloWebInterface->start(variables.web_port); - } - } - } - variables.web_port_old = variables.web_port; - } - } + load_http_server(); + load_restapi_server(); // Update the admin variable for 'web_verbosity' admin___web_verbosity = variables.web_verbosity; } diff --git a/src/main.cpp b/src/main.cpp index aaac09822..cfe5f4ff9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1145,7 +1145,6 @@ void ProxySQL_Main_init_phase3___start_all() { GloAdmin->init_mysql_servers(); GloAdmin->init_proxysql_servers(); GloAdmin->load_scheduler_to_runtime(); - GloAdmin->proxysql_restapi().load_restapi_to_runtime(); #ifdef DEBUG std::cerr << "Main phase3 : GloAdmin initialized in "; #endif @@ -1217,6 +1216,17 @@ void ProxySQL_Main_init_phase3___start_all() { if (GloMyLdapAuth) { GloAdmin->init_ldap_variables(); } + + // HTTP Server should be initialized after other modules. See #4510 + GloAdmin->init_http_server(); + GloAdmin->proxysql_restapi().load_restapi_to_runtime(); + + // Signal ProxySQL_Admin that all modules have been started + GloAdmin->all_modules_started = true; + + // Load the config not previously loaded for these modules + GloAdmin->load_http_server(); + GloAdmin->load_restapi_server(); } From 50972bd15d849f4a242822397fa9900aee1b6d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 23 Apr 2024 09:15:52 +0200 Subject: [PATCH 3/6] Fix user-after-free on HTTP_Server 'system' ept --- lib/ProxySQL_HTTP_Server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProxySQL_HTTP_Server.cpp b/lib/ProxySQL_HTTP_Server.cpp index ff3888558..d8affaf39 100644 --- a/lib/ProxySQL_HTTP_Server.cpp +++ b/lib/ProxySQL_HTTP_Server.cpp @@ -586,7 +586,7 @@ int ProxySQL_HTTP_Server::handler(void *cls, struct MHD_Connection *connection, delete cpu_sqlite; s.append(""); - response = MHD_create_response_from_buffer(s.length(), (void *) s.c_str(), MHD_RESPMEM_PERSISTENT); + response = MHD_create_response_from_buffer(s.length(), (void *) s.c_str(), MHD_RESPMEM_MUST_COPY); ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); return ret; From f190c0ad0fc1d5b6c8f18b461f746c7e57f27799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 23 Apr 2024 16:08:19 +0200 Subject: [PATCH 4/6] Handle 'SELECT LAST_INSERT_ID() FROM DUAL' - Closes #4493 --- lib/MySQL_Session.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 1dc1c1943..4156b58a4 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -44,6 +44,8 @@ #define SELECT_CONNECTION_ID_LEN 22 #define SELECT_LAST_INSERT_ID "SELECT LAST_INSERT_ID()" #define SELECT_LAST_INSERT_ID_LEN 23 +#define SELECT_LAST_INSERT_ID_FROM_DUAL "SELECT LAST_INSERT_ID() FROM DUAL" +#define SELECT_LAST_INSERT_ID_FROM_DUAL_LEN 33 #define SELECT_LAST_INSERT_ID_LIMIT1 "SELECT LAST_INSERT_ID() LIMIT 1" #define SELECT_LAST_INSERT_ID_LIMIT1_LEN 31 #define SELECT_VARIABLE_IDENTITY "SELECT @@IDENTITY" @@ -7267,6 +7269,8 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C if ( (pkt->size==SELECT_LAST_INSERT_ID_LEN+5 && *((char *)(pkt->ptr)+4)==(char)0x03 && strncasecmp((char *)SELECT_LAST_INSERT_ID,(char *)pkt->ptr+5,pkt->size-5)==0) || + (pkt->size==SELECT_LAST_INSERT_ID_FROM_DUAL_LEN+5 && *((char *)(pkt->ptr)+4)==(char)0x03 && strncasecmp((char *)SELECT_LAST_INSERT_ID_FROM_DUAL,(char *)pkt->ptr+5,pkt->size-5)==0) + || (pkt->size==SELECT_LAST_INSERT_ID_LIMIT1_LEN+5 && *((char *)(pkt->ptr)+4)==(char)0x03 && strncasecmp((char *)SELECT_LAST_INSERT_ID_LIMIT1,(char *)pkt->ptr+5,pkt->size-5)==0) || (pkt->size==SELECT_VARIABLE_IDENTITY_LEN+5 && *((char *)(pkt->ptr)+4)==(char)0x03 && strncasecmp((char *)SELECT_VARIABLE_IDENTITY,(char *)pkt->ptr+5,pkt->size-5)==0) From 47d22b8a85d7c8b688270a01dc67c9a02d7cbea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 23 Apr 2024 16:09:52 +0200 Subject: [PATCH 5/6] Update 'LAST_INSERT_ID' tap test with 'FROM DUAL' support --- test/tap/tests/mysql-last_insert_id-t.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/tap/tests/mysql-last_insert_id-t.cpp b/test/tap/tests/mysql-last_insert_id-t.cpp index 1e8e9d18b..90549afa4 100644 --- a/test/tap/tests/mysql-last_insert_id-t.cpp +++ b/test/tap/tests/mysql-last_insert_id-t.cpp @@ -18,8 +18,9 @@ inline unsigned long long monotonic_time() { } -std::string queries[4] = { +std::string queries[5] = { "SELECT LAST_INSERT_ID() LIMIT 1", + "SELECT LAST_INSERT_ID() FROM DUAL", "SELECT LAST_INSERT_ID()", "SELECT @@IDENTITY LIMIT 1", "SELECT @@IDENTITY" From 73b7b543b8aa7c9799089d3a11528c243120400a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Wed, 24 Apr 2024 03:39:26 +0000 Subject: [PATCH 6/6] Fixed a compilation with TEST_AURORA --- lib/MyHGC.cpp | 4 +++ lib/MySQL_HostGroups_Manager.cpp | 4 --- lib/MySrvC.cpp | 54 -------------------------------- 3 files changed, 4 insertions(+), 58 deletions(-) diff --git a/lib/MyHGC.cpp b/lib/MyHGC.cpp index 6daa6be29..9a2a8a062 100644 --- a/lib/MyHGC.cpp +++ b/lib/MyHGC.cpp @@ -1,5 +1,9 @@ #include "MySQL_HostGroups_Manager.h" +#ifdef TEST_AURORA +static unsigned long long array_mysrvc_total = 0; +static unsigned long long array_mysrvc_cands = 0; +#endif // TEST_AURORA extern MySQL_Threads_Handler *GloMTH; diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 90bc41536..705a06515 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -31,10 +31,6 @@ using std::function; -#ifdef TEST_AURORA -static unsigned long long array_mysrvc_total = 0; -static unsigned long long array_mysrvc_cands = 0; -#endif // TEST_AURORA #define SAFE_SQLITE3_STEP(_stmt) do {\ do {\ diff --git a/lib/MySrvC.cpp b/lib/MySrvC.cpp index 94401e901..572530d67 100644 --- a/lib/MySrvC.cpp +++ b/lib/MySrvC.cpp @@ -1,58 +1,4 @@ #include "MySQL_HostGroups_Manager.h" -/* -#include "proxysql.h" -#include "cpp.h" - -#include "MySQL_PreparedStatement.h" -#include "MySQL_Data_Stream.h" - -#include -#include -#include - -#include -#include -#include -#include - -#include "prometheus_helpers.h" -#include "proxysql_utils.h" - -#define char_malloc (char *)malloc -#define itostr(__s, __i) { __s=char_malloc(32); sprintf(__s, "%lld", __i); } - -#include "thread.h" -#include "wqueue.h" - -#include "ev.h" - -#include -#include -#include - -using std::function; - -#ifdef TEST_AURORA -static unsigned long long array_mysrvc_total = 0; -static unsigned long long array_mysrvc_cands = 0; -#endif // TEST_AURORA - -#define SAFE_SQLITE3_STEP(_stmt) do {\ - do {\ - rc=(*proxy_sqlite3_step)(_stmt);\ - if (rc!=SQLITE_DONE) {\ - assert(rc==SQLITE_LOCKED);\ - usleep(100);\ - }\ - } while (rc!=SQLITE_DONE);\ -} while (0) - -extern ProxySQL_Admin *GloAdmin; - -extern MySQL_Threads_Handler *GloMTH; - -extern MySQL_Monitor *GloMyMon; -*/ class MySrvConnList; class MySrvC;