use of org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFutureAdapter in project ignite by apache.
the class IgniteTxHandler method processNearTxPrepareResponse.
/**
* @param nodeId Node ID.
* @param res Response.
*/
private void processNearTxPrepareResponse(UUID nodeId, GridNearTxPrepareResponse res) {
try (TraceSurroundings ignored = MTC.support(ctx.kernalContext().tracing().create(TX_NEAR_PREPARE_RESP, MTC.span()))) {
if (txPrepareMsgLog.isDebugEnabled())
txPrepareMsgLog.debug("Received near prepare response [txId=" + res.version() + ", node=" + nodeId + ']');
GridNearTxPrepareFutureAdapter fut = (GridNearTxPrepareFutureAdapter) ctx.mvcc().<IgniteInternalTx>versionedFuture(res.version(), res.futureId());
if (fut == null) {
U.warn(log, "Failed to find future for near prepare response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']');
return;
}
IgniteInternalTx tx = fut.tx();
assert tx != null;
res.txState(tx.txState());
fut.onResult(nodeId, res);
}
}
use of org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFutureAdapter in project ignite by apache.
the class GridCommandHandlerAbstractTest method checkUserFutures.
/**
* Checks if all non-system txs and non-system mvcc futures are finished.
*/
protected void checkUserFutures() {
for (Ignite ignite : G.allGrids()) {
IgniteEx ig = (IgniteEx) ignite;
final Collection<GridCacheFuture<?>> futs = ig.context().cache().context().mvcc().activeFutures();
boolean hasFutures = false;
for (GridCacheFuture<?> fut : futs) {
if (!fut.isDone()) {
// skipping system tx futures if possible
if (fut instanceof GridNearTxPrepareFutureAdapter && ((GridNearTxPrepareFutureAdapter) fut).tx().system())
continue;
if (fut instanceof GridDhtTxPrepareFuture && ((GridDhtTxPrepareFuture) fut).tx().system())
continue;
log.error("Expecting no active future [node=" + ig.localNode().id() + ", fut=" + fut + ']');
hasFutures = true;
}
}
if (hasFutures)
fail("Some mvcc futures are not finished");
Collection<IgniteInternalTx> txs = ig.context().cache().context().tm().activeTransactions().stream().filter(tx -> !tx.system()).collect(Collectors.toSet());
for (IgniteInternalTx tx : txs) log.error("Expecting no active transaction [node=" + ig.localNode().id() + ", tx=" + tx + ']');
if (!txs.isEmpty())
fail("Some transaction are not finished");
}
}
Aggregations