Re: BUG #17358: While using --with-uuid=bsd option, uuid_ossp test fails on NetBSD 9.2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: byavuz81(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17358: While using --with-uuid=bsd option, uuid_ossp test fails on NetBSD 9.2
Date: 2022-01-09 00:38:41
Message-ID: 1605935.1641688721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> Well, maybe. Just considering having our own generator already puts us
> in a state of sin, because the whole argument for v1 UUID uniqueness
> hinges on there being just one generator per machine (or per MAC
> address, anyway). As soon as there are independent generators using
> the same MAC address, they can't positively guarantee uniqueness.
> My thought about it is that once you've crossed that boundary, allowing
> each process to generate UUIDs independently is not much of a leap.

After a bit of further thought, it seems like a reasonable compromise
could be to move the code into core PG and maintain the UUID assignment
state in shared memory. We'd still set the clock sequence number to
something random at shmem initialization, but thereafter all backends
would draw from that shared state, allowing us to provide a guarantee
of uniqueness across the PG instance rather than just per-process.

(I don't see any value in trying to preserve the clock sequence number
across restarts. A restart should take long enough that the timestamp
will advance, making it moot. The main value of the clock sequence number
is to make it less likely that we'll generate the same UUID as some other
generator running on the same machine, so a random choice seems optimal.)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Padmakumar Kadayaprth 2022-01-09 08:18:01 Postgres HA and Pglogical
Previous Message Tom Lane 2022-01-08 21:25:31 Re: BUG #17358: While using --with-uuid=bsd option, uuid_ossp test fails on NetBSD 9.2