Re: [PATCH] Improve AtSubCommit_childXids

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [PATCH] Improve AtSubCommit_childXids
Дата
Msg-id 20191113180200.ecjvlffqjydccpji@alap3.anarazel.de
обсуждение исходный текст
Ответ на RE: [PATCH] Improve AtSubCommit_childXids  (Ranier Vilela <ranier_gyn@hotmail.com>)
Список pgsql-hackers
Hi,

On this list we quote inline, and trim quoted messages to the relevant
parts...

On 2019-11-13 17:40:27 +0000, Ranier Vilela wrote:
> "Why is this an improvement? And what setting are we removing? You mean
> that we reset nChildXids, even if it's already 0? Hard to see how that
> matters."
> 
> The orginal function, ever set ChildXidsm, nChildXidsa and maxChildXids.
> See at lines 1594, 1595, 1596, even if it's already 0!

So? It's easier to reason about that way anyway, and it's just about
free, because the cacheline is already touched.


> The test (nChildXids > 0), possibly works, but, may confuse when do use
> memcpy function soon after, and access one pointer that below, is checked by NULL.
> How hard to see this?

But they don't necessarily have to mean the same. One is about the array
being allocated, and one is about the number of actual xids in
there. The memcpy cares about the number of xids in it. The free cares
about whether memory is allocated.

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Invisible PROMPT2
Следующее
От: Chapman Flack
Дата:
Сообщение: Re: Invisible PROMPT2