@Override public Long apply() { long freeSpace = 0L; for (CacheGroupContext grpCtx : cctx.cache().cacheGroups()) { if (!grpCtx.dataRegion().config().getName().equals(dataRegName)) continue; assert grpCtx.offheap() instanceof GridCacheOffheapManager; freeSpace += ((GridCacheOffheapManager)grpCtx.offheap()).freeSpace(); } return freeSpace; } };
/** * 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() + "]"); } }
/** * @param grp Cache group. * @param freeList Free list. */ public RowStore(CacheGroupContext grp, FreeList freeList) { assert grp != null; assert freeList != null; this.freeList = freeList; ctx = grp.shared(); coctx = grp.cacheObjectContext(); pageMem = grp.dataRegion().pageMemory(); persistenceEnabled = grp.dataRegion().config().isPersistenceEnabled(); }
/** * @param enabled Global WAL enabled flag. */ public void globalWalEnabled(boolean enabled) { if (globalWalEnabled != enabled) { log.info("Global WAL state for group=" + cacheOrGroupName() + " changed from " + globalWalEnabled + " to " + enabled); persistGlobalWalState(enabled); globalWalEnabled = enabled; } }
/** * @param enabled Local WAL enabled flag. */ public void localWalEnabled(boolean enabled) { if (localWalEnabled != enabled){ log.info("Local WAL state for group=" + cacheOrGroupName() + " changed from " + localWalEnabled + " to " + enabled); persistLocalWalState(enabled); localWalEnabled = enabled; } }
GridIterator<CacheDataRow> it = grpCtx.offheap().partitionIterator(part.id()); partHash += Arrays.hashCode(row.value().valueBytes(grpCtx.cacheObjectContext())); grpCtx.groupId() + ", partId=" + part.id() + "] changed during hash calculation [before=" + updateCntrBefore + ", after=" + updateCntrAfter + "]"); U.error(log, "Can't calculate partition hash [grpId=" + grpCtx.groupId() + ", partId=" + part.id() + "]", e); boolean isPrimary = part.primary(grpCtx.topology().readyTopologyVersion()); PartitionKey partKey = new PartitionKey(grpCtx.groupId(), part.id(), grpCtx.cacheOrGroupName());
throws IgniteCheckedException { super(name, grp.groupId(), pageMem, grp.dataRegion().config().isPersistenceEnabled() ? grp.shared().wal() : null, grp.offheap().globalRemoveId(), metaPageId, reuseList, grp.sharedGroup() ? CacheIdAwarePendingEntryInnerIO.VERSIONS : PendingEntryInnerIO.VERSIONS, grp.sharedGroup() ? CacheIdAwarePendingEntryLeafIO.VERSIONS : PendingEntryLeafIO.VERSIONS, grp.shared().kernalContext().failure()); assert !grp.dataRegion().config().isPersistenceEnabled() || grp.shared().database().checkpointLockIsHeldByThread();
GridIterator<CacheDataRow> it = grpCtx.offheap().partitionIterator(part.id()); boolean isPrimary = part.primary(grpCtx.topology().readyTopologyVersion()); int cacheId = row.cacheId() == 0 ? grpCtx.groupId() : row.cacheId(); grpCtx.singleCacheContext() : grpCtx.shared().cacheContext(row.cacheId()); grpCtx.cacheObjectContext(), row.key(), true, true); U.error(log, "Failed to process partition [grpId=" + grpCtx.groupId() + ", partId=" + part.id() + "]", e); PartitionKey partKey = new PartitionKey(grpCtx.groupId(), part.id(), grpCtx.cacheOrGroupName());
cctx.cache().cacheGroups(), cacheGroup -> { if (cacheGroup.isLocal()) return null; cacheGroup.offheap().restorePartitionStates(Collections.emptyMap()); if (cacheGroup.localStartVersion().equals(fut.initialVersion())) cacheGroup.topology().afterStateRestored(fut.initialVersion()); "[grp=" + cacheGroup.cacheOrGroupName() + "]");
return Collections.emptyMap(); GridDhtLocalPartition part = grpCtx.topology().localPartition(partKey.partitionId()); for (GridCacheContext ctx : grpCtx.caches()) cacheIdToCtx.put(ctx.cacheId(), ctx); continue; KeyCacheObject key = grpCtx.shared().kernalContext().cacheObjects().toKeyCacheObject( grpCtx.cacheObjectContext(), entryHashRecord.key().cacheObjectType(), entryHashRecord.keyBytes()); Object o = CacheObjectUtils.unwrapBinaryIfNeeded(grpCtx.cacheObjectContext(), val, true, true); entryHashRecord.valueBytes(row.value().valueBytes(grpCtx.cacheObjectContext()));
/** * @param grp Cache group. */ private void cleanup(CacheGroupContext grp) { CacheConfiguration cfg = grp.config(); for (Object obj : grp.configuredUserObjects()) cleanup(cfg, obj, false); if (!grp.systemCache() && !U.IGNITE_MBEANS_DISABLED) { try { ctx.config().getMBeanServer().unregisterMBean(U.makeMBeanName(ctx.igniteInstanceName(), CACHE_GRP_METRICS_MBEAN_GRP, grp.cacheOrGroupName())); } catch (Throwable e) { U.error(log, "Failed to unregister MBean for cache group: " + grp.name(), e); } } }
if (!compiled.matcher(context.cacheOrGroupName()).find()) continue; ci.setGrpName(context.cacheOrGroupName()); ci.setGrpId(context.groupId()); ci.setCachesCnt(context.caches().size()); ci.setPartitions(context.config().getAffinity().partitions()); ci.setBackupsCnt(context.config().getBackups()); ci.setAffinityClsName(context.config().getAffinity().getClass().getSimpleName()); ci.setMode(context.config().getCacheMode()); ci.setAtomicityMode(context.config().getAtomicityMode()); ci.setMapped(mapped(context.caches().iterator().next().name()));
/** * @return Partition topology. */ public GridDhtPartitionTopology topology() { return grp.topology(); }
/** * Read row from data pages. * Can be called with cctx == null, if cache instance is unknown, but its ID is stored in the data row. * * @param grp Cache group. * @param sharedCtx Shared context. * @param pageMem Page memory. * @param rowData Row data. * @param skipVer Whether version read should be skipped. * @throws IgniteCheckedException If failed. */ public final void initFromLink( @Nullable CacheGroupContext grp, GridCacheSharedContext<?, ?> sharedCtx, PageMemory pageMem, RowData rowData, boolean skipVer ) throws IgniteCheckedException { // Group is null if try evict page, with persistence evictions should be disabled. assert grp != null || pageMem instanceof PageMemoryNoStoreImpl; CacheObjectContext coctx = grp != null ? grp.cacheObjectContext() : null; boolean readCacheId = grp == null || grp.storeCacheIdInDataPage(); int grpId = grp != null ? grp.groupId() : 0; IoStatisticsHolder statHolder = grp != null ? grp.statisticsHolderData() : IoStatisticsHolderNoOp.INSTANCE; doInitFromLink(link, sharedCtx, coctx, pageMem, grpId, statHolder, readCacheId, rowData, null, skipVer); }
? grpCtx.topology() : cctx.exchange().clientTopology(grpDesc.groupId(), events().discoveryCache()); || grpCtx.config().isReadThrough() || grpCtx.config().isWriteThrough() || grpCtx.config().getCacheStoreFactory() != null || grpCtx.config().getRebalanceDelay() == -1 || grpCtx.config().getRebalanceMode() == CacheRebalanceMode.NONE || grpCtx.config().getExpiryPolicyFactory() == null || SKIP_PARTITION_SIZE_VALIDATION) return null; log.warning("Partition states validation has failed for group: " + grpCtx.cacheOrGroupName() + ". " + ex.getMessage());
/** * Invalidates page memory for given partition. Destroys partition store. * <b>NOTE:</b> This method can be invoked only within checkpoint lock or checkpointer thread. * * @param grpId Group ID. * @param partId Partition ID. * * @throws IgniteCheckedException If destroy has failed. */ public void destroyPartitionStore(int grpId, int partId) throws IgniteCheckedException { PageMemoryEx pageMemory = (PageMemoryEx)grp.dataRegion().pageMemory(); int tag = pageMemory.invalidate(grp.groupId(), partId); if (grp.walEnabled()) ctx.wal().log(new PartitionDestroyRecord(grp.groupId(), partId)); ctx.pageStore().onPartitionDestroyed(grpId, partId, tag); }
/** * @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; }
IgniteCacheOffheapManager offh = grp.offheap(); AffinityTopologyVersion topVer = grp.affinity().lastVersion(); assertEquals(j * PARTS, (int)row.key().value(grp.cacheObjectContext(), false)); assertEquals(j * PARTS, (int)row.value().value(grp.cacheObjectContext(), false)); assertEquals(j * PARTS + 1, (int)row.key().value(grp.cacheObjectContext(), false)); assertEquals(j * PARTS + 1, (int)row.value().value(grp.cacheObjectContext(), false)); offh = grp.offheap(); topVer = grp.affinity().lastVersion(); assertEquals(j * PARTS, (int)row.key().value(grp.cacheObjectContext(), false)); assertEquals(j * PARTS, (int)row.value().value(grp.cacheObjectContext(), false)); assertEquals(j * PARTS + 1, (int)row.key().value(grp.cacheObjectContext(), false)); assertEquals(j * PARTS + 1, (int)row.value().value(grp.cacheObjectContext(), false));
/** * @return Cache group ID. */ public int groupId() { return grp.groupId(); }