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

From Kyotaro Horiguchi
Subject Re: Disable WAL logging to speed up data loading
Date
Msg-id 20210113.110706.198230270559275306.horikyota.ntt@gmail.com
Whole thread Raw
In response to RE: Disable WAL logging to speed up data loading  ("osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com>)
Responses Re: Disable WAL logging to speed up data loading  (movead li <lchch1990@sina.cn>)
RE: Disable WAL logging to speed up data loading  ("tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>)
List pgsql-hackers
At Tue, 12 Jan 2021 07:09:28 +0000, "osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com> wrote in 
> On Tuesday, January 12, 2021 12:52 PM Takayuki/綱川 貴之 <tsunakawa.takay@fujitsu.com> wrote:
> > From: Osumi, Takamichi/大墨 昂道 <osumi.takamichi@fujitsu.com>
> > > I updated the patch following this discussion, and fixed the
> > > documentation as well.
> > 
> > 
> > +          (rmid == RM_GIST_ID && info == RM_GIST_ID) ||
> > +          (rmid == RM_GENERIC_ID)))
> > 
> > info is wrong for GiST, and one pair of parenthesis is unnecessary.  The above
> > would be:
> > 
> > +          (rmid == RM_GIST_ID && info ==
> > XLOG_GIST_ASSIGN_LSN) ||
> > +          rmid == RM_GENERIC_ID))
> Oops, sorry for this careless mistake.
> Fixed. And again, regression test produces no failure.

@@ -449,6 +450,18 @@ XLogInsert(RmgrId rmid, uint8 info)
         return EndPos;
     }
 
+    /* Issues only limited types of WAL when wal logging is disabled */
+    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) ||
+          (rmid == RM_GIST_ID && info == XLOG_GIST_ASSIGN_LSN) ||
+          rmid == RM_GENERIC_ID))

As Sawada-san mentioned, this prevents future index AMs from being
pluggable.  Providing an interface would work but seems a bit too
invasive.  The record insertion flags is there for this very purpose.

XLogBeginInsert();
XLogSetRecrodFlags(XLOG_MARK_ESSENTIAL);  # new flag value
XLOGInsert(....);

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: "Hou, Zhijie"
Date:
Subject: RE: Single transaction in the tablesync worker?
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: [Patch] Optimize dropping of relation buffers using dlist