Skip to content

Commit

Permalink
Merge pull request #4425 from sysown/v2.x-4355
Browse files Browse the repository at this point in the history
Fast shutdown for TERM signal #4355
  • Loading branch information
renecannao authored Jan 19, 2024
2 parents 44ebd62 + 93fca24 commit 26738b4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/ProxySQL_GloVars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@
extern MySQL_LDAP_Authentication* GloMyLdapAuth;

static void term_handler(int sig) {
proxy_warning("Received TERM signal: shutdown in progress...\n");
proxy_warning("Received TERM signal: shutdown in progress...\n");
/*
In ProxySQL 2.1 we replace PROXYSQL SHUTDOWN with PROXYSQL SHUTDOWN SLOW , and the former command now perform a "fast shutdown".
The same is now implemented for TERM signal handler.
*/
#ifdef DEBUG
// Note: in DEBUG built we will still perform a slow shutdown.
// DEBUG built is not meant for production use.
__sync_bool_compare_and_swap(&glovars.shutdown,0,1);
#else
exit(EXIT_SUCCESS);
#endif
__sync_bool_compare_and_swap(&glovars.shutdown,0,1);
}

void crash_handler(int sig) {
Expand Down

0 comments on commit 26738b4

Please sign in to comment.