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

From Aleksander Alekseev
Subject Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Date
Msg-id CAJ7c6TPivODEmn9+kQV=22_W6aowQUwjxTr+jjknFGGonbc5GQ@mail.gmail.com
Whole thread Raw
In response to Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)  (Aleksander Alekseev <aleksander@timescale.com>)
List 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

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [PATCHES] Post-special page storage TDE support
Next
From: "Drouvot, Bertrand"
Date:
Subject: Re: Synchronizing slots from primary to standby