pgsql: Fix race condition in TransactionGroupUpdateXidStatus(). - Mailing list pgsql-committers

From Amit Kapila
Subject pgsql: Fix race condition in TransactionGroupUpdateXidStatus().
Date
Msg-id E1lxiZd-0001mW-T7@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix race condition in TransactionGroupUpdateXidStatus().

When we cannot immediately acquire XactSLRULock in exclusive mode at
commit time, we add ourselves to a list of processes that need their XIDs
status update. We do this if the clog page where we need to update the
current transaction status is the same as the group leader's clog page,
otherwise, we allow the caller to clear it by itself. Now, when we can't
add ourselves to any group, we were not clearing the current proc if it
has already become a member of some group which was leading to an
assertion failure when the same proc was assigned to another backend after
the current backend exits.

Reported-by: Alexander Lakhin
Bug: 17072
Author: Amit Kapila
Tested-By: Alexander Lakhin
Backpatch-through: 11, where it was introduced
Discussion: https://postgr.es/m/17072-2f8764857ef2c92a@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b786304c2904a4e444fe740bbc2e0b69efacc19d

Modified Files
--------------
src/backend/access/transam/clog.c | 5 +++++
1 file changed, 5 insertions(+)


pgsql-committers by date:

Previous
From: Thomas Munro
Date:
Subject: pgsql: Change recovery_init_sync_method to PGC_SIGHUP.
Next
From: Amit Kapila
Date:
Subject: pgsql: Improve RelationGetIdentityKeyBitmap().