Commit 1f113abd authored by Robert Haas's avatar Robert Haas

Move StartupCLOG() calls to just after we initialize ShmemVariableCache.

Previously, the hot_standby=off code path did this at end of recovery,
while the hot_standby=on code path did it at the beginning of recovery.
It's better to do this in only one place because (a) it's simpler,
(b) StartupCLOG() is trivial so trying to postpone the work isn't
useful, and (c) this will make it possible to simplify some other
logic.

Patch by me, reviewed by Heikki Linnakangas.

Discussion: http://postgr.es/m/CA+TgmoZYig9+AQodhF5sRXuKkJ=RgFDugLr3XX_dz_F-p=TwTg@mail.gmail.com
parent e42b3c3b
...@@ -6855,6 +6855,13 @@ StartupXLOG(void) ...@@ -6855,6 +6855,13 @@ StartupXLOG(void)
*/ */
StartupReorderBuffer(); StartupReorderBuffer();
/*
* Startup CLOG. This must be done after ShmemVariableCache->nextXid
* has been initialized and before we accept connections or begin WAL
* replay.
*/
StartupCLOG();
/* /*
* Startup MultiXact. We need to do this early to be able to replay * Startup MultiXact. We need to do this early to be able to replay
* truncations. * truncations.
...@@ -7125,11 +7132,10 @@ StartupXLOG(void) ...@@ -7125,11 +7132,10 @@ StartupXLOG(void)
ProcArrayInitRecovery(XidFromFullTransactionId(ShmemVariableCache->nextXid)); ProcArrayInitRecovery(XidFromFullTransactionId(ShmemVariableCache->nextXid));
/* /*
* Startup commit log and subtrans only. MultiXact and commit * Startup subtrans only. CLOG, MultiXact and commit
* timestamp have already been started up and other SLRUs are not * timestamp have already been started up and other SLRUs are not
* maintained during recovery and need not be started yet. * maintained during recovery and need not be started yet.
*/ */
StartupCLOG();
StartupSUBTRANS(oldestActiveXID); StartupSUBTRANS(oldestActiveXID);
/* /*
...@@ -7945,14 +7951,11 @@ StartupXLOG(void) ...@@ -7945,14 +7951,11 @@ StartupXLOG(void)
LWLockRelease(ProcArrayLock); LWLockRelease(ProcArrayLock);
/* /*
* Start up the commit log and subtrans, if not already done for hot * Start up subtrans, if not already done for hot standby. (commit
* standby. (commit timestamps are started below, if necessary.) * timestamps are started below, if necessary.)
*/ */
if (standbyState == STANDBY_DISABLED) if (standbyState == STANDBY_DISABLED)
{
StartupCLOG();
StartupSUBTRANS(oldestActiveXID); StartupSUBTRANS(oldestActiveXID);
}
/* /*
* Perform end of recovery actions for any SLRUs that need it. * Perform end of recovery actions for any SLRUs that need it.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment