diff --git a/include/proxysql_structs.h b/include/proxysql_structs.h index 5ed96807e..b91c14304 100644 --- a/include/proxysql_structs.h +++ b/include/proxysql_structs.h @@ -361,6 +361,8 @@ struct _global_variables_t { //pthread_rwlock_t rwlock_global; pthread_rwlock_t rwlock_usernames; + bool has_debug; + volatile int shutdown; bool nostart; int reload; diff --git a/lib/Standard_MySQL_Authentication.cpp b/lib/Standard_MySQL_Authentication.cpp index f066979ad..c29493dea 100644 --- a/lib/Standard_MySQL_Authentication.cpp +++ b/lib/Standard_MySQL_Authentication.cpp @@ -40,6 +40,14 @@ class Standard_MySQL_Authentication: public MySQL_Authentication { // PtrArray cred_array; public: Standard_MySQL_Authentication() { +#ifdef DEBUG + if (glovars.has_debug==false) { +#else + if (glovars.has_debug==true) { +#endif /* DEBUG */ + perror("Incompatible debagging version"); + exit(EXIT_FAILURE); + } spinlock_rwlock_init(&creds_backends.lock); spinlock_rwlock_init(&creds_frontends.lock); }; diff --git a/lib/Standard_MySQL_Thread.cpp b/lib/Standard_MySQL_Thread.cpp index a9fffcdde..2bc72e5d1 100644 --- a/lib/Standard_MySQL_Thread.cpp +++ b/lib/Standard_MySQL_Thread.cpp @@ -205,6 +205,14 @@ class Standard_MySQL_Threads_Handler: public MySQL_Threads_Handler } variables; public: Standard_MySQL_Threads_Handler() { +#ifdef DEBUG + if (glovars.has_debug==false) { +#else + if (glovars.has_debug==true) { +#endif /* DEBUG */ + perror("Incompatible debagging version"); + exit(EXIT_FAILURE); + } num_threads=0; mysql_threads=NULL; stacksize=0; diff --git a/lib/Standard_ProxySQL_Admin.cpp b/lib/Standard_ProxySQL_Admin.cpp index f87145542..b3686e591 100644 --- a/lib/Standard_ProxySQL_Admin.cpp +++ b/lib/Standard_ProxySQL_Admin.cpp @@ -1319,6 +1319,14 @@ public: */ Standard_ProxySQL_Admin::Standard_ProxySQL_Admin() { // int i; +#ifdef DEBUG + if (glovars.has_debug==false) { +#else + if (glovars.has_debug==true) { +#endif /* DEBUG */ + perror("Incompatible debagging version"); + exit(EXIT_FAILURE); + } SPA=this; spinlock_rwlock_init(&rwlock); diff --git a/lib/Standard_Query_Cache.cpp b/lib/Standard_Query_Cache.cpp index 3f1d3025d..f3df25be8 100644 --- a/lib/Standard_Query_Cache.cpp +++ b/lib/Standard_Query_Cache.cpp @@ -321,6 +321,14 @@ virtual double area() const { }; Standard_Query_Cache() { +#ifdef DEBUG + if (glovars.has_debug==false) { +#else + if (glovars.has_debug==true) { +#endif /* DEBUG */ + perror("Incompatible debagging version"); + exit(EXIT_FAILURE); + } QCnow=time(NULL); //test=0; size=SHARED_QUERY_CACHE_HASH_TABLES; diff --git a/lib/Standard_Query_Processor.cpp b/lib/Standard_Query_Processor.cpp index feb085719..a8fc206d0 100644 --- a/lib/Standard_Query_Processor.cpp +++ b/lib/Standard_Query_Processor.cpp @@ -243,6 +243,14 @@ protected: public: Standard_Query_Processor() { +#ifdef DEBUG + if (glovars.has_debug==false) { +#else + if (glovars.has_debug==true) { +#endif /* DEBUG */ + perror("Incompatible debagging version"); + exit(EXIT_FAILURE); + } proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR, 4, "Initializing Query Processor with version=0\n"); spinlock_rwlock_init(&rwlock); version=0; diff --git a/src/main.cpp b/src/main.cpp index 81bbe32cf..fdd2d5450 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -190,6 +190,12 @@ int main(int argc, const char * argv[]) { { +#ifdef DEBUG + glovars.has_debug=true; +#else + glovars.has_debug=false; +#endif /* DEBUG */ + __thr_sfp=l_mem_init(); { diff --git a/src/proxysql_global.cpp b/src/proxysql_global.cpp index 5d253ac54..12e868696 100644 --- a/src/proxysql_global.cpp +++ b/src/proxysql_global.cpp @@ -3,4 +3,3 @@ //#include "proxysql_glovars.hpp" #include "cpp.h" //ProxySQL_GlobalVariables GloVars; -