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

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: small typo in src/backend/access/transam/xlog.c
Дата
Msg-id 20130722200159.GD752@alap2.anarazel.de
обсуждение исходный текст
Ответ на Re: small typo in src/backend/access/transam/xlog.c  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: small typo in src/backend/access/transam/xlog.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2013-07-22 15:55:46 -0400, Robert Haas wrote:
> On Mon, Jul 22, 2013 at 6:45 AM, didier <did447@gmail.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: small typo in src/backend/access/transam/xlog.c
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: enum-ify resource manager's xl_info values