Issue - (#53): Fix a bug where the query response time histogram does show proper counters.

PG-143 : Total sum of all the response histograms should be equal to total_calls.
This commit is contained in:
Ibrar Ahmed
2020-10-12 21:49:35 +00:00
parent 166ee0a25b
commit f48a64cc0a
3 changed files with 7 additions and 64 deletions

View File

@@ -20,7 +20,6 @@ static HTAB *pgss_object_hash;
static HTAB *pgss_buckethash = NULL;
static HTAB *pgss_waiteventshash = NULL;
static pgssBucketEntry **pgssBucketEntries = NULL;
static pgssWaitEventEntry **pgssWaitEventEntries = NULL;
static HTAB* hash_init(const char *hash_name, int key_size, int entry_size, int hash_size);
@@ -81,8 +80,6 @@ pgss_shmem_startup(void)
}
pgss_hash = hash_init("pg_stat_monitor: Queries hashtable", sizeof(pgssHashKey), sizeof(pgssEntry),PGSM_MAX);
pgss_buckethash = hash_init("pg_stat_monitor: Bucket hashtable", sizeof(pgssBucketHashKey), sizeof(pgssBucketEntry), PGSM_MAX_BUCKETS);
pgss_waiteventshash = hash_init("pg_stat_monitor: Wait Event hashtable", sizeof(pgssWaitEventKey), sizeof(pgssWaitEventEntry), 100);
pgss_object_hash = hash_init("pg_stat_monitor: Object hashtable", sizeof(pgssObjectHashKey), sizeof(pgssObjectEntry), PGSM_OBJECT_CACHE);
@@ -105,24 +102,6 @@ pgss_shmem_startup(void)
}
}
pgssBucketEntries = malloc(sizeof (pgssBucketEntry) * PGSM_MAX_BUCKETS);
for (i = 0; i < PGSM_MAX_BUCKETS; i++)
{
pgssBucketHashKey key;
pgssBucketEntry *entry = NULL;
bool found = false;
key.bucket_id = i;
/* Find or create an entry with desired hash code */
entry = (pgssBucketEntry *) hash_search(pgss_buckethash, &key, HASH_ENTER, &found);
if (!found)
{
memset(&entry->counters, 0, sizeof(pgssBucketCounters));
SpinLockInit(&entry->mutex);
pgssBucketEntries[i] = entry;
}
}
LWLockRelease(AddinShmemInitLock);
/*
@@ -151,24 +130,12 @@ HTAB* pgsm_get_hash(void)
return pgss_hash;
}
pgssBucketEntry** pgsm_get_bucket_entries(void)
{
Assert(pgssBucketEntries);
return pgssBucketEntries;
}
HTAB* pgsm_get_wait_event_hash(void)
{
Assert(pgss_waiteventshash);
return pgss_waiteventshash;
}
pgssBucketEntry** pgsm_get_bucket(void)
{
Assert(pgssBucketEntries);
return pgssBucketEntries;
}
pgssWaitEventEntry** pgsm_get_wait_event_entry(void)
{
Assert(pgssWaitEventEntries);
@@ -291,7 +258,6 @@ hash_entry_reset()
}
pgss->current_wbucket = 0;
free(pgssWaitEventEntries);
free(pgssBucketEntries);
LWLockRelease(pgss->lock);
}