/** */ private static Optional<IgniteCacheOffheapManager.CacheDataStore> dataStore( GridCacheContext<?, ?> cctx, Object key) { int p = cctx.affinity().partition(key); return StreamSupport.stream(cctx.offheap().cacheDataStores().spliterator(), false) .filter(ds -> ds.partId() == p) .findFirst(); }
/** */ private static Optional<IgniteCacheOffheapManager.CacheDataStore> dataStore( GridCacheContext<?, ?> cctx, Object key) { int p = cctx.affinity().partition(key); IgniteCacheOffheapManager offheap = cctx.offheap(); return StreamSupport.stream(offheap.cacheDataStores().spliterator(), false) .filter(ds -> ds.partId() == p) .findFirst(); } }
/** */ private static Optional<IgniteCacheOffheapManager.CacheDataStore> dataStore( GridCacheContext<?, ?> cctx, Object key) { int p = cctx.affinity().partition(key); return StreamSupport.stream(cctx.offheap().cacheDataStores().spliterator(), false) .filter(ds -> ds.partId() == p) .findFirst(); } }
for (IgniteCacheOffheapManager.CacheDataStore ds : cacheCtx.offheap().cacheDataStores()) ds.setRowCacheCleaner(rowCache);
for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) { if (!store.isEmpty()) { empty = false;
for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) { int part = store.partId();
for (IgniteCacheOffheapManager.CacheDataStore store : icache.context().offheap().cacheDataStores()) { GridCursor<? extends CacheDataRow> cur = store.cursor();
/** * Check versions presence in index tree. * * @param srv Node. * @param afterRebuild Whether index rebuild has occurred. * @throws IgniteCheckedException if failed. */ @SuppressWarnings({"ConstantConditions", "unchecked"}) protected void checkDataState(IgniteEx srv, boolean afterRebuild) throws IgniteCheckedException { IgniteInternalCache icache = srv.cachex(CACHE_NAME); IgniteCache cache = srv.cache(CACHE_NAME); assertNotNull(icache); for (IgniteCacheOffheapManager.CacheDataStore store : icache.context().offheap().cacheDataStores()) { GridCursor<? extends CacheDataRow> cur = store.cursor(); while (cur.next()) { CacheDataRow row = cur.get(); int key = row.key().value(icache.context().cacheObjectContext(), false); if (!afterRebuild || key <= AMOUNT / 2) assertEquals(key, cache.get(key)); else assertEquals(-1, cache.get(key)); } } }
/** * Callback invoked on cache registration within indexing. * * @param cctx Cache context. */ public void onCacheRegistered(GridCacheContext cctx) { if (!cctx.config().isSqlOnheapCacheEnabled()) return; synchronized (mux) { int grpId = cctx.groupId(); if (caches != null) { H2RowCache cache = caches.get(grpId); if (cache != null) { cache.onCacheRegistered(); return; } } HashMap<Integer, H2RowCache> caches0 = copy(); H2RowCache rowCache = new H2RowCache(cctx.group(), cctx.config().getSqlOnheapCacheMaxSize()); caches0.put(grpId, rowCache); caches = caches0; // Inject row cache cleaner into store on cache creation. // Used in case the cache with enabled SqlOnheapCache is created in exists cache group // and SqlOnheapCache is disbaled for the caches have been created before. for (IgniteCacheOffheapManager.CacheDataStore ds : cctx.offheap().cacheDataStores()) ds.setRowCacheCleaner(rowCache); } }
/** {@inheritDoc} */ @Override public Cursor find(Session ses, final SearchRow lower, final SearchRow upper) { IndexingQueryCacheFilter filter = null; MvccSnapshot mvccSnapshot = null; GridH2QueryContext qctx = GridH2QueryContext.get(); if (qctx != null) { IndexingQueryFilter f = qctx.filter(); filter = f != null ? f.forCache(getTable().cacheName()) : null; mvccSnapshot = qctx.mvccSnapshot(); } assert !cctx.mvccEnabled() || mvccSnapshot != null; KeyCacheObject lowerObj = lower != null ? cctx.toCacheKeyObject(lower.getValue(0).getObject()) : null; KeyCacheObject upperObj = upper != null ? cctx.toCacheKeyObject(upper.getValue(0).getObject()) : null; try { Collection<GridCursor<? extends CacheDataRow>> cursors = new ArrayList<>(); for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) if (filter == null || filter.applyPartition(store.partId())) cursors.add(store.cursor(cctx.cacheId(), lowerObj, upperObj, null, mvccSnapshot)); return new H2Cursor(cursors.iterator()); } catch (IgniteCheckedException e) { throw DbException.convert(e); } }