distable smart stop

This commit is contained in:
gentle_hu
2020-07-24 09:55:58 +08:00
parent 0a8c01422d
commit 0afc96783f
4 changed files with 6 additions and 22 deletions

View File

@ -3410,7 +3410,7 @@ static void do_help(void)
" (PostgreSQL server executable) or gs_initdb\n"));
printf(_(" -p PATH-TO-POSTGRES normally not necessary\n"));
printf(_("\nOptions for stop or restart:\n"));
printf(_(" -m, --mode=MODE MODE can be \"smart\", \"fast\", or \"immediate\"\n"));
printf(_(" -m, --mode=MODE MODE can be \"fast\", or \"immediate\"\n"));
printf(_("\nOptions for restore:\n"));
printf(_(" --remove-backup Remove the pg_rewind_bak dir after restore with \"restore\" command\n"));
#ifdef ENABLE_MULTIPLE_NODES
@ -3420,7 +3420,6 @@ static void do_help(void)
printf(_(" -n NAME patch name, NAME should be patch name with path\n"));
#endif
printf(_("\nShutdown modes are:\n"));
printf(_(" smart quit with fast shutdown on primary, and recovery done on standby\n"));
printf(_(" fast quit directly, with proper shutdown\n"));
printf(_(" immediate quit without complete shutdown; will lead to recovery on restart\n"));
@ -3479,12 +3478,7 @@ static void do_help(void)
static void set_mode(char* modeopt)
{
if (strcmp(modeopt, "s") == 0 || strcmp(modeopt, "smart") == 0) {
shutdown_mode = SMART_MODE;
stop_mode = "smart";
switch_mode = SmartDemote;
sig = SIGTERM;
} else if (strcmp(modeopt, "f") == 0 || strcmp(modeopt, "fast") == 0) {
if (strcmp(modeopt, "f") == 0 || strcmp(modeopt, "fast") == 0) {
shutdown_mode = FAST_MODE;
stop_mode = "fast";
switch_mode = FastDemote;

View File

@ -39,14 +39,12 @@ void DoShutdown(ShutdownStmt* stmt)
if (shutdown_mode == NULL || strcmp(shutdown_mode, "fast") == 0) {
/* default value is SIGINT, need to do nothing. */
} else if (strcmp(shutdown_mode, "smart") == 0) {
signal = SIGTERM;
} else if (strcmp(shutdown_mode, "immediate") == 0) {
signal = SIGQUIT;
} else {
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unknow parameter: %s\nshutdown only support fast, smart and immediate mode.\n", shutdown_mode)));
errmsg("unknow parameter: %s\nshutdown only support fast and immediate mode.\n", shutdown_mode)));
}
if (gs_signal_send(PostmasterPid, signal)) {

View File

@ -43,7 +43,6 @@ ACTION_REBUID = "generateconf"
ACTION_CERT = "cert"
STOP_MODE_FAST = "fast"
STOP_MODE_IMMEDIATE = "immediate"
STOP_MODE_SMART = "smart"
ACTION_VIEW = "view"
ACTION_QUERY = "query"
ACTION_KERBEROS = "kerberos"
@ -153,7 +152,7 @@ Options for start
Options for stop
-h Name of the host to be shut down.
-m, --mode=MODE Shutdown mode. It can be f (fast),
i (immediate), or s (smart).
or i (immediate).
-D Path of dn
--time-out=SECS Maximum waiting time when start the cluster
or node.
@ -572,16 +571,9 @@ Install options:
self.g_opts.mode = STOP_MODE_FAST
# Specifies that the stop type must be f, i or s
if (self.g_opts.mode not in [STOP_MODE_FAST, STOP_MODE_IMMEDIATE,
STOP_MODE_SMART, "f", "i", "s"]):
"f", "i"]):
GaussLog.exitWithError(ErrorCode.GAUSS_500["GAUSS_50004"] % "m")
# cm_ctl: can't stop one node or instance with -m smart.
if (self.g_opts.nodeName != "" and self.g_opts.mode ==
STOP_MODE_SMART):
GaussLog.exitWithError(ErrorCode.GAUSS_500["GAUSS_50010"] % \
"-m" + "Can't stop one node with -m smart "
"mode.")
def checkOutFileParameter(self):
"""
Check parameter for status

View File

@ -16,5 +16,5 @@ ERROR: Only system admin can shutdown database.
DROP USER shutdown_test;
shutdown invalid_str;
ERROR: unknow parameter: invalid_str
shutdown only support fast, smart and immediate mode.
shutdown only support fast and immediate mode.