From 335397456b7e3f9f619038cb322fbfc9dd649d4f Mon Sep 17 00:00:00 2001 From: Amit Kapila Date: Tue, 2 Nov 2021 09:10:17 +0530 Subject: [PATCH] Move MarkCurrentTransactionIdLoggedIfAny() out of the critical section. We don't modify any shared state in this function which could cause problems for any concurrent session. This will make it look similar to the other updates for the same structure (TransactionState) which avoids confusion for future readers of code. Author: Dilip Kumar Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/E1mSoYz-0007Fh-D9@gemulon.postgresql.org --- src/backend/access/transam/xlog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 6aca1fd75d9..0a0771a18eb 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -1169,10 +1169,10 @@ XLogInsertRecord(XLogRecData *rdata, */ WALInsertLockRelease(); - MarkCurrentTransactionIdLoggedIfAny(); - END_CRIT_SECTION(); + MarkCurrentTransactionIdLoggedIfAny(); + /* * Mark top transaction id is logged (if needed) so that we should not try * to log it again with the next WAL record in the current subtransaction. -- 2.39.5