if (!begininsert_called)
elog(ERROR, "XLogBeginInsert was not called");
- /* info's high bits are reserved for use by me */
- if (info & XLR_INFO_MASK)
+ /*
+ * The caller can set rmgr bits and XLR_SPECIAL_REL_UPDATE; the rest
+ * are reserved for use by me.
+ */
+ if ((info & ~(XLR_RMGR_INFO_MASK | XLR_SPECIAL_REL_UPDATE)) != 0)
elog(PANIC, "invalid xlog info mask %02X", info);
TRACE_POSTGRESQL_XLOG_INSERT(rmid, info);
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, sizeof(xlrec));
- XLogInsert(RM_SMGR_ID, XLOG_SMGR_CREATE);
+ XLogInsert(RM_SMGR_ID, XLOG_SMGR_CREATE | XLR_SPECIAL_REL_UPDATE);
}
/*
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, sizeof(xlrec));
- lsn = XLogInsert(RM_SMGR_ID, XLOG_SMGR_TRUNCATE);
+ lsn = XLogInsert(RM_SMGR_ID,
+ XLOG_SMGR_TRUNCATE | XLR_SPECIAL_REL_UPDATE);
/*
* Flush, because otherwise the truncation of the main relation might
XLogRegisterData((char *) &xlrec,
sizeof(xl_dbase_create_rec));
- (void) XLogInsert(RM_DBASE_ID, XLOG_DBASE_CREATE);
+ (void) XLogInsert(RM_DBASE_ID,
+ XLOG_DBASE_CREATE | XLR_SPECIAL_REL_UPDATE);
}
}
heap_endscan(scan);
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, sizeof(xl_dbase_create_rec));
- (void) XLogInsert(RM_DBASE_ID, XLOG_DBASE_CREATE);
+ (void) XLogInsert(RM_DBASE_ID,
+ XLOG_DBASE_CREATE | XLR_SPECIAL_REL_UPDATE);
}
/*
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, sizeof(xl_dbase_drop_rec));
- (void) XLogInsert(RM_DBASE_ID, XLOG_DBASE_DROP);
+ (void) XLogInsert(RM_DBASE_ID,
+ XLOG_DBASE_DROP | XLR_SPECIAL_REL_UPDATE);
}
/* Now it's safe to release the database lock */
XLogBeginInsert();
XLogRegisterData((char *) &xlrec, sizeof(xl_dbase_drop_rec));
- (void) XLogInsert(RM_DBASE_ID, XLOG_DBASE_DROP);
+ (void) XLogInsert(RM_DBASE_ID,
+ XLOG_DBASE_DROP | XLR_SPECIAL_REL_UPDATE);
}
pfree(dstpath);
#define SizeOfXLogRecord MAXALIGN(sizeof(XLogRecord))
/*
- * XLOG uses only low 4 bits of xl_info. High 4 bits may be used by rmgr.
+ * The high 4 bits in xl_info may be used freely by rmgr. The
+ * XLR_SPECIAL_REL_UPDATE bit can be passed by XLogInsert caller. The rest
+ * are set internally by XLogInsert.
*/
#define XLR_INFO_MASK 0x0F
#define XLR_RMGR_INFO_MASK 0xF0
+/*
+ * If a WAL record modifies any relation files, in ways not covered by the
+ * usual block references, this flag is set. This is not used for anything
+ * by PostgreSQL itself, but it allows external tools that read WAL and keep
+ * track of modified blocks to recognize such special record types.
+ */
+#define XLR_SPECIAL_REL_UPDATE 0x01
+
/*
* xl_len == 0 is only allowed if this flag is set. This provides an extra
* cross-check when reading records.
*/
#define XLR_NO_RMGR_DATA 0x02
+
/*
* Header info for block data appended to an XLOG record.
*