Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()
Date: 2018-02-01 18:55:57
Message-ID: CA+TgmoaoXUCc-ZHZk7had2NuJ-==FKL3rRHHp1fVjNu_FkLyYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 1, 2018 at 1:00 AM, Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> wrote:
> IMHO we're missing a point here. When xl_prev is changed to a 2-byte value
> (as the patch suggests), the risk only comes when an old WAL file is
> recycled for some future WAL file and the old and the future WAL file's
> segment numbers share the same low order 16-bits. Now as the patch stands,
> we take precaution to never reuse a WAL file with conflicting low order
> bits.

You and Simon seem to be assuming that the only case we need to worry
about is when the old segment had an xl_prev value at the same offset,
and you may be right, but if that is guaranteed, I don't understand
why it's guaranteed. Why couldn't that offset in the old WAL file
been in the middle of a WAL record and thus subject to containing any
random garbage?

If we know that, at the same offset in the previous WAL file, there
was definitely an xl_prev pointer, then it seems like some trick like
what you're proposing might work, although I'm not sure of the
details. But if that could've been something else -- like the middle
of a WAL record -- then that doesn't really help. Our chance of a
false match is pretty much just 2^-nbits.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-02-01 19:03:23 Re: [HACKERS] Refactoring identifier checks to consistently use strcmp
Previous Message Robert Haas 2018-02-01 18:45:47 Re: [HACKERS] why not parallel seq scan for slow functions