[PATCH] Prevent repeated deadlock-check signals in standby buffer pin waits - Mailing list pgsql-hackers

From JoongHyuk Shin
Subject [PATCH] Prevent repeated deadlock-check signals in standby buffer pin waits
Date
Msg-id CACSdjfO3ox8i8N3KxGf3HThzX1vnRRkY2kq1m5qsvGxjcuM1jg@mail.gmail.com
Whole thread
Responses Re: [PATCH] Prevent repeated deadlock-check signals in standby buffer pin waits
List pgsql-hackers
In ResolveRecoveryConflictWithBufferPin(), when deadlock_timeout fires,
the function sends RECOVERY_CONFLICT_BUFFERPIN_DEADLOCK and returns.
The caller (LockBufferForCleanup) loops back, sets up another deadlock_timeout,
and the signal gets sent again every interval.

The lock-conflict path had the same problem and was fixed in 8900b5a9d59a
by adding a second ProcWaitForSignal() after the deadlock-check signal.
The buffer-pin path was left with an XXX comment asking "should we fix this?".

The attached patch applies the same fix: after sending the deadlock-check
signal, reset got_standby_deadlock_timeout and call ProcWaitForSignal()
so the startup process waits for UnpinBuffer() rather than looping
and re-signaling.

Patch attached.
Attachment

pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: Optimize LISTEN/NOTIFY
Next
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition