Re: Thinko in pgstat_build_snapshot()

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Gurjeet Singh <gurjeet(at)singh(dot)im>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Thinko in pgstat_build_snapshot()
Date: 2025-04-06 11:35:23
Message-ID: CAPmGK16J8CpF3Yfbz06x213wH5FuvO2h4Kd__Q8PFpzzWL2cLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 30, 2025 at 10:47 PM Gurjeet Singh <gurjeet(at)singh(dot)im> wrote:
> On Sun, Mar 30, 2025 at 4:31 AM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> > On 30/03/2025 13:23, Etsuro Fujita wrote:
> > > While working on something else I noticed $SUBJECT: we are allocating
> > > more memory than necessary and copying more data than necessary
> > > because we specify the wrong PgStat_KindInfo member as the size
> > > argument for MemoryContextAlloc and memcpy. This could become
> > > problematic if snapshotting a very large number of variables stats, so
> > > I fixed it. Attached is a patch for that.
> >
> > Good catch. Patch looks good to me at quick glance.
>
> +1 on both counts.

I will push the patch as well.

Thank you both for looking at the patch!

Best regards,
Etsuro Fujita

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tender Wang 2025-04-06 11:42:01 Re: Removing unneeded self joins
Previous Message Etsuro Fujita 2025-04-06 11:31:50 Re: Typo in comment for pgstat_database_flush_cb()