From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Pluggable cumulative statistics |
Date: | 2024-07-08 05:30:23 |
Message-ID: | Zot5bxoPYdS7yaoy@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Jul 05, 2024 at 09:35:19AM +0900, Michael Paquier wrote:
> On Thu, Jul 04, 2024 at 11:30:17AM +0000, Bertrand Drouvot wrote:
>> On Wed, Jul 03, 2024 at 06:47:15PM +0900, Michael Paquier wrote:
>>> - PgStat_Snapshot holds an array of void* also indexed by
>>> PGSTAT_NUM_KINDS, pointing to the fixed stats stored in the
>>> snapshots.
>>
>> Same, that's just a 96 bytes overhead (8 * PGSTAT_NUM_KINDS) as compared to now.
>
> Still Andres does not seem to like that much, well ;)
Please find attached a rebased patch set labelled v4. Built-in
fixed-numbered stats are still attached to the snapshot and shmem
control structures, and custom fixed stats kinds are tracked in the
same way as v3 with new members tracking data stored in
TopMemoryContext for the snapshots and shmem for the control data.
So, the custom and built-in stats kinds are separated into separate
parts of the structures, including the "valid" flags for the
snapshots. And this avoids any redirection when looking at the
built-in fixed-numbered stats.
I've tried at address all the previous comments (there could be stuff
I've missed while rebasing, of course).
The first three patches are refactoring pieces to make the rest more
edible, while 0004~ implement the main logic with templates in
modules/injection_points:
- 0001 refactors pgstat_write_statsfile() so as a loop om
PgStat_KindInfo is used to write the data. This is done with the
addition of snapshot_ctl_off in PgStat_KindInfo, to point to the area
in PgStat_Snapshot where the data is located for fixed stats.
9004abf6206e has done the same for the read part.
- 0002 adds an init_shmem callback, to let stats kinds initialize
states based on what's been allocated.
- 0003 refactors the read/write to use a new entry type in the stats
file for fixed-numbered stats.
- 0004 switches PgStat_Kind from an enum to uint32, adding a better
type for pluggability.
- 0005 is the main implementation.
- 0006 adds some docs.
- 0007 (variable-numbered stats) and 0008 (fixed-numbered stats) are
the examples demonstrating how to make pluggable stats for both types,
with tests of their own.
--
Michael
Attachment | Content-Type | Size |
---|---|---|
v4-0001-Use-pgstat_kind_infos-to-write-fixed-shared-stati.patch | text/x-diff | 5.2 KB |
v4-0002-Add-PgStat_KindInfo.init_shmem_cb.patch | text/x-diff | 10.4 KB |
v4-0003-Add-a-new-F-type-of-entry-in-pgstats-file.patch | text/x-diff | 2.7 KB |
v4-0004-Switch-PgStat_Kind-from-enum-to-uint32.patch | text/x-diff | 3.1 KB |
v4-0005-Introduce-pluggable-APIs-for-Cumulative-Statistic.patch | text/x-diff | 20.2 KB |
v4-0006-doc-Add-section-for-Custom-Cumulative-Statistics-.patch | text/x-diff | 3.3 KB |
v4-0007-injection_points-Add-statistics-for-custom-points.patch | text/x-diff | 14.2 KB |
v4-0008-injection_points-Add-example-for-fixed-numbered-s.patch | text/x-diff | 11.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bertrand Drouvot | 2024-07-08 05:38:25 | Re: walsender.c comment with no context is hard to understand |
Previous Message | Peter Smith | 2024-07-08 05:22:54 | Re: Pgoutput not capturing the generated columns |