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
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
Description: PGP signature