Re: pgsql: Improve generation algorithm for database system identifier.

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Improve generation algorithm for database system identifier.
Date: 2014-05-27 15:48:38
Message-ID: 20140527154838.GB1305@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hi Tom,

On 2014-04-26 19:11:14 +0000, Tom Lane wrote:
> Improve generation algorithm for database system identifier.
>
> As noted some time ago, the original coding had a typo ("|" for "^")
> that made the result less unique than intended. Even the intended
> behavior is obsolete since it was based on wanting to produce a
> usable value even if we didn't have int64 arithmetic --- a limitation
> we stopped supporting years ago. Instead, let's redefine the system
> identifier as tv_sec in the upper 32 bits (same as before), tv_usec
> in the next 20 bits, and the low 12 bits of getpid() in the remaining
> bits. This is still hardly guaranteed-universally-unique, but it's
> noticeably better than before. Per my proposal at
> <29019(dot)1374535940(at)sss(dot)pgh(dot)pa(dot)us>

> Modified Files
> --------------
> src/backend/access/transam/xlog.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)

I just noticed that pg_resetxlog.c has a copy of the identifer
generation algorithm that's not been adjusted by that commit.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-05-27 18:32:34 Re: pgsql: Improve generation algorithm for database system identifier.
Previous Message Robert Haas 2014-05-27 03:01:47 pgsql: worker_spi: Initialize bgw_notify_pid in all cases.