Search in sources :

Example 1 with GridNearTxPrepareFutureAdapter

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);
    }
}
Also used : GridNearTxPrepareFutureAdapter(org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFutureAdapter) TraceSurroundings(org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings)

Example 2 with GridNearTxPrepareFutureAdapter

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");
    }
}
Also used : KEYSTORE_PATH(org.apache.ignite.internal.encryption.AbstractEncryptionTest.KEYSTORE_PATH) Arrays(java.util.Arrays) KeystoreEncryptionSpi(org.apache.ignite.spi.encryption.keystore.KeystoreEncryptionSpi) IgniteEx(org.apache.ignite.internal.IgniteEx) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) DirectoryStream(java.nio.file.DirectoryStream) DFLT_CHECKPOINT_FREQ(org.apache.ignite.configuration.DataStorageConfiguration.DFLT_CHECKPOINT_FREQ) ByteArrayInputStream(java.io.ByteArrayInputStream) IDLE_DUMP_FILE_PREFIX(org.apache.ignite.internal.processors.cache.verify.VerifyBackupPartitionsDumpTask.IDLE_DUMP_FILE_PREFIX) Arrays.asList(java.util.Arrays.asList) Path(java.nio.file.Path) GridDhtTxPrepareFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture) WALMode(org.apache.ignite.configuration.WALMode) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) GridClientFactory(org.apache.ignite.internal.client.GridClientFactory) CommandHandler(org.apache.ignite.internal.commandline.CommandHandler) Collection(java.util.Collection) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) IgniteCache(org.apache.ignite.IgniteCache) DFLT_REENCRYPTION_RATE_MBPS(org.apache.ignite.configuration.EncryptionConfiguration.DFLT_REENCRYPTION_RATE_MBPS) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) EncryptionConfiguration(org.apache.ignite.configuration.EncryptionConfiguration) Files.newDirectoryStream(java.nio.file.Files.newDirectoryStream) Handler(java.util.logging.Handler) TestRecordingCommunicationSpi(org.apache.ignite.internal.TestRecordingCommunicationSpi) Objects.nonNull(java.util.Objects.nonNull) Files.delete(java.nio.file.Files.delete) System.lineSeparator(java.lang.System.lineSeparator) ByteArrayOutputStream(java.io.ByteArrayOutputStream) U(org.apache.ignite.internal.util.typedef.internal.U) ArrayList(java.util.ArrayList) ClusterNode(org.apache.ignite.cluster.ClusterNode) IdleVerify(org.apache.ignite.internal.commandline.cache.IdleVerify) String.join(java.lang.String.join) KEYSTORE_PASSWORD(org.apache.ignite.internal.encryption.AbstractEncryptionTest.KEYSTORE_PASSWORD) IgniteInternalTx(org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx) IgnitePredicate(org.apache.ignite.lang.IgnitePredicate) AtomicConfiguration(org.apache.ignite.configuration.AtomicConfiguration) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) GridCommandHandlerTestUtils.addSslParams(org.apache.ignite.util.GridCommandHandlerTestUtils.addSslParams) PrintStream(java.io.PrintStream) G(org.apache.ignite.internal.util.typedef.G) F(org.apache.ignite.internal.util.typedef.F) DFLT_REENCRYPTION_BATCH_SIZE(org.apache.ignite.configuration.EncryptionConfiguration.DFLT_REENCRYPTION_BATCH_SIZE) GridNearTxPrepareFutureAdapter(org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFutureAdapter) Ignite(org.apache.ignite.Ignite) File(java.io.File) GridCacheFuture(org.apache.ignite.internal.processors.cache.GridCacheFuture) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty) ConnectorConfiguration(org.apache.ignite.configuration.ConnectorConfiguration) Paths(java.nio.file.Paths) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) IGNITE_ENABLE_EXPERIMENTAL_COMMAND(org.apache.ignite.IgniteSystemProperties.IGNITE_ENABLE_EXPERIMENTAL_COMMAND) EVT_CONSISTENCY_VIOLATION(org.apache.ignite.events.EventType.EVT_CONSISTENCY_VIOLATION) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) InputStream(java.io.InputStream) IgniteInternalTx(org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx) IgniteEx(org.apache.ignite.internal.IgniteEx) Ignite(org.apache.ignite.Ignite) GridNearTxPrepareFutureAdapter(org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFutureAdapter) GridDhtTxPrepareFuture(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture) GridCacheFuture(org.apache.ignite.internal.processors.cache.GridCacheFuture)

Aggregations

GridNearTxPrepareFutureAdapter (org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFutureAdapter)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 InputStream (java.io.InputStream)1 PrintStream (java.io.PrintStream)1 String.join (java.lang.String.join)1 System.lineSeparator (java.lang.System.lineSeparator)1 DirectoryStream (java.nio.file.DirectoryStream)1 Files.delete (java.nio.file.Files.delete)1 Files.newDirectoryStream (java.nio.file.Files.newDirectoryStream)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 List (java.util.List)1 Objects.nonNull (java.util.Objects.nonNull)1 Handler (java.util.logging.Handler)1