Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes handling of cache statistics #15937

Merged
merged 2 commits into from Nov 6, 2019

Conversation

vbekiaris
Copy link
Collaborator

@vbekiaris vbekiaris commented Nov 5, 2019

Previously used Config.findCacheConfig can only lookup
cache configs added statically or dynamically via Config.addCacheConfig
but misses configuration of dynamically created caches via
CacheManager.createCache, so it is wrong to use it to filter stats.
Instead, we retrieve cache configs from CacheService.getCacheConfigs
which includes configuration of all caches known at runtime.

Fixes missing cache statistics from MC

Previously used Config.findCacheConfig can only lookup
cache configs added statically or dynamically via Config.addCacheConfig
but misses configuration of dynamically created caches via
CacheManager.createCache, so it is wrong to use it to filter stats.
Instead, we retrieve cache configs from CacheService.getCacheConfigs
which includes configuration of all known caches at runtime.
Map<String, LocalCacheStats> stats = cacheService.getStats();
for (String cacheNameWithPrefix : stats.keySet()) {
assertContains(cacheNameWithPrefix, CACHE_WITH_STATS_PREFIX);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need an assertEquals(100,stats.size()) too? It's verified by the next case though that the stat disabled caches actually don't have stats. Do we need then the 50 stats disabled caches in this test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a commit removing the redundant test.

@emre-aydin emre-aydin merged commit 7dfc524 into hazelcast:master Nov 6, 2019
@vbekiaris vbekiaris deleted the fixes/4.0/cache-stats-mc branch November 6, 2019 14:21
@mmedenjak mmedenjak added the Source: Internal PR or issue was opened by an employee label Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants