0001-Always-enable-timeouts-in-ResolveRecoveryConflictWit.patch
application/octet-stream
Filename: 0001-Always-enable-timeouts-in-ResolveRecoveryConflictWit.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: Always enable timeouts in ResolveRecoveryConflictWithBufferPin
| File | + | − |
|---|---|---|
| src/backend/storage/ipc/standby.c | 19 | 30 |
From 0e6a1a86ac62f0aa8481363256cc503328e1e970 Mon Sep 17 00:00:00 2001
From: Anthony Hsu <erwaman@gmail.com>
Date: Thu, 26 Jun 2025 22:58:59 -0700
Subject: [PATCH] Always enable timeouts in
ResolveRecoveryConflictWithBufferPin
---
src/backend/storage/ipc/standby.c | 49 ++++++++++++-------------------
1 file changed, 19 insertions(+), 30 deletions(-)
diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
index 7fa8d9247e0..81a04a571c0 100644
--- a/src/backend/storage/ipc/standby.c
+++ b/src/backend/storage/ipc/standby.c
@@ -769,8 +769,7 @@ cleanup:
* The ProcWaitForSignal() sleep normally done in LockBufferForCleanup()
* (when not InHotStandby) is performed here, for code clarity.
*
- * We either resolve conflicts immediately or set a timeout to wake us at
- * the limit of our patience.
+ * We set a timeout to wake us at the limit of our patience.
*
* Resolve conflicts by sending a PROCSIG signal to all backends to check if
* they hold one of the buffer pins that is blocking Startup process. If so,
@@ -798,38 +797,28 @@ ResolveRecoveryConflictWithBufferPin(void)
ltime = GetStandbyLimitTime();
- if (GetCurrentTimestamp() >= ltime && ltime != 0)
+ /*
+ * Wake up at ltime, and check for deadlocks as well if we will be
+ * waiting longer than deadlock_timeout
+ */
+ EnableTimeoutParams timeouts[2];
+ int cnt = 0;
+
+ if (ltime != 0)
{
- /*
- * We're already behind, so clear a path as quickly as possible.
- */
- SendRecoveryConflictWithBufferPin(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
+ timeouts[cnt].id = STANDBY_TIMEOUT;
+ timeouts[cnt].type = TMPARAM_AT;
+ timeouts[cnt].fin_time = ltime;
+ cnt++;
}
- else
- {
- /*
- * Wake up at ltime, and check for deadlocks as well if we will be
- * waiting longer than deadlock_timeout
- */
- EnableTimeoutParams timeouts[2];
- int cnt = 0;
- if (ltime != 0)
- {
- timeouts[cnt].id = STANDBY_TIMEOUT;
- timeouts[cnt].type = TMPARAM_AT;
- timeouts[cnt].fin_time = ltime;
- cnt++;
- }
-
- got_standby_deadlock_timeout = false;
- timeouts[cnt].id = STANDBY_DEADLOCK_TIMEOUT;
- timeouts[cnt].type = TMPARAM_AFTER;
- timeouts[cnt].delay_ms = DeadlockTimeout;
- cnt++;
+ got_standby_deadlock_timeout = false;
+ timeouts[cnt].id = STANDBY_DEADLOCK_TIMEOUT;
+ timeouts[cnt].type = TMPARAM_AFTER;
+ timeouts[cnt].delay_ms = DeadlockTimeout;
+ cnt++;
- enable_timeouts(timeouts, cnt);
- }
+ enable_timeouts(timeouts, cnt);
/*
* Wait to be signaled by UnpinBuffer() or for the wait to be interrupted
--
2.50.0.727.gbf7dc18ff4-goog