mirror of https://github.com/citusdata/citus.git
Simplfy CreateTenantStats()
parent
9c4c40217b
commit
f53b4cb1f8
|
@ -706,12 +706,11 @@ CreateTenantStats(MultiTenantMonitor *monitor, TimestampTz queryTime)
|
||||||
*/
|
*/
|
||||||
EvictTenantsIfNecessary(queryTime);
|
EvictTenantsIfNecessary(queryTime);
|
||||||
|
|
||||||
bool found;
|
|
||||||
TenantStatsHashKey *key = CreateTenantStatsHashKey(AttributeToTenant,
|
TenantStatsHashKey *key = CreateTenantStatsHashKey(AttributeToTenant,
|
||||||
AttributeToColocationGroupId);
|
AttributeToColocationGroupId);
|
||||||
|
|
||||||
TenantStats *stats = (TenantStats *) hash_search(monitor->tenants, key,
|
TenantStats *stats = (TenantStats *) hash_search(monitor->tenants, key,
|
||||||
HASH_ENTER, &found);
|
HASH_ENTER, NULL);
|
||||||
|
|
||||||
pfree(key);
|
pfree(key);
|
||||||
|
|
||||||
|
@ -724,11 +723,7 @@ CreateTenantStats(MultiTenantMonitor *monitor, TimestampTz queryTime)
|
||||||
stats->score = 0;
|
stats->score = 0;
|
||||||
stats->lastScoreReduction = 0;
|
stats->lastScoreReduction = 0;
|
||||||
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
/* initialize the stats lock for the new entry in the hash table */
|
|
||||||
SpinLockInit(&stats->lock);
|
SpinLockInit(&stats->lock);
|
||||||
}
|
|
||||||
|
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue