v13-0006-TEST-try-to-replicate-buggy-oldest-offset.patch.txt
text/plain
Filename: v13-0006-TEST-try-to-replicate-buggy-oldest-offset.patch.txt
Type: text/plain
Part: 5
Message:
Re: POC: make mxidoff 64 bits
From 4a2e64b44cf8ec22a264d8fa495432f535482fb4 Mon Sep 17 00:00:00 2001
From: Maxim Orlov <orlovmg@gmail.com>
Date: Fri, 27 Dec 2024 19:39:58 +0300
Subject: [PATCH v13 6/7] TEST: try to replicate buggy oldest offset
---
src/bin/pg_upgrade/t/005_offset.pl | 59 ++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/src/bin/pg_upgrade/t/005_offset.pl b/src/bin/pg_upgrade/t/005_offset.pl
index df84186de4..2d91d101fa 100644
--- a/src/bin/pg_upgrade/t/005_offset.pl
+++ b/src/bin/pg_upgrade/t/005_offset.pl
@@ -305,6 +305,8 @@ my @TESTS = (
100, 101, 102, 103, 104, 105, 106,
# self upgrade
1000,
+ # buggy
+ 2000
);
# =============================================================================
@@ -560,4 +562,61 @@ SKIP:
ok(1, "TEST $TEST_NO PASSED");
}
+# =============================================================================
+# Buggy
+# =============================================================================
+
+SKIP:
+{
+ my $TEST_NO = 2000;
+ skip "do not test case $TEST_NO", 1
+ unless ( grep( /^$TEST_NO$/, @TESTS ) );
+
+ if (!defined($ENV{oldinstall}))
+ {
+ die "oldinstall is not defined";
+ }
+
+ my $dbname = 'buggy';
+ my $newnode = PostgreSQL::Test::Cluster->new("new_$dbname");
+ my $oldnode = PostgreSQL::Test::Cluster->new("old_$dbname",
+ install_path => $ENV{oldinstall});
+ $newnode->init;
+ $oldnode->init(force_initdb => 1);
+
+ $oldnode->append_conf('postgresql.conf', q(
+ autovacuum = off
+ max_prepared_transactions = 2
+ fsync = off
+ ));
+ $oldnode->start;
+
+ mxid_gen2($oldnode, 'FOO', 1.25);
+ mxid_gen2($oldnode, 'BAR', 1.25);
+
+ $oldnode->safe_psql('postgres', q(
+ DROP TABLE BAR;
+ CHECKPOINT;
+ ));
+ $oldnode->stop;
+
+ unlink($oldnode->data_dir . "/pg_multixact/offsets/0000");
+
+ command_ok(
+ [
+ 'pg_upgrade', '--no-sync',
+ '-d', $oldnode->data_dir,
+ '-D', $newnode->data_dir,
+ '-b', $oldnode->config_data('--bindir'),
+ '-B', $newnode->config_data('--bindir'),
+ '-s', $newnode->host,
+ '-p', $oldnode->port,
+ '-P', $newnode->port,
+ '--copy'
+ ],
+ 'run of pg_upgrade');
+
+ ok(1, "TEST $TEST_NO PASSED");
+}
+
done_testing();
--
2.43.0