> BTW, ProcWakeup() can reset waitStart before the waiter updates it in > ProcSleep() (or ResolveRecoveryConflictWithLock() during hot standby)? > If so, seems waitStart could remain set even after the wait, causing the same > issue. To fix this, we should reset waitStart at the end of ProcSleep() and > in LockErrorCleanup() as well?
Yes, it happens. I held the waiter at ProcSleep() entry while the holder committed, and waitStart stayed set after the wait. v2 attached. 0001 is unchanged. 0002 clears waitStart at the end of ProcSleep() and in LockErrorCleanup(). The LockErrorCleanup() part is for a cancel that arrives after the grant, where ProcSleep() errors out before its end. With 0002 the standby shows the start of the current wait, and the other cases read NULL. On 14 to 17, 0002 needs a small context fix since ResetAwaitedLock() is "lockAwaited = NULL" there. Thanks, Shihao
v2-0002-Clear-waitStart-when-the-lock-is-granted-before-i.patch
Description: Binary data
v2-0001-Reset-waitStart-when-a-lock-wait-fails.patch
Description: Binary data
