1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-09 13:09:39 +03:00

Add macros for ReorderBufferTXN toptxn.

Currently, there are quite a few places in reorderbuffer.c that tries to
access top-transaction for a subtransaction. This makes the code to access
top-transaction consistent and easier to follow.

Author: Peter Smith
Reviewed-by: Vignesh C, Sawada Masahiko
Discussion: https://postgr.es/m/CAHut+PuCznOyTqBQwjRUu-ibG-=KHyCv-0FTcWQtZUdR88umfg@mail.gmail.com
This commit is contained in:
Amit Kapila
2023-03-17 08:29:41 +05:30
parent eb7d043c9b
commit e709596b25
4 changed files with 41 additions and 33 deletions

View File

@@ -694,8 +694,8 @@ maybe_send_schema(LogicalDecodingContext *ctx,
if (in_streaming)
xid = change->txn->xid;
if (change->txn->toptxn)
topxid = change->txn->toptxn->xid;
if (rbtxn_is_subtxn(change->txn))
topxid = rbtxn_get_toptxn(change->txn)->xid;
else
topxid = xid;
@@ -1879,7 +1879,7 @@ pgoutput_stream_abort(struct LogicalDecodingContext *ctx,
Assert(!in_streaming);
/* determine the toplevel transaction */
toptxn = (txn->toptxn) ? txn->toptxn : txn;
toptxn = rbtxn_get_toptxn(txn);
Assert(rbtxn_is_streamed(toptxn));