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 c55040ccd0
Discussion: https://postgr.es/m/CAA4eK1LxGgnUroPz8STb6OfjVU1yaHoSA+T63URwmGCLdMJ0LA@mail.gmail.com
This commit is contained in:
Amit Kapila 2022-11-10 17:08:27 +05:30
parent 5962c8cbe5
commit daadb42e92
1 changed files with 12 additions and 10 deletions

View File

@ -3204,16 +3204,17 @@ ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid,
} }
/* /*
* Setup the invalidation of the toplevel transaction. * Accumulate the invalidations for executing them later.
* *
* This needs to be called for each XLOG_XACT_INVALIDATIONS message and * This needs to be called for each XLOG_XACT_INVALIDATIONS message and
* accumulates all the invalidation messages in the toplevel transaction as * accumulates all the invalidation messages in the toplevel transaction, if
* well as in the form of change in reorder buffer. We require to record it in * available, otherwise in the current transaction, as well as in the form of
* form of the change so that we can execute only the required invalidations * change in reorder buffer. We require to record it in form of the change
* instead of executing all the invalidations on each CommandId increment. We * so that we can execute only the required invalidations instead of executing
* also need to accumulate these in the toplevel transaction because in some * all the invalidations on each CommandId increment. We also need to
* cases we skip processing the transaction (see ReorderBufferForget), we need * accumulate these in the txn buffer because in some cases where we skip
* to execute all the invalidations together. * processing the transaction (see ReorderBufferForget), we need to execute
* all the invalidations together.
*/ */
void void
ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid, ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid,
@ -3229,8 +3230,9 @@ ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid,
oldcontext = MemoryContextSwitchTo(rb->context); oldcontext = MemoryContextSwitchTo(rb->context);
/* /*
* Collect all the invalidations under the top transaction so that we can * Collect all the invalidations under the top transaction, if available,
* execute them all together. See comment atop this function * so that we can execute them all together. See comments atop this
* function.
*/ */
if (txn->toptxn) if (txn->toptxn)
txn = txn->toptxn; txn = txn->toptxn;