Skip to content

Commit

Permalink
Fast shutdown for TERM signal #4355
Browse files Browse the repository at this point in the history
Closes #4355
  • Loading branch information
renecannao committed Jan 18, 2024
1 parent 2840e18 commit 93fca24
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 93fca24

Please sign in to comment.