Skip to content

Commit ea9968c

Browse files
committed
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.
1 parent d7b6c8c commit ea9968c

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, 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.412 2010/05/15 07:14:43 sriggs Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.413 2010/05/15 20:01:32 rhaas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -6514,7 +6514,7 @@ CheckRecoveryConsistency(void)
65146514
IsUnderPostmaster)
65156515
{
65166516
backendsAllowed = true;
6517-
SendPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT);
6517+
SendPostmasterSignal(PMSIGNAL_BEGIN_HOT_STANDBY);
65186518
}
65196519
}
65206520

src/backend/postmaster/postmaster.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.607 2010/05/14 18:08:33 rhaas Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.608 2010/05/15 20:01:32 rhaas Exp $
4141
*
4242
* NOTES
4343
*
@@ -240,13 +240,13 @@ static bool RecoveryError = false; /* T if WAL recovery failed */
240240
* postmaster, and we switch to PM_RECOVERY state. The background writer is
241241
* launched, while the startup process continues applying WAL. If Hot Standby
242242
* is enabled, then, after reaching a consistent point in WAL redo, startup
243-
* process signals us again, and we switch to PM_RECOVERY_CONSISTENT state and
243+
* process signals us again, and we switch to PM_HOT_STANDBY state and
244244
* begin accepting connections to perform read-only queries. When archive
245245
* recovery is finished, the startup process exits with exit code 0 and we
246246
* switch to PM_RUN state.
247247
*
248248
* Normal child backends can only be launched when we are in PM_RUN or
249-
* PM_RECOVERY_CONSISTENT state. (We also allow launch of normal
249+
* PM_HOT_STANDBY state. (We also allow launch of normal
250250
* child backends in PM_WAIT_BACKUP state, but only for superusers.)
251251
* In other states we handle connection requests by launching "dead_end"
252252
* child processes, which will simply send the client an error message and
@@ -273,7 +273,7 @@ typedef enum
273273
PM_INIT, /* postmaster starting */
274274
PM_STARTUP, /* waiting for startup subprocess */
275275
PM_RECOVERY, /* in archive recovery mode */
276-
PM_RECOVERY_CONSISTENT, /* consistent recovery mode */
276+
PM_HOT_STANDBY, /* in hot standby mode */
277277
PM_RUN, /* normal "database is alive" state */
278278
PM_WAIT_BACKUP, /* waiting for online backup mode to end */
279279
PM_WAIT_READONLY, /* waiting for read only backends to exit */
@@ -1450,7 +1450,7 @@ ServerLoop(void)
14501450
*/
14511451
if (BgWriterPID == 0 &&
14521452
(pmState == PM_RUN || pmState == PM_RECOVERY ||
1453-
pmState == PM_RECOVERY_CONSISTENT))
1453+
pmState == PM_HOT_STANDBY))
14541454
BgWriterPID = StartBackgroundWriter();
14551455

14561456
/*
@@ -1927,8 +1927,8 @@ canAcceptConnections(void)
19271927
pmState == PM_RECOVERY))
19281928
return CAC_STARTUP; /* normal startup */
19291929
if (!FatalError &&
1930-
pmState == PM_RECOVERY_CONSISTENT)
1931-
return CAC_OK; /* connection OK during recovery */
1930+
pmState == PM_HOT_STANDBY)
1931+
return CAC_OK; /* connection OK during hot standby */
19321932
return CAC_RECOVERY; /* else must be crash recovery */
19331933
}
19341934

@@ -2168,7 +2168,7 @@ pmdie(SIGNAL_ARGS)
21682168
(errmsg("received smart shutdown request")));
21692169

21702170
if (pmState == PM_RUN || pmState == PM_RECOVERY ||
2171-
pmState == PM_RECOVERY_CONSISTENT)
2171+
pmState == PM_HOT_STANDBY)
21722172
{
21732173
/* autovacuum workers are told to shut down immediately */
21742174
SignalAutovacWorkers(SIGTERM);
@@ -2226,7 +2226,7 @@ pmdie(SIGNAL_ARGS)
22262226
pmState == PM_WAIT_BACKUP ||
22272227
pmState == PM_WAIT_READONLY ||
22282228
pmState == PM_WAIT_BACKENDS ||
2229-
pmState == PM_RECOVERY_CONSISTENT)
2229+
pmState == PM_HOT_STANDBY)
22302230
{
22312231
ereport(LOG,
22322232
(errmsg("aborting any active transactions")));
@@ -2784,7 +2784,7 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
27842784
FatalError = true;
27852785
/* We now transit into a state of waiting for children to die */
27862786
if (pmState == PM_RECOVERY ||
2787-
pmState == PM_RECOVERY_CONSISTENT ||
2787+
pmState == PM_HOT_STANDBY ||
27882788
pmState == PM_RUN ||
27892789
pmState == PM_WAIT_BACKUP ||
27902790
pmState == PM_WAIT_READONLY ||
@@ -4135,7 +4135,7 @@ sigusr1_handler(SIGNAL_ARGS)
41354135
PG_SETMASK(&BlockSig);
41364136

41374137
/*
4138-
* RECOVERY_STARTED and RECOVERY_CONSISTENT signals are ignored in
4138+
* RECOVERY_STARTED and BEGIN_HOT_STANDBY signals are ignored in
41394139
* unexpected states. If the startup process quickly starts up, completes
41404140
* recovery, exits, we might process the death of the startup process
41414141
* first. We don't want to go back to recovery in that case.
@@ -4155,7 +4155,7 @@ sigusr1_handler(SIGNAL_ARGS)
41554155

41564156
pmState = PM_RECOVERY;
41574157
}
4158-
if (CheckPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT) &&
4158+
if (CheckPostmasterSignal(PMSIGNAL_BEGIN_HOT_STANDBY) &&
41594159
pmState == PM_RECOVERY)
41604160
{
41614161
/*
@@ -4167,7 +4167,7 @@ sigusr1_handler(SIGNAL_ARGS)
41674167
ereport(LOG,
41684168
(errmsg("database system is ready to accept read only connections")));
41694169

4170-
pmState = PM_RECOVERY_CONSISTENT;
4170+
pmState = PM_HOT_STANDBY;
41714171
}
41724172

41734173
if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER) &&

src/include/storage/pmsignal.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.30 2010/02/26 02:01:27 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/storage/pmsignal.h,v 1.31 2010/05/15 20:01:32 rhaas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -23,8 +23,7 @@
2323
typedef enum
2424
{
2525
PMSIGNAL_RECOVERY_STARTED, /* recovery has started */
26-
PMSIGNAL_RECOVERY_CONSISTENT, /* recovery has reached consistent
27-
* state */
26+
PMSIGNAL_BEGIN_HOT_STANDBY, /* begin Hot Standby */
2827
PMSIGNAL_WAKEN_ARCHIVER, /* send a NOTIFY signal to xlog archiver */
2928
PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */
3029
PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */

0 commit comments

Comments
 (0)