Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xJnVj-00000000Rrh-3yE5 for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Oct 2026 07:46:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xJnVi-00000009yB9-1GXQ for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Oct 2026 07:46:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xJnVh-00000009yB1-4A7q for pgsql-bugs@lists.postgresql.org; Thu, 22 Oct 2026 07:46:50 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xJnVg-00000000MkM-1RFo for pgsql-bugs@lists.postgresql.org; Thu, 22 Oct 2026 07:46:49 +0000 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-3ad2b3b1c02so894345a91.1 for ; Thu, 22 Oct 2026 00:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792655207; x=1793260007; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=kQSCBJXJELJgS38uVG/r0GXVQuTaBxdazZqvKWbsRds=; b=jpRm6aZ6pHxKO2mT4EKlxBaUxzZtDDtHuu88ltOCpGBh3XrxsDJebbWbUo6aJIjLNA +clrV2SR6HhXLzyYV2wxWJS98k/+rl1Z0wP1HRUskN9tyfe+J8HSknmhkOm0OBzoy9L3 LkhWp6Y21+Iqrg51/F0OoxI64kVQBXUFhQO2ciQwR+PU2EcAQDnoz/JxJFHpqTYZXSHB 2iX4ZABTaMN4Xlv1XO+mNADNoi52ZisSYx396OW5zypnAzHolP38jAg0d3c1MYvYm6gg rA4Q9V5zJ2Eis5LO1jwEQRVwHizOnkiqbIm5/L4EDiENEGZxM5K9a/XcmT/r7Ki1qKAs CRLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792655207; x=1793260007; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kQSCBJXJELJgS38uVG/r0GXVQuTaBxdazZqvKWbsRds=; b=OcFkTHZVrH0V9wHIAdsc7zlvXS3kBtM7h1Ryct3jrUim/SOjgrLwtZgISsyexboeca o0r+EmUJ9RCyPaLZVsQw34fI3CNINF/5BO8fh11SYqFwJyYxhx4i0pF6VvC3f7+UcQyU L+u8QcuaQuOKCIj6nZsygtbUDmuunorkja+IL9I4pkA02e1wX3m6YeaXFlbX5JdMHJn5 Fd9k55z5Ob8NIglrcjVixQBjnQcAYfqeO7itBvEepsqh31NmVARN83ydos9gDqvQI3s4 agkshxWal7iR6/BG8up0JEM8kwtuHHaw0z8QV2YZrq0zHZ9Qa8/mhKoRzkzZjS0YwbXE qmIQ== X-Forwarded-Encrypted: i=1; AKwUvBzD1hMj8LGZ9lMhY6wX/o54CDDlafEZsdU4tdcxr0brvJr+sEirPesBs8CF1pZGam+vRCU/ab5LxidR@lists.postgresql.org X-Gm-Message-State: AFq9FYLZFpyFS64o/K2QwQ6OtIvGkn/VuAGjELzLDh1gceffGNme4b3r a0m4ArtJcua4kGz90UanNuTv0ZtWHENYIkbmAe6aQF6O/PW0yM7KI6Ay X-Gm-Gg: AYBFou1ES+CQ72HPiBRdXxhvRDW5eYmntJ+Qy6wzM3OJ9D7YCTLx0Gvrr5zRyZUFROc yyss6fajUdHpGCgYAh+xluTezUHPHT6UJXAOsB9YyRkFVgQwdM3pWOXSVFiP1znaoNPyHLSyc/y d7W2S6jz7bKtEmHZ1fIePbq57iW+UxgXsFu/ZUL26g91/e55S3ANiwiO8CmX19upGXZDoIfB21F VMHIvqvVukYlPjAJ5BGegW3DKI3cuBcDLDnf34SpR8J0dQ79YKtMLsSvKkFQ/h9CvaflO/T8fTs 76nkZ1OtdhIVYf5q5uGC/XDpwhWLqfdeq+3YzQRp72/uVvpVX3iOcloTWN/USfGOOFK0GHRvN/p ERMKMlZ48q7006r0w3L4F0612COk0QT8ZV+9w6mv7rueoU6dzpAp34VB5/IV0hIgH+jTaRTbhB/ tXAovk48UlTrf0HoLB3uIFawkNyZj42zebdWoGEUlv6WwqG0LXlfdsksTVJ8ttzhHli+jYfCN6G w2p+WXV3oVCQi+iCMsxoE2PllX4GCL7z/7YWEA2ZvGLsqroPVahYxjUQ8AhoKae8LkJjrYS/9NT fPZAVelF/klvyJRQJrmKgEXJYIj5xmNxxj0GLw== X-Received: by 2002:a17:90a:d885:b0:3ac:9a5e:9ce9 with SMTP id 98e67ed59e1d1-3ad86ed685bmr3778513a91.29.1792655207071; Thu, 22 Oct 2026 00:46:47 -0700 (PDT) Received: from [192.168.1.19] (58-190-153-33f1.hyg1.eonet.ne.jp. [58.190.153.33]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3ad83466e46sm4182559a91.1.2026.10.22.00.46.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Oct 2026 00:46:46 -0700 (PDT) Message-ID: Date: Thu, 22 Oct 2026 16:46:44 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #19760: CLUSTER loses a row the transaction inserted and then updated in a rolled-back subtransaction To: Michael Paquier , Zhijie Hou Cc: shihao zhong , Ayush Tiwari , alpkeles99@gmail.com, pgsql-bugs@lists.postgresql.org References: <5fff280b-96c4-497f-bbfc-0af95b9844b3@gmail.com> <949ad7b3-2b0e-40dc-b6ac-e84da432149b@gmail.com> Content-Language: en-US From: Takeshi Ideriha In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi On 2026/10/22 11:22, Michael Paquier wrote: > On Wed, Oct 21, 2026 at 06:01:28PM +0800, Zhijie Hou wrote: >> + if (!(tuple->t_infomask & HEAP_XMAX_INVALID) && >> + !HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask) && >> + !HeapTupleHeaderIsOnlyLocked(tuple)) >> + { >> + TransactionId xmax = HeapTupleHeaderGetUpdateXid(tuple); >> + >> + if (!TransactionIdIsInProgress(xmax) && >> + !TransactionIdDidCommit(xmax)) >> + SetHintBits(tuple, buffer, HEAP_XMAX_INVALID, >> + InvalidTransactionId); >> >> If a tuple's Xmax is a MultiXact and the updating subtransaction is still in >> progress when HeapTupleHeaderIsOnlyLocked() is called, it returns false. >> However, if that updating subtransaction aborts before the second >> TransactionIdIsInProgress() check, the second check returns false and sets >> HEAP_XMAX_INVALID on the tuple even though the MultiXact still has active >> members, which I think violates the MultiXact hint-bit standard. > > Perhaps also check for HEAP_XMAX_IS_MULTI to skip the multixacts and > make sure that active members are not lost, then? I am not completely > sure if this would be always right, though, these code paths are the > hard-level definition of tricky. > I'm +1 for fixing the subtransaction issue first but let me add a comment regarding this multixact race issue. It should be OK not to set the hint bit for a tuple whose xmax is MultiXact containing a key locker and an aborted updating subtransaction. This is because rewrite_heap_tuple filters out this tuple by HeapTupleHeaderIsOnlyLocked and doesn't put it into unresolved table. I'm not sure if there is another issue we need to consider in addition to the performance issue. Regards, Takeshi Ideriha