diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c index a02a69f..6ed368b 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -267,9 +267,11 @@ set_status_by_pages(int nsubxids, TransactionId *subxids, * has a race condition (see TransactionGroupUpdateXidStatus) but the * worst thing that happens if we mess up is a small loss of efficiency; * the intent is to avoid having the leader access pages it wouldn't - * otherwise need to touch. Finally, we skip it for prepared transactions, - * which don't have the semaphore we would need for this optimization, - * and which are anyway probably not all that common. + * otherwise need to touch. We also skip it if the transaction status is + * other than commit, because for rollback and rollback to savepoint, the + * list of subxids won't be same as subxids array in PGPROC. Finally, we skip + * it for prepared transactions, which don't have the semaphore we would need + * for this optimization, and which are anyway probably not all that common. */ static void TransactionIdSetPageStatus(TransactionId xid, int nsubxids, @@ -279,6 +281,7 @@ TransactionIdSetPageStatus(TransactionId xid, int nsubxids, { if (all_xact_same_page && nsubxids < PGPROC_MAX_CACHED_SUBXIDS && + status == TRANSACTION_STATUS_COMMITTED && !IsGXactActive()) { /*