v1-0001-reproduce-the-failure-in-031_recovery_conflict.pl.patch

application/octet-stream

Filename: v1-0001-reproduce-the-failure-in-031_recovery_conflict.pl.patch
Type: application/octet-stream
Part: 0
Message: Re: Implement waiting for wal lsn replay: reloaded

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 v1-0001
Subject: reproduce the failure in 031_recovery_conflict.pl
File+
src/test/recovery/t/031_recovery_conflict.pl 16 1
From ca73929687f9bf7d4aaa258f8e413ff2c3eea6aa Mon Sep 17 00:00:00 2001
From: alterego655 <824662526@qq.com>
Date: Wed, 7 Jan 2026 11:39:41 +0800
Subject: [PATCH v1] reproduce the failure in 031_recovery_conflict.pl

---
 src/test/recovery/t/031_recovery_conflict.pl | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/test/recovery/t/031_recovery_conflict.pl b/src/test/recovery/t/031_recovery_conflict.pl
index 7a740f69806..39061fcc0a8 100644
--- a/src/test/recovery/t/031_recovery_conflict.pl
+++ b/src/test/recovery/t/031_recovery_conflict.pl
@@ -198,10 +198,25 @@ like($res, qr/^6000$/m,
 	"$sect: cursor with conflicting temp file established");
 
 # Drop the tablespace currently containing spill files for the query on the
-# standby
+# standby.  We pause replay before the DROP, then resume it via a background
+# session.  This forces wait_for_replay_catchup's internal WAIT FOR LSN to be
+# running when the conflict fires, exercising the recovery conflict handling
+# in Cluster.pm.
+$node_standby->safe_psql('postgres', "SELECT pg_wal_replay_pause()");
 $node_primary->safe_psql($test_db, qq[DROP TABLESPACE $tablespace1;]);
 
+# Start a background session that waits 1 second then resumes replay.
+# This triggers the conflict while wait_for_replay_catchup is running.
+my $resume_session = $node_standby->background_psql('postgres');
+$resume_session->query_until(
+	qr/start/, qq[
+	\\echo start
+	SELECT pg_sleep(1);
+	SELECT pg_wal_replay_resume();
+]);
+
 $node_primary->wait_for_replay_catchup($node_standby);
+$resume_session->quit;
 
 check_conflict_log(
 	"User was or might have been using tablespace that must be dropped");
-- 
2.51.0