Re: [BUG + PATCH] DSA pagemap out-of-bounds in make_new_segment odd-sized path

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Paul Bunn <paul(dot)bunn(at)icloud(dot)com>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUG + PATCH] DSA pagemap out-of-bounds in make_new_segment odd-sized path
Date: 2026-03-09 04:55:21
Message-ID: aa5SuZezpUzXA6k_@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 06, 2026 at 08:22:27AM -0800, Paul Bunn wrote:
> ugh, the .out file was not updated. v4 fixes that.

I have looked at that, and found that the assumptions behind the
formulas could have a better documentation, information actually added
partially in the commit log of the first versions of the patch.
Having that in the comments of the code felt more adapted.

The test case was taking a long time to run, up to a couple of
seconds. And it was much slower in the buildfarm. The allocation
time stacks quickly once we aim for higher, and being able to test the
odd-sized case could come to 1901 and 6501 for the number of pages.
Hence I have slightly reworked the function, tweaking it with a
"start" and an "end" location, on top of the custom "step".

A last issue was with total_pages, shadow variable of a declaration
with the same name in the function make_new_segment(). This can be
switched to a PG_USED_FOR_ASSERTS_ONLY, with a different name.

And backpatched down to v14, with the test down to v17. The test
required a slight tweak in v18 and v17.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2026-03-09 05:14:38 Re: Convert NOT IN sublinks to anti-joins when safe
Previous Message Amit Langote 2026-03-09 04:41:51 Re: generic plans and "initial" pruning