Skip to content

Commit ade24da

Browse files
committed
Document XLOG_INCLUDE_XID a little better
I noticed that commit 0bead9a 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 <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/202109212119.c3nhfp64t2ql@alvherre.pgsql
1 parent 43c1c4f commit ade24da

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/backend/access/transam/xloginsert.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ XLogRegisterBufData(uint8 block_id, char *data, int len)
409409
* - XLOG_MARK_UNIMPORTANT, to signal that the record is not important for
410410
* durability, which allows to avoid triggering WAL archiving and other
411411
* background activity.
412+
* - XLOG_INCLUDE_XID, a message-passing hack between XLogRecordAssemble
413+
* and XLogResetInsertion.
412414
*/
413415
void
414416
XLogSetRecordFlags(uint8 flags)

src/include/access/xlog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ extern bool XLOG_DEBUG;
212212
*/
213213
#define XLOG_INCLUDE_ORIGIN 0x01 /* include the replication origin */
214214
#define XLOG_MARK_UNIMPORTANT 0x02 /* record not important for durability */
215-
#define XLOG_INCLUDE_XID 0x04 /* include XID of top-level xact */
215+
#define XLOG_INCLUDE_XID 0x04 /* WAL-internal message-passing hack */
216216

217217

218218
/* Checkpoint statistics */

src/include/access/xlogrecord.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,9 @@ typedef struct XLogRecordDataHeaderLong
215215
* Block IDs used to distinguish different kinds of record fragments. Block
216216
* references are numbered from 0 to XLR_MAX_BLOCK_ID. A rmgr is free to use
217217
* any ID number in that range (although you should stick to small numbers,
218-
* because the WAL machinery is optimized for that case). A couple of ID
219-
* numbers are reserved to denote the "main" data portion of the record.
218+
* because the WAL machinery is optimized for that case). A few ID
219+
* numbers are reserved to denote the "main" data portion of the record,
220+
* as well as replication-supporting transaction metadata.
220221
*
221222
* The maximum is currently set at 32, quite arbitrarily. Most records only
222223
* need a handful of block references, but there are a few exceptions that

0 commit comments

Comments
 (0)