Search in sources :

Example 1 with GridCacheTxRecoveryFuture

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

the class IgniteTxHandler method processCheckPreparedTxResponse.

/**
     * @param nodeId Node ID.
     * @param res Response.
     */
protected void processCheckPreparedTxResponse(UUID nodeId, GridCacheTxRecoveryResponse res) {
    if (txRecoveryMsgLog.isDebugEnabled()) {
        txRecoveryMsgLog.debug("Received tx recovery response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']');
    }
    GridCacheTxRecoveryFuture fut = (GridCacheTxRecoveryFuture) ctx.mvcc().future(res.futureId());
    if (fut == null) {
        if (txRecoveryMsgLog.isDebugEnabled()) {
            txRecoveryMsgLog.debug("Failed to find future for tx recovery response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']');
        }
        return;
    } else
        res.txState(fut.tx().txState());
    fut.onResult(nodeId, res);
}
Also used : GridCacheTxRecoveryFuture(org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture)

Example 2 with GridCacheTxRecoveryFuture

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

the class IgniteTxManager method commitIfPrepared.

/**
     * Commits transaction in case when node started transaction failed, but all related
     * transactions were prepared (invalidates transaction if it is not fully prepared).
     *
     * @param tx Transaction.
     * @param failedNodeIds Failed nodes IDs.
     */
public void commitIfPrepared(IgniteInternalTx tx, Set<UUID> failedNodeIds) {
    assert tx instanceof GridDhtTxLocal || tx instanceof GridDhtTxRemote : tx;
    assert !F.isEmpty(tx.transactionNodes()) : tx;
    assert tx.nearXidVersion() != null : tx;
    GridCacheTxRecoveryFuture fut = new GridCacheTxRecoveryFuture(cctx, tx, failedNodeIds, tx.transactionNodes());
    cctx.mvcc().addFuture(fut, fut.futureId());
    if (log.isDebugEnabled())
        log.debug("Checking optimistic transaction state on remote nodes [tx=" + tx + ", fut=" + fut + ']');
    fut.prepare();
}
Also used : GridDhtTxRemote(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote) GridDhtTxLocal(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal) GridCacheTxRecoveryFuture(org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture)

Aggregations

GridCacheTxRecoveryFuture (org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture)2 GridDhtTxLocal (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal)1 GridDhtTxRemote (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote)1