diff --git a/include/MySQL_Thread.h b/include/MySQL_Thread.h index d6ab55b60..839c3f19e 100644 --- a/include/MySQL_Thread.h +++ b/include/MySQL_Thread.h @@ -505,6 +505,7 @@ class MySQL_Threads_Handler } variables; struct { unsigned int mirror_sessions_current; + int threads_initialized = 0; /// Prometheus metrics arrays std::array p_counter_array {}; std::array p_gauge_array {}; diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 88e2c38f3..5b149b30a 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -5747,6 +5747,7 @@ __exit_kill_session: } unsigned long long MySQL_Threads_Handler::get_total_mirror_queue() { + if ((__sync_fetch_and_add(&status_variables.threads_initialized, 0) == 0) || this->shutdown_) return 0; unsigned long long q=0; unsigned int i; for (i=0;ishutdown_) return 0; unsigned long long q=0; unsigned int i; for (i=0;ishutdown_) return 0; unsigned long long q=0; unsigned int i; for (i=0;ishutdown_) return 0; unsigned long long q=0; unsigned int i; for (i=0;ishutdown_) return 0; unsigned long long q=0; unsigned int i; for (i=0;ishutdown_) return 0; unsigned long long q=0; unsigned int i; for (i=0;ishutdown_) return 0; unsigned long long q=0; unsigned int i; for (i=0;istatus_variables.threads_initialized, 1); { cpu_timer t;