/** * @return Cache group ID. */ public int groupId() { return grp.groupId(); }
/** {@inheritDoc} */ @Override public int groupId() { return grp.groupId(); }
/** {@inheritDoc} */ @Override public int getGroupId() { return ctx.groupId(); }
/** * Await evict finish. */ private void awaitFinishAll(){ partsEvictFutures.forEach(this::awaitFinish); evictionGroupsMap.remove(grp.groupId()); }
@Override public T2<Integer, IndexIntegrityCheckIssue> call() throws Exception { IndexIntegrityCheckIssue issue = integrityCheckIndexPartition(grpCtx, cpFlag); return new T2<>(grpCtx.groupId(), issue); } });
/** * @param grpCtx Stopped cache group context. */ public void stopCacheGroupOnReconnect(CacheGroupContext grpCtx) { cachesRegistry.unregisterGroup(grpCtx.groupId()); }
/** {@inheritDoc} */ @Override public void shutdownForCacheGroup(CacheGroupContext grp, boolean destroy) throws IgniteCheckedException { grpsWithoutIdx.remove(grp.groupId()); CacheStoreHolder old = idxCacheStores.remove(grp.groupId()); if (old != null) { IgniteCheckedException ex = shutdown(old, /*clean files if destroy*/destroy, null); if (destroy) removeCacheGroupConfigurationData(grp); if (ex != null) throw ex; } }
/** * @param grp Cache group. */ void onCacheGroupCreated(CacheGroupContext grp) { if (!grpHolders.containsKey(grp.groupId())) { cctx.io().addCacheGroupHandler(grp.groupId(), GridDhtAffinityAssignmentResponse.class, (IgniteBiInClosure<UUID, GridDhtAffinityAssignmentResponse>)this::processAffinityAssignmentResponse); } }
/** * @param grp Cache group. * @param topNodes Topology nodes. */ public void validate(CacheGroupContext grp, Collection<ClusterNode> topNodes) { grpValidRes = U.newHashMap(1); grpValidRes.put(grp.groupId(), validateCacheGroup(grp,topNodes)); }
/** * Collects non local cache groups. * * @return Collection of non local cache groups. */ private List<CacheGroupContext> nonLocalCacheGroups() { return cctx.cache().cacheGroups().stream() .filter(grp -> !grp.isLocal() && !cacheGroupStopping(grp.groupId())) .collect(Collectors.toList()); }
/** * Shows progress group of eviction. */ private void showProgress() { if (log.isInfoEnabled()) log.info("Group eviction in progress [grpName=" + grp.cacheOrGroupName()+ ", grpId=" + grp.groupId() + ", remainingPartsToEvict=" + (totalTasks.get() - taskInProgress) + ", partsEvictInProgress=" + taskInProgress + ", totalParts= " + grp.topology().localPartitions().size() + "]"); } }
/** {@inheritDoc} */ @Override protected CacheDataStore createCacheDataStore0(int p) throws IgniteCheckedException { if (ctx.database() instanceof GridCacheDatabaseSharedManager) ((GridCacheDatabaseSharedManager) ctx.database()).cancelOrWaitPartitionDestroy(grp.groupId(), p); boolean exists = ctx.pageStore() != null && ctx.pageStore().exists(grp.groupId(), p); return new GridCacheDataStore(p, exists); }
/** {@inheritDoc} */ @Override public RootPage rootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException { long pageId = allocateForTree(); return new RootPage(new FullPageId(pageId, grp.groupId()), true); }
@Override public void applyx(IgniteInternalFuture<Boolean> future) throws IgniteCheckedException { if (future.get()) ctx.walState().onGroupRebalanceFinished(grp.groupId(), assignments.topologyVersion()); } });
/** * @return Page ID. * @throws IgniteCheckedException If failed. */ private long allocateForTree() throws IgniteCheckedException { ReuseList reuseList = grp.reuseList(); long pageId; if (reuseList == null || (pageId = reuseList.takeRecycledPage()) == 0L) pageId = grp.dataRegion().pageMemory().allocatePage(grp.groupId(), INDEX_PARTITION, FLAG_IDX); return pageId; }
@Override public void shutdownForCacheGroup(CacheGroupContext grp, boolean destroy) throws IgniteCheckedException { super.shutdownForCacheGroup(grp, destroy); cleanupPages(fullPageId -> fullPageId.groupId() == grp.groupId()); }
/** * 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)); } }
/** {@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); }
/** * @param node Node. * @param cacheName Cache name. * @return Cache group ID for given cache name. */ protected static final int groupIdForCache(Ignite node, String cacheName) { for (CacheGroupContext grp : ((IgniteKernal)node).context().cache().cacheGroups()) { if (grp.hasCache(cacheName)) return grp.groupId(); } fail("Failed to find group for cache: " + cacheName); return 0; }
/** * Total count of allocated pages in page store. */ private long pageStoreAllocatedPages() { IgnitePageStoreManager pageStoreMgr = gridCtx.cache().context().pageStore(); assert pageStoreMgr != null; long totalAllocated = pageStoreMgr.pagesAllocated(MetaStorage.METASTORAGE_CACHE_ID); if (MvccUtils.mvccEnabled(gridCtx)) totalAllocated += pageStoreMgr.pagesAllocated(TxLog.TX_LOG_CACHE_ID); for (CacheGroupContext ctx : gridCtx.cache().cacheGroups()) totalAllocated += pageStoreMgr.pagesAllocated(ctx.groupId()); return totalAllocated; }