/** {@inheritDoc} */ @Override public void removeAll() throws IgniteCheckedException { assert ctx.isLocal(); // We do batch and recreate cursor because removing using a single cursor // will cause it to reinitialize on each merged page. List<K> keys = new ArrayList<>(Math.min(REMOVE_ALL_KEYS_BATCH, size())); do { Iterator<CacheDataRow> it = ctx.offheap().cacheIterator(ctx.cacheId(), true, true, null, null, null); while (it.hasNext() && keys.size() < REMOVE_ALL_KEYS_BATCH) keys.add((K)it.next().key()); removeAll(keys); keys.clear(); } while (!isEmpty()); }
@Override public boolean apply() { for (Ignite g : G.allGrids()) { GridCacheAdapter<Object, Object> cache = ((IgniteEx)g).context().cache().internalCache(name); if (cache == null) return true; if (!cache.isEmpty()) return false; } return true; } }, getTestTimeout());
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { try { // Cleanup. igfsPrimary.clear(); while (!dataCache.isEmpty()) U.sleep(100); checkEvictionPolicy(0, 0); } finally { stopAllGrids(false); } }
@Override public void apply() { for (int i = 0; i < NODE_CNT; i++) { IgniteEx g = grid(i); GridCacheAdapter<Object, Object> cache = ((IgniteKernal)g).internalCache( g.igfsx("igfs").configuration().getDataCacheConfiguration().getName()); assertTrue("Data cache is not empty [keys=" + cache.keySet() + ", node=" + g.localNode().id() + ']', cache.isEmpty()); } } });
int size = cache.localSize(new CachePeekMode[]{CachePeekMode.PRIMARY}); boolean isEmpty = cache.isEmpty();
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void removeAll() throws IgniteCheckedException { assert ctx.isLocal(); // We do batch and recreate cursor because removing using a single cursor // will cause it to reinitialize on each merged page. List<K> keys = new ArrayList<>(Math.min(REMOVE_ALL_KEYS_BATCH, size())); do { for (Iterator<CacheDataRow> it = ctx.offheap().cacheIterator(ctx.cacheId(), true, true, null, null); it.hasNext() && keys.size() < REMOVE_ALL_KEYS_BATCH; ) keys.add((K)it.next().key()); removeAll(keys); keys.clear(); } while (!isEmpty()); }