mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Move CheckRecoveryConflictDeadlock() call to a safer place.
This kluge was inserted in a spot apparently chosen at random: the lock
manager's state is not yet fully set up for the wait, and in particular
LockWaitCancel hasn't been armed by setting lockAwaited, so the ProcLock
will not get cleaned up if the ereport is thrown. This seems to not cause
any observable problem in trivial test cases, because LockReleaseAll will
silently clean up the debris; but I was able to cause failures with tests
involving subtransactions.
Fixes breakage induced by commit c85c941470
.
Back-patch to all affected branches.
This commit is contained in:
@ -934,6 +934,15 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
|
||||
*/
|
||||
LWLockRelease(partitionLock);
|
||||
|
||||
/*
|
||||
* Also, now that we will successfully clean up after an ereport, it's
|
||||
* safe to check to see if there's a buffer pin deadlock against the
|
||||
* Startup process. Of course, that's only necessary if we're doing
|
||||
* Hot Standby and are not the Startup process ourselves.
|
||||
*/
|
||||
if (RecoveryInProgress() && !InRecovery)
|
||||
CheckRecoveryConflictDeadlock();
|
||||
|
||||
/* Reset deadlock_state before enabling the signal handler */
|
||||
deadlock_state = DS_NOT_YET_CHECKED;
|
||||
|
||||
|
Reference in New Issue
Block a user