summaryrefslogtreecommitdiff
path: root/src/test/modules
diff options
context:
space:
mode:
authorMichael Paquier2024-11-22 01:12:26 +0000
committerMichael Paquier2024-11-22 01:12:26 +0000
commitc06e71d1acaf490660ed4ae5c28b3079628746b0 (patch)
tree266b42e6e6936a3ec7cfc18a9e3807ebad4981e5 /src/test/modules
parent4c4aaa19a6fed39e0eb0247625331c3df34d8211 (diff)
Add write_to_file to PgStat_KindInfo for pgstats kinds
This new field controls if entries of a stats kind should be written or not to the on-disk pgstats file when shutting down an instance. This affects both fixed and variable-numbered kinds. This is useful for custom statistics by itself, and a patch is under discussion to add a new builtin stats kind where the write of the stats is not necessary. All the built-in stats kinds, as well as the two custom stats kinds in the test module injection_points, set this flag to "true" for now, so as stats entries are written to the on-disk pgstats file. Author: Bertrand Drouvot Reviewed-by: Nazir Bilal Yavuz Discussion: https://postgr.es/m/Zz7T47nHwYgeYwOe@ip-10-97-1-34.eu-west-3.compute.internal
Diffstat (limited to 'src/test/modules')
-rw-r--r--src/test/modules/injection_points/injection_stats.c1
-rw-r--r--src/test/modules/injection_points/injection_stats_fixed.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/test/modules/injection_points/injection_stats.c b/src/test/modules/injection_points/injection_stats.c
index d89d0559134..e16b9db2845 100644
--- a/src/test/modules/injection_points/injection_stats.c
+++ b/src/test/modules/injection_points/injection_stats.c
@@ -39,6 +39,7 @@ static bool injection_stats_flush_cb(PgStat_EntryRef *entry_ref, bool nowait);
static const PgStat_KindInfo injection_stats = {
.name = "injection_points",
.fixed_amount = false, /* Bounded by the number of points */
+ .write_to_file = true,
/* Injection points are system-wide */
.accessed_across_databases = true,
diff --git a/src/test/modules/injection_points/injection_stats_fixed.c b/src/test/modules/injection_points/injection_stats_fixed.c
index 2fed178b7a6..c5b0bb8cf04 100644
--- a/src/test/modules/injection_points/injection_stats_fixed.c
+++ b/src/test/modules/injection_points/injection_stats_fixed.c
@@ -50,6 +50,7 @@ static void injection_stats_fixed_snapshot_cb(void);
static const PgStat_KindInfo injection_stats_fixed = {
.name = "injection_points_fixed",
.fixed_amount = true,
+ .write_to_file = true,
.shared_size = sizeof(PgStat_StatInjFixedEntry),
.shared_data_off = offsetof(PgStatShared_InjectionPointFixed, stats),