/** */ 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); 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(); } }
long partMetaId = pageMem.partitionMetaPageId(grpId, store.partId()); store.partId(), newSizes); pageCnt = this.ctx.pageStore().pages(grpId, store.partId()); io, grpId, store.partId(), this.ctx.pageStore().pages(grpId, store.partId()), store.fullSize() )) log.info("Will not include SQL indexes to snapshot because there is " + "a partition not in " + OWNING + " state [grp=" + grp.cacheOrGroupName() + ", partId=" + store.partId() + ", state=" + state + ']');
/** {@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); } }
/** {@inheritDoc} */ @Override public final void destroyCacheDataStore(CacheDataStore store) throws IgniteCheckedException { int p = store.partId(); partStoreLock.lock(p); try { boolean removed = partDataStores.remove(p, store); assert removed; destroyCacheDataStore0(store); } catch (IgniteCheckedException e) { throw new IgniteException(e); } finally { partStoreLock.unlock(p); } }
/** {@inheritDoc} */ @Override protected void destroyCacheDataStore0(CacheDataStore store) throws IgniteCheckedException { assert ctx.database() instanceof GridCacheDatabaseSharedManager : "Destroying cache data store when persistence is not enabled: " + ctx.database(); int partId = store.partId(); ctx.database().checkpointReadLock(); try { saveStoreMetadata(store, null, true, false); } finally { ctx.database().checkpointReadUnlock(); } ((GridCacheDatabaseSharedManager)ctx.database()).schedulePartitionDestroy(grp.groupId(), partId); }
/** * Check that we need to snapshot this partition and add it to map. * * @param store Store. * @param ctx Snapshot context. */ private void tryAddEmptyPartitionToSnapshot(CacheDataStore store, Context ctx) { if (getPartition(store).state() == OWNING) { ctx.partitionStatMap().put( new GroupPartitionId(grp.groupId(), store.partId()), new PagesAllocationRange(0, 0)); } }
/** * @param store Store. * * @return corresponding to store local partition */ private GridDhtLocalPartition getPartition(CacheDataStore store) { return grp.topology().localPartition(store.partId(), AffinityTopologyVersion.NONE, false, true); }
long partMetaId = pageMem.partitionMetaPageId(grpId, store.partId()); store.partId(), newSizes); pageCnt = this.ctx.pageStore().pages(grpId, store.partId()); io, grpId, store.partId(), this.ctx.pageStore().pages(grpId, store.partId()), store.fullSize() )) log.info("Will not include SQL indexes to snapshot because there is " + "a partition not in " + OWNING + " state [grp=" + grp.cacheOrGroupName() + ", partId=" + store.partId() + ", state=" + state + ']');
int part = store.partId();
/** {@inheritDoc} */ @Override public final void destroyCacheDataStore(CacheDataStore store) throws IgniteCheckedException { int p = store.partId(); partStoreLock.lock(p); try { boolean removed = partDataStores.remove(p, store); assert removed; destroyCacheDataStore0(store); } catch (IgniteCheckedException e) { throw new IgniteException(e); } finally { partStoreLock.unlock(p); } }
/** {@inheritDoc} */ @Override protected void destroyCacheDataStore0(CacheDataStore store) throws IgniteCheckedException { assert ctx.database() instanceof GridCacheDatabaseSharedManager : "Destroying cache data store when persistence is not enabled: " + ctx.database(); int partId = store.partId(); ctx.database().checkpointReadLock(); try { saveStoreMetadata(store, null, true, false); } finally { ctx.database().checkpointReadUnlock(); } ((GridCacheDatabaseSharedManager)ctx.database()).schedulePartitionDestroy(grp.groupId(), partId); }
/** * Check that we need to snapshot this partition and add it to map. * * @param store Store. * @param ctx Snapshot context. */ private void tryAddEmptyPartitionToSnapshot(CacheDataStore store, Context ctx) { if (getPartition(store).state() == OWNING) { ctx.partitionStatMap().put( new GroupPartitionId(grp.groupId(), store.partId()), new PagesAllocationRange(0, 0)); } }
/** * @param store Store. * * @return corresponding to store local partition */ private GridDhtLocalPartition getPartition(CacheDataStore store) { return grp.topology().localPartition(store.partId(), AffinityTopologyVersion.NONE, false, true); }