use of org.apache.ignite.internal.processors.cache.GridCacheProcessor in project ignite by apache.
the class AffinityHistoryCleanupTest method checkHistory.
/**
* @param ignite Node.
* @param expHist Expected history.
* @param expSize Expected 'non client events' history size.
* @throws Exception If failed.
*/
private void checkHistory(Ignite ignite, List<AffinityTopologyVersion> expHist, int expSize) throws Exception {
awaitPartitionMapExchange();
GridCacheProcessor proc = ((IgniteKernal) ignite).context().cache();
int cnt = 0;
for (GridCacheContext cctx : proc.context().cacheContexts()) {
GridAffinityAssignmentCache aff = GridTestUtils.getFieldValue(cctx.affinity(), "aff");
AtomicInteger histSize = GridTestUtils.getFieldValue(aff, "histSize");
assertEquals(expSize, histSize.get());
Map<AffinityTopologyVersion, Object> cache = GridTestUtils.getFieldValue(aff, "affCache");
assertEquals("Unexpected history: " + cache.keySet(), expHist.size(), cache.size());
for (AffinityTopologyVersion topVer : expHist) assertTrue("No history [ver=" + topVer + ", hist=" + cache.keySet() + ']', cache.containsKey(topVer));
cnt++;
}
assert cnt > 4;
}
Aggregations