Added is_locked flag within '#ifdef DEBUG' conditional block

pull/4517/head
Rahim Kanji 2 years ago
parent a081695ae9
commit e4fd764d86

@ -972,7 +972,9 @@ class MySQL_HostGroups_Manager {
void init();
void wrlock();
void wrunlock();
bool is_locked = false; // will be removed after testing
#ifdef DEBUG
bool is_locked = false;
#endif
int servers_add(SQLite3_result *resultset);
/**
* @brief Generates a new global checksum for module 'mysql_servers_v2' using the provided hash.

@ -392,9 +392,9 @@ MySrvC *MyHGC::get_random_MySrvC(char * gtid_uuid, uint64_t gtid_trxid, int max_
void MyHGC::refresh_online_server_count() {
if (__sync_fetch_and_add(&glovars.shutdown, 0) != 0)
return;
#ifdef DEBUG
assert(MyHGM->is_locked);
#endif
unsigned int online_servers_count = 0;
for (unsigned int i = 0; i < mysrvs->servers->len; i++) {
MySrvC* mysrvc = (MySrvC*)mysrvs->servers->index(i);

@ -724,7 +724,9 @@ void MySQL_HostGroups_Manager::wrlock() {
#else
spin_wrlock(&rwlock);
#endif
#ifdef DEBUG
is_locked = true;
#endif
}
void MySQL_HostGroups_Manager::p_update_mysql_error_counter(p_mysql_error_type err_type, unsigned int hid, char* address, uint16_t port, unsigned int code) {
@ -759,7 +761,9 @@ void MySQL_HostGroups_Manager::p_update_mysql_error_counter(p_mysql_error_type e
}
void MySQL_HostGroups_Manager::wrunlock() {
#ifdef DEBUG
is_locked = false;
#endif
#ifdef MHM_PTHREAD_MUTEX
pthread_mutex_unlock(&lock);
#else

Loading…
Cancel
Save