v13-0002-Add-test-for-multixid-wraparound.patch
text/x-patch
Filename: v13-0002-Add-test-for-multixid-wraparound.patch
Type: text/x-patch
Part: 1
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 v13-0002
Subject: Add test for multixid wraparound
| File | + | − |
|---|---|---|
| src/test/modules/test_slru/meson.build | 2 | 1 |
| src/test/modules/test_slru/t/002_multixact_wraparound.pl | 50 | 0 |
From cad589df660a97353aeab247d10c83164d92bf28 Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Fri, 28 Nov 2025 21:05:18 +0200
Subject: [PATCH v13 2/2] Add test for multixid wraparound
Author: Andrey Borodin <amborodin@acm.org>
---
src/test/modules/test_slru/meson.build | 3 +-
.../test_slru/t/002_multixact_wraparound.pl | 50 +++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
create mode 100644 src/test/modules/test_slru/t/002_multixact_wraparound.pl
diff --git a/src/test/modules/test_slru/meson.build b/src/test/modules/test_slru/meson.build
index e58bbdf75ac..691b387d13f 100644
--- a/src/test/modules/test_slru/meson.build
+++ b/src/test/modules/test_slru/meson.build
@@ -38,7 +38,8 @@ tests += {
'enable_injection_points': get_option('injection_points') ? 'yes' : 'no',
},
'tests': [
- 't/001_multixact.pl'
+ 't/001_multixact.pl',
+ 't/002_multixact_wraparound.pl'
],
},
}
diff --git a/src/test/modules/test_slru/t/002_multixact_wraparound.pl b/src/test/modules/test_slru/t/002_multixact_wraparound.pl
new file mode 100644
index 00000000000..efaf902e5e3
--- /dev/null
+++ b/src/test/modules/test_slru/t/002_multixact_wraparound.pl
@@ -0,0 +1,50 @@
+# Copyright (c) 2024-2025, PostgreSQL Global Development Group
+
+# Test multixact wraparound
+
+use strict;
+use warnings FATAL => 'all';
+
+use PostgreSQL::Test::Cluster;
+use PostgreSQL::Test::Utils;
+
+use Test::More;
+
+my ($node, $result);
+
+$node = PostgreSQL::Test::Cluster->new('mike');
+$node->init;
+$node->append_conf('postgresql.conf',
+ "shared_preload_libraries = 'test_slru'");
+
+# Set the cluster's next multitransaction to 0xFFFFFFF0.
+my $node_pgdata = $node->data_dir;
+command_ok(
+ [
+ 'pg_resetwal',
+ '--multixact-ids' => '0xFFFFFFF0,0xFFFFFFF0',
+ $node_pgdata
+ ],
+ "set the cluster's next multitransaction to 0xFFFFFFF0");
+command_ok(
+ [
+ 'dd', 'if=/dev/zero', "of=$node_pgdata/pg_multixact/offsets/FFFF",
+ 'bs=4', 'count=65536'
+ ],
+ "init SLRU file");
+
+command_ok([ 'rm', "$node_pgdata/pg_multixact/offsets/0000", ],
+ "drop old SLRU file");
+
+$node->start;
+$node->safe_psql('postgres', q(CREATE EXTENSION test_slru));
+
+# Consume multixids to wrap around
+foreach my $i (1 .. 32)
+{
+ $node->safe_psql('postgres', q{SELECT test_create_multixact();});
+}
+
+$node->stop;
+
+done_testing();
--
2.47.3