Fixes #2920: Improved logic for 'PROXYSQL STOP' and 'PROXYSQL START'

- Added new logic for making both commands actually wait
   for the completion of the operations they started.
 - Now "PROXYSQL STOP" command sends and OK packet to the
   client on completion.
pull/2957/head
Javier Jaramago Fernández 6 years ago
parent 543f2ce8b6
commit a6b95a3344

@ -1206,7 +1206,11 @@ 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) {
__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");
@ -1237,6 +1241,11 @@ 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);
GloMTH->signal_all_threads(0);
while (__sync_fetch_and_add(&glovars.shutdown,0)==1) {
usleep(1000);
}
SPA->send_MySQL_OK(&sess->client_myds->myprot, NULL);
return false;
}

Loading…
Cancel
Save