From 13795e380eecf21cad817026c2ad42127c2ee2fc Mon Sep 17 00:00:00 2001
From: Maxim Orlov <orlovmg@gmail.com>
Date: Fri, 5 Dec 2025 19:24:05 +0300
Subject: [PATCH] Improve 7b81be9b42 Add test for multixid wraparound

Add support for different block sizes
---
 .../modules/test_slru/t/002_multixact_wraparound.pl    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/test/modules/test_slru/t/002_multixact_wraparound.pl b/src/test/modules/test_slru/t/002_multixact_wraparound.pl
index de37d845b1..073454d9c3 100644
--- a/src/test/modules/test_slru/t/002_multixact_wraparound.pl
+++ b/src/test/modules/test_slru/t/002_multixact_wraparound.pl
@@ -24,16 +24,20 @@ command_ok(
 		$node_pgdata
 	],
 	"set the cluster's next multitransaction to 0xFFFFFFF8");
+my $out = (run_command([ 'pg_resetwal', '--dry-run', $node->data_dir ]))[0];
+$out =~ /^Database block size: *(\d+)$/m or die;
+my $blcksz = $1;
+my $bytes_per_seg = 32 * $blcksz; # SLRU pages per segment
 
 # Fixup the SLRU files to match the state we reset to.
 
-# initialize SLRU file with zeros (65536 entries * 4 bytes = 262144 bytes)
+# initialize SLRU file with zeros
 my $slru_file = "$node_pgdata/pg_multixact/offsets/FFFF";
 open my $fh, ">", $slru_file
   or die "could not open \"$slru_file\": $!";
 binmode $fh;
-# Write 65536 entries of 4 bytes each (all zeros)
-syswrite($fh, "\0" x 262144) == 262144
+# Write 65536 entries of 4 bytes each (all zeros) for default 8192 block size
+syswrite($fh, "\0" x $bytes_per_seg) == $bytes_per_seg
   or die "could not write to \"$slru_file\": $!";
 close $fh;
 
-- 
2.50.1 (Apple Git-155)

