mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-02 13:57:20 +02:00
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 68a2e52bba
.
To fix, move the relevant initialization steps from InitXLOGAccess()
to XLOGShmemInit(), making this more parallel to what we do
elsewhere.
Amit Kapila
This commit is contained in:
parent
fece13d747
commit
3372f1adad
@ -4815,6 +4815,11 @@ XLOGShmemInit(void)
|
|||||||
{
|
{
|
||||||
/* both should be present or neither */
|
/* both should be present or neither */
|
||||||
Assert(foundCFile && foundXLog);
|
Assert(foundCFile && foundXLog);
|
||||||
|
|
||||||
|
/* Initialize local copy of WALInsertLocks and register the tranche */
|
||||||
|
WALInsertLocks = XLogCtl->Insert.WALInsertLocks;
|
||||||
|
LWLockRegisterTranche(XLogCtl->Insert.WALInsertLockTrancheId,
|
||||||
|
&XLogCtl->Insert.WALInsertLockTranche);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(XLogCtl, 0, sizeof(XLogCtlData));
|
memset(XLogCtl, 0, sizeof(XLogCtlData));
|
||||||
@ -7595,11 +7600,6 @@ InitXLOGAccess(void)
|
|||||||
ThisTimeLineID = XLogCtl->ThisTimeLineID;
|
ThisTimeLineID = XLogCtl->ThisTimeLineID;
|
||||||
Assert(ThisTimeLineID != 0 || IsBootstrapProcessingMode());
|
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 */
|
/* Use GetRedoRecPtr to copy the RedoRecPtr safely */
|
||||||
(void) GetRedoRecPtr();
|
(void) GetRedoRecPtr();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user