From 93fca249140e394a17b7a94cd2965f2e9c31f01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Thu, 18 Jan 2024 02:13:23 +0000 Subject: [PATCH] Fast shutdown for TERM signal #4355 Closes #4355 --- lib/ProxySQL_GloVars.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ProxySQL_GloVars.cpp b/lib/ProxySQL_GloVars.cpp index 238624ea27..2127596f8d 100644 --- a/lib/ProxySQL_GloVars.cpp +++ b/lib/ProxySQL_GloVars.cpp @@ -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) {