Document XLOG_INCLUDE_XID a little better
authorAlvaro Herrera
Tue, 21 Sep 2021 22:47:53 +0000 (19:47 -0300)
committerAlvaro Herrera
Tue, 21 Sep 2021 22:47:53 +0000 (19:47 -0300)
I noticed that commit 0bead9af484c left this flag undocumented in
XLogSetRecordFlags, which led me to discover that the flag doesn't
actually do what the one comment on it said it does.  Improve the
situation by adding some more comments.

Backpatch to 14, where the aforementioned commit appears.

Author: Álvaro Herrera 
Discussion: https://postgr.es/m/202109212119[email protected]

src/backend/access/transam/xloginsert.c
src/include/access/xlog.h
src/include/access/xlogrecord.h

index 32b4cc84e79aaae8fb77266078a4a7bb9cf63072..b153fad594d896b3ad01a36c65b188e6cb1e42cf 100644 (file)
@@ -399,6 +399,8 @@ XLogRegisterBufData(uint8 block_id, char *data, int len)
  * - XLOG_MARK_UNIMPORTANT, to signal that the record is not important for
  *  durability, which allows to avoid triggering WAL archiving and other
  *  background activity.
+ * - XLOG_INCLUDE_XID, a message-passing hack between XLogRecordAssemble
+ *  and XLogResetInsertion.
  */
 void
 XLogSetRecordFlags(uint8 flags)
index 77187c12bebac7f4abf5790c61b966f543326889..ee3e369b79f3bb6eb41f902b2729ebc9f65f2ce9 100644 (file)
@@ -246,7 +246,7 @@ extern bool XLOG_DEBUG;
  */
 #define XLOG_INCLUDE_ORIGIN        0x01    /* include the replication origin */
 #define XLOG_MARK_UNIMPORTANT  0x02    /* record not important for durability */
-#define XLOG_INCLUDE_XID       0x04    /* include XID of top-level xact */
+#define XLOG_INCLUDE_XID       0x04    /* WAL-internal message-passing hack */
 
 
 /* Checkpoint statistics */
index 80c92a2498a32b1528e529edf8f18ac4a4cba61e..f68cb189128eb1e1cece3d12b7b966beb19d61f7 100644 (file)
@@ -211,8 +211,9 @@ typedef struct XLogRecordDataHeaderLong
  * Block IDs used to distinguish different kinds of record fragments. Block
  * references are numbered from 0 to XLR_MAX_BLOCK_ID. A rmgr is free to use
  * any ID number in that range (although you should stick to small numbers,
- * because the WAL machinery is optimized for that case). A couple of ID
- * numbers are reserved to denote the "main" data portion of the record.
+ * because the WAL machinery is optimized for that case). A few ID
+ * numbers are reserved to denote the "main" data portion of the record,
+ * as well as replication-supporting transaction metadata.
  *
  * The maximum is currently set at 32, quite arbitrarily. Most records only
  * need a handful of block references, but there are a few exceptions that