public inbox for [email protected]  
help / color / mirror / Atom feed
From: Maxim Orlov <[email protected]>
To: Anton A. Melnikov <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Maybe don't process multi xmax in FreezeMultiXactId() if it is already marked as invalid?
Date: Tue, 18 Jun 2024 17:29:13 +0300
Message-ID: <CACG=ezbB2q2wYZseBA5mcNKXZwamPRb2dzzqrRtJ37E=K7do2w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

Hi!

Maybe, I'm too bold, but looks like a kinda bug to me.  At least, I don't
understand why we do not check the HEAP_XMAX_INVALID flag.
My guess is nobody noticed, that MultiXactIdIsValid call does not check the
mentioned flag in the "first" condition, but it's all my speculation.
Does anyone know if there are reasons to deliberately ignore the HEAP_XMAX
INVALID flag? Or this is just an unfortunate oversight.

PFA, my approach on this issue.

-- 
Best regards,
Maxim Orlov.


Attachments:

  [application/octet-stream] v2-0001-Invalidate-xmax-if-HEAP_XMAX_INVALID-is-set.patch (772B, ../CACG=ezbB2q2wYZseBA5mcNKXZwamPRb2dzzqrRtJ37E=K7do2w@mail.gmail.com/3-v2-0001-Invalidate-xmax-if-HEAP_XMAX_INVALID-is-set.patch)
  download | inline diff:
From 90867d80a081de1509dc57938e39ed02649f88ab Mon Sep 17 00:00:00 2001
From: Maxim Orlov <[email protected]>
Date: Tue, 18 Jun 2024 17:17:06 +0300
Subject: [PATCH v2] Invalidate xmax if HEAP_XMAX_INVALID is set.

---
 src/backend/access/heap/heapam.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 82bb9cb33b6..0c4db5b225f 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -6216,6 +6216,7 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
 	Assert(t_infomask & HEAP_XMAX_IS_MULTI);
 
 	if (!MultiXactIdIsValid(multi) ||
+		(t_infomask & HEAP_XMAX_INVALID) ||
 		HEAP_LOCKED_UPGRADED(t_infomask))
 	{
 		*flags |= FRM_INVALIDATE_XMAX;
-- 
2.45.2



view thread (7+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Maybe don't process multi xmax in FreezeMultiXactId() if it is already marked as invalid?
  In-Reply-To: <CACG=ezbB2q2wYZseBA5mcNKXZwamPRb2dzzqrRtJ37E=K7do2w@mail.gmail.com>

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

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