Skip to content

Commit bc134d7

Browse files
committed
Change the signaling of end-of-recovery. Startup process now indicates end
of recovery by exiting with exit code 0, like in previous releases. Per Tom's suggestion.
1 parent 451a15f commit bc134d7

File tree

4 files changed

+114
-203
lines changed

4 files changed

+114
-203
lines changed

src/backend/access/transam/xlog.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.331 2009/02/18 15:58:40 heikki Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.332 2009/02/23 09:28:49 heikki Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -432,7 +432,7 @@ static bool InRedo = false;
432432
static volatile sig_atomic_t shutdown_requested = false;
433433
/*
434434
* Flag set when executing a restore command, to tell SIGTERM signal handler
435-
* that it's safe to just proc_exit(0).
435+
* that it's safe to just proc_exit.
436436
*/
437437
static volatile sig_atomic_t in_restore_command = false;
438438

@@ -2752,7 +2752,7 @@ RestoreArchivedFile(char *path, const char *xlogfname,
27522752
*/
27532753
in_restore_command = true;
27542754
if (shutdown_requested)
2755-
proc_exit(0);
2755+
proc_exit(1);
27562756

27572757
/*
27582758
* Copy xlog from archival storage to XLOGDIR
@@ -2818,7 +2818,7 @@ RestoreArchivedFile(char *path, const char *xlogfname,
28182818
* On SIGTERM, assume we have received a fast shutdown request, and exit
28192819
* cleanly. It's pure chance whether we receive the SIGTERM first, or the
28202820
* child process. If we receive it first, the signal handler will call
2821-
* proc_exit(0), otherwise we do it here. If we or the child process
2821+
* proc_exit, otherwise we do it here. If we or the child process
28222822
* received SIGTERM for any other reason than a fast shutdown request,
28232823
* postmaster will perform an immediate shutdown when it sees us exiting
28242824
* unexpectedly.
@@ -2829,7 +2829,7 @@ RestoreArchivedFile(char *path, const char *xlogfname,
28292829
* too.
28302830
*/
28312831
if (WTERMSIG(rc) == SIGTERM)
2832-
proc_exit(0);
2832+
proc_exit(1);
28332833

28342834
signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 125;
28352835

@@ -5367,7 +5367,7 @@ StartupXLOG(void)
53675367
* recovery.
53685368
*/
53695369
if (shutdown_requested)
5370-
proc_exit(0);
5370+
proc_exit(1);
53715371

53725372
/*
53735373
* Have we reached our safe starting point? If so, we can
@@ -7646,7 +7646,7 @@ static void
76467646
StartupProcShutdownHandler(SIGNAL_ARGS)
76477647
{
76487648
if (in_restore_command)
7649-
proc_exit(0);
7649+
proc_exit(1);
76507650
else
76517651
shutdown_requested = true;
76527652
}
@@ -7694,9 +7694,9 @@ StartupProcessMain(void)
76947694

76957695
BuildFlatFiles(false);
76967696

7697-
/* Let postmaster know that startup is finished */
7698-
SendPostmasterSignal(PMSIGNAL_RECOVERY_COMPLETED);
7699-
7700-
/* exit normally */
7697+
/*
7698+
* Exit normally. Exit code 0 tells postmaster that we completed
7699+
* recovery successfully.
7700+
*/
77017701
proc_exit(0);
77027702
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy