aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2021-11-02 08:35:29 +0530
committerAmit Kapila <akapila@postgresql.org>2021-11-02 08:35:29 +0530
commit71db6459e6e4ef623e98f3b1e3e9fed1bfb0ae3b (patch)
tree6194a420c627bd423f9bb4f47e35384eef5a539c /src/backend/access/transam/xlog.c
parent43a134f28b350c4b731db9dddf2f53c407a7077f (diff)
downloadpostgresql-71db6459e6e4ef623e98f3b1e3e9fed1bfb0ae3b.tar.gz
postgresql-71db6459e6e4ef623e98f3b1e3e9fed1bfb0ae3b.zip
Replace XLOG_INCLUDE_XID flag with a more localized flag.
Commit 0bead9af484c introduced XLOG_INCLUDE_XID flag to indicate that the WAL record contains subXID-to-topXID association. It uses that flag later to mark in CurrentTransactionState that top-xid is logged so that we should not try to log it again with the next WAL record in the current subtransaction. However, we can use a localized variable to pass that information. In passing, change the related function and variable names to make them consistent with what the code is actually doing. Author: Dilip Kumar Reviewed-by: Alvaro Herrera, Amit Kapila Discussion: https://postgr.es/m/E1mSoYz-0007Fh-D9@gemulon.postgresql.org
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index f547efd2944..6aca1fd75d9 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -999,6 +999,9 @@ static void WALInsertLockUpdateInsertingAt(XLogRecPtr insertingAt);
* 'flags' gives more in-depth control on the record being inserted. See
* XLogSetRecordFlags() for details.
*
+ * 'topxid_included' tells whether the top-transaction id is logged along with
+ * current subtransaction. See XLogRecordAssemble().
+ *
* The first XLogRecData in the chain must be for the record header, and its
* data must be MAXALIGNed. XLogInsertRecord fills in the xl_prev and
* xl_crc fields in the header, the rest of the header must already be filled
@@ -1014,7 +1017,8 @@ XLogRecPtr
XLogInsertRecord(XLogRecData *rdata,
XLogRecPtr fpw_lsn,
uint8 flags,
- int num_fpi)
+ int num_fpi,
+ bool topxid_included)
{
XLogCtlInsert *Insert = &XLogCtl->Insert;
pg_crc32c rdata_crc;
@@ -1170,6 +1174,13 @@ XLogInsertRecord(XLogRecData *rdata,
END_CRIT_SECTION();
/*
+ * Mark top transaction id is logged (if needed) so that we should not try
+ * to log it again with the next WAL record in the current subtransaction.
+ */
+ if (topxid_included)
+ MarkSubxactTopXidLogged();
+
+ /*
* Update shared LogwrtRqst.Write, if we crossed page boundary.
*/
if (StartPos / XLOG_BLCKSZ != EndPos / XLOG_BLCKSZ)