Rename PM_RECOVERY_CONSISTENT and PMSIGNAL_RECOVERY_CONSISTENT.

The new names PM_HOT_STANDBY and PMSIGNAL_BEGIN_HOT_STANDBY more accurately
reflect their actual function.
This commit is contained in:
Robert Haas 2010-05-15 20:01:32 +00:00
parent d7b6c8c0a5
commit ea9968c331
3 changed files with 17 additions and 18 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.412 2010/05/15 07:14:43 sriggs Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.413 2010/05/15 20:01:32 rhaas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -6514,7 +6514,7 @@ CheckRecoveryConsistency(void)
IsUnderPostmaster) IsUnderPostmaster)
{ {
backendsAllowed = true; backendsAllowed = true;
SendPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT); SendPostmasterSignal(PMSIGNAL_BEGIN_HOT_STANDBY);
} }
} }

View File

@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.607 2010/05/14 18:08:33 rhaas Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.608 2010/05/15 20:01:32 rhaas Exp $
* *
* NOTES * NOTES
* *
@ -240,13 +240,13 @@ static bool RecoveryError = false; /* T if WAL recovery failed */
* postmaster, and we switch to PM_RECOVERY state. The background writer is * postmaster, and we switch to PM_RECOVERY state. The background writer is
* launched, while the startup process continues applying WAL. If Hot Standby * launched, while the startup process continues applying WAL. If Hot Standby
* is enabled, then, after reaching a consistent point in WAL redo, startup * is enabled, then, after reaching a consistent point in WAL redo, startup
* process signals us again, and we switch to PM_RECOVERY_CONSISTENT state and * process signals us again, and we switch to PM_HOT_STANDBY state and
* begin accepting connections to perform read-only queries. When archive * begin accepting connections to perform read-only queries. When archive
* recovery is finished, the startup process exits with exit code 0 and we * recovery is finished, the startup process exits with exit code 0 and we
* switch to PM_RUN state. * switch to PM_RUN state.
* *
* Normal child backends can only be launched when we are in PM_RUN or * Normal child backends can only be launched when we are in PM_RUN or
* PM_RECOVERY_CONSISTENT state. (We also allow launch of normal * PM_HOT_STANDBY state. (We also allow launch of normal
* child backends in PM_WAIT_BACKUP state, but only for superusers.) * child backends in PM_WAIT_BACKUP state, but only for superusers.)
* In other states we handle connection requests by launching "dead_end" * In other states we handle connection requests by launching "dead_end"
* child processes, which will simply send the client an error message and * child processes, which will simply send the client an error message and
@ -273,7 +273,7 @@ typedef enum
PM_INIT, /* postmaster starting */ PM_INIT, /* postmaster starting */
PM_STARTUP, /* waiting for startup subprocess */ PM_STARTUP, /* waiting for startup subprocess */
PM_RECOVERY, /* in archive recovery mode */ PM_RECOVERY, /* in archive recovery mode */
PM_RECOVERY_CONSISTENT, /* consistent recovery mode */ PM_HOT_STANDBY, /* in hot standby mode */
PM_RUN, /* normal "database is alive" state */ PM_RUN, /* normal "database is alive" state */
PM_WAIT_BACKUP, /* waiting for online backup mode to end */ PM_WAIT_BACKUP, /* waiting for online backup mode to end */
PM_WAIT_READONLY, /* waiting for read only backends to exit */ PM_WAIT_READONLY, /* waiting for read only backends to exit */
@ -1450,7 +1450,7 @@ ServerLoop(void)
*/ */
if (BgWriterPID == 0 && if (BgWriterPID == 0 &&
(pmState == PM_RUN || pmState == PM_RECOVERY || (pmState == PM_RUN || pmState == PM_RECOVERY ||
pmState == PM_RECOVERY_CONSISTENT)) pmState == PM_HOT_STANDBY))
BgWriterPID = StartBackgroundWriter(); BgWriterPID = StartBackgroundWriter();
/* /*
@ -1927,8 +1927,8 @@ canAcceptConnections(void)
pmState == PM_RECOVERY)) pmState == PM_RECOVERY))
return CAC_STARTUP; /* normal startup */ return CAC_STARTUP; /* normal startup */
if (!FatalError && if (!FatalError &&
pmState == PM_RECOVERY_CONSISTENT) pmState == PM_HOT_STANDBY)
return CAC_OK; /* connection OK during recovery */ return CAC_OK; /* connection OK during hot standby */
return CAC_RECOVERY; /* else must be crash recovery */ return CAC_RECOVERY; /* else must be crash recovery */
} }
@ -2168,7 +2168,7 @@ pmdie(SIGNAL_ARGS)
(errmsg("received smart shutdown request"))); (errmsg("received smart shutdown request")));
if (pmState == PM_RUN || pmState == PM_RECOVERY || if (pmState == PM_RUN || pmState == PM_RECOVERY ||
pmState == PM_RECOVERY_CONSISTENT) pmState == PM_HOT_STANDBY)
{ {
/* autovacuum workers are told to shut down immediately */ /* autovacuum workers are told to shut down immediately */
SignalAutovacWorkers(SIGTERM); SignalAutovacWorkers(SIGTERM);
@ -2226,7 +2226,7 @@ pmdie(SIGNAL_ARGS)
pmState == PM_WAIT_BACKUP || pmState == PM_WAIT_BACKUP ||
pmState == PM_WAIT_READONLY || pmState == PM_WAIT_READONLY ||
pmState == PM_WAIT_BACKENDS || pmState == PM_WAIT_BACKENDS ||
pmState == PM_RECOVERY_CONSISTENT) pmState == PM_HOT_STANDBY)
{ {
ereport(LOG, ereport(LOG,
(errmsg("aborting any active transactions"))); (errmsg("aborting any active transactions")));
@ -2784,7 +2784,7 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
FatalError = true; FatalError = true;
/* We now transit into a state of waiting for children to die */ /* We now transit into a state of waiting for children to die */
if (pmState == PM_RECOVERY || if (pmState == PM_RECOVERY ||
pmState == PM_RECOVERY_CONSISTENT || pmState == PM_HOT_STANDBY ||
pmState == PM_RUN || pmState == PM_RUN ||
pmState == PM_WAIT_BACKUP || pmState == PM_WAIT_BACKUP ||
pmState == PM_WAIT_READONLY || pmState == PM_WAIT_READONLY ||
@ -4135,7 +4135,7 @@ sigusr1_handler(SIGNAL_ARGS)
PG_SETMASK(&BlockSig); PG_SETMASK(&BlockSig);
/* /*
* RECOVERY_STARTED and RECOVERY_CONSISTENT signals are ignored in * RECOVERY_STARTED and BEGIN_HOT_STANDBY signals are ignored in
* unexpected states. If the startup process quickly starts up, completes * unexpected states. If the startup process quickly starts up, completes
* recovery, exits, we might process the death of the startup process * recovery, exits, we might process the death of the startup process
* first. We don't want to go back to recovery in that case. * first. We don't want to go back to recovery in that case.
@ -4155,7 +4155,7 @@ sigusr1_handler(SIGNAL_ARGS)
pmState = PM_RECOVERY; pmState = PM_RECOVERY;
} }
if (CheckPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT) && if (CheckPostmasterSignal(PMSIGNAL_BEGIN_HOT_STANDBY) &&
pmState == PM_RECOVERY) pmState == PM_RECOVERY)
{ {
/* /*
@ -4167,7 +4167,7 @@ sigusr1_handler(SIGNAL_ARGS)
ereport(LOG, ereport(LOG,
(errmsg("database system is ready to accept read only connections"))); (errmsg("database system is ready to accept read only connections")));
pmState = PM_RECOVERY_CONSISTENT; pmState = PM_HOT_STANDBY;
} }
if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER) && if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER) &&

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.30 2010/02/26 02:01:27 momjian Exp $ * $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.31 2010/05/15 20:01:32 rhaas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -23,8 +23,7 @@
typedef enum typedef enum
{ {
PMSIGNAL_RECOVERY_STARTED, /* recovery has started */ PMSIGNAL_RECOVERY_STARTED, /* recovery has started */
PMSIGNAL_RECOVERY_CONSISTENT, /* recovery has reached consistent PMSIGNAL_BEGIN_HOT_STANDBY, /* begin Hot Standby */
* state */
PMSIGNAL_WAKEN_ARCHIVER, /* send a NOTIFY signal to xlog archiver */ PMSIGNAL_WAKEN_ARCHIVER, /* send a NOTIFY signal to xlog archiver */
PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */ PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */
PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */ PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */