Re: small typo in src/backend/access/transam/xlog.c

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: didier <did447(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: small typo in src/backend/access/transam/xlog.c
Date: 2013-07-22 20:01:59
Message-ID: 20130722200159.GD752@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-07-22 15:55:46 -0400, Robert Haas wrote:
> On Mon, Jul 22, 2013 at 6:45 AM, didier <did447(at)gmail(dot)com> wrote:
> > Hi
> >
> > in void
> > BootStrapXLOG(void)
> >
> > * to seed it other than the system clock value...) The upper half of
> > the
> > * uint64 value is just the tv_sec part, while the lower half is the
> > XOR
> > * of tv_sec and tv_usec. This is to ensure that we don't lose
> > uniqueness
> > * unnecessarily if "uint64" is really only 32 bits wide. A person
> > * knowing this encoding can determine the initialization time of
> > the
> > * installation, which could perhaps be useful sometimes.
> > */
> > gettimeofday(&tv, NULL);
> > sysidentifier = ((uint64) tv.tv_sec) << 32;
> > sysidentifier |= (uint32) (tv.tv_sec | tv.tv_usec);
> >
> > should be
> > sysidentifier |= (uint32) (tv.tv_sec ^ tv.tv_usec);
>
> And why is that?

The comment above tells: "while the lower half is the XOR of tv_sec and
tv_usec."

I don't think it really matters. the bitwise OR has the tenency to
collect too many set bits, but ... who cares?
On the other hand, changing it is easy and shouldn't cause any problems.

Greetings,

Andres Freund

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2013-07-22 20:15:40 Re: enum-ify resource manager's xl_info values
Previous Message Robert Haas 2013-07-22 19:55:46 Re: small typo in src/backend/access/transam/xlog.c