pgsql: Improve generation algorithm for database system identifier.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve generation algorithm for database system identifier.
Date: 2014-04-26 19:11:14
Message-ID: E1We80I-0000z6-Or@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5035701e07e8bd395aa878465a102afd7b74e8c3

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

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-04-28 01:24:44 pgsql: Can't completely get rid of #ifndef FRONTEND in palloc.h :-(
Previous Message Tom Lane 2014-04-26 18:14:37 pgsql: Don't #include utils/palloc.h in common/fe_memutils.h.