From 841be96b35a071b36c4f0497cbebc9df2cfdde77 Mon Sep 17 00:00:00 2001 From: chenxiaobin <1025221611@qq.com> Date: Mon, 20 Dec 2021 07:56:10 +0000 Subject: [PATCH] Consider other lockers of a xmax when it's a multi with an aborted update --- .../storage/access/heap/heapam_visibility.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gausskernel/storage/access/heap/heapam_visibility.cpp b/src/gausskernel/storage/access/heap/heapam_visibility.cpp index eb700d618..6d277a0a7 100644 --- a/src/gausskernel/storage/access/heap/heapam_visibility.cpp +++ b/src/gausskernel/storage/access/heap/heapam_visibility.cpp @@ -793,11 +793,21 @@ restart: } } - /* no member, even just a locker, alive anymore */ - if (!MultiXactIdIsRunning(HeapTupleHeaderGetXmax(page, tuple))) + /* + * By here, the update in the Xmax is either aborted or crashed, but + * what about the other members? + */ + if (!MultiXactIdIsRunning(HeapTupleHeaderGetXmax(page, tuple))) { + /* + * There's no member, even just a locker, alive anymore, so we can + * mark the Xmax as invalid. + */ SetHintBits(tuple, buffer, HEAP_XMAX_INVALID, InvalidTransactionId); - /* it must have aborted or crashed */ - return TM_Ok; + return TM_Ok; + } else { + /* There are lockers running */ + return TM_BeingModified; + } } if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(page, tuple))) {