/** * @return Partition topology. */ public GridDhtPartitionTopology topology() { return grp.topology(); }
/** * @return Partition topology. */ public GridDhtPartitionTopology topology() { return ctx.group().topology(); }
/** * @param grp Cache group. */ public GridDhtPreloader(CacheGroupContext grp) { super(grp); top = grp.topology(); startFut = new GridFutureAdapter<>(); }
/** {@inheritDoc} */ @Override public int getPartitions() { return ctx.topology().partitions(); }
/** {@inheritDoc} */ @Override public List<Integer> getPartitionIds() { List<GridDhtLocalPartition> parts = ctx.topology().localPartitions(); List<Integer> partsRes = new ArrayList<>(parts.size()); for (GridDhtLocalPartition part : parts) partsRes.add(part.id()); return partsRes; }
/** {@inheritDoc} */ @Override public int size() { int size = 0; for (GridDhtLocalPartition part : grp.topology().currentLocalPartitions()) size += set(part).size(); return size; }
/** {@inheritDoc} */ @Override public boolean contains(Object o) { for (GridDhtLocalPartition part : grp.topology().currentLocalPartitions()) { if (set(part).contains(o)) return true; } return false; } }
/** {@inheritDoc} */ @Override public int internalSize() { int size = 0; for (GridDhtLocalPartition part : grp.topology().currentLocalPartitions()) size += part.internalSize(); return size; }
/** {@inheritDoc} */ @Override public int publicSize(int cacheId) { int size = 0; for (GridDhtLocalPartition part : grp.topology().currentLocalPartitions()) size += part.publicSize(cacheId); return size; }
/** * @param store Store. * * @return corresponding to store local partition */ private GridDhtLocalPartition getPartition(CacheDataStore store) { return grp.topology().localPartition(store.partId(), AffinityTopologyVersion.NONE, false, true); }
/** * @param p Partition. * @return Partition data. */ @Nullable private CacheDataStore partitionData(int p) { if (grp.isLocal()) return locCacheDataStore; else { GridDhtLocalPartition part = grp.topology().localPartition(p, AffinityTopologyVersion.NONE, false, true); return part != null ? part.dataStore() : null; } }
/** * @param grp Cache group. */ GridDhtPartitionSupplier(CacheGroupContext grp) { assert grp != null; this.grp = grp; log = grp.shared().logger(getClass()); top = grp.topology(); if (rebalanceThrottleOverride > 0) LT.info(log, "Using rebalance throttle override: " + rebalanceThrottleOverride); }
/** {@inheritDoc} */ @Override public void printMemoryStats() { super.printMemoryStats(); ctx.group().topology().printMemoryStats(1024); }
/** * 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() + "]"); } }
/** * Count of partitions with a given state in the entire cluster. * * @param state State. */ private int clusterPartitionsCountByState(GridDhtPartitionState state) { GridDhtPartitionFullMap partFullMap = ctx.topology().partitionMap(true); int cnt = 0; for (UUID nodeId : partFullMap.keySet()) cnt += nodePartitionsCountByState(nodeId, state); return cnt; }
/** * @param cctx Cache context. * @param key Key. * @return Data store. */ @Nullable private CacheDataStore dataStore(GridCacheContext cctx, KeyCacheObject key) { if (grp.isLocal()) return locCacheDataStore; GridDhtLocalPartition part = grp.topology().localPartition(cctx.affinity().partition(key), null, false); return part != null ? dataStore(part) : null; }
/** {@inheritDoc} */ @Override public long getLocalNodeRentingEntriesCount() { long entriesCnt = 0; for (GridDhtLocalPartition part : ctx.topology().localPartitions()) { if (part.state() == GridDhtPartitionState.RENTING) entriesCnt += part.dataStore().fullSize(); } return entriesCnt; }
/** {@inheritDoc} */ @Override public long totalPartitionEntriesCount(int p) { if (grp.isLocal()) return locCacheDataStore.fullSize(); else { GridDhtLocalPartition part = grp.topology().localPartition(p, AffinityTopologyVersion.NONE, false, true); return part != null ? part.dataStore().fullSize() : 0; } }
/** * @param gridNumber Grid number. * @param cacheName Cache name. * @return Partitions states for given cache name. */ private List<GridDhtPartitionState> getPartitionsStates(int gridNumber, String cacheName) { CacheGroupContext cgCtx = grid(gridNumber).context().cache().cacheGroup(CU.cacheId(cacheName)); GridDhtPartitionTopologyImpl top = (GridDhtPartitionTopologyImpl)cgCtx.topology(); return top.localPartitions().stream() .map(GridDhtLocalPartition::state) .collect(Collectors.toList()); }
/** {@inheritDoc} */ @Override public void preloadPartition(int part) throws IgniteCheckedException { if (grp.isLocal()) { dataStore(part).preload(); return; } GridDhtLocalPartition locPart = grp.topology().localPartition(part, AffinityTopologyVersion.NONE, false, false); assert locPart != null && locPart.reservations() > 0; locPart.dataStore().preload(); }