|
|
|
|
@ -778,11 +778,17 @@ int ProxySQL_Test___GetDigestTable(bool reset, bool use_swap) {
|
|
|
|
|
|
|
|
|
|
ProxySQL_Config& ProxySQL_Admin::proxysql_config() {
|
|
|
|
|
static ProxySQL_Config instance = ProxySQL_Config(admindb);
|
|
|
|
|
if (instance.admindb != admindb) {
|
|
|
|
|
instance.admindb = admindb;
|
|
|
|
|
}
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProxySQL_Restapi& ProxySQL_Admin::proxysql_restapi() {
|
|
|
|
|
static ProxySQL_Restapi instance = ProxySQL_Restapi(admindb);
|
|
|
|
|
if (instance.admindb != admindb) {
|
|
|
|
|
instance.admindb = admindb;
|
|
|
|
|
}
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1200,7 +1206,13 @@ bool admin_handler_command_proxysql(char *query_no_space, unsigned int query_no_
|
|
|
|
|
rc=__sync_bool_compare_and_swap(&GloVars.global.nostart,1,0);
|
|
|
|
|
}
|
|
|
|
|
if (rc) {
|
|
|
|
|
// Set the status variable 'threads_initialized' to 0 because it's initialized back
|
|
|
|
|
// in main 'init_phase3'. After GloMTH have been initialized again.
|
|
|
|
|
__sync_bool_compare_and_swap(&GloMTH->status_variables.threads_initialized, 1, 0);
|
|
|
|
|
proxy_debug(PROXY_DEBUG_ADMIN, 4, "Starting ProxySQL following PROXYSQL START command\n");
|
|
|
|
|
while(__sync_fetch_and_add(&GloMTH->status_variables.threads_initialized, 0) == 1) {
|
|
|
|
|
usleep(1000);
|
|
|
|
|
}
|
|
|
|
|
SPA->send_MySQL_OK(&sess->client_myds->myprot, NULL);
|
|
|
|
|
} else {
|
|
|
|
|
proxy_warning("ProxySQL was already started when received PROXYSQL START command\n");
|
|
|
|
|
@ -1231,6 +1243,17 @@ bool admin_handler_command_proxysql(char *query_no_space, unsigned int query_no_
|
|
|
|
|
GloMTH->commit();
|
|
|
|
|
glovars.reload=2;
|
|
|
|
|
__sync_bool_compare_and_swap(&glovars.shutdown,0,1);
|
|
|
|
|
// After setting the shutdown flag, we should wake all threads and wait for
|
|
|
|
|
// the shutdown phase to complete.
|
|
|
|
|
GloMTH->signal_all_threads(0);
|
|
|
|
|
while (__sync_fetch_and_add(&glovars.shutdown,0)==1) {
|
|
|
|
|
usleep(1000);
|
|
|
|
|
}
|
|
|
|
|
// After shutdown phase is completed, we must to send a 'OK' to the
|
|
|
|
|
// mysql client, otherwise, since this session might not be drop due
|
|
|
|
|
// to the waiting condition, the client wont disconnect and will
|
|
|
|
|
// keep forever waiting for acknowledgement.
|
|
|
|
|
SPA->send_MySQL_OK(&sess->client_myds->myprot, NULL);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -4605,6 +4628,7 @@ void ProxySQL_Admin::vacuum_stats(bool is_admin) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void *child_mysql(void *arg) {
|
|
|
|
|
if (GloMTH == nullptr) { return NULL; }
|
|
|
|
|
|
|
|
|
|
pthread_attr_t thread_attr;
|
|
|
|
|
size_t tmp_stack_size=0;
|
|
|
|
|
|