Re: [PATCH] Improve AtSubCommit_childXids - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [PATCH] Improve AtSubCommit_childXids
Date
Msg-id 20191113180200.ecjvlffqjydccpji@alap3.anarazel.de
Whole thread Raw
In response to RE: [PATCH] Improve AtSubCommit_childXids  (Ranier Vilela <ranier_gyn@hotmail.com>)
List 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 by date:

Previous
From: David Fetter
Date:
Subject: Re: Invisible PROMPT2
Next
From: Chapman Flack
Date:
Subject: Re: Invisible PROMPT2