/** {@inheritDoc} */ @Test @Override public void testLocalClearKeys() throws Exception { IgniteCache<String, Integer> nearCache = jcache(); IgniteCache<String, Integer> primary = fullCache(); Collection<String> keys = primaryKeysForCache(primary, 3); int i = 0; for (String key : keys) nearCache.put(key, i++); String lastKey = F.last(keys); Set<String> keysToRmv = new HashSet<>(keys); keysToRmv.remove(lastKey); assert keysToRmv.size() > 1; nearCache.localClearAll(keysToRmv); for (String key : keys) { boolean found = nearCache.localPeek(key, CachePeekMode.ONHEAP) != null; if (keysToRmv.contains(key)) assertFalse("Found removed key " + key, found); else assertTrue("Not found key " + key, found); } }
/** {@inheritDoc} */ @Test @Override public void testLocalClearKeys() throws Exception { IgniteCache<String, Integer> nearCache = jcache(); IgniteCache<String, Integer> primary = fullCache(); Collection<String> keys = primaryKeysForCache(primary, 3); int i = 0; for (String key : keys) nearCache.put(key, i++); String lastKey = F.last(keys); Set<String> keysToRmv = new HashSet<>(keys); keysToRmv.remove(lastKey); assert keysToRmv.size() > 1; nearCache.localClearAll(keysToRmv); for (String key : keys) { if (keysToRmv.contains(key)) { assertNull(nearCache.localPeek(key)); assertNotNull(primary.localPeek(key)); } } }
/** * @throws Exception If failed. */ @Test public void testAffinity() throws Exception { long fileSize = 32L * 1024 * 1024; IgfsPath filePath = new IgfsPath("/file"); try (OutputStream os = igfs.create(filePath, true)) { for(int i = 0; i < fileSize / chunk.length; ++i) os.write(chunk); } long len = igfs.info(filePath).length(); int start = 0; // Check default maxLen (maxLen = 0) for (int i = 0; i < igfs.context().data().groupBlockSize() / 1024; i++) { Collection<IgfsBlockLocation> blocks = igfs.affinity(filePath, start, len); assertEquals(F.first(blocks).start(), start); assertEquals(start + len, F.last(blocks).start() + F.last(blocks).length()); len -= 1024 * 2; start += 1024; } }
FieldsQueryCursor<List<?>> cur = F.last(qryCursors);
/** * @throws Exception If failed. */ @SuppressWarnings("ConstantConditions") private void checkPartitions() throws Exception { AffinityFunction aff = cacheConfiguration(grid(0).configuration(), DEFAULT_CACHE_NAME).getAffinity(); int partCnt = aff.partitions(); IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME); for (int i = 0; i < partCnt; i++) { Collection<ClusterNode> nodes = affinity(cache).mapKeyToPrimaryAndBackups(i); assertEquals(2, nodes.size()); ClusterNode primary = F.first(nodes); ClusterNode backup = F.last(nodes); assertFalse(F.eq(primary.attribute(SPLIT_ATTRIBUTE_NAME), backup.attribute(SPLIT_ATTRIBUTE_NAME))); } }
U.grids2names(ignites) + ']'); Ignite last = F.last(ignites);
first.length() >= grpSize - pos % grpSize); IgfsBlockLocation last = F.last(aff);
ClusterNode backup = F.last(nodes);
VisorQueryCursor<List<?>> cur = new VisorQueryCursor<>(F.last(qryCursors));