public inbox for [email protected]
help / color / mirror / Atom feedFrom: Mircea Cadariu <[email protected]>
To: Anthonin Bonnefoy <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Re: Propagate XLogFindNextRecord error to callers
Date: Tue, 3 Feb 2026 16:05:40 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAO6_XqoxJXddcT4wkd9Xd+cD6Sz-fyspRGuV4Bq-wbXG4pVNzA@mail.gmail.com>
References: <CAO6_XqoxJXddcT4wkd9Xd+cD6Sz-fyspRGuV4Bq-wbXG4pVNzA@mail.gmail.com>
HiĀ Anthonin,
On 12/12/2025 10:39, Anthonin Bonnefoy wrote:
>
> With this patch, pg_waldump will now have the following output when
> reading a file with an invalid header:
> pg_waldump: error: could not find a valid record after D80/5C000000:
> invalid magic number D116 in WAL segment 0000001400000D8000000017, LSN
> D80/5C000000, offset 0
I've picked up the review for your patch.
Attached is a failing test that reproduces the issue. Have I got it
right? We can consider using it to validate your patch then.
--
Thanks,
Mircea Cadariu
From 56f5a2512275f2bc1086d846aa8d63b8d7166ca0 Mon Sep 17 00:00:00 2001
From: Mircea Cadariu <[email protected]>
Date: Tue, 3 Feb 2026 15:49:26 +0000
Subject: [PATCH v1] Add pg_waldump test for invalid WAL page magic error
message
---
src/bin/pg_waldump/t/003_error_message.pl | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 src/bin/pg_waldump/t/003_error_message.pl
diff --git a/src/bin/pg_waldump/t/003_error_message.pl b/src/bin/pg_waldump/t/003_error_message.pl
new file mode 100644
index 0000000000..7992d18f1b
--- /dev/null
+++ b/src/bin/pg_waldump/t/003_error_message.pl
@@ -0,0 +1,22 @@
+use strict;
+use warnings FATAL => 'all';
+use PostgreSQL::Test::Utils;
+use Test::More;
+
+my $tempdir = PostgreSQL::Test::Utils::tempdir();
+my $walfile = "$tempdir/000000010000000000000000";
+
+open(my $fh, '>', $walfile) or die "Cannot create $walfile: $!";
+binmode($fh);
+print $fh pack('vvVQ<VVQ<VV',
+ 0xD116, 0x0002, 1, 0, 0, 0, 12345678901234, 16*1024*1024, 8192);
+print $fh "\0" x (8192 - 40);
+close($fh);
+
+command_fails_like(
+ [ 'pg_waldump', '--start=0/28', $walfile ],
+ qr/invalid magic number.*D116/i,
+ 'detailed error message shown for invalid WAL page magic'
+);
+
+done_testing();
--
2.39.5 (Apple Git-154)
Attachments:
[text/plain] v1-0001-Add-pg_waldump-test-for-invalid-WAL-page-magic-er.patch (1.3K, 2-v1-0001-Add-pg_waldump-test-for-invalid-WAL-page-magic-er.patch)
download | inline diff:
From 56f5a2512275f2bc1086d846aa8d63b8d7166ca0 Mon Sep 17 00:00:00 2001
From: Mircea Cadariu <[email protected]>
Date: Tue, 3 Feb 2026 15:49:26 +0000
Subject: [PATCH v1] Add pg_waldump test for invalid WAL page magic error
message
---
src/bin/pg_waldump/t/003_error_message.pl | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 src/bin/pg_waldump/t/003_error_message.pl
diff --git a/src/bin/pg_waldump/t/003_error_message.pl b/src/bin/pg_waldump/t/003_error_message.pl
new file mode 100644
index 0000000000..7992d18f1b
--- /dev/null
+++ b/src/bin/pg_waldump/t/003_error_message.pl
@@ -0,0 +1,22 @@
+use strict;
+use warnings FATAL => 'all';
+use PostgreSQL::Test::Utils;
+use Test::More;
+
+my $tempdir = PostgreSQL::Test::Utils::tempdir();
+my $walfile = "$tempdir/000000010000000000000000";
+
+open(my $fh, '>', $walfile) or die "Cannot create $walfile: $!";
+binmode($fh);
+print $fh pack('vvVQ<VVQ<VV',
+ 0xD116, 0x0002, 1, 0, 0, 0, 12345678901234, 16*1024*1024, 8192);
+print $fh "\0" x (8192 - 40);
+close($fh);
+
+command_fails_like(
+ [ 'pg_waldump', '--start=0/28', $walfile ],
+ qr/invalid magic number.*D116/i,
+ 'detailed error message shown for invalid WAL page magic'
+);
+
+done_testing();
--
2.39.5 (Apple Git-154)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Propagate XLogFindNextRecord error to callers
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox