if (initialized()) throw new IllegalStateException("SELECT FOR UPDATE future has been initialized already."); onDone(timeoutException()); onDone(tx.timedOut() ? tx.timeoutException() : tx.rollbackException()); onDone(e); map(n); markInitialized();
/** * @param node Node. */ private void map(ClusterNode node) { GridDistributedTxMapping mapping = tx.mappings().get(node.id()); if (mapping == null) tx.mappings().put(mapping = new GridDistributedTxMapping(node)); mapping.markQueryUpdate(); if (node.isLocal()) tx.colocatedLocallyMapped(true); int futId = futuresCountNoLock(); miniFutIds.put(node.id(), futId); add(new NodeFuture(node)); }
/** * Initialize this future for distributed execution. * @param topVer Topology version. * @param nodes Nodes to run query on. */ public synchronized void init(AffinityTopologyVersion topVer, Collection<ClusterNode> nodes) { doInit(topVer, nodes, false); }
/** * Finds pending map node future by the given ID. * * @param nodeId Node id. * @return Map node future. */ private NodeFuture mapFuture(UUID nodeId) { synchronized (this) { Integer idx = miniFutIds.get(nodeId); if (idx == null) throw new IllegalStateException("SELECT FOR UPDATE node future not found [nodeId=" + nodeId + "]."); assert idx >= 0 && idx < futuresCountNoLock(); IgniteInternalFuture<Long> fut = future(idx); if (!fut.isDone()) return (NodeFuture)fut; } return null; }
/** {@inheritDoc} */ @Override public void onTimeout() { if (log.isDebugEnabled()) log.debug("Timed out waiting for lock response: " + this); onDone(timeoutException()); }
sfuFut = new GridNearTxSelectForUpdateFuture(cctx, tx, opTimeout); sfuFut.initLocal();
/** {@inheritDoc} */ @Override public boolean onNodeLeft(UUID nodeId) { if (topVer == null) return false; // Local query, do nothing. for (IgniteInternalFuture<?> fut : futures()) { NodeFuture f = (NodeFuture)fut; if (f.node.id().equals(nodeId)) { if (log.isDebugEnabled()) log.debug("Found mini-future for left node [nodeId=" + nodeId + ", mini=" + f + ", fut=" + this + ']'); ClusterTopologyCheckedException topEx = new ClusterTopologyCheckedException("Failed to enlist keys " + "(primary node left grid, retry transaction if possible) [node=" + nodeId + ']'); topEx.retryReadyFuture(cctx.shared().nextAffinityReadyFuture(topVer)); return f.onResult(0, false, topEx); } } if (log.isDebugEnabled()) log.debug("Future does not have mapping for left node (ignoring) [nodeId=" + nodeId + ", fut=" + this + ']'); return false; }
/** {@inheritDoc} */ @Override public void onTimeout() { if (log.isDebugEnabled()) log.debug("Timed out waiting for lock response: " + this); onDone(timeoutException()); }
/** * Finds pending map node future by the given ID. * * @param nodeId Node id. * @return Map node future. */ private NodeFuture mapFuture(UUID nodeId) { synchronized (this) { Integer idx = miniFutIds.get(nodeId); if (idx == null) throw new IllegalStateException("SELECT FOR UPDATE node future not found [nodeId=" + nodeId + "]."); assert idx >= 0 && idx < futuresCountNoLock(); IgniteInternalFuture<Long> fut = future(idx); if (!fut.isDone()) return (NodeFuture)fut; } return null; }
sfuFut = new GridNearTxSelectForUpdateFuture(cctx, tx, opTimeout); sfuFut.initLocal();
/** {@inheritDoc} */ @Override public boolean onNodeLeft(UUID nodeId) { if (topVer == null) return false; // Local query, do nothing. for (IgniteInternalFuture<?> fut : futures()) { NodeFuture f = (NodeFuture)fut; if (f.node.id().equals(nodeId)) { if (log.isDebugEnabled()) log.debug("Found mini-future for left node [nodeId=" + nodeId + ", mini=" + f + ", fut=" + this + ']'); ClusterTopologyCheckedException topEx = new ClusterTopologyCheckedException("Failed to enlist keys " + "(primary node left grid, retry transaction if possible) [node=" + nodeId + ']'); topEx.retryReadyFuture(cctx.shared().nextAffinityReadyFuture(topVer)); return f.onResult(0, false, topEx); } } if (log.isDebugEnabled()) log.debug("Future does not have mapping for left node (ignoring) [nodeId=" + nodeId + ", fut=" + this + ']'); return false; }
if (initialized()) throw new IllegalStateException("SELECT FOR UPDATE future has been initialized already."); onDone(timeoutException()); onDone(tx.timedOut() ? tx.timeoutException() : tx.rollbackException()); onDone(e); map(n); markInitialized();
/** * @param node Node. */ private void map(ClusterNode node) { GridDistributedTxMapping mapping = tx.mappings().get(node.id()); if (mapping == null) tx.mappings().put(mapping = new GridDistributedTxMapping(node)); mapping.markQueryUpdate(); if (node.isLocal()) tx.colocatedLocallyMapped(true); int futId = futuresCountNoLock(); miniFutIds.put(node.id(), futId); add(new NodeFuture(node)); }
/** * Initialize this future for local execution. */ public synchronized void initLocal() { doInit(null, Collections.singletonList(cctx.localNode()), true); }
/** * Initialize this future for distributed execution. * @param topVer Topology version. * @param nodes Nodes to run query on. */ public synchronized void init(AffinityTopologyVersion topVer, Collection<ClusterNode> nodes) { doInit(topVer, nodes, false); }
/** * Initialize this future for local execution. */ public synchronized void initLocal() { doInit(null, Collections.singletonList(cctx.localNode()), true); }