test_custom_stats: Test module for custom cumulative statistics This test module acts as a replacement that existed prior to d52c24b0f808 in the test module injection_points. It uses a more flexible structure than its ancestor: - Two libraries are built, one for fixed-sized stats and one for variable-sized stats. - No GUCs required. The stats are enabled only if one or both libraries are loaded with shared_preload_libraries. - Same kind IDs reserved: 25 (variable-sized) and 26 (fixed-sized)
The goal of this redesign is to be able to easier extend the code coverage provided by this module for other changes that are currently under discussion, and injection_points was not suited for these. Injection points are also now widely used in the tree now, so extending more the test coverage for custom pgstats in the test module injection_points would be a riskier long-term move. The new code is mostly a copy of what existed previously in the test module injection_points, with the same callbacks defined for fixed-sized and variable-sized stats, but a simpler overall structure in terms of the stats counters updated. The test coverage should remain the same as previously: one TAP test is used to check data reports, crash recovery and clean restart scenarios. Tests are added for the manual reset of fixed-sized stats, something not tested until now. Author: Sami Imseih <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Discussion: https://postgr.es/m/CAA5RZ0sJgO6GAwgFxmzg9MVP=rm7us8kkcwpuqxe-f5qxmp...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/31280d96a64850f5a9a924088890ab43a2905237 Modified Files -------------- doc/src/sgml/xfunc.sgml | 6 + src/test/modules/Makefile | 1 + src/test/modules/meson.build | 1 + src/test/modules/test_custom_stats/.gitignore | 4 + src/test/modules/test_custom_stats/Makefile | 27 ++ src/test/modules/test_custom_stats/meson.build | 55 ++++ .../test_custom_stats/t/001_custom_stats.pl | 139 ++++++++++ .../test_custom_fixed_stats--1.0.sql | 20 ++ .../test_custom_stats/test_custom_fixed_stats.c | 224 +++++++++++++++ .../test_custom_fixed_stats.control | 4 + .../test_custom_var_stats--1.0.sql | 25 ++ .../test_custom_stats/test_custom_var_stats.c | 303 +++++++++++++++++++++ .../test_custom_var_stats.control | 4 + src/tools/pgindent/typedefs.list | 4 + 14 files changed, 817 insertions(+)
