mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +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:
@ -249,6 +249,24 @@ typedef struct ReorderBufferChange
|
||||
((txn)->txn_flags & RBTXN_SKIPPED_PREPARE) != 0 \
|
||||
)
|
||||
|
||||
/* Is this a top-level transaction? */
|
||||
#define rbtxn_is_toptxn(txn) \
|
||||
( \
|
||||
(txn)->toptxn == NULL \
|
||||
)
|
||||
|
||||
/* Is this a subtransaction? */
|
||||
#define rbtxn_is_subtxn(txn) \
|
||||
( \
|
||||
(txn)->toptxn != NULL \
|
||||
)
|
||||
|
||||
/* Get the top-level transaction of this (sub)transaction. */
|
||||
#define rbtxn_get_toptxn(txn) \
|
||||
( \
|
||||
rbtxn_is_subtxn(txn) ? (txn)->toptxn : (txn) \
|
||||
)
|
||||
|
||||
typedef struct ReorderBufferTXN
|
||||
{
|
||||
/* See above */
|
||||
|
Reference in New Issue
Block a user