pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <pgsql@j-davis.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Is this a problem in GenericXLogFinish()?
Date: Wed, 27 Sep 2023 08:03:45 -0700
Message-ID: <08b4f1f7dcf321d38373f06acc65a8d62cc2f017.camel@j-davis.com> (raw)
In-Reply-To: <CA+TgmobvdZMWj5=fextXP_Q81eS9g0sbVbVE4qiKAtJs8dMjyA@mail.gmail.com>
References: <d2c31606e6bb9b83a02ed4835d65191b38d4ba12.camel@j-davis.com>
	<25104133-7df8-cae3-b9a2-1c0aaa1c094a@iki.fi>
	<399492009193fa2c37a61b630e4449546a550039.camel@j-davis.com>
	<c84114f8-c7f1-5b57-f85a-3adc31e1a904@iki.fi>
	<146426fc662f88604c700a72a3833b1919922f9e.camel@j-davis.com>
	<CA+TgmobvdZMWj5=fextXP_Q81eS9g0sbVbVE4qiKAtJs8dMjyA@mail.gmail.com>

On Wed, 2023-09-27 at 10:36 -0400, Robert Haas wrote:
> On Tue, Sep 26, 2023 at 9:36 PM Jeff Davis <pgsql@j-davis.com> wrote:
> > That site is pretty trivial to fix, but there are also a couple
> > places
> > in hash.c and hashovfl.c that are registering a clean page and it's
> > not
> > clear to me exactly what's going on.
> 
> Huh, I wonder if that's just a bug. Do you know where exactly?

hashovfl.c:665 and hash.c:831

In both cases it's registering the bucket_buf, and has a comment like:

 /*
  * bucket buffer needs to be registered to ensure that we can
  * acquire a cleanup lock on it during replay.
  */

And various redo routines have comments like:

 /*
  * Ensure we have a cleanup lock on primary bucket page before we
start
  * with the actual replay operation.  This is to ensure that neither a
  * scan can start nor a scan can be already-in-progress during the
replay
  * of this operation.  If we allow scans during this operation, then
they
  * can miss some records or show the same record multiple times.
  */

So it looks like it's intentionally registering a clean buffer so that
it can take a cleanup lock for reasons other than cleaning (or even
modiying) the page. I would think that there's a better way of
accomplishing that goal, so perhaps we can fix that?

Regards,
	Jeff Davis






view thread (64+ messages)  latest in thread

Message-ID: <08b4f1f7dcf321d38373f06acc65a8d62cc2f017.camel@j-davis.com>
Permalink:  ../08b4f1f7dcf321d38373f06acc65a8d62cc2f017.camel@j-davis.com/
Also on:    postgresql.org/message-id/08b4f1f7dcf321d38373f06acc65a8d62cc2f017.camel@j-davis.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pgsql@j-davis.com, robertmhaas@gmail.com, hlinnaka@iki.fi
  Subject: Re: Is this a problem in GenericXLogFinish()?
  In-Reply-To: <08b4f1f7dcf321d38373f06acc65a8d62cc2f017.camel@j-davis.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox