Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb757abe

Browse files
committed
injection_points: Tweak variable-numbered stats to work with pending data
As coded, the module was not using pending entries to store its datalocally before doing a flush to the central dshash with a timedpgstat_report_stat() call. Hence, the flush callback was defined, butfinished by being not used. As a template, this is more efficient thanthe original logic of updating directly the shared memory entries asthis reduces the interactions that need to be done with the pgstatshash table in shared memory.injection_stats_flush_cb() was also missing a pgstat_unlock_entry(), soadd one, while on it.Reviewed-by: Bertrand DrouvotDiscussion:https://postgr.es/m/Z3JbLhKFFm6kKfT8@ip-10-97-1-34.eu-west-3.compute.internal
1 parentc9b3d49 commitb757abe

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎src/test/modules/injection_points/injection_stats.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ injection_stats_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
8080
return false;
8181

8282
shfuncent->stats.numcalls+=localent->numcalls;
83+
84+
pgstat_unlock_entry(entry_ref);
85+
8386
return true;
8487
}
8588

@@ -127,13 +130,13 @@ pgstat_create_inj(const char *name)
127130
if (!inj_stats_loaded|| !inj_stats_enabled)
128131
return;
129132

130-
entry_ref=pgstat_get_entry_ref_locked(PGSTAT_KIND_INJECTION,InvalidOid,
131-
PGSTAT_INJ_IDX(name), false);
133+
entry_ref=pgstat_prep_pending_entry(PGSTAT_KIND_INJECTION,InvalidOid,
134+
PGSTAT_INJ_IDX(name),NULL);
135+
132136
shstatent= (PgStatShared_InjectionPoint*)entry_ref->shared_stats;
133137

134138
/* initialize shared memory data */
135139
memset(&shstatent->stats,0,sizeof(shstatent->stats));
136-
pgstat_unlock_entry(entry_ref);
137140
}
138141

139142
/*
@@ -168,16 +171,14 @@ pgstat_report_inj(const char *name)
168171
if (!inj_stats_loaded|| !inj_stats_enabled)
169172
return;
170173

171-
entry_ref=pgstat_get_entry_ref_locked(PGSTAT_KIND_INJECTION,InvalidOid,
172-
PGSTAT_INJ_IDX(name),false);
174+
entry_ref=pgstat_prep_pending_entry(PGSTAT_KIND_INJECTION,InvalidOid,
175+
PGSTAT_INJ_IDX(name),NULL);
173176

174177
shstatent= (PgStatShared_InjectionPoint*)entry_ref->shared_stats;
175178
statent=&shstatent->stats;
176179

177180
/* Update the injection point statistics */
178181
statent->numcalls++;
179-
180-
pgstat_unlock_entry(entry_ref);
181182
}
182183

183184
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp