Permalink
Browse files

Fix of the query_histogram_enabled() - when the histogram is dynamic,…

… it's always enabled.
  • Loading branch information...
1 parent 81c5934 commit 57bc4ca2a3c2c6a5ef5cb729ae5945b8e4bbea59 @tvondra committed Nov 1, 2011
Showing with 5 additions and 8 deletions.
  1. +5 −8 queryhist.c
View
13 queryhist.c
@@ -215,7 +215,7 @@ explain_ExecutorStart(QueryDesc *queryDesc, int eflags)
else
standard_ExecutorStart(queryDesc, eflags);
- /* FIXME This enables */
+ /* Enable the histogram whenever the histogram is dynamic or (bins>0). */
if (query_histogram_enabled())
{
/*
@@ -562,22 +562,19 @@ size_t get_histogram_size() {
return MAXALIGN(sizeof(histogram_info_t));
}
+/* The histogram is enabled when the number of bins is positive or when
+ * the histogram is dynamic (in that case we can't rely on the bins number
+ * as it may change next second). */
static
bool query_histogram_enabled() {
- bool enabled;
-
/* when the histogram is static, check the number of bins (does not
* make much sense, I guess - it's probably better to remove the
* library from the config altogether than just setting 0). */
if (! default_histogram_dynamic) {
return (default_histogram_bins > 0);
}
- LWLockAcquire(shared_histogram_info->lock, LW_SHARED);
- enabled = (shared_histogram_info->bins > 0);
- LWLockRelease(shared_histogram_info->lock);
-
- return enabled;
+ return true;
}

0 comments on commit 57bc4ca

Please sign in to comment.