Re: [PATCH] pg_surgery: check the page header and line pointers

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] pg_surgery: check the page header and line pointers
Date: 2026-09-05 14:16:22
Message-ID: BE260D29-1209-4607-82F9-BD3E9D97674F@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks, v2 addresses both points. The code changes look good to me.

The TAP test still has one small portability issue: it hardcodes 8192.
It does not need to support every BLCKSZ, but it could read SHOW
block_size and skip unless it is 8192. Otherwise a 4 kB build rejects
the header in PageIsVerified() before reaching the new check.

+# t_lp: leave the header alone, but point the first line pointer past the
+# end of the page. Item is (lp_off = 32767, lp_flags = LP_NORMAL,
+# lp_len = 100) packed into the 32-bit ItemIdData word.

The exact lp_off and lp_len values produced by the packed ItemIdData
word depend on the platform's bit-field ordering. The word is invalid
with either ordering, so the test is fine, but the comment can avoid
claiming those exact values.

With those minor test adjustments, this looks ready for committer to me.

Best regards, Andrey Borodin.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sehrope Sarkuni 2026-09-05 15:03:03 Re: Avoid streaming zero-filled WAL switch padding
Previous Message Andrey Borodin 2026-09-05 13:15:13 Re: Archive-fed logical decoding: pausing recovery on slot conflict