Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit daadb42

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 5962c8c commit daadb42

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/backend/replication/logical/reorderbuffer.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,16 +3204,17 @@ ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid,
32043204
}
32053205

32063206
/*
3207-
* Setup the invalidation of the toplevel transaction.
3207+
* Accumulate the invalidations for executing them later.
32083208
*
32093209
* This needs to be called for each XLOG_XACT_INVALIDATIONS message and
3210-
* accumulates all the invalidation messages in the toplevel transaction as
3211-
* well as in the form of change in reorder buffer. We require to record it in
3212-
* form of the change so that we can execute only the required invalidations
3213-
* instead of executing all the invalidations on each CommandId increment. We
3214-
* also need to accumulate these in the toplevel transaction because in some
3215-
* cases we skip processing the transaction (see ReorderBufferForget), we need
3216-
* to execute all the invalidations together.
3210+
* accumulates all the invalidation messages in the toplevel transaction, if
3211+
* available, otherwise in the current transaction, as well as in the form of
3212+
* change in reorder buffer. We require to record it in form of the change
3213+
* so that we can execute only the required invalidations instead of executing
3214+
* all the invalidations on each CommandId increment. We also need to
3215+
* accumulate these in the txn buffer because in some cases where we skip
3216+
* processing the transaction (see ReorderBufferForget), we need to execute
3217+
* all the invalidations together.
32173218
*/
32183219
void
32193220
ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid,
@@ -3229,8 +3230,9 @@ ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid,
32293230
oldcontext = MemoryContextSwitchTo(rb->context);
32303231

32313232
/*
3232-
* Collect all the invalidations under the top transaction so that we can
3233-
* execute them all together. See comment atop this function
3233+
* Collect all the invalidations under the top transaction, if available,
3234+
* so that we can execute them all together. See comments atop this
3235+
* function.
32343236
*/
32353237
if (txn->toptxn)
32363238
txn = txn->toptxn;

0 commit comments

Comments
 (0)