mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Fix assertion failure with latch wait in single-user mode
LatchWaitSetPostmasterDeathPos, the latch event position for the
postmaster death event, is initialized under IsUnderPostmaster.
WaitLatch() considered it as a valid wait target in single-user mode
(!IsUnderPostmaster), which was incorrect.
One code path found to fail with an assertion failure is a database drop
in single-user mode while waiting in WaitForProcSignalBarrier() after
the drop.
Oversight in commit 84e5b2f07a
.
Author: Patrick Stählin <me@packi.ch>
Co-authored-by: Ronan Dunklau <ronan.dunklau@aiven.io>
Discussion: https://postgr.es/m/18996-3a2744c8140488de@postgresql.org
Backpatch-through: 18
This commit is contained in:
@ -187,9 +187,11 @@ WaitLatch(Latch *latch, int wakeEvents, long timeout,
|
||||
if (!(wakeEvents & WL_LATCH_SET))
|
||||
latch = NULL;
|
||||
ModifyWaitEvent(LatchWaitSet, LatchWaitSetLatchPos, WL_LATCH_SET, latch);
|
||||
ModifyWaitEvent(LatchWaitSet, LatchWaitSetPostmasterDeathPos,
|
||||
(wakeEvents & (WL_EXIT_ON_PM_DEATH | WL_POSTMASTER_DEATH)),
|
||||
NULL);
|
||||
|
||||
if (IsUnderPostmaster)
|
||||
ModifyWaitEvent(LatchWaitSet, LatchWaitSetPostmasterDeathPos,
|
||||
(wakeEvents & (WL_EXIT_ON_PM_DEATH | WL_POSTMASTER_DEATH)),
|
||||
NULL);
|
||||
|
||||
if (WaitEventSetWait(LatchWaitSet,
|
||||
(wakeEvents & WL_TIMEOUT) ? timeout : -1,
|
||||
|
Reference in New Issue
Block a user