RE: Disable WAL logging to speed up data loading

Поиск
Список
Период
Сортировка
От tsunakawa.takay@fujitsu.com
Тема RE: Disable WAL logging to speed up data loading
Дата
Msg-id TYAPR01MB29903B614F328CF5D246DAA7FEA90@TYAPR01MB2990.jpnprd01.prod.outlook.com
обсуждение исходный текст
Ответ на Re: Disable WAL logging to speed up data loading  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Ответы Re: Disable WAL logging to speed up data loading  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Logical Replication - behavior of ALTER PUBLICATION .. DROP TABLE and ALTER SUBSCRIPTION .. REFRESH PUBLICATION
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: remove unneeded pstrdup in fetch_table_list