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

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: "k.jamison@fujitsu.com" <k.jamison@fujitsu.com>
Cc: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, "tgl@sss.pgh.pa.us" <tgl@sss.pgh.pa.us>, Thomas Munro <thomas.munro@gmail.com>, "andres@anarazel.de" <andres@anarazel.de>, "robertmhaas@gmail.com" <robertmhaas@gmail.com>, "tomas.vondra@2ndquadrant.com" <tomas.vondra@2ndquadrant.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-11-18T12:04:31Z
Lists: pgsql-hackers
On Wed, Nov 18, 2020 at 2:34 PM k.jamison@fujitsu.com
<k.jamison@fujitsu.com> wrote:
>
> On Thursday, November 12, 2020 1:14 PM, Tsunakawa-san wrote:
> I forgot to reply.
> Thank you very much Tsunakawa-san for testing and to everyone
> who has provided their reviews and insights as well.
>
> Now thinking about smgrnblocks(), currently Thomas Munro is also working on implementing a
> shared SmgrRelation [1] to store sizes. However, since that is still under development and the
> discussion is still ongoing, I hope we can first commit these set of patches here as these are already
> in committable form. I think it's alright to accept the early improvements implemented in this thread
> to the source code.
>

Yeah, that won't be a bad idea especially because the patch being
discussed in the thread you referred is still in an exploratory phase.
I haven't tested or done a detailed review but I feel there shouldn't
be many problems if we agree on the approach.

Thomas/others, do you have objections to proceeding here? It shouldn't
be a big problem to change the code in this area even if we get the
shared relation size stuff in.

-- 
With Regards,
Amit Kapila.



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