Re: Move system identifier generation to a common helper

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Move system identifier generation to a common helper
Date: 2026-06-10 20:29:20
Message-ID: 954FFDCA-2DA8-4B8E-84A9-62FFC0C5C5E9@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 10 Jun 2026, at 15:25, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 04.06.26 14:22, Imran Zaheer wrote:
>> The code used to generate a new system identifier is duplicated in
>> multiple locations, including BootStrapXLOG(), pg_createsubscriber, and
>> pg_resetwal.
>> Move the generation logic into a common GenerateSystemIdentifier()
>> helper so that all callers use a single implementation, avoiding
>> duplication of the same algorithm.
>
> Then again, this code is from PG 8.0. We have had pg_strong_random() required since PG 12. Maybe we should use that now for this.

One feature of the current scheme is that it's explicitly not random, but can
be reverse-engineered to figure out the init time. Maybe we should have a
better way of doing that regardless, but it doesn't seem like a bad feature to
keep.

--
Daniel Gustafsson

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-06-10 20:29:33 Re: Heads Up: cirrus-ci is shutting down June 1st
Previous Message Andrew Dunstan 2026-06-10 20:23:47 Re: BackgroundPsql swallowing errors on windows