/** {@inheritDoc} */ @Override public String toString() { Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() { @Override public String apply(IgniteInternalFuture<?> f) { if (f instanceof MiniFuture) { return "[node=" + ((MiniFuture)f).primary().id() + ", loc=" + ((MiniFuture)f).primary().isLocal() + ", done=" + f.isDone() + "]"; } else return f.toString(); } }); return S.toString(GridNearPessimisticTxPrepareFuture.class, this, "innerFuts", futs, "txId", tx.nearXidVersion(), "super", super.toString()); }
/** {@inheritDoc} */ @Override public void onResult(UUID nodeId, GridNearTxPrepareResponse res) { if (!isDone()) { MiniFuture mini = miniFuture(res.miniId()); if (mini != null) { assert mini.node().id().equals(nodeId); mini.onResult(res); } else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near optimistic prepare fut, failed to find mini future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + ", fut=" + this + ']'); } } } else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near optimistic prepare fut, response for finished future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + ", fut=" + this + ']'); } } }
/** * @param e Node failure. * @param discoThread {@code True} if executed from discovery thread. */ void onNodeLeft(ClusterTopologyCheckedException e, boolean discoThread) { if (msgLog.isDebugEnabled()) { msgLog.debug("Near optimistic prepare fut, mini future node left [txId=" + parent.tx.nearXidVersion() + ", node=" + m.primary().id() + ']'); } if (isDone()) return; if (RCV_RES_UPD.compareAndSet(this, 0, 1)) { if (log.isDebugEnabled()) log.debug("Remote node left grid while sending or waiting for reply (will not retry): " + this); // Fail the whole future (make sure not to remap on different primary node // to prevent multiple lock coordinators). parent.onError(e, discoThread); } }
/** {@inheritDoc} */ @Override public void onResult(UUID nodeId, GridNearTxPrepareResponse res) { if (!isDone()) { assert res.clientRemapVersion() == null : res; MiniFuture f = miniFuture(res.miniId()); if (f != null) { assert f.primary().id().equals(nodeId); f.onResult(res, true); } else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near pessimistic prepare, failed to find mini future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + ", fut=" + this + ']'); } } } else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near pessimistic prepare, response for finished future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + ", fut=" + this + ']'); } } }
/** */ private void checkScenario(IgniteEx ign, int srvCnt, ImmutableMap<UUID, Set<UUID>> txNodes, Runnable r) throws Exception { try (Transaction userTx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { r.run(); GridNearTxLocal nearTx = ((TransactionProxyImpl)userTx).tx(); nearTx.prepareNearTxLocal().get(); List<IgniteInternalTx> txs = IntStream.range(0, srvCnt) .mapToObj(i -> txsOnNode(grid(i), nearTx.nearXidVersion())) .flatMap(Collection::stream) .collect(Collectors.toList()); assertFalse(txs.isEmpty()); txs.forEach(tx -> assertEquals(txNodes, repack(tx.transactionNodes()))); } }
else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near finish fut, failed to find mini future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + msgLog.debug("Near finish fut, response for finished future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res +
msgLog.debug("Near finish fut, failed to find mini future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + msgLog.debug("Near finish fut, response for finished future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res +
/** * @param e Error. */ void onNodeLeft(ClusterTopologyCheckedException e) { if (msgLog.isDebugEnabled()) { msgLog.debug("Near pessimistic prepare, mini future node left [txId=" + tx.nearXidVersion() + ", nodeId=" + m.primary().id() + ']'); } if (tx.onePhaseCommit()) { tx.markForBackupCheck(); // Do not fail future for one-phase transaction right away. onDone((GridNearTxPrepareResponse)null); } onError(e); }
tx0.nearXidVersion(), tx0.mvccSnapshot(), tx0.threadId(),
GridCacheVersion nearVer = tx.nearXidVersion();
GridCacheVersion nearXidVer = tx.nearXidVersion(); if (msgLog.isDebugEnabled()) { msgLog.debug("Near finish fut, failed to finish [" + "txId=" + tx.nearXidVersion() + ", node=" + backup.id() + ", err=" + e + ']'); "txId=" + tx.nearXidVersion() + ", node=" + backup.id() + ']'); if (msgLog.isDebugEnabled()) { msgLog.debug("Near finish fut, failed to send check committed request [" + "txId=" + tx.nearXidVersion() + ", node=" + backup.id() + ", err=" + e + ']');
msgLog.debug("Near pessimistic prepare, sent request [txId=" + tx.nearXidVersion() + ", node=" + primary.id() + ']'); msgLog.debug("Near pessimistic prepare, failed send request [txId=" + tx.nearXidVersion() + ", node=" + primary.id() + ", err=" + e + ']');
txFinishMsgLog.debug("Received dht finish check committed response [txId=" + fut.tx().nearXidVersion() + ", dhtTxId=" + res.xid() + ", node=" + nodeId + ']');
"txId=" + tx.nearXidVersion() + ", node=" + n.id() + ']'); if (msgLog.isDebugEnabled()) { msgLog.debug("Near finish fut, failed to send request [" + "txId=" + tx.nearXidVersion() + ", node=" + n.id() + ", err=" + e + ']');
msgLog.debug("Near optimistic prepare fut, sent request [txId=" + tx.nearXidVersion() + ", node=" + n.id() + ']'); msgLog.debug("Near optimistic prepare fut, failed to sent request [txId=" + tx.nearXidVersion() + ", node=" + n.id() + ", err=" + e + ']');
/** {@inheritDoc} */ @Override public String toString() { Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() { @Override public String apply(IgniteInternalFuture<?> f) { if (f instanceof MiniFuture) { return "[node=" + ((MiniFuture)f).primary().id() + ", loc=" + ((MiniFuture)f).primary().isLocal() + ", done=" + f.isDone() + "]"; } else return f.toString(); } }); return S.toString(GridNearPessimisticTxPrepareFuture.class, this, "innerFuts", futs, "txId", tx.nearXidVersion(), "super", super.toString()); }
/** {@inheritDoc} */ @Override public void onResult(UUID nodeId, GridNearTxPrepareResponse res) { if (!isDone()) { MiniFuture mini = miniFuture(res.miniId()); if (mini != null) { assert mini.node().id().equals(nodeId); mini.onResult(res); } else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near optimistic prepare fut, failed to find mini future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + ", fut=" + this + ']'); } } } else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near optimistic prepare fut, response for finished future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + ", fut=" + this + ']'); } } }
/** * @param e Node failure. * @param discoThread {@code True} if executed from discovery thread. */ void onNodeLeft(ClusterTopologyCheckedException e, boolean discoThread) { if (msgLog.isDebugEnabled()) { msgLog.debug("Near optimistic prepare fut, mini future node left [txId=" + parent.tx.nearXidVersion() + ", node=" + m.primary().id() + ']'); } if (isDone()) return; if (RCV_RES_UPD.compareAndSet(this, 0, 1)) { if (log.isDebugEnabled()) log.debug("Remote node left grid while sending or waiting for reply (will not retry): " + this); // Fail the whole future (make sure not to remap on different primary node // to prevent multiple lock coordinators). parent.onError(e, discoThread); } }
/** {@inheritDoc} */ @Override public void onResult(UUID nodeId, GridNearTxPrepareResponse res) { if (!isDone()) { assert res.clientRemapVersion() == null : res; MiniFuture f = miniFuture(res.miniId()); if (f != null) { assert f.primary().id().equals(nodeId); f.onResult(res, true); } else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near pessimistic prepare, failed to find mini future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + ", fut=" + this + ']'); } } } else { if (msgLog.isDebugEnabled()) { msgLog.debug("Near pessimistic prepare, response for finished future [txId=" + tx.nearXidVersion() + ", node=" + nodeId + ", res=" + res + ", fut=" + this + ']'); } } }
/** * @param e Error. */ void onNodeLeft(ClusterTopologyCheckedException e) { if (msgLog.isDebugEnabled()) { msgLog.debug("Near pessimistic prepare, mini future node left [txId=" + tx.nearXidVersion() + ", nodeId=" + m.primary().id() + ']'); } if (tx.onePhaseCommit()) { tx.markForBackupCheck(); // Do not fail future for one-phase transaction right away. onDone((GridNearTxPrepareResponse)null); } onError(e); }