From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c) |
Date: | 2023-06-05 11:24:13 |
Message-ID: | CAEudQArzX-q7FuvHxcEQKP9RuM7eFw4CnvU_xQtkiu4+tnaA4A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Em seg., 5 de jun. de 2023 às 08:06, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
escreveu:
> Em dom., 4 de jun. de 2023 às 23:37, Richard Guo <guofenglinux(at)gmail(dot)com>
> escreveu:
>
>>
>> On Sun, Jun 4, 2023 at 8:42 PM Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
>>
>>> Hi,
>>>
>>> Per Coverity.
>>>
>>> At function ExtendBufferedRelShared, has a always true test.
>>> eb.rel was dereferenced one line above, so in
>>> if (eb.rel) is always true.
>>>
>>> I think it's worth removing the test, because Coverity raises dozens of
>>> alerts thinking eb.rel might be NULL.
>>> Besides, one less test is one less branch.
>>>
>>
>> This also happens in ExtendBufferedRelTo, and the comment there explains
>> that the eb.rel 'could have been closed while waiting for lock'.
>>
> Well, RelationGetSmgr also dereferences eb.rel.
> If eb.rel could be closed while waiting for lock,
> anyone who references eb.rel below takes a risk?
>
> static inline SMgrRelation
> RelationGetSmgr(Relation rel)
> {
> if (unlikely(rel->rd_smgr == NULL))
> smgrsetowner(&(rel->rd_smgr), smgropen(rel->rd_locator, rel->rd_backend));
> return rel->rd_smgr;
> }
>
Sorry Richard, nevermind.
My fault, I withdraw this patch.
regards,
Ranier Vilela
From | Date | Subject | |
---|---|---|---|
Next Message | Jelte Fennema | 2023-06-05 11:43:42 | Re: Adding SHOW CREATE TABLE |
Previous Message | Yu Shi (Fujitsu) | 2023-06-05 11:06:45 | RE: [PATCH] Reuse Workers and Replication Slots during Logical Replication |