mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
injection_points: Add stats for point caching and loading
This adds two counters to the fixed-numbered stats of injection points to track the number of times injection points have been cached and loaded from the cache, as of the additions coming froma0a5869a85and4b211003ec. These should have been part off68cd847fa, but I have lacked time and energy back then, and it did not prevent the code to be a useful template. While on it, this commit simplifies the description of a few tests while adding coverage for the new stats data. Author: Yogesh Sharma Discussion: https://postgr.es/m/3a6977f7-54ab-43ce-8806-11d5e15526a2@catprosystems.com
This commit is contained in:
@@ -297,7 +297,7 @@ injection_points_attach(PG_FUNCTION_ARGS)
|
||||
condition.pid = MyProcPid;
|
||||
}
|
||||
|
||||
pgstat_report_inj_fixed(1, 0, 0);
|
||||
pgstat_report_inj_fixed(1, 0, 0, 0, 0);
|
||||
InjectionPointAttach(name, "injection_points", function, &condition,
|
||||
sizeof(InjectionPointCondition));
|
||||
|
||||
@@ -329,6 +329,7 @@ injection_points_load(PG_FUNCTION_ARGS)
|
||||
if (inj_state == NULL)
|
||||
injection_init_shmem();
|
||||
|
||||
pgstat_report_inj_fixed(0, 0, 0, 0, 1);
|
||||
INJECTION_POINT_LOAD(name);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -343,7 +344,7 @@ injection_points_run(PG_FUNCTION_ARGS)
|
||||
{
|
||||
char *name = text_to_cstring(PG_GETARG_TEXT_PP(0));
|
||||
|
||||
pgstat_report_inj_fixed(0, 0, 1);
|
||||
pgstat_report_inj_fixed(0, 0, 1, 0, 0);
|
||||
INJECTION_POINT(name);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -358,6 +359,7 @@ injection_points_cached(PG_FUNCTION_ARGS)
|
||||
{
|
||||
char *name = text_to_cstring(PG_GETARG_TEXT_PP(0));
|
||||
|
||||
pgstat_report_inj_fixed(0, 0, 0, 1, 0);
|
||||
INJECTION_POINT_CACHED(name);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -434,7 +436,7 @@ injection_points_detach(PG_FUNCTION_ARGS)
|
||||
{
|
||||
char *name = text_to_cstring(PG_GETARG_TEXT_PP(0));
|
||||
|
||||
pgstat_report_inj_fixed(0, 1, 0);
|
||||
pgstat_report_inj_fixed(0, 1, 0, 0, 0);
|
||||
if (!InjectionPointDetach(name))
|
||||
elog(ERROR, "could not detach injection point \"%s\"", name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user