Skip to content

Commit 36e545c

Browse files
author
Amit Kapila
committed
Fix comments atop ReorderBufferAddInvalidations.
The comments atop seem to indicate that we always accumulate invalidation messages in a top-level transaction which is neither required nor matches with the code. Author: Amit Kapila Reviewd by: Masahiko Sawada Backpatch-through: 14, where it was introduced in commit c55040c Discussion: https://postgr.es/m/CAA4eK1LxGgnUroPz8STb6OfjVU1yaHoSA+T63URwmGCLdMJ0LA@mail.gmail.com
1 parent 5ca3645 commit 36e545c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/backend/replication/logical/reorderbuffer.c

+12-10
Original file line numberDiff line numberDiff line change
@@ -3208,16 +3208,17 @@ ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid,
32083208
}
32093209

32103210
/*
3211-
* Setup the invalidation of the toplevel transaction.
3211+
* Accumulate the invalidations for executing them later.
32123212
*
32133213
* This needs to be called for each XLOG_XACT_INVALIDATIONS message and
3214-
* accumulates all the invalidation messages in the toplevel transaction as
3215-
* well as in the form of change in reorder buffer. We require to record it in
3216-
* form of the change so that we can execute only the required invalidations
3217-
* instead of executing all the invalidations on each CommandId increment. We
3218-
* also need to accumulate these in the toplevel transaction because in some
3219-
* cases we skip processing the transaction (see ReorderBufferForget), we need
3220-
* to execute all the invalidations together.
3214+
* accumulates all the invalidation messages in the toplevel transaction, if
3215+
* available, otherwise in the current transaction, as well as in the form of
3216+
* change in reorder buffer. We require to record it in form of the change
3217+
* so that we can execute only the required invalidations instead of executing
3218+
* all the invalidations on each CommandId increment. We also need to
3219+
* accumulate these in the txn buffer because in some cases where we skip
3220+
* processing the transaction (see ReorderBufferForget), we need to execute
3221+
* all the invalidations together.
32213222
*/
32223223
void
32233224
ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid,
@@ -3233,8 +3234,9 @@ ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid,
32333234
oldcontext = MemoryContextSwitchTo(rb->context);
32343235

32353236
/*
3236-
* Collect all the invalidations under the top transaction so that we can
3237-
* execute them all together. See comment atop this function
3237+
* Collect all the invalidations under the top transaction, if available,
3238+
* so that we can execute them all together. See comments atop this
3239+
* function.
32383240
*/
32393241
if (txn->toptxn)
32403242
txn = txn->toptxn;

0 commit comments

Comments
 (0)