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

Commit44445b2

Browse files
committed
Set the process latch when processing recovery conflict interrupts.
Because RecoveryConflictInterrupt() didn't set the process latchanything using the latter to wait for events didn't get notified aboutrecovery conflicts. Most latch users are never the target of recoveryconflicts, which explains the lack of reports about this untilnow.Since 9.3 two possible affected users exist though: The sql callablepg_sleep() now uses latches to wait and background workers areexpected to use latches in their main loop. Both would currently waituntil the end of WaitLatch's timeout.Fix by adding a SetLatch() to RecoveryConflictInterrupt(). It'd alsobe possible to fix the issue by having each latch user setset_latch_on_sigusr1. That seems failure prone and though, as most ofthese callsites won't often receive recovery conflicts and thus willlikely only be tested against normal query cancels et al. It'd also beunnecessarily verbose.Backpatch to 9.1 where latches were introduced. Arguably 9.3 would besufficient, because that's where pg_sleep() was converted to waitingon the latch and background workers got introduced; but there could beuser level code making use of the latch pre 9.3.
1 parent5eebb8d commit44445b2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2806,6 +2806,16 @@ RecoveryConflictInterrupt(ProcSignalReason reason)
28062806
}
28072807
}
28082808

2809+
/*
2810+
* Set the process latch. This function essentially emulates signal
2811+
* handlers like die() and StatementCancelHandler() and it seems prudent
2812+
* to behave similarly as they do. Alternatively all plain backend code
2813+
* waiting on that latch, expecting to get interrupted by query cancels et
2814+
* al., would also need to set set_latch_on_sigusr1.
2815+
*/
2816+
if (MyProc)
2817+
SetLatch(&MyProc->procLatch);
2818+
28092819
errno=save_errno;
28102820
}
28112821

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp