Re: Pluggable cumulative statistics
От
Michael Paquier
Тема
Re: Pluggable cumulative statistics
Дата
Msg-id
ZoUeI2jdbO_gn8cU@paquier.xyz
Ответ на
Re: Pluggable cumulative statistics (Michael Paquier)
Список
Дерево обсуждения
Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Dmitry Dolgov <9erthalion6@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Andres Freund <andres@anarazel.de>
Re: Pluggable cumulative statistics Andres Freund <andres@anarazel.de>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Andrei Lepikhov <lepihov@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Andres Freund <andres@anarazel.de>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Dmitry Dolgov <9erthalion6@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Dmitry Dolgov <9erthalion6@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Dmitry Dolgov <9erthalion6@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
Re: Pluggable cumulative statistics Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Re: Pluggable cumulative statistics Michael Paquier <michael@paquier.xyz>
On Fri, Jun 21, 2024 at 08:13:15AM +0900, Michael Paquier wrote: > On Thu, Jun 20, 2024 at 02:27:14PM +0000, Bertrand Drouvot wrote: >> On Thu, Jun 20, 2024 at 09:46:30AM +0900, Michael Paquier wrote: >> I think it makes sense to follow the same "behavior" as the custom >> wal resource managers. That, indeed, looks much more simpler than v1. > > Thanks for the feedback. While looking at a different patch from Tristan in this area at [1], I still got annoyed that this patch set was not able to support the case of custom fixed-numbered stats, so as it is possible to plug in pgstats things similar to the archiver, the checkpointer, WAL, etc. These are plugged in shared memory, and are handled with copies in the stats snapshots. After a good night of sleep, I have come up with a good solution for that, among the following lines: - PgStat_ShmemControl holds an array of void* indexed by PGSTAT_NUM_KINDS, pointing to shared memory areas allocated for each fixed-numbered stats. Each entry is allocated a size corresponding to PgStat_KindInfo->shared_size. - PgStat_Snapshot holds an array of void* also indexed by PGSTAT_NUM_KINDS, pointing to the fixed stats stored in the snapshots. These have a size of PgStat_KindInfo->shared_data_len, set up when stats are initialized at process startup, so this reflects everywhere. - Fixed numbered stats now set shared_size, and we use this number to determine the size to allocate for each fixed-numbered stats in shmem. - A callback is added to initialize the shared memory assigned to each fixed-numbered stats, consisting of LWLock initializations for the current types of stats. So this initialization step is moved out of pgstat.c into each stats kind file. All that has been done in the rebased patch set as of 0001, which is kind of a nice cleanup overall because it removes all the dependencies to the fixed-numbered stats structures from the "main" pgstats code in pgstat.c and pgstat_shmem.c. The remaining patches consist of: - 0002, Switch PgStat_Kind to a uint32. Cleanup. - 0003 introduces the pluggable stats facility. Feeding on the refactoring for the fixed-numbered stats in 0001, it is actually possible to get support for these in the pluggable APIs by just removing the restriction in the registration path. This extends the void* arrays to store references that cover the range of custom kind IDs. - 0004 has some docs. - 0005 includes an example of implementation for variable-numbered stats with the injection_points module. - 0006 is new for this thread, implementing an example for fixed-numbered stats, using again the injection_points module. This stuff gathers stats about the number of times points are run, attached and detached. Perhaps that's useful in itself, I don't know, but it provides the coverage I want for this facility. While on it, I have applied one of the cleanup patches as 9fd02525793f. [1]: https://www.postgresql.org/message-id/ZoNytpoHOzHGBLYi@paquier.xyz -- Michael
В списке pgsql-hackers по дате отправления
От: Fujii Masao
Дата: