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

Commitf998e99

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 parent582b41d commitf998e99

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
@@ -2807,6 +2807,16 @@ RecoveryConflictInterrupt(ProcSignalReason reason)
28072807
}
28082808
}
28092809

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp