summaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2014-07-24 09:04:59 -0400
committerRobert Haas <rhaas@postgresql.org>2014-07-24 09:16:27 -0400
commit3372f1adad12bc70321fdf22f3c11ac67e429f63 (patch)
tree58b3953dd03f06687ded49828b20ee1386b4bee4 /src/backend/access/transam/xlog.c
parentfece13d7477720bcbf02af795bed695c54d1250c (diff)
Fix checkpointer crash in EXEC_BACKEND builds.
Nothing in the checkpointer calls InitXLOGAccess(), so WALInsertLocks never got initialized there. Without EXEC_BACKEND, it works anyway because the correct value is inherited from the postmaster, but with EXEC_BACKEND we've got a problem. The problem appears to have been introduced by commit 68a2e52bbaf98f136a96b3a0d734ca52ca440a95. To fix, move the relevant initialization steps from InitXLOGAccess() to XLOGShmemInit(), making this more parallel to what we do elsewhere. Amit Kapila
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c804a04cb66..609ad2e07bc 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4815,6 +4815,11 @@ XLOGShmemInit(void)
{
/* both should be present or neither */
Assert(foundCFile && foundXLog);
+
+ /* Initialize local copy of WALInsertLocks and register the tranche */
+ WALInsertLocks = XLogCtl->Insert.WALInsertLocks;
+ LWLockRegisterTranche(XLogCtl->Insert.WALInsertLockTrancheId,
+ &XLogCtl->Insert.WALInsertLockTranche);
return;
}
memset(XLogCtl, 0, sizeof(XLogCtlData));
@@ -7595,11 +7600,6 @@ InitXLOGAccess(void)
ThisTimeLineID = XLogCtl->ThisTimeLineID;
Assert(ThisTimeLineID != 0 || IsBootstrapProcessingMode());
- /* Initialize our copy of WALInsertLocks and register the tranche */
- WALInsertLocks = XLogCtl->Insert.WALInsertLocks;
- LWLockRegisterTranche(XLogCtl->Insert.WALInsertLockTrancheId,
- &XLogCtl->Insert.WALInsertLockTranche);
-
/* Use GetRedoRecPtr to copy the RedoRecPtr safely */
(void) GetRedoRecPtr();
}