Search in sources :

Example 91 with ClusterTopologyCheckedException

use of org.apache.ignite.internal.cluster.ClusterTopologyCheckedException in project gridgain by gridgain.

the class GridIoManager method sendToGridTopic.

/**
 * @param nodeId Id of destination node.
 * @param topic Topic to send the message to.
 * @param msg Message to send.
 * @param plc Type of processing.
 * @throws IgniteCheckedException Thrown in case of any errors.
 */
public void sendToGridTopic(UUID nodeId, GridTopic topic, Message msg, byte plc) throws IgniteCheckedException {
    ClusterNode node = ctx.discovery().node(nodeId);
    if (node == null)
        throw new ClusterTopologyCheckedException("Failed to send message to node (has node left grid?): " + nodeId);
    send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null, false);
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)

Example 92 with ClusterTopologyCheckedException

use of org.apache.ignite.internal.cluster.ClusterTopologyCheckedException in project gridgain by gridgain.

the class GridJobProcessor method handleException.

/**
 * Handles errors that happened prior to job creation.
 *
 * @param node Sender node.
 * @param req Job execution request.
 * @param ex Exception that happened.
 * @param endTime Job end time.
 */
private void handleException(ClusterNode node, GridJobExecuteRequest req, IgniteException ex, long endTime) {
    UUID locNodeId = ctx.localNodeId();
    ClusterNode sndNode = ctx.discovery().node(node.id());
    if (sndNode == null) {
        U.warn(log, "Failed to reply to sender node because it left grid [nodeId=" + node.id() + ", jobId=" + req.getJobId() + ']');
        if (ctx.event().isRecordable(EVT_JOB_FAILED)) {
            JobEvent evt = new JobEvent();
            evt.jobId(req.getJobId());
            evt.message("Job reply failed (original task node left grid): " + req.getJobId());
            evt.node(ctx.discovery().localNode());
            evt.taskName(req.getTaskName());
            evt.taskClassName(req.getTaskClassName());
            evt.taskSessionId(req.getSessionId());
            evt.type(EVT_JOB_FAILED);
            evt.taskNode(node);
            evt.taskSubjectId(req.getSubjectId());
            // Record job reply failure.
            ctx.event().record(evt);
        }
        return;
    }
    try {
        boolean loc = ctx.localNodeId().equals(sndNode.id()) && !ctx.config().isMarshalLocalJobs();
        GridJobExecuteResponse jobRes = new GridJobExecuteResponse(locNodeId, req.getSessionId(), req.getJobId(), loc ? null : U.marshal(marsh, ex), ex, loc ? null : U.marshal(marsh, null), null, loc ? null : U.marshal(marsh, null), null, false, null);
        if (req.isSessionFullSupport()) {
            // Send response to designated job topic.
            // Always go through communication to preserve order,
            // if attributes are enabled.
            // Job response topic.
            Object topic = TOPIC_TASK.topic(req.getJobId(), locNodeId);
            long timeout = endTime - U.currentTimeMillis();
            if (timeout <= 0)
                // Ignore the actual timeout and send response anyway.
                timeout = 1;
            // Send response to designated job topic.
            // Always go through communication to preserve order.
            ctx.io().sendOrderedMessage(sndNode, topic, jobRes, req.isInternal() ? MANAGEMENT_POOL : SYSTEM_POOL, timeout, false);
        } else if (ctx.localNodeId().equals(sndNode.id()))
            ctx.task().processJobExecuteResponse(ctx.localNodeId(), jobRes);
        else
            // Send response to common topic as unordered message.
            ctx.io().sendToGridTopic(sndNode, TOPIC_TASK, jobRes, req.isInternal() ? MANAGEMENT_POOL : SYSTEM_POOL);
    } catch (IgniteCheckedException e) {
        // The only option here is to log, as we must assume that resending will fail too.
        if ((e instanceof ClusterTopologyCheckedException) || isDeadNode(node.id()))
            // Avoid stack trace for left nodes.
            U.error(log, "Failed to reply to sender node because it left grid [nodeId=" + node.id() + ", jobId=" + req.getJobId() + ']');
        else {
            assert sndNode != null;
            U.error(log, "Error sending reply for job [nodeId=" + sndNode.id() + ", jobId=" + req.getJobId() + ']', e);
        }
        if (ctx.event().isRecordable(EVT_JOB_FAILED)) {
            JobEvent evt = new JobEvent();
            evt.jobId(req.getJobId());
            evt.message("Failed to send reply for job: " + req.getJobId());
            evt.node(ctx.discovery().localNode());
            evt.taskName(req.getTaskName());
            evt.taskClassName(req.getTaskClassName());
            evt.taskSessionId(req.getSessionId());
            evt.type(EVT_JOB_FAILED);
            evt.taskNode(node);
            evt.taskSubjectId(req.getSubjectId());
            // Record job reply failure.
            ctx.event().record(evt);
        }
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) JobEvent(org.apache.ignite.events.JobEvent) GridJobExecuteResponse(org.apache.ignite.internal.GridJobExecuteResponse) UUID(java.util.UUID) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)

Example 93 with ClusterTopologyCheckedException

use of org.apache.ignite.internal.cluster.ClusterTopologyCheckedException in project gridgain by gridgain.

the class GridDhtLockFuture method map.

/**
 * @param entries Entries.
 */
private void map(Iterable<GridDhtCacheEntry> entries) {
    synchronized (this) {
        if (mapped)
            return;
        mapped = true;
    }
    try {
        if (log.isDebugEnabled())
            log.debug("Mapping entry for DHT lock future: " + this);
        // Assign keys to primary nodes.
        for (GridDhtCacheEntry entry : entries) {
            try {
                while (true) {
                    try {
                        cctx.dhtMap(nearNodeId, topVer, entry, tx == null ? lockVer : null, log, dhtMap, null);
                        GridCacheMvccCandidate cand = entry.candidate(lockVer);
                        // Possible in case of lock cancellation.
                        if (cand == null) {
                            onFailed(false);
                            // Will mark initialized in finally block.
                            return;
                        }
                        break;
                    } catch (GridCacheEntryRemovedException ignore) {
                        if (log.isDebugEnabled())
                            log.debug("Got removed entry when mapping DHT lock future (will retry): " + entry);
                        entry = cctx.dht().entryExx(entry.key(), topVer);
                    }
                }
            } catch (GridDhtInvalidPartitionException e) {
                assert false : "DHT lock should never get invalid partition [err=" + e + ", fut=" + this + ']';
            }
        }
        if (checkDone())
            return;
        if (log.isDebugEnabled())
            log.debug("Mapped DHT lock future [dhtMap=" + F.nodeIds(dhtMap.keySet()) + ", dhtLockFut=" + this + ']');
        long timeout = inTx() ? tx.remainingTime() : this.timeout;
        synchronized (this) {
            // Prevents entry removal on concurrent rollback.
            if (checkDone())
                return;
            // Create mini futures.
            for (Map.Entry<ClusterNode, List<GridDhtCacheEntry>> mapped : dhtMap.entrySet()) {
                ClusterNode n = mapped.getKey();
                List<GridDhtCacheEntry> dhtMapping = mapped.getValue();
                int cnt = F.size(dhtMapping);
                if (cnt > 0) {
                    assert !n.id().equals(cctx.localNodeId());
                    if (inTx() && tx.remainingTime() == -1)
                        return;
                    MiniFuture fut = new MiniFuture(n, dhtMapping);
                    GridDhtLockRequest req = new GridDhtLockRequest(cctx.cacheId(), nearNodeId, inTx() ? tx.nearXidVersion() : null, threadId, futId, fut.futureId(), lockVer, topVer, inTx(), read, isolation(), isInvalidate(), timeout, cnt, 0, inTx() ? tx.size() : cnt, inTx() ? tx.subjectId() : null, inTx() ? tx.taskNameHash() : 0, read ? accessTtl : -1L, skipStore, cctx.store().configured(), keepBinary, cctx.deploymentEnabled(), inTx() ? tx.label() : null);
                    try {
                        for (ListIterator<GridDhtCacheEntry> it = dhtMapping.listIterator(); it.hasNext(); ) {
                            GridDhtCacheEntry e = it.next();
                            boolean needVal = false;
                            try {
                                // Must unswap entry so that isNewLocked returns correct value.
                                e.unswap(false);
                                needVal = e.isNewLocked();
                                if (needVal) {
                                    List<ClusterNode> owners = cctx.topology().owners(e.partition(), tx != null ? tx.topologyVersion() : cctx.affinity().affinityTopologyVersion());
                                    // Do not preload if local node is partition owner.
                                    if (owners.contains(cctx.localNode()))
                                        needVal = false;
                                }
                                // Skip entry if it is not new and is not present in updated mapping.
                                if (tx != null && !needVal)
                                    continue;
                                boolean invalidateRdr = e.readerId(n.id()) != null;
                                req.addDhtKey(e.key(), invalidateRdr, cctx);
                                if (needVal) {
                                    // Mark last added key as needed to be preloaded.
                                    req.markLastKeyForPreload();
                                    if (tx != null) {
                                        IgniteTxEntry txEntry = tx.entry(e.txKey());
                                        // NOOP entries will be sent to backups on prepare step.
                                        if (txEntry.op() == GridCacheOperation.READ)
                                            txEntry.op(GridCacheOperation.NOOP);
                                    }
                                }
                                GridCacheMvccCandidate added = e.candidate(lockVer);
                                assert added != null;
                                assert added.dhtLocal();
                                if (added.ownerVersion() != null)
                                    req.owned(e.key(), added.ownerVersion());
                            } catch (GridCacheEntryRemovedException ex) {
                                assert false : "Entry cannot become obsolete when DHT local candidate is added " + "[e=" + e + ", ex=" + ex + ']';
                            }
                        }
                        if (!F.isEmpty(req.keys())) {
                            if (tx != null)
                                tx.addLockTransactionNode(n);
                            // Append new future.
                            add(fut);
                            cctx.io().send(n, req, cctx.ioPolicy());
                            if (msgLog.isDebugEnabled()) {
                                msgLog.debug("DHT lock fut, sent request [txId=" + nearLockVer + ", dhtTxId=" + lockVer + ", inTx=" + inTx() + ", nodeId=" + n.id() + ']');
                            }
                        }
                    } catch (IgniteCheckedException e) {
                        // Fail the whole thing.
                        if (e instanceof ClusterTopologyCheckedException)
                            fut.onResult();
                        else {
                            if (msgLog.isDebugEnabled()) {
                                msgLog.debug("DHT lock fut, failed to send request [txId=" + nearLockVer + ", dhtTxId=" + lockVer + ", inTx=" + inTx() + ", node=" + n.id() + ", err=" + e + ']');
                            }
                            fut.onResult(e);
                        }
                    }
                }
            }
        }
    } finally {
        markInitialized();
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteTxEntry(org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry) GridDhtInvalidPartitionException(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) GridCacheEntryRemovedException(org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) LinkedHashMap(java.util.LinkedHashMap) GridCacheMvccCandidate(org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)

Example 94 with ClusterTopologyCheckedException

use of org.apache.ignite.internal.cluster.ClusterTopologyCheckedException in project gridgain by gridgain.

the class GridPartitionedGetFuture method map.

/**
 * @param keys Keys.
 * @param mapped Mappings to check for duplicates.
 * @param topVer Topology version on which keys should be mapped.
 */
@Override
protected void map(Collection<KeyCacheObject> keys, Map<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>> mapped, AffinityTopologyVersion topVer) {
    try (TraceSurroundings ignored = MTC.support(cctx.kernalContext().tracing().create(CACHE_API_GET_MAP, span))) {
        MTC.span().addTag("topology.version", () -> Objects.toString(topVer));
        GridDhtPartitionsExchangeFuture fut = cctx.shared().exchange().lastTopologyFuture();
        // Finished DHT future is required for topology validation.
        if (!fut.isDone()) {
            if ((topVer.topologyVersion() > 0 && fut.initialVersion().after(topVer)) || (fut.exchangeActions() != null && fut.exchangeActions().hasStop()))
                fut = cctx.shared().exchange().lastFinishedFuture();
            else {
                fut.listen(new IgniteInClosure<IgniteInternalFuture<AffinityTopologyVersion>>() {

                    @Override
                    public void apply(IgniteInternalFuture<AffinityTopologyVersion> fut) {
                        try {
                            AffinityTopologyVersion topVer0 = fut.get();
                            cctx.closures().runLocalSafe(new GridPlainRunnable() {

                                @Override
                                public void run() {
                                    map(keys, mapped, topVer.topologyVersion() > 0 ? topVer : topVer0);
                                }
                            }, true);
                        } catch (IgniteCheckedException e) {
                            onDone(e);
                        }
                    }
                });
                return;
            }
        }
        Collection<ClusterNode> cacheNodes = CU.affinityNodes(cctx, topVer);
        validate(cacheNodes, fut);
        // Future can be already done with some exception.
        if (isDone())
            return;
        Map<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>> mappings = U.newHashMap(cacheNodes.size());
        int keysSize = keys.size();
        // Map for local (key,value) pairs.
        Map<K, V> locVals = U.newHashMap(keysSize);
        // True if we have remote nodes after key mapping complete.
        boolean hasRmtNodes = false;
        // Assign keys to nodes.
        for (KeyCacheObject key : keys) hasRmtNodes |= map(key, topVer, mappings, mapped, locVals);
        // Future can be alredy done with some exception.
        if (isDone())
            return;
        // Add local read (key,value) in result.
        if (!locVals.isEmpty())
            add(new GridFinishedFuture<>(locVals));
        // If we have remote nodes in mapping we should registrate future in mvcc manager.
        if (hasRmtNodes)
            registrateFutureInMvccManager(this);
        // Create mini futures after mapping to remote nodes.
        for (Map.Entry<ClusterNode, LinkedHashMap<KeyCacheObject, Boolean>> entry : mappings.entrySet()) {
            // Node for request.
            ClusterNode n = entry.getKey();
            // Keys for request.
            LinkedHashMap<KeyCacheObject, Boolean> mappedKeys = entry.getValue();
            assert !mappedKeys.isEmpty();
            // If this is the primary or backup node for the keys.
            if (n.isLocal()) {
                GridDhtFuture<Collection<GridCacheEntryInfo>> fut0 = cache().getDhtAsync(n.id(), -1, mappedKeys, false, readThrough, topVer, subjId, taskName == null ? 0 : taskName.hashCode(), expiryPlc, skipVals, recovery, txLbl, mvccSnapshot());
                Collection<Integer> invalidParts = fut0.invalidPartitions();
                if (!F.isEmpty(invalidParts)) {
                    Collection<KeyCacheObject> remapKeys = new ArrayList<>(keysSize);
                    for (KeyCacheObject key : keys) {
                        int part = cctx.affinity().partition(key);
                        if (key != null && invalidParts.contains(part)) {
                            addNodeAsInvalid(n, part, topVer);
                            remapKeys.add(key);
                        }
                    }
                    AffinityTopologyVersion updTopVer = cctx.shared().exchange().readyAffinityVersion();
                    // Remap recursively.
                    map(remapKeys, mappings, updTopVer);
                }
                // Add new future.
                add(fut0.chain(f -> {
                    try {
                        return createResultMap(f.get());
                    } catch (Exception e) {
                        U.error(log, "Failed to get values from dht cache [fut=" + fut0 + "]", e);
                        onDone(e);
                        return Collections.emptyMap();
                    }
                }));
            } else {
                MiniFuture miniFut = new MiniFuture(n, mappedKeys, topVer);
                GridCacheMessage req = miniFut.createGetRequest(futId);
                // Append new future.
                add(miniFut);
                try {
                    cctx.io().send(n, req, cctx.ioPolicy());
                } catch (IgniteCheckedException e) {
                    // Fail the whole thing.
                    if (e instanceof ClusterTopologyCheckedException)
                        miniFut.onNodeLeft((ClusterTopologyCheckedException) e);
                    else
                        miniFut.onResult(e);
                }
            }
        }
        markInitialized();
    }
}
Also used : IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) GridFinishedFuture(org.apache.ignite.internal.util.future.GridFinishedFuture) EntryGetResult(org.apache.ignite.internal.processors.cache.EntryGetResult) GridCacheMessage(org.apache.ignite.internal.processors.cache.GridCacheMessage) GridCacheVersion(org.apache.ignite.internal.processors.cache.version.GridCacheVersion) U(org.apache.ignite.internal.util.typedef.internal.U) CACHE_API_GET_MAP(org.apache.ignite.internal.processors.tracing.SpanType.CACHE_API_GET_MAP) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) ClusterNode(org.apache.ignite.cluster.ClusterNode) GridDhtPartitionsExchangeFuture(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture) Map(java.util.Map) S(org.apache.ignite.internal.util.typedef.internal.S) IgniteCacheExpiryPolicy(org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy) ClusterTopologyServerNotFoundException(org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException) CACHE_API_PARTITIONED_GET_FUTURE(org.apache.ignite.internal.processors.tracing.SpanType.CACHE_API_PARTITIONED_GET_FUTURE) GridNearGetRequest(org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest) GridLeanMap(org.apache.ignite.internal.util.GridLeanMap) GridCacheEntryInfo(org.apache.ignite.internal.processors.cache.GridCacheEntryInfo) F(org.apache.ignite.internal.util.typedef.F) IgniteInClosure(org.apache.ignite.lang.IgniteInClosure) Collection(java.util.Collection) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) Set(java.util.Set) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException) UUID(java.util.UUID) CacheObject(org.apache.ignite.internal.processors.cache.CacheObject) GridCacheEntryRemovedException(org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException) CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) GridDhtInvalidPartitionException(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException) Objects(java.util.Objects) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) MvccSnapshot(org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot) MTC(org.apache.ignite.internal.processors.tracing.MTC) CU(org.apache.ignite.internal.util.typedef.internal.CU) GridPlainRunnable(org.apache.ignite.internal.util.lang.GridPlainRunnable) GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) Collections(java.util.Collections) GridCacheEntryEx(org.apache.ignite.internal.processors.cache.GridCacheEntryEx) IgniteUuid(org.apache.ignite.lang.IgniteUuid) TraceSurroundings(org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings) ArrayList(java.util.ArrayList) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) TraceSurroundings(org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings) GridPlainRunnable(org.apache.ignite.internal.util.lang.GridPlainRunnable) LinkedHashMap(java.util.LinkedHashMap) GridFinishedFuture(org.apache.ignite.internal.util.future.GridFinishedFuture) GridCacheMessage(org.apache.ignite.internal.processors.cache.GridCacheMessage) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) ClusterNode(org.apache.ignite.cluster.ClusterNode) GridDhtPartitionsExchangeFuture(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) ClusterTopologyServerNotFoundException(org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException) GridCacheEntryRemovedException(org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException) GridDhtInvalidPartitionException(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException) Collection(java.util.Collection) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) GridLeanMap(org.apache.ignite.internal.util.GridLeanMap) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)

Example 95 with ClusterTopologyCheckedException

use of org.apache.ignite.internal.cluster.ClusterTopologyCheckedException in project gridgain by gridgain.

the class GridPartitionedSingleGetFuture method map.

/**
 * @param topVer Topology version.
 */
@SuppressWarnings("unchecked")
private void map(AffinityTopologyVersion topVer) {
    try (TraceSurroundings ignored = MTC.support(cctx.kernalContext().tracing().create(CACHE_API_GET_MAP, span))) {
        MTC.span().addTag("topology.version", () -> Objects.toString(topVer));
        GridDhtPartitionsExchangeFuture fut = cctx.shared().exchange().lastTopologyFuture();
        // Finished DHT future is required for topology validation.
        if (!fut.isDone()) {
            if ((topVer.topologyVersion() > 0 && fut.initialVersion().after(topVer)) || (fut.exchangeActions() != null && fut.exchangeActions().hasStop()))
                fut = cctx.shared().exchange().lastFinishedFuture();
            else {
                fut.listen(new IgniteInClosure<IgniteInternalFuture<AffinityTopologyVersion>>() {

                    @Override
                    public void apply(IgniteInternalFuture<AffinityTopologyVersion> fut0) {
                        try {
                            AffinityTopologyVersion topVer0 = fut0.get();
                            cctx.closures().runLocalSafe(new GridPlainRunnable() {

                                @Override
                                public void run() {
                                    map(topVer.topologyVersion() > 0 ? topVer : topVer0);
                                }
                            }, true);
                        } catch (IgniteCheckedException e) {
                            onDone(e);
                        }
                    }
                });
                return;
            }
        }
        if (!validate(fut))
            return;
        ClusterNode node = mapKeyToNode(topVer);
        if (node == null) {
            assert isDone() : this;
            return;
        }
        if (isDone())
            return;
        // Read value if node is localNode.
        if (node.isLocal()) {
            GridDhtFuture<GridCacheEntryInfo> fut0 = cctx.dht().getDhtSingleAsync(node.id(), -1, key, false, readThrough, topVer, subjId, taskName == null ? 0 : taskName.hashCode(), expiryPlc, skipVals, recovery, txLbl, mvccSnapshot);
            Collection<Integer> invalidParts = fut0.invalidPartitions();
            if (!F.isEmpty(invalidParts)) {
                addNodeAsInvalid(node);
                AffinityTopologyVersion updTopVer = cctx.shared().exchange().readyAffinityVersion();
                // Remap recursively.
                map(updTopVer);
            } else {
                fut0.listen(f -> {
                    try {
                        GridCacheEntryInfo info = f.get();
                        setResult(info);
                    } catch (Exception e) {
                        U.error(log, "Failed to get values from dht cache [fut=" + fut0 + "]", e);
                        onDone(e);
                    }
                });
            }
        } else {
            synchronized (this) {
                assert this.node == null;
                this.topVer = topVer;
                this.node = node;
            }
            registrateFutureInMvccManager(this);
            boolean needVer = this.needVer;
            BackupPostProcessingClosure postClos = CU.createBackupPostProcessingClosure(topVer, log, cctx, key, expiryPlc, readThrough && cctx.readThroughConfigured(), skipVals);
            if (postClos != null) {
                // Need version to correctly store value.
                needVer = true;
                postProcessingClos = postClos;
            }
            GridCacheMessage req = new GridNearSingleGetRequest(cctx.cacheId(), futId.localId(), key, readThrough, topVer, subjId, taskName == null ? 0 : taskName.hashCode(), expiryPlc != null ? expiryPlc.forCreate() : -1L, expiryPlc != null ? expiryPlc.forAccess() : -1L, skipVals, /*add reader*/
            false, needVer, cctx.deploymentEnabled(), recovery, txLbl, mvccSnapshot);
            try {
                cctx.io().send(node, req, cctx.ioPolicy());
            } catch (IgniteCheckedException e) {
                if (e instanceof ClusterTopologyCheckedException)
                    onNodeLeft(node.id());
                else
                    onDone(e);
            }
        }
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridCacheEntryInfo(org.apache.ignite.internal.processors.cache.GridCacheEntryInfo) GridDhtPartitionsExchangeFuture(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) TraceSurroundings(org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings) GridPlainRunnable(org.apache.ignite.internal.util.lang.GridPlainRunnable) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) GridCacheEntryRemovedException(org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException) NodeStoppingException(org.apache.ignite.internal.NodeStoppingException) ClusterTopologyServerNotFoundException(org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException) GridDhtInvalidPartitionException(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException) BackupPostProcessingClosure(org.apache.ignite.internal.processors.cache.GridCacheUtils.BackupPostProcessingClosure) GridCacheMessage(org.apache.ignite.internal.processors.cache.GridCacheMessage) IgniteSystemProperties.getInteger(org.apache.ignite.IgniteSystemProperties.getInteger) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) GridNearSingleGetRequest(org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)

Aggregations

ClusterTopologyCheckedException (org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)204 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)147 ClusterNode (org.apache.ignite.cluster.ClusterNode)114 UUID (java.util.UUID)54 AffinityTopologyVersion (org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)45 Map (java.util.Map)41 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)38 HashMap (java.util.HashMap)33 ArrayList (java.util.ArrayList)32 IgniteException (org.apache.ignite.IgniteException)32 Collection (java.util.Collection)28 KeyCacheObject (org.apache.ignite.internal.processors.cache.KeyCacheObject)28 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)26 GridCacheEntryRemovedException (org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException)26 GridCacheVersion (org.apache.ignite.internal.processors.cache.version.GridCacheVersion)24 GridCacheContext (org.apache.ignite.internal.processors.cache.GridCacheContext)22 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)22 Nullable (org.jetbrains.annotations.Nullable)22 ClusterTopologyServerNotFoundException (org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException)21 List (java.util.List)19