Re: Thinko in pgstat_build_snapshot() - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Thinko in pgstat_build_snapshot()
Date
Msg-id df2dc0d0-7d46-4a51-9f36-a6f79cd4ece5@iki.fi
Whole thread Raw
In response to Thinko in pgstat_build_snapshot()  (Etsuro Fujita <etsuro.fujita@gmail.com>)
Responses Re: Thinko in pgstat_build_snapshot()
List pgsql-hackers
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.

-- 
Heikki Linnakangas
Neon (https://neon.tech)



pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Typo in comment for pgstat_database_flush_cb()
Next
From: Tender Wang
Date:
Subject: Re: Typo in comment for pgstat_database_flush_cb()