From: | "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com> |
---|---|
To: | 'Amit Kapila' <amit(dot)kapila16(at)gmail(dot)com>, "k(dot)jamison(at)fujitsu(dot)com" <k(dot)jamison(at)fujitsu(dot)com> |
Cc: | Kyotaro Horiguchi <horikyota(dot)ntt(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-09-28 02:50:20 |
Message-ID: | TYAPR01MB29906DA4E02ED8B315524FFFFE350@TYAPR01MB2990.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> I agree with the above two points.
Thank you. I'm relieved to know I didn't misunderstand.
> > * Then, add a new function, say, smgrnblocks_cached() that simply returns
> the cached block count, and DropRelFileNodeBuffers() uses it instead of
> smgrnblocks().
> >
>
> I am not sure if it worth adding a new function for this. Why not simply add a
> boolean variable in smgrnblocks for this?
One reason is that adding an argument requires modification of existing call sites (10 + a few). Another is that, although this may be different for each person's taste, it's sometimes not easy to understand when a function call with true/false appears. One such example is find_XXX(some_args, true/false), where the true/false represents missing_ok. Another example is as follows. I often wonder "what's the meaning of this false, and that true?"
if (!InstallXLogFileSegment(&destsegno, tmppath, false, 0, false))
elog(ERROR, "InstallXLogFileSegment should not have failed");
Fortunately, the new function is very short and doesn't duplicate much code. The function is a simple getter and the function name can convey the meaning straight (if the name is good.)
> BTW, AFAICS, the latest patch
> doesn't have code to address this point.
Kirk-san, can you address this? I don't mind much if you add an argument or a new function.
Regards
Takayuki Tsunakawa
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Fan | 2020-09-28 02:51:16 | Re: Partition prune with stable Expr |
Previous Message | David Rowley | 2020-09-28 02:47:22 | Re: Small improvements to pg_list.h's linitial(), lsecond(), lthird() etc macros |