Re: [Patch] Optimize dropping of relation buffers using dlist

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: tsunakawa.takay@fujitsu.com
Cc: k.jamison@fujitsu.com, amit.kapila16@gmail.com, tgl@sss.pgh.pa.us, andres@anarazel.de, robertmhaas@gmail.com, tomas.vondra@2ndquadrant.com, pgsql-hackers@postgresql.org
Date: 2020-10-01T03:17:54Z
Lists: pgsql-hackers
At Thu, 1 Oct 2020 02:40:52 +0000, "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com> wrote in 
> With the following code, when the main fork does not meet the
> optimization criteria, other forks are not optimized as well.  You
> want to determine each fork's optimization separately, don't you?

In more detail, if smgrcachednblocks() returned InvalidBlockNumber for
any of the forks, we should give up the optimization at all since we
need to run a full scan anyway.  On the other hand, if any of the
forks is smaller than the threshold, we still can use the optimization
when we know the accurate block number of all the forks.

Still, I prefer to use total block number of all forks since we anyway
visit the all forks.  Is there any reason to exlucde forks other than
the main fork while we visit all of them already?

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



Commits

  1. Fix size overflow in calculation introduced by commits d6ad34f3 and bea449c6.

  2. Optimize DropRelFileNodesAllBuffers() for recovery.

  3. Optimize DropRelFileNodeBuffers() for recovery.

  4. Cache smgrnblocks() results in recovery.

  5. Add a check to prevent overwriting valid data if smgrnblocks() gives a