Skip to content

Commit 5b7fae5

Browse files
author
Alexander Korotkov
committed
Yet another fix for GUCs.
1 parent ef83fa1 commit 5b7fae5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

contrib/pg_stat_wait/pg_stat_wait.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,43 +154,52 @@ set_history_gucs()
154154
mixedStruct *var = (mixedStruct *) guc_vars[i];
155155
const char *name = var->generic.name;
156156

157+
if (var->generic.flags & GUC_CUSTOM_PLACEHOLDER)
158+
continue;
159+
157160
if (!strcmp(name, "pg_stat_wait.history_size"))
158161
{
159162
history_size_found = true;
160163
var->integer.variable = &collector_hdr->historySize;
164+
collector_hdr->historySize = 5000;
161165
}
162166
else if (!strcmp(name, "pg_stat_wait.history_period"))
163167
{
164168
history_period_found = true;
165169
var->integer.variable = &collector_hdr->historyPeriod;
170+
collector_hdr->historyPeriod = 10;
166171
}
167172
else if (!strcmp(name, "pg_stat_wait.history_skip_latch"))
168173
{
169174
history_skip_latch_found = true;
170175
var->_bool.variable = &collector_hdr->historySkipLatch;
176+
collector_hdr->historySkipLatch = false;
171177
}
172178
}
173179

174180
if (!history_size_found)
175181
DefineCustomIntVariable("pg_stat_wait.history_size",
176182
"Sets size of waits history.", NULL,
177183
&collector_hdr->historySize, 5000, 100, INT_MAX,
178-
PGC_SUSET, GUC_CUSTOM_PLACEHOLDER,
184+
PGC_SUSET, 0,
179185
shmem_int_guc_check_hook, NULL, NULL);
180186

181187
if (!history_period_found)
182188
DefineCustomIntVariable("pg_stat_wait.history_period",
183189
"Sets period of waits history sampling.", NULL,
184190
&collector_hdr->historyPeriod, 10, 1, INT_MAX,
185-
PGC_SUSET, GUC_CUSTOM_PLACEHOLDER,
191+
PGC_SUSET, 0,
186192
shmem_int_guc_check_hook, NULL, NULL);
187193

188194
if (!history_skip_latch_found)
189195
DefineCustomBoolVariable("pg_stat_wait.history_skip_latch",
190196
"Skip latch events in waits history", NULL,
191197
&collector_hdr->historySkipLatch, false,
192-
PGC_SUSET, GUC_CUSTOM_PLACEHOLDER,
198+
PGC_SUSET, 0,
193199
shmem_bool_guc_check_hook, NULL, NULL);
200+
201+
if (history_size_found || history_period_found || history_skip_latch_found)
202+
ProcessConfigFile(PGC_SIGHUP);
194203
}
195204

196205
/*

0 commit comments

Comments
 (0)