Search in sources :

Example 6 with GridCacheProcessor

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;
}
Also used : GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) GridAffinityAssignmentCache(org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache) GridCacheProcessor(org.apache.ignite.internal.processors.cache.GridCacheProcessor)

Aggregations

GridCacheProcessor (org.apache.ignite.internal.processors.cache.GridCacheProcessor)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 ClusterMetrics (org.apache.ignite.cluster.ClusterMetrics)2 ClusterNode (org.apache.ignite.cluster.ClusterNode)2 GridCacheAdapter (org.apache.ignite.internal.processors.cache.GridCacheAdapter)2 RuntimeMXBean (java.lang.management.RuntimeMXBean)1 InetAddress (java.net.InetAddress)1 DecimalFormat (java.text.DecimalFormat)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 UUID (java.util.UUID)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IgniteClientDisconnectedException (org.apache.ignite.IgniteClientDisconnectedException)1 IgniteException (org.apache.ignite.IgniteException)1 CacheMode (org.apache.ignite.cache.CacheMode)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 GridMessageListenHandler (org.apache.ignite.internal.GridMessageListenHandler)1