Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Maxim Orlov <orlovmg(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Japin Li <japinli(at)hotmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(at)paquier(dot)xyz>, Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Date: 2023-11-08 14:17:26
Message-ID: CAJ7c6TPivODEmn9+kQV=22_W6aowQUwjxTr+jjknFGGonbc5GQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Maxim,

I see both of us accounted for Alexanders feedback and submitted v59.
Your newer version seems to have issues on cfbot, so resubmitting the
previous patchset that passes the tests. Please feel free to add
changes.

> See SlruCorrectSegmentFilenameLength():
>
> ```
> if (ctl->long_segment_names)
> return (len == 15); /* see SlruFileName() */
> else
> /*
> * Commit 638cf09e76d allowed 5-character lengths. Later commit
> * 73c986adde5 allowed 6-character length.
> *
> * XXX should we still consider such names to be valid?
> */
> return (len == 4 || len == 5 || len == 6);
> ```
>
> Should we just drop it or check that segno is <= 0xFFFFFF?

I also choose to change this Assert and to add a corresponding comment:

else
{
- Assert(segno >= 0 && segno <= 0xFFFF);
+ /*
+ * Despite the fact that %04X format string is used up to 24 bit
+ * integers are allowed. See SlruCorrectSegmentFilenameLength()
+ */
+ Assert(segno >= 0 && segno <= 0xFFFFFF);
return snprintf(path, MAXPGPATH, "%s/%04X", (ctl)->Dir,
(unsigned int) segno);
}

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v60-0001-Index-SLRUs-by-64-bit-integers-rather-than-by-32.patch application/octet-stream 56.4 KB
v60-0003-Make-use-FullTransactionId-in-2PC-filenames.patch application/octet-stream 2.9 KB
v60-0002-Use-larger-segment-file-names-for-pg_notify.patch application/octet-stream 13.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-11-08 14:39:16 Re: Synchronizing slots from primary to standby
Previous Message Stephen Frost 2023-11-08 14:04:13 Re: [PATCHES] Post-special page storage TDE support