diff --git a/include/proxysql.h b/include/proxysql.h index f27761dc0..3863c856e 100644 --- a/include/proxysql.h +++ b/include/proxysql.h @@ -78,8 +78,12 @@ //#include "cpp.h" - -#define PROXYSQL_VERSION "20140617" +#ifdef DEBUG +#define DEB "_DEBUG" +#else +#define DEB "" +#endif /* DEBUG */ +#define PROXYSQL_VERSION "20140617" DEB #define PROXYSQL_CODENAME "Hebe" #ifndef PROXYSQL_FUNC_DEFS diff --git a/include/proxysql_structs.h b/include/proxysql_structs.h index 9983fb70c..4add9fe02 100644 --- a/include/proxysql_structs.h +++ b/include/proxysql_structs.h @@ -364,6 +364,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 532652065..c29493dea 100644 --- a/lib/Standard_MySQL_Authentication.cpp +++ b/lib/Standard_MySQL_Authentication.cpp @@ -14,7 +14,12 @@ typedef struct _account_details_t { bool transaction_persistent; } account_details_t; -#define MYSQL_AUTHENTICATION_VERSION "0.1.0706" +#ifdef DEBUG +#define DEB "_DEBUG" +#else +#define DEB "" +#endif /* DEBUG */ +#define MYSQL_AUTHENTICATION_VERSION "0.1.0706" DEB //#define MY_SEPERATOR_HASH "__uy1gf2doi3ujh4ge5__" @@ -35,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 0ed778c14..b1d5d991c 100644 --- a/lib/Standard_MySQL_Thread.cpp +++ b/lib/Standard_MySQL_Thread.cpp @@ -16,7 +16,12 @@ extern "C" { #endif /* __cplusplus */ -#define MYSQL_THREAD_VERSION "0.1.1114" +#ifdef DEBUG +#define DEB "_DEBUG" +#else +#define DEB "" +#endif /* DEBUG */ +#define MYSQL_THREAD_VERSION "0.1.1114" DEB #define DEFAULT_NUM_THREADS 4 @@ -200,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 dc69f6351..967f6776a 100644 --- a/lib/Standard_ProxySQL_Admin.cpp +++ b/lib/Standard_ProxySQL_Admin.cpp @@ -1293,8 +1293,12 @@ __end_while_pool: return NULL; } - -#define PROXYSQL_ADMIN_VERSION "0.1.0815" +#ifdef DEBUG +#define DEB "_DEBUG" +#else +#define DEB "" +#endif /* DEBUG */ +#define PROXYSQL_ADMIN_VERSION "0.1.0815" DEB //class Standard_ProxySQL_Admin: public ProxySQL_Admin { /* @@ -1315,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 124093e07..f3df25be8 100644 --- a/lib/Standard_Query_Cache.cpp +++ b/lib/Standard_Query_Cache.cpp @@ -29,7 +29,12 @@ } while(0) -#define QUERY_CACHE_VERSION "0.1.0629" +#ifdef DEBUG +#define DEB "_DEBUG" +#else +#define DEB "" +#endif /* DEBUG */ +#define QUERY_CACHE_VERSION "0.1.0629" DEB __thread uint64_t __thr_cntSet=0; __thread uint64_t __thr_cntGet=0; @@ -316,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 771968491..1d04ca700 100644 --- a/lib/Standard_Query_Processor.cpp +++ b/lib/Standard_Query_Processor.cpp @@ -9,7 +9,12 @@ #include "../deps/libinjection/libinjection_sqli.h" -#define QUERY_PROCESSOR_VERSION "0.1.728" +#ifdef DEBUG +#define DEB "_DEBUG" +#else +#define DEB "" +#endif /* DEBUG */ +#define QUERY_PROCESSOR_VERSION "0.1.728" DEB #define strdup_null(__c) ( __c ? strdup(__c) : __c ) @@ -238,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; -