RE: Disable WAL logging to speed up data loading - Mailing list pgsql-hackers

From tsunakawa.takay@fujitsu.com
Subject RE: Disable WAL logging to speed up data loading
Date
Msg-id TYAPR01MB29903B614F328CF5D246DAA7FEA90@TYAPR01MB2990.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: Disable WAL logging to speed up data loading  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Disable WAL logging to speed up data loading  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
> 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
mandatoryeven 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
bothhave good reasons: the former centralizes the handling of XACT and XLOG RM WAL records (as the current XLOG module
doesalready), 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






pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION
Next
From: Amit Kapila
Date:
Subject: Re: remove unneeded pstrdup in fetch_table_list