@Override public Object call() throws Exception { return affinity.allPartitions(n); } }, IgniteException.class, EXPECTED_MSG);
/** {@inheritDoc} */ @Override public int[] allPartitions(ClusterNode n) { CacheOperationContext old = gate.enter(null); try { return delegate.allPartitions(n); } finally { gate.leave(old); } }
@Override public boolean apply() { // Partition count which must be transferred to 2'nd node. int parts = ignite2.affinity(DEFAULT_CACHE_NAME).allPartitions(ignite2.cluster().localNode()).length; return evtCnt.get() >= parts; } }, 5000);
@Override public boolean apply() { // Partition count which must be transferred to 2'nd node. int parts = ignite2.affinity(DEFAULT_CACHE_NAME).allPartitions(ignite2.cluster().localNode()).length; return evtCnt.get() >= parts; } }, 5000);
/** {@inheritDoc} */ @Override public int[] call() throws Exception { if (primary && backup) return affinity().allPartitions(n); else if (primary) return affinity().primaryPartitions(n); else if (backup) return affinity().backupPartitions(n); else throw new IllegalStateException("primary or backup or both flags should be switched on"); } }
/** * Check allPartitions, backupPartitions and primaryPartitions methods. * * @param testAff Affinity1. * @param aff Affinity2. */ private void checkPartitions(Affinity testAff, Affinity aff) { for (ClusterNode n : nodes()) { checkEqualIntArray(testAff.allPartitions(n), aff.allPartitions(n)); checkEqualIntArray(testAff.backupPartitions(n), aff.backupPartitions(n)); checkEqualIntArray(testAff.primaryPartitions(n), aff.primaryPartitions(n)); } }
int[] parts = node != null ? aff.allPartitions(node) : U.EMPTY_INTS;
/** * JUnit. * * @throws Exception If failed. */ @Test public void testAllPartitions() throws Exception { // Pick 2 nodes and create a projection over them. ClusterNode n0 = grid(0).localNode(); int[] parts = grid(0).affinity(DEFAULT_CACHE_NAME).allPartitions(n0); assert !F.isEmpty(parts); AffinityFunctionContext ctx = new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null, new AffinityTopologyVersion(1), 1); List<List<ClusterNode>> assignment = affinity().assignPartitions(ctx); for (int p : parts) { Collection<ClusterNode> owners = nodes(assignment, p); assert !F.isEmpty(owners); assert owners.contains(n0); } }
/** * @throws Exception If failed. */ @Test public void testNonPersistentCachesIgnoreBaselineTopology() throws Exception { Ignite ig = startGrids(4); ig.cluster().active(true); IgniteCache persistentCache = ig.createCache(CACHE_NAME); IgniteCache inMemoryCache = ig.createCache( new CacheConfiguration<>().setName(CACHE_NAME + 2).setDataRegionName("memory")); Ignite newNode = startGrid(4); awaitPartitionMapExchange(); assertEquals(0, ig.affinity(persistentCache.getName()).allPartitions(newNode.cluster().localNode()).length); assertTrue(ig.affinity(inMemoryCache.getName()).allPartitions(newNode.cluster().localNode()).length > 0); }
assertEquals(0, nearIgnite.affinity(persistentCache.getName()).allPartitions(nonBltNode).length); assertTrue(nearIgnite.affinity(inMemoryCache.getName()).allPartitions(nonBltNode).length > 0);
int[] parts = aff.allPartitions(grid(0).localNode());
/** {@inheritDoc} */ @Override public int[] allPartitions(ClusterNode n) { CacheOperationContext old = gate.enter(null); try { return delegate.allPartitions(n); } finally { gate.leave(old); } }
int[] parts = node != null ? aff.allPartitions(node) : U.EMPTY_INTS;