/** * @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); } }
/** * @param setId Set ID. * @param topVer Topology version. * @throws IgniteCheckedException If failed. */ private void removeSetData(IgniteUuid setId, AffinityTopologyVersion topVer) throws IgniteCheckedException { boolean loc = cctx.isLocal(); GridCacheAffinityManager aff = cctx.affinity(); if (!loc) { aff.affinityReadyFuture(topVer).get(); cctx.preloader().syncFuture().get(); } IgniteInternalCache<?, ?> cache = cctx.cache(); final int BATCH_SIZE = 100; Collection<SetItemKey> keys = new ArrayList<>(BATCH_SIZE); for (Cache.Entry entry : cache.localEntries(new CachePeekMode[] {CachePeekMode.PRIMARY})) { Object obj = entry.getKey(); if (!(obj instanceof SetItemKey && setId.equals(((SetItemKey)obj).setId()))) continue; keys.add((SetItemKey)obj); if (keys.size() == BATCH_SIZE) { retryRemoveAll(cache, keys); keys.clear(); } } if (!keys.isEmpty()) retryRemoveAll(cache, keys); }
@Override public Void call() throws Exception { int nodeIdx = restartNodeIdx.getAndIncrement(); Thread.currentThread().setName("restart-thread-" + nodeIdx); boolean clientMode = clientNode.compareAndSet(false, true); while (U.currentTimeMillis() < stopTime) { if (clientMode) client.set(true); log.info("Restart node [node=" + nodeIdx + ", client=" + clientMode + ']'); try { Ignite ignite = startGrid(nodeIdx); IgniteCache<Object, Object> cache; if (clientMode && ccfg.getNearConfiguration() != null) cache = ignite.createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); else cache = ignite.cache(ccfg.getName()); checkGet(cache); IgniteInternalFuture<?> syncFut = ((IgniteCacheProxy)cache).context().preloader().syncFuture(); while (!syncFut.isDone() && U.currentTimeMillis() < stopTime) checkGet(cache); checkGet(cache); } finally { stopGrid(nodeIdx); } } return null; } }, restartCnt + 1, "restart-thread");
.syncFuture(); GridFutureAdapter<?> fut2 = (GridFutureAdapter<?>)kernal.internalCache(SECOND_CACHE_NAME).preloader() .syncFuture();
((GridFutureAdapter)grp.preloader().syncFuture()).onDone();
/** * @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); } }
/** * @param setId Set ID. * @param topVer Topology version. * @throws IgniteCheckedException If failed. */ @SuppressWarnings("unchecked") private void removeSetData(IgniteUuid setId, AffinityTopologyVersion topVer) throws IgniteCheckedException { boolean loc = cctx.isLocal(); GridCacheAffinityManager aff = cctx.affinity(); if (!loc) { aff.affinityReadyFuture(topVer).get(); cctx.preloader().syncFuture().get(); } IgniteInternalCache<?, ?> cache = cctx.cache(); final int BATCH_SIZE = 100; Collection<SetItemKey> keys = new ArrayList<>(BATCH_SIZE); for (Cache.Entry entry : cache.localEntries(new CachePeekMode[] {CachePeekMode.PRIMARY})) { Object obj = entry.getKey(); if (!(obj instanceof SetItemKey && setId.equals(((SetItemKey)obj).setId()))) continue; keys.add((SetItemKey)obj); if (keys.size() == BATCH_SIZE) { retryRemoveAll(cache, keys); keys.clear(); } } if (!keys.isEmpty()) retryRemoveAll(cache, keys); }
((GridFutureAdapter)grp.preloader().syncFuture()).onDone();