/** * Gets ready future for the next affinity topology version (used in cases when a node leaves grid). * * @param curVer Current topology version (before a node left grid). * @return Ready future. */ public IgniteInternalFuture<?> nextAffinityReadyFuture(AffinityTopologyVersion curVer) { if (curVer == null) return null; AffinityTopologyVersion nextVer = new AffinityTopologyVersion(curVer.topologyVersion() + 1); IgniteInternalFuture<?> fut = exchMgr.affinityReadyFuture(nextVer); return fut == null ? new GridFinishedFuture<>() : fut; }
/** * @return {@code True} If there is any exchange future in progress. */ private boolean exchangeInProgress() { if (exchWorker.hasPendingServerExchange()) return true; GridDhtPartitionsExchangeFuture current = lastTopologyFuture(); if (current == null) return false; GridDhtTopologyFuture finished = lastFinishedFut.get(); if (finished == null || finished.result().compareTo(current.initialVersion()) < 0) { ClusterNode triggeredBy = current.firstEvent().eventNode(); if (current.partitionChangesInProgress() && !triggeredBy.isClient()) return true; } return false; }
if (!enterBusy()) return; log.debug("Partitions have been scheduled to resend [reason=Single update from " + node.id() + "]"); scheduleResendPartitions(); GridDhtPartitionsExchangeFuture exchFut = exchangeFuture(msg.exchangeId()); AffinityTopologyVersion readyVer = readyAffinityVersion(); leaveBusy();
/** * @param sb String builder. * @param ctx Context. */ static void dumpExchangeInfo(StringBuilder sb, GridKernalContext ctx) { GridCachePartitionExchangeManager exchMgr = ctx.cache().context().exchange(); GridDhtTopologyFuture fut = exchMgr.lastTopologyFuture(); sb.append("Partitions exchange info [readyVer=").append(exchMgr.readyAffinityVersion()).append(']').append(U.nl()) .append("Last initialized exchange future: ").append(fut); }
/** * @param cancelled Is cancelled. */ private void checkIsDone(boolean cancelled) { if (remaining.isEmpty()) { sendRebalanceFinishedEvent(); if (log.isInfoEnabled()) log.info("Completed rebalance future: " + this); if (log.isDebugEnabled()) log.debug("Partitions have been scheduled to resend [reason=" + "Rebalance is done [grp=" + grp.cacheOrGroupName() + "]"); ctx.exchange().scheduleResendPartitions(); Collection<Integer> m = new HashSet<>(); for (Map.Entry<UUID, Collection<Integer>> e : missed.entrySet()) { if (e.getValue() != null && !e.getValue().isEmpty()) m.addAll(e.getValue()); } if (!m.isEmpty()) { U.log(log, ("Reassigning partitions that were missed: " + m)); onDone(false); //Finished but has missed partitions, will force dummy exchange ctx.exchange().forceReassign(exchId); return; } if (!cancelled && !grp.preloader().syncFuture().isDone()) ((GridFutureAdapter)grp.preloader().syncFuture()).onDone(); onDone(!cancelled); } }
snpMgr, new GridCacheDeploymentManager<K, V>(), new GridCachePartitionExchangeManager<K, V>(), affMgr, ioMgr, affinity().clearGroupHoldersAndRegistry(); exchMgr.onKernalStart(active, true);
/** * @param sb String builder. */ public void dumpPendingMessages(StringBuilder sb) { synchronized (pendingMsgs) { if (pendingMsgs.isEmpty()) return; sb.append("Pending cache messages waiting for exchange [readyVer="). append(cctx.exchange().readyAffinityVersion()). append(", discoVer="). append(cctx.discovery().topologyVersion()).append(']'); sb.append(nl()); for (GridCacheMessage msg : pendingMsgs) { sb.append("Message [waitVer=").append(msg.topologyVersion()).append(", msg=").append(msg).append(']'); sb.append(nl()); } } }
g0.context().cache().context().exchange().affinityReadyFuture(waitTopVer); AffinityTopologyVersion readyVer = exchMgr.readyAffinityVersion(); IgniteInternalFuture<?> fut = exchMgr.affinityReadyFuture(readyVer); !exchMgr.rebalanceTopologyVersion().equals(AffinityTopologyVersion.NONE) && !affNodes.get(0).equals(dht.context().affinity().primaryByPartition(p, readyVer));
/** * Holds (suspends) job execution until our cache version becomes equal to remote cache's version. * * @return {@code True} if topology check passed. */ private boolean waitAffinityReadyFuture() { GridCacheProcessor cacheProc = ((IgniteEx)ignite).context().cache(); AffinityTopologyVersion locTopVer = cacheProc.context().exchange().readyAffinityVersion(); if (locTopVer.compareTo(topVer) < 0) { IgniteInternalFuture<?> fut = cacheProc.context().exchange().affinityReadyFuture(topVer); if (fut != null && !fut.isDone()) { jobCtx.holdcc(); fut.listen(new CI1<IgniteInternalFuture<?>>() { @Override public void apply(IgniteInternalFuture<?> t) { ((IgniteEx)ignite).context().closure().runLocalSafe(new Runnable() { @Override public void run() { jobCtx.callcc(); } }, false); } }); return false; } } return true; } }
cctx.exchange().exchangerBlockingSectionBegin(); cctx.exchange().exchangerBlockingSectionEnd(); cctx.exchange().exchangerBlockingSectionBegin(); cctx.exchange().exchangerBlockingSectionEnd(); boolean skipWaitOnLocalJoin = cctx.exchange().latch().canSkipJoiningNodes(initialVersion()) && localJoinExchange(); cctx.exchange().exchangerBlockingSectionBegin(); cctx.exchange().exchangerBlockingSectionEnd(); cctx.exchange().exchangerBlockingSectionBegin(); cctx.exchange().exchangerBlockingSectionEnd(); cctx.exchange().exchangerBlockingSectionBegin(); cctx.exchange().exchangerBlockingSectionEnd(); cctx.exchange().exchangerBlockingSectionBegin(); cctx.exchange().exchangerBlockingSectionEnd(); cctx.exchange().exchangerBlockingSectionBegin();
/** {@inheritDoc} */ @Override public void apply(StringBuilder sb, GridKernalContext ctx) { sb.append(U.nl()); List<GridDhtPartitionsExchangeFuture> futs = ctx.cache().context().exchange().exchangeFutures(); for (GridDhtPartitionsExchangeFuture fut : futs) { if (topVer.equals(fut.initialVersion())) { sb.append("Exchange future: ").append(fut); return; } } sb.append("Failed to find exchange future: ").append(topVer); }
/** * */ public void init() { AffinityTopologyVersion topVer = this.topVer.topologyVersion() > 0 ? this.topVer : canRemap ? cctx.affinity().affinityTopologyVersion() : cctx.shared().exchange().readyAffinityVersion(); GridDhtTopologyFuture topFut = cctx.shared().exchange().lastFinishedFuture(); Throwable err = topFut != null ? topFut.validateCache(cctx, recovery, true, key, null) : null; if (err != null) { onDone(err); return; } map(topVer); }
AffinityTopologyVersion topVer = grid(1).context().cache().context().exchange().lastTopologyFuture().get(); IgniteInternalFuture<?> fut = grid(0).context().cache().context().exchange().affinityReadyFuture(topVer);
GridDhtTopologyFuture lastFinished = exch.lastFinishedFuture(); while (lastFinished == exch.lastTopologyFuture()) doSleep(1);
ignite.context().cache().context().exchange().scheduleResendPartitions(); long topVer0 = grid(0).context().cache().context().exchange().readyAffinityVersion().topologyVersion(); long topVer1 = grid(1).context().cache().context().exchange().readyAffinityVersion().topologyVersion(); long topVer2 = grid(2).context().cache().context().exchange().readyAffinityVersion().topologyVersion(); assert grid(0).context().cache().context().exchange().readyAffinityVersion().topologyVersion() > topVer0; assert grid(1).context().cache().context().exchange().readyAffinityVersion().topologyVersion() > topVer1; assert grid(2).context().cache().context().exchange().readyAffinityVersion().topologyVersion() > topVer2;
/** {@inheritDoc} */ @Override public GridDhtTopologyFuture topologyVersionFuture() { GridDhtTopologyFuture topReadyFut0 = topReadyFut; assert topReadyFut0 != null; if (!topReadyFut0.changedAffinity()) { GridDhtTopologyFuture lastFut = ctx.exchange().lastFinishedFuture(); if (lastFut != null) return lastFut; } return topReadyFut0; }
log.debug("Schedule resend parititions due to snapshot in progress"); scheduleResendPartitions(); log.debug("Refreshing partitions from oldest node: " + cctx.localNodeId()); sendAllPartitions(rmts, rmtTopVer, grps); cctx.localNodeId()); sendLocalPartitions(oldest, null, grps);
grpToRefresh.stream().map(CacheGroupContext::name).collect(Collectors.toList()) + ']'); cctx.exchange().refreshPartitions(grpToRefresh); cctx.exchange().lastFinishedFuture(this); cctx.exchange().onExchangeDone(res, initialVersion(), err0);
ctx.shared().exchange().affinityReadyFuture(req.topologyVersion()); ctx.shared().exchange().exchangeFutures();
"Evictions are done [grp" + grp.cacheOrGroupName() + "]"); ctx.exchange().scheduleResendPartitions();