Search in sources :

Example 16 with CachePartialUpdateCheckedException

use of org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException in project ignite by apache.

the class GridNearAtomicSingleUpdateFuture method onAllReceived.

/**
 * @return Non-null topology version if update should be remapped.
 */
private AffinityTopologyVersion onAllReceived() {
    assert Thread.holdsLock(this);
    assert futureMapped() : this;
    AffinityTopologyVersion remapTopVer0 = null;
    if (remapTopVer == null) {
        if (err != null && X.hasCause(err, CachePartialUpdateCheckedException.class) && X.hasCause(err, ClusterTopologyCheckedException.class) && storeFuture() && --remapCnt > 0) {
            ClusterTopologyCheckedException topErr = X.cause(err, ClusterTopologyCheckedException.class);
            if (!(topErr instanceof ClusterTopologyServerNotFoundException)) {
                CachePartialUpdateCheckedException cause = X.cause(err, CachePartialUpdateCheckedException.class);
                assert cause != null && cause.topologyVersion() != null : err;
                remapTopVer0 = new AffinityTopologyVersion(cause.topologyVersion().topologyVersion() + 1);
                err = null;
            }
        }
    } else
        remapTopVer0 = remapTopVer;
    if (remapTopVer0 != null) {
        cctx.mvcc().removeAtomicFuture(futId);
        reqState = null;
        topVer = AffinityTopologyVersion.ZERO;
        futId = 0;
        remapTopVer = null;
    }
    return remapTopVer0;
}
Also used : AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) ClusterTopologyServerNotFoundException(org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException) CachePartialUpdateCheckedException(org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)

Example 17 with CachePartialUpdateCheckedException

use of org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException in project ignite by apache.

the class GridNearAtomicSingleUpdateFuture method onNodeLeft.

/**
 * {@inheritDoc}
 */
@Override
public boolean onNodeLeft(UUID nodeId) {
    GridCacheReturn opRes0 = null;
    CachePartialUpdateCheckedException err0 = null;
    AffinityTopologyVersion remapTopVer0 = null;
    GridNearAtomicCheckUpdateRequest checkReq = null;
    boolean rcvAll = false;
    long futId;
    synchronized (this) {
        if (!futureMapped())
            return false;
        futId = this.futId;
        if (reqState.req.nodeId.equals(nodeId)) {
            GridNearAtomicAbstractUpdateRequest req = reqState.onPrimaryFail();
            if (req != null) {
                GridNearAtomicUpdateResponse res = primaryFailedResponse(req);
                rcvAll = true;
                reqState.onPrimaryResponse(res, cctx);
                onPrimaryError(req, res);
            }
        } else {
            DhtLeftResult res = reqState.onDhtNodeLeft(nodeId);
            if (res == DhtLeftResult.DONE)
                rcvAll = true;
            else if (res == DhtLeftResult.ALL_RCVD_CHECK_PRIMARY)
                checkReq = new GridNearAtomicCheckUpdateRequest(reqState.req);
            else
                return false;
        }
        if (rcvAll) {
            opRes0 = opRes;
            err0 = err;
            remapTopVer0 = onAllReceived();
        }
    }
    if (checkReq != null)
        sendCheckUpdateRequest(checkReq);
    else if (rcvAll)
        finishUpdateFuture(opRes0, err0, remapTopVer0, futId);
    return false;
}
Also used : GridCacheReturn(org.apache.ignite.internal.processors.cache.GridCacheReturn) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) CachePartialUpdateCheckedException(org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException)

Aggregations

CachePartialUpdateCheckedException (org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException)17 AffinityTopologyVersion (org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion)12 GridCacheReturn (org.apache.ignite.internal.processors.cache.GridCacheReturn)9 Map (java.util.Map)4 ClusterTopologyCheckedException (org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)4 KeyCacheObject (org.apache.ignite.internal.processors.cache.KeyCacheObject)4 CacheObject (org.apache.ignite.internal.processors.cache.CacheObject)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 UUID (java.util.UUID)2 EntryProcessorException (javax.cache.processor.EntryProcessorException)2 EntryProcessorResult (javax.cache.processor.EntryProcessorResult)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)2 ClusterTopologyServerNotFoundException (org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException)2 GridCacheEntryEx (org.apache.ignite.internal.processors.cache.GridCacheEntryEx)2 GridCacheEntryRemovedException (org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException)2 GridFinishedFuture (org.apache.ignite.internal.util.future.GridFinishedFuture)2 Collection (java.util.Collection)1 EntryProcessor (javax.cache.processor.EntryProcessor)1