v2-0002-Test-the-stats-report-in-parallel-apply-worker.patch

application/octet-stream

Filename: v2-0002-Test-the-stats-report-in-parallel-apply-worker.patch
Type: application/octet-stream
Part: 1
Message: RE: Fix stats reporting delays in logical parallel apply worker

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 v2-0002
Subject: Test the stats report in parallel apply worker
File+
src/test/subscription/t/026_stats.pl 16 0
From bc74d2584adbb601aa6a0fd5f023190f7bfaad27 Mon Sep 17 00:00:00 2001
From: Zhijie Hou <houzj.fnst@fujitsu.com>
Date: Wed, 15 Apr 2026 16:59:53 +0800
Subject: [PATCH v2 2/2] Test the stats report in parallel apply worker

---
 src/test/subscription/t/026_stats.pl | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/test/subscription/t/026_stats.pl b/src/test/subscription/t/026_stats.pl
index 5d457060a02..cfd8d9b9d00 100644
--- a/src/test/subscription/t/026_stats.pl
+++ b/src/test/subscription/t/026_stats.pl
@@ -16,6 +16,9 @@ $node_publisher->start;
 # Create subscriber node.
 my $node_subscriber = PostgreSQL::Test::Cluster->new('subscriber');
 $node_subscriber->init;
+
+# Increase the worker limit to allow a parallel apply worker for this test.
+$node_subscriber->append_conf('postgresql.conf', "max_logical_replication_workers = 5");
 $node_subscriber->start;
 
 
@@ -136,6 +139,13 @@ sub create_sub_pub_w_errors
 	# Truncate test table so that apply worker can continue.
 	$node_subscriber->safe_psql($db, qq(TRUNCATE $table_name));
 
+	# Force the publisher to stream the changes to the subscriber immediately so
+	# that the delete_missing conflict can be tested in the parallel apply
+	# worker.
+	$node_publisher->append_conf('postgresql.conf',
+		"debug_logical_replication_streaming = immediate");
+	$node_publisher->reload;
+
 	# Delete data from the test table on the publisher. This delete operation
 	# should be skipped on the subscriber since the table is already empty.
 	$node_publisher->safe_psql($db, qq(DELETE FROM $table_name;));
@@ -151,6 +161,12 @@ sub create_sub_pub_w_errors
 	  or die
 	  qq(Timed out while waiting for delete_missing conflict for subscription '$sub_name');
 
+	# Reset debug_logical_replication_streaming to allow subsequent tests to
+	# verify non-streaming behavior.
+	$node_publisher->append_conf('postgresql.conf',
+		"debug_logical_replication_streaming = buffered");
+	$node_publisher->reload;
+
 	return ($pub_name, $sub_name);
 }
 
-- 
2.53.0.windows.2