src/backend/replication/logical/reorderbuffer.c
void
ReorderBufferAbortOld(ReorderBuffer *rb, TransactionId oldestRunningXid)
{
	dlist_mutable_iter it;

	/*
	 * Iterate through all (potential) toplevel TXNs and abort all that are
	 * older than what possibly can be running. Once we've found the first
	 * that is alive we stop, there might be some that acquired an xid earlier
	 * but started writing later, but it's unlikely and they will cleaned up
	 * in a later call to ReorderBufferAbortOld().
	 */
	dlist_foreach_modify(it, &rb->toplevel_by_lsn)
	{
		ReorderBufferTXN *txn;

		txn = dlist_container(ReorderBufferTXN, node, it.cur);

		if (TransactionIdPrecedes(txn->xid, oldestRunningXid))
		{
			elog(DEBUG1, "aborting old transaction %u", txn->xid);

			/* remove potential on-disk data, and deallocate this tx */
			ReorderBufferCleanupTXN(rb, txn);
		}
		else
			return;
	}
}
/*
 * Abort all transactions that aren't actually running anymore because the
 * server restarted.
 *
 * NB: These really have to be transactions that have aborted due to a server
 * crash/immediate restart, as we don't deal with invalidations here.
 */
Abort all transactions that aren't actually running anymore because the
server restarted.

These really have to be transactions that have aborted due to a server
crash/immediate restart, as we don't deal with invalidations here.
Abort all transactions that aren ' t actually running anymore because the server restarted . These really have to be transactions that have aborted due to a server crash / immediate restart as we don ' t deal with invalidations here .
void
ReorderBufferAbortOld(ReorderBuffer *rb, TransactionId oldestRunningXid)
{
	dlist_mutable_iter it;
	dlist_foreach_modify(it, &rb->toplevel_by_lsn)
	{
		ReorderBufferTXN *txn;
		txn = dlist_container(ReorderBufferTXN, node, it.cur);
		if (TransactionIdPrecedes(txn->xid, oldestRunningXid))
		{
			elog(DEBUG1, "aborting old transaction %u", txn->xid);
			ReorderBufferCleanupTXN(rb, txn);
		}
		else
			return;
	}
}
void ReorderBufferAbortOld ( ReorderBuffer * rb , TransactionId oldestRunningXid ) { dlist_mutable_iter it ; dlist_foreach_modify ( it , & rb -> toplevel_by_lsn ) { ReorderBufferTXN * txn ; txn = dlist_container ( ReorderBufferTXN , node , it . cur ) ; if ( TransactionIdPrecedes ( txn -> xid , oldestRunningXid ) ) { elog ( DEBUG1 , " " , txn -> xid ) ; ReorderBufferCleanupTXN ( rb , txn ) ; } else return ; } }
Abort all transactions that aren't actually running anymore because the
 server restarted.
Abort all transactions that aren ' t actually running anymore because the server restarted .
/*
	 * Iterate through all (potential) toplevel TXNs and abort all that are
	 * older than what possibly can be running. Once we've found the first
	 * that is alive we stop, there might be some that acquired an xid earlier
	 * but started writing later, but it's unlikely and they will cleaned up
	 * in a later call to ReorderBufferAbortOld().
	 */ /* remove potential on-disk data, and deallocate this tx */