Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6cfebfe

Browse files
committed
Make WaitForLSNReplay() issue FATAL on postmaster death
Reported-by: Michael PaquierDiscussion:https://postgr.es/m/ZvY2C8N4ZqgCFaLu%40paquier.xyzReviewed-by: Pavel Borisov
1 parent5035172 commit6cfebfe

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎src/backend/access/transam/xlogwait.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout)
222222
{
223223
XLogRecPtrcurrentLSN;
224224
TimestampTzendtime=0;
225-
intwake_events=WL_LATCH_SET |WL_EXIT_ON_PM_DEATH;
225+
intwake_events=WL_LATCH_SET |WL_POSTMASTER_DEATH;
226226

227227
/* Shouldn't be called when shmem isn't initialized */
228228
Assert(waitLSNState);
@@ -313,6 +313,16 @@ WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout)
313313
rc=WaitLatch(MyLatch,wake_events,delay_ms,
314314
WAIT_EVENT_WAIT_FOR_WAL_REPLAY);
315315

316+
/*
317+
* Emergency bailout if postmaster has died. This is to avoid the
318+
* necessity for manual cleanup of all postmaster children.
319+
*/
320+
if (rc&WL_POSTMASTER_DEATH)
321+
ereport(FATAL,
322+
(errcode(ERRCODE_ADMIN_SHUTDOWN),
323+
errmsg("terminating connection due to unexpected postmaster exit"),
324+
errcontext("while waiting for LSN replay")));
325+
316326
if (rc&WL_LATCH_SET)
317327
ResetLatch(MyLatch);
318328
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp