From: Kyotaro Horiguchi <[email protected]>
> XLogBeginInsert();
> XLogSetRecrodFlags(XLOG_MARK_ESSENTIAL); # new flag value
> XLOGInsert(....);
Oh, sounds like a nice idea. That's more flexible by allowing WAL-emitting
modules to specify which WAL records are mandatory even when wal_level is none.
For example, gistXLogAssignLSN() adds the above flag like this:
XLogBeginInsert();
XLogSetRecordFlags(XLOG_MARK_UNIMPORTANT | XLOG_MARK_ESSENTIAL);
XLogRegisterData((char *) &dummy, sizeof(dummy));
(Here's a word play - unimportant but essential, what's that?)
And the filter in XLogInsert() becomes:
+ if (wal_level == WAL_LEVEL_NONE &&
+ !((rmid == RM_XLOG_ID && info == XLOG_CHECKPOINT_SHUTDOWN) ||
+ (rmid == RM_XLOG_ID && info == XLOG_PARAMETER_CHANGE) ||
+ (rmid == RM_XACT_ID && info == XLOG_XACT_PREPARE) ||
+ (curinsert_flags & XLOG_MARK_ESSENTIAL)))
Or,
+ if (wal_level == WAL_LEVEL_NONE &&
+ !(curinsert_flags & XLOG_MARK_ESSENTIAL))
and add the new flag when emitting XLOG_CHECKPOINT_ONLINE,
XLOG_PARAMETER_CHANGE and XLOG_PREPARE records. I think both have good
reasons: the former centralizes the handling of XACT and XLOG RM WAL records
(as the current XLOG module does already), and the latter delegates the
decision to each module. Which would you prefer? (I kind of like the former,
but this is a weak opinion.)
Regards
Takayuki Tsunakawa