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

From: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>
To: "k(dot)jamison(at)fujitsu(dot)com" <k(dot)jamison(at)fujitsu(dot)com>
Cc: 'Thomas Munro' <thomas(dot)munro(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: [Patch] Optimize dropping of relation buffers using dlist
Date: 2020-10-29 02:08:02
Message-ID: TYAPR01MB2990CF06E88342854CF3DB6CFE140@TYAPR01MB2990.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The patch looks almost good except for the minor ones:

(1)
+ for (i = 0; i < nnodes; i++)
+ {
+ RelFileNodeBackend rnode = smgr_reln[i]->smgr_rnode;
+
+ rnodes[i] = rnode;
+ }

You can write:

+ for (i = 0; i < nnodes; i++)
+ rnodes[i] = smgr_reln[i]->smgr_rnode;

(2)
+ if (!accurate || j >= MAX_FORKNUM ||

The correct condition would be:

+ if (j <= MAX_FORKNUM ||

because j becomes MAX_FORKNUM + 1 if accurate sizes for all forks could be obtained. If any fork's size is inaccurate, j is <= MAX_FORKNUM when exiting the loop, so you don't need to test for accurate flag.

(3)
+ {
+ goto buffer_full_scan;
+ return;
+ }

return after goto cannot be reached, so this should just be:

+ goto buffer_full_scan;

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-10-29 02:09:14 Re: recovering from "found xmin ... from before relfrozenxid ..."
Previous Message Michael Paquier 2020-10-29 01:59:52 Re: Add important info about ANALYZE after create Functional Index