pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Is this a problem in GenericXLogFinish()?
Date: Sat, 28 Oct 2023 20:00:00 +0900
Message-ID: <ZTzpsFEV3DhlmxX5@paquier.xyz> (raw)
In-Reply-To: <CAA4eK1+5jacq3g-fcVM2VTKt72SerQ5XuGV5rcrVNG1q7Shr+A@mail.gmail.com>
References: <CA+TgmoY+dagCyrMKau7UQeQU6w4LuVEu+yjsmJBoXKAo6XbUUA@mail.gmail.com>
	<4b2dfe9c67713413a06be761f677bc34222afcb4.camel@j-davis.com>
	<CA+TgmobjyWDQfiMLj1_Lf0GheiY0SaOEPbFEepfa3G-XOLmHOA@mail.gmail.com>
	<23d87b531fab74e69fd753791a7e5047f17da9ab.camel@j-davis.com>
	<f045c8f7-ee24-ead6-3679-c04a43d21351@gmail.com>
	<8a1c93b33b6e0aac92b771339cce520eac0adf96.camel@j-davis.com>
	<ZToVxyLSVUisFPp0@paquier.xyz>
	<CA+TgmoZ8X60+mR4jhS4LoQ1Jf-amSS0xCyfu=p7f94t7HoiH2g@mail.gmail.com>
	<ZTsBF-TKekQIFeL6@paquier.xyz>
	<CAA4eK1+5jacq3g-fcVM2VTKt72SerQ5XuGV5rcrVNG1q7Shr+A@mail.gmail.com>

On Sat, Oct 28, 2023 at 03:45:13PM +0530, Amit Kapila wrote:
> Yes, we need it to exclude any concurrent in-progress scans that could
> return incorrect tuples during bucket squeeze operation.

Thanks.  So I assume that we should just set REGBUF_NO_CHANGE when the
primary and write buffers are the same and there are no tuples to
move.  Say with something like the attached?
--
Michael

Attachments:

fix-hash-replay.patch (text/x-diff, 1.1K) download diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c index 9d1ff20b92..9928068179 100644 --- a/src/backend/access/hash/hashovfl.c +++ b/src/backend/access/hash/hashovfl.c @@ -647,6 +647,7 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf, xl_hash_squeeze_page xlrec; XLogRecPtr recptr; int i; + int wbuf_flags; xlrec.prevblkno = prevblkno; xlrec.nextblkno = nextblkno; @@ -668,7 +669,15 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf, XLogRegisterBuffer(0, bucketbuf, flags); } - XLogRegisterBuffer(1, wbuf, REGBUF_STANDARD); + /* + * If the bucket buffer and the primary buffer are the same, a cleanup + * lock is still required on the write buffer even if there no tuples + * to move, so it needs to be registered in this case. + */ + wbuf_flags = REGBUF_STANDARD; + if (xlrec.is_prim_bucket_same_wrt && xlrec.ntups == 0) + wbuf_flags |= REGBUF_NO_CHANGE; + XLogRegisterBuffer(1, wbuf, wbuf_flags); if (xlrec.ntups > 0) { XLogRegisterBufData(1, (char *) itup_offsets,
signature.asc (application/pgp-signature, 832B) download

view thread (64+ messages)  latest in thread

Message-ID: <ZTzpsFEV3DhlmxX5@paquier.xyz>
Permalink:  ../ZTzpsFEV3DhlmxX5@paquier.xyz/
Also on:    postgresql.org/message-id/ZTzpsFEV3DhlmxX5@paquier.xyz

 ·  · 

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: michael@paquier.xyz, amit.kapila16@gmail.com, robertmhaas@gmail.com, pgsql@j-davis.com, exclusion@gmail.com, hlinnaka@iki.fi
  Subject: Re: Is this a problem in GenericXLogFinish()?
  In-Reply-To: <ZTzpsFEV3DhlmxX5@paquier.xyz>

* 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