Re: Making aggregate deserialization (and WAL receive) functions slightly faster

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Making aggregate deserialization (and WAL receive) functions slightly faster
Date: 2023-10-05 05:23:36
Message-ID: ZR5IWNXBtoyfNbh8@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 04, 2023 at 07:47:11PM +1300, David Rowley wrote:
> The original patch had a new function in stringinfo.c which allowed a
> StringInfoData to be initialised from an existing string with some
> given length. Tom wasn't a fan of that because there wasn't any
> protection against someone trying to use the given StringInfoData and
> then calling appendStringInfo to append another string. That can't be
> done in this case as we can't repalloc the VARDATA_ANY(state) pointer
> due to it not pointing directly to a palloc'd chunk. Tom's complaint
> seemed to be about having a reusable function which could be abused,
> so I modified the patch to remove the reusable code. I think your
> macro idea in stringinfo.h would put the patch in the same position as
> it was initially.

Ahem, well. Based on this argument my own argument does not hold
much. Perhaps I'd still use a macro at the top of array_userfuncs.c
and numeric.c, to avoid repeating the same pattern respectively two
and four times, documenting once on top of both macros that this is a
fake StringInfo because of the reasons documented in these code paths.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jon Erdman 2023-10-05 05:31:00 Re: [HACKERS] Logical replication and multimaster
Previous Message Jon Erdman 2023-10-05 05:14:31 Re: [HACKERS] Logical replication and multimaster