Repository: ignite Updated Branches: refs/heads/ignite-8446 87e546c60 -> de0b1a70d
IGNITE-8446 Ability to check and completely fill transactions on creation Signed-off-by: Anton Vinogradov <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/de0b1a70 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/de0b1a70 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/de0b1a70 Branch: refs/heads/ignite-8446 Commit: de0b1a70d15298a773780733a99eb93c737a29a0 Parents: 87e546c Author: Anton Vinogradov <[email protected]> Authored: Thu May 31 18:12:48 2018 +0300 Committer: Anton Vinogradov <[email protected]> Committed: Thu May 31 18:12:48 2018 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/IgniteTransactions.java | 5 - .../org/apache/ignite/events/EventType.java | 58 ++++- .../ignite/events/TransactionStartedEvent.java | 55 ----- .../events/TransactionStateChangedEvent.java | 55 +++++ .../cache/distributed/near/GridNearTxLocal.java | 6 +- .../transactions/IgniteTransactionsImpl.java | 16 +- .../cache/transactions/IgniteTxAdapter.java | 176 +++++++++++++- .../cache/transactions/IgniteTxManager.java | 5 +- .../cache/transactions/TxLabelTest.java | 132 +---------- .../TxRollbackOnIncorrectParamsTest.java | 237 +++++++++++++++++++ .../transactions/TxStateChangeEventTest.java | 213 +++++++++++++++++ .../cache/transactions/TxTimeoutTest.java | 159 ------------- .../testsuites/IgniteCacheTestSuite6.java | 4 +- 13 files changed, 757 insertions(+), 364 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java b/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java index 626d381..2bb7101 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteTransactions.java @@ -124,9 +124,4 @@ public interface IgniteTransactions { * @throws NullPointerException if label is null. */ public IgniteTransactions withLabel(String lb); - - /** - * @return Transaction label. - */ - public String label(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/main/java/org/apache/ignite/events/EventType.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/EventType.java b/modules/core/src/main/java/org/apache/ignite/events/EventType.java index e814d1a..9181539 100644 --- a/modules/core/src/main/java/org/apache/ignite/events/EventType.java +++ b/modules/core/src/main/java/org/apache/ignite/events/EventType.java @@ -788,11 +788,59 @@ public interface EventType { * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for * internal Ignite events and should not be used by user-defined events. * - * @see WalSegmentArchivedEvent + * @see TransactionStateChangedEvent */ public static final int EVT_TX_STARTED = 129; /** + * Built-in event type: Transaction has been committed. + * <p> + * Fired for each committed transactions except system transactions. + * <p> + * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for + * internal Ignite events and should not be used by user-defined events. + * + * @see TransactionStateChangedEvent + */ + public static final int EVT_TX_COMMITTED = 130; + + /** + * Built-in event type: Transaction has been rolled back. + * <p> + * Fired for each rolled back transactions except system transactions. + * <p> + * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for + * internal Ignite events and should not be used by user-defined events. + * + * @see TransactionStateChangedEvent + */ + public static final int EVT_TX_ROLLED_BACK = 131; + + /** + * Built-in event type: Transaction has been suspended. + * <p> + * Fired for each started suspended except system transactions. + * <p> + * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for + * internal Ignite events and should not be used by user-defined events. + * + * @see TransactionStateChangedEvent + */ + public static final int EVT_TX_SUSPENDED = 132; + + /** + * Built-in event type: Transaction has been resumed. + * <p> + * Fired for each resumed transactions except system transactions. + * <p> + * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for + * internal Ignite events and should not be used by user-defined events. + * + * @see TransactionStateChangedEvent + */ + public static final int EVT_TX_RESUMED = 133; + + /** * All checkpoint events. This array can be directly passed into * {@link IgniteEvents#localListen(IgnitePredicate, int...)} method to * subscribe to all checkpoint events. @@ -995,10 +1043,14 @@ public interface EventType { * {@link IgniteEvents#localListen(IgnitePredicate, int...)} method to * subscribe to all transaction events. * - * @see TransactionStartedEvent + * @see TransactionStateChangedEvent */ public static final int[] EVTS_TX = { - EVT_TX_STARTED + EVT_TX_STARTED, + EVT_TX_COMMITTED, + EVT_TX_ROLLED_BACK, + EVT_TX_SUSPENDED, + EVT_TX_RESUMED }; /** http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/main/java/org/apache/ignite/events/TransactionStartedEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/TransactionStartedEvent.java b/modules/core/src/main/java/org/apache/ignite/events/TransactionStartedEvent.java deleted file mode 100644 index dbe7d32..0000000 --- a/modules/core/src/main/java/org/apache/ignite/events/TransactionStartedEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.events; - -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cluster.ClusterNode; - -/** - * Event indicates transaction creation. - * - * @see EventType#EVTS_TX - */ -public class TransactionStartedEvent extends EventAdapter { - /** */ - private static final long serialVersionUID = 0L; - - /** Tx. */ - private IgniteTransactions tx; - - /** - * @param node Node. - * @param msg Message. - * @param type Type. - * @param tx Tx. - */ - public TransactionStartedEvent(ClusterNode node, String msg, int type, IgniteTransactions tx) { - super(node, msg, type); - - assert tx != null; - - this.tx = tx; - } - - /** - * - */ - public IgniteTransactions tx() { - return tx; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/main/java/org/apache/ignite/events/TransactionStateChangedEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/TransactionStateChangedEvent.java b/modules/core/src/main/java/org/apache/ignite/events/TransactionStateChangedEvent.java new file mode 100644 index 0000000..6c2998f --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/events/TransactionStateChangedEvent.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.events; + +import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.transactions.Transaction; + +/** + * Event indicates transaction state change. + * + * @see EventType#EVTS_TX + */ +public class TransactionStateChangedEvent extends EventAdapter { + /** */ + private static final long serialVersionUID = 0L; + + /** Tx. */ + private Transaction tx; + + /** + * @param node Node. + * @param msg Message. + * @param type Type. + * @param tx Tx. + */ + public TransactionStateChangedEvent(ClusterNode node, String msg, int type, Transaction tx) { + super(node, msg, type); + + assert tx != null; + + this.tx = tx; + } + + /** + * + */ + public Transaction tx() { + return tx; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index 16653e0..ce1c4cc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -47,10 +47,10 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.GridCacheEntryEx; import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException; import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate; -import org.apache.ignite.internal.processors.cache.GridCacheVersionedFuture; import org.apache.ignite.internal.processors.cache.GridCacheOperation; import org.apache.ignite.internal.processors.cache.GridCacheReturn; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; +import org.apache.ignite.internal.processors.cache.GridCacheVersionedFuture; import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy; import org.apache.ignite.internal.processors.cache.KeyCacheObject; import org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheEntry; @@ -3981,9 +3981,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements GridTimeou return hasRemoteLocks; } - /** - * @return Public API proxy. - */ + /** {@inheritDoc} */ public TransactionProxy proxy() { if (proxy == null) proxy = new TransactionProxyImpl(this, cctx, false); http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java index b5e3a45..25ba849 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java @@ -20,9 +20,7 @@ package org.apache.ignite.internal.processors.cache.transactions; import java.util.Collection; import org.apache.ignite.IgniteTransactions; import org.apache.ignite.configuration.TransactionConfiguration; -import org.apache.ignite.events.TransactionStartedEvent; import org.apache.ignite.internal.IgniteTransactionsEx; -import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; @@ -33,13 +31,11 @@ import org.apache.ignite.lang.IgniteClosure; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionException; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionMetrics; +import org.apache.ignite.transactions.TransactionException; import org.jetbrains.annotations.Nullable; -import static org.apache.ignite.events.EventType.EVT_TX_STARTED; - /** * Grid transactions implementation. */ @@ -185,11 +181,6 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { assert tx != null; - GridEventStorageManager evt = cctx.gridEvents(); - - if (sysCacheCtx == null /* ignoring system tx */ && evt.isRecordable(EVT_TX_STARTED)) - evt.record(new TransactionStartedEvent(cctx.discovery().localNode(), null, EVT_TX_STARTED, this)); - return tx; } finally { @@ -234,11 +225,6 @@ public class IgniteTransactionsImpl<K, V> implements IgniteTransactionsEx { return new IgniteTransactionsImpl<>(cctx, lb); } - /** {@inheritDoc} */ - @Override public String label() { - return lb; - } - /** * @param ctx Cache context. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java index 3cf1146..9956d9d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java @@ -43,8 +43,10 @@ import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.events.TransactionStateChangedEvent; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.managers.discovery.ConsistentIdMapper; +import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager; import org.apache.ignite.internal.pagemem.wal.WALPointer; import org.apache.ignite.internal.pagemem.wal.record.TxRecord; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; @@ -65,8 +67,8 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheLazyPlainVer import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext; import org.apache.ignite.internal.processors.cache.version.GridCacheVersionedEntryEx; -import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException; import org.apache.ignite.internal.processors.cluster.BaselineTopology; +import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException; import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException; import org.apache.ignite.internal.util.GridSetWrapper; import org.apache.ignite.internal.util.future.GridFutureAdapter; @@ -80,7 +82,9 @@ import org.apache.ignite.internal.util.typedef.T2; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.lang.IgniteAsyncSupport; import org.apache.ignite.lang.IgniteBiTuple; +import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; @@ -88,6 +92,10 @@ import org.apache.ignite.transactions.TransactionState; import org.jetbrains.annotations.Nullable; import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ; +import static org.apache.ignite.events.EventType.EVT_TX_COMMITTED; +import static org.apache.ignite.events.EventType.EVT_TX_RESUMED; +import static org.apache.ignite.events.EventType.EVT_TX_ROLLED_BACK; +import static org.apache.ignite.events.EventType.EVT_TX_SUSPENDED; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.CREATE; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.NOOP; @@ -1008,6 +1016,8 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement protected final boolean state(TransactionState state, boolean timedOut) { boolean valid = false; + int evtType = -1; + TransactionState prev; boolean notify = false; @@ -1021,6 +1031,8 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement case ACTIVE: { valid = prev == SUSPENDED; + evtType = EVT_TX_RESUMED; + break; } case PREPARING: { @@ -1054,6 +1066,8 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement valid = prev == COMMITTING; + evtType = EVT_TX_COMMITTED; + break; } @@ -1063,6 +1077,8 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement valid = prev == ROLLING_BACK; + evtType = EVT_TX_ROLLED_BACK; + break; } @@ -1082,6 +1098,8 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement case SUSPENDED: { valid = prev == ACTIVE; + evtType = EVT_TX_SUSPENDED; + break; } } @@ -1095,6 +1113,9 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement if (log.isDebugEnabled()) log.debug("Changed transaction state [prev=" + prev + ", new=" + this.state + ", tx=" + this + ']'); + if (evtType != -1) + recordStateChangedEvent(evtType); + notifyAll(); } else { @@ -1160,6 +1181,17 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement return valid; } + /** + * @param type Event type. + */ + public void recordStateChangedEvent(int type){ + GridEventStorageManager evt = cctx.gridEvents(); + + if (!system() /* ignoring system tx */ && evt.isRecordable(type)) + evt.record(new TransactionStateChangedEvent( + cctx.discovery().localNode(), null, type, proxy())); + } + /** {@inheritDoc} */ @Override public void endVersion(GridCacheVersion endVer) { this.endVer = endVer; @@ -1203,6 +1235,13 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement this.sysInvalidate = sysInvalidate; } + /** + * @return Public API proxy. + */ + public TransactionProxy proxy() { + return new DefaultTransactionProxyImpl(this); + } + /** {@inheritDoc} */ @Nullable @Override public Map<UUID, Collection<UUID>> transactionNodes() { return txNodes; @@ -2412,4 +2451,139 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement return S.toString(TxFinishFuture.class, this, "duration", duration); } } + + /** + * Default proxy. + */ + private static class DefaultTransactionProxyImpl implements TransactionProxy{ + /** Tx. */ + private IgniteTxAdapter tx; + + /** + * @param tx Tx. + */ + public DefaultTransactionProxyImpl(IgniteTxAdapter tx) { + this.tx = tx; + } + + /** {@inheritDoc} */ + @Override public IgniteUuid xid() { + return tx.xid(); + } + + /** {@inheritDoc} */ + @Override public UUID nodeId() { + return tx.nodeId(); + } + + /** {@inheritDoc} */ + @Override public long threadId() { + return tx.threadId(); + } + + /** {@inheritDoc} */ + @Override public long startTime() { + return tx.startTime(); + } + + /** {@inheritDoc} */ + @Override public TransactionIsolation isolation() { + return tx.isolation(); + } + + /** {@inheritDoc} */ + @Override public TransactionConcurrency concurrency() { + return tx.concurrency(); + } + + /** {@inheritDoc} */ + @Override public boolean implicit() { + return tx.implicit(); + } + + /** {@inheritDoc} */ + @Override public boolean isInvalidate() { + return tx.isInvalidate(); + } + + /** {@inheritDoc} */ + @Override public TransactionState state() { + return tx.state(); + } + + /** {@inheritDoc} */ + @Override public long timeout() { + return tx.timeout(); + } + + /** {@inheritDoc} */ + @Override public long timeout(long timeout) { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public boolean setRollbackOnly() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public boolean isRollbackOnly() { + return tx.isRollbackOnly(); + } + + /** {@inheritDoc} */ + @Override public void commit() throws IgniteException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public IgniteFuture<Void> commitAsync() throws IgniteException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void close() throws IgniteException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void rollback() throws IgniteException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public IgniteFuture<Void> rollbackAsync() throws IgniteException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void resume() throws IgniteException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public void suspend() throws IgniteException { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Nullable @Override public String label() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public IgniteAsyncSupport withAsync() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public boolean isAsync() { + throw new UnsupportedOperationException(); + } + + /** {@inheritDoc} */ + @Override public <R> IgniteFuture<R> future() { + throw new UnsupportedOperationException(); + } + } } http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java index 86360b6..4dbbe85 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java @@ -51,9 +51,9 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedExceptio import org.apache.ignite.internal.processors.cache.GridCacheMapEntry; import org.apache.ignite.internal.processors.cache.GridCacheMessage; import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate; -import org.apache.ignite.internal.processors.cache.GridCacheVersionedFuture; import org.apache.ignite.internal.processors.cache.GridCacheReturnCompletableWrapper; import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter; +import org.apache.ignite.internal.processors.cache.GridCacheVersionedFuture; import org.apache.ignite.internal.processors.cache.GridDeferredAckMessageSender; import org.apache.ignite.internal.processors.cache.distributed.GridCacheMappedVersion; import org.apache.ignite.internal.processors.cache.distributed.GridCacheTxFinishSync; @@ -101,6 +101,7 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_TX_SALVAGE_TIMEOUT import static org.apache.ignite.IgniteSystemProperties.IGNITE_WAL_LOG_TX_RECORDS; import static org.apache.ignite.events.EventType.EVT_NODE_FAILED; import static org.apache.ignite.events.EventType.EVT_NODE_LEFT; +import static org.apache.ignite.events.EventType.EVT_TX_STARTED; import static org.apache.ignite.internal.GridTopic.TOPIC_TX; import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL; import static org.apache.ignite.internal.processors.cache.GridCacheOperation.READ; @@ -532,6 +533,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter { else sysThreadMap.put(new TxThreadKey(tx.threadId(), cacheCtx.cacheId()), tx); } + + ((GridNearTxLocal)tx).recordStateChangedEvent(EVT_TX_STARTED); } // Handle mapped versions. http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxLabelTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxLabelTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxLabelTest.java index 062a4e0..d89ba0b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxLabelTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxLabelTest.java @@ -18,41 +18,27 @@ package org.apache.ignite.internal.processors.cache.transactions; import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteEvents; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.events.Event; -import org.apache.ignite.events.TransactionStartedEvent; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest; import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionRollbackException; - -import static org.apache.ignite.events.EventType.EVTS_TX; -import static org.apache.ignite.events.EventType.EVT_TX_STARTED; /** * Tests transaction labels. */ -public class TxLabelTest extends GridCommonAbstractTest { +public class TxLabelTest extends GridCacheAbstractSelfTest { /** * Tests transaction labels. */ - public void testLabel() throws Exception { - Ignite ignite = startGrid(0); - - IgniteCache cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); - - testLabel0(grid(0), "lbl0", cache); - testLabel0(grid(0), "lbl1", cache); + public void testLabel() { + testLabel0(grid(0), "lbl0"); + testLabel0(grid(0), "lbl1"); try { - testLabel0(grid(0), null, cache); + testLabel0(grid(0), null); fail(); } - catch (NullPointerException e) { - assertTrue(e.getMessage().contains("label should not be empty.")); + catch (Exception e) { + // Expected. } } @@ -60,110 +46,18 @@ public class TxLabelTest extends GridCommonAbstractTest { * @param ignite Ignite. * @param lbl Label. */ - private void testLabel0(Ignite ignite, String lbl, IgniteCache cache) { - try (Transaction tx = ignite.transactions().withLabel(lbl).txStart()) { + private void testLabel0(Ignite ignite, String lbl) { + try(Transaction tx = ignite.transactions().withLabel(lbl).txStart()) { assertEquals(lbl, tx.label()); - cache.put(0, 0); - - tx.commit(); - } - } - - /** - * - */ - public void testLabelFilledLocalGuarantee() throws Exception { - Ignite ignite = startGrid(0); - - final IgniteEvents evts = ignite.events(); - - evts.enableLocal(EVTS_TX); - - evts.localListen((IgnitePredicate<Event>)e -> { - assert e instanceof TransactionStartedEvent; - - TransactionStartedEvent evt = (TransactionStartedEvent)e; - - IgniteTransactions tx = evt.tx(); - - if (tx.label() == null) - tx.tx().rollback(); - - return true; - }, EVT_TX_STARTED); - - try (Transaction tx = ignite.transactions().withLabel("test").txStart()) { - tx.commit(); - } - - try (Transaction tx = ignite.transactions().txStart()) { - tx.commit(); - - fail("Should fail prior this line."); - } - catch (TransactionRollbackException ignored) { - // No-op. - } - } - - /** - * - */ - public void testLabelFilledRemoteGuarantee() throws Exception { - Ignite ignite = startGrid(0); - Ignite remote = startGrid(1); - - final IgniteEvents evts = ignite.events(); - - evts.enableLocal(EVTS_TX); - - evts.remoteListen(null, - (IgnitePredicate<Event>)e -> { - assert e instanceof TransactionStartedEvent; + ignite.cache(DEFAULT_CACHE_NAME).put(0, 0); - TransactionStartedEvent evt = (TransactionStartedEvent)e; - - IgniteTransactions tx = evt.tx(); - - if (tx.label() == null) - tx.tx().rollback(); - - return true; - }, - EVT_TX_STARTED); - - try (Transaction tx = ignite.transactions().withLabel("test").txStart()) { tx.commit(); } - - try (Transaction tx = remote.transactions().withLabel("test").txStart()) { - tx.commit(); - } - - try (Transaction tx = ignite.transactions().txStart()) { - tx.commit(); - - fail("Should fail prior this line."); - } - catch (TransactionRollbackException ignored) { - // No-op. - } - - try (Transaction tx = remote.transactions().txStart()) { - tx.commit(); - - fail("Should fail prior this line."); - } - catch (TransactionRollbackException ignored) { - // No-op. - } } /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - super.afterTest(); - - stopAllGrids(); + @Override protected int gridCount() { + return 1; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java new file mode 100644 index 0000000..40916b8 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java @@ -0,0 +1,237 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.transactions; + +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteEvents; +import org.apache.ignite.events.Event; +import org.apache.ignite.events.TransactionStateChangedEvent; +import org.apache.ignite.lang.IgnitePredicate; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.apache.ignite.transactions.Transaction; +import org.apache.ignite.transactions.TransactionConcurrency; +import org.apache.ignite.transactions.TransactionIsolation; +import org.apache.ignite.transactions.TransactionRollbackException; + +import static org.apache.ignite.events.EventType.EVTS_TX; +import static org.apache.ignite.events.EventType.EVT_TX_STARTED; + +/** + * Tests transaction timeout. + */ +public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { + /** + * + */ + public void testTimeoutSetLocalGuarantee() throws Exception { + Ignite ignite = startGrid(0); + + final IgniteEvents evts = ignite.events(); + + evts.enableLocal(EVTS_TX); + + evts.localListen((IgnitePredicate<Event>)e -> { + assert e instanceof TransactionStateChangedEvent; + + TransactionStateChangedEvent evt = (TransactionStateChangedEvent)e; + + Transaction tx = evt.tx(); + + if (tx.timeout() < 200) + tx.rollback(); + + return true; + }, EVT_TX_STARTED); + + try (Transaction tx = ignite.transactions().txStart( + TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ, 200, 2)) { + tx.commit(); + } + + try (Transaction tx = ignite.transactions().txStart( + TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ, 100, 2)) { + tx.commit(); + + fail("Should fail prior this line."); + } + catch (TransactionRollbackException ignored) { + // No-op. + } + + try (Transaction tx = ignite.transactions().txStart()) { + tx.commit(); + + fail("Should fail prior this line."); + } + catch (TransactionRollbackException ignored) { + // No-op. + } + } + + /** + * + */ + public void testLabelFilledLocalGuarantee() throws Exception { + Ignite ignite = startGrid(0); + + final IgniteEvents evts = ignite.events(); + + evts.enableLocal(EVTS_TX); + + evts.localListen((IgnitePredicate<Event>)e -> { + assert e instanceof TransactionStateChangedEvent; + + TransactionStateChangedEvent evt = (TransactionStateChangedEvent)e; + + Transaction tx = evt.tx(); + + if (tx.label() == null) + tx.rollback(); + + return true; + }, EVT_TX_STARTED); + + try (Transaction tx = ignite.transactions().withLabel("test").txStart()) { + tx.commit(); + } + + try (Transaction tx = ignite.transactions().txStart()) { + tx.commit(); + + fail("Should fail prior this line."); + } + catch (TransactionRollbackException ignored) { + // No-op. + } + } + + /** + * + */ + public void testLabelFilledRemoteGuarantee() throws Exception { + Ignite ignite = startGrid(0); + Ignite remote = startGrid(1); + + final IgniteEvents evts = ignite.events(); + + evts.enableLocal(EVTS_TX); + + evts.remoteListen(null, + (IgnitePredicate<Event>)e -> { + assert e instanceof TransactionStateChangedEvent; + + TransactionStateChangedEvent evt = (TransactionStateChangedEvent)e; + + Transaction tx = evt.tx(); + + if (tx.label() == null) + tx.rollback(); + + return true; + }, + EVT_TX_STARTED); + + try (Transaction tx = ignite.transactions().withLabel("test").txStart()) { + tx.commit(); + } + + try (Transaction tx = remote.transactions().withLabel("test").txStart()) { + tx.commit(); + } + + try (Transaction tx = ignite.transactions().txStart()) { + tx.commit(); + + fail("Should fail prior this line."); + } + catch (TransactionRollbackException ignored) { + // No-op. + } + + try (Transaction tx = remote.transactions().txStart()) { + tx.commit(); + + fail("Should fail prior this line."); + } + catch (TransactionRollbackException ignored) { + // No-op. + } + } + + /** + * + */ + public void testTimeoutSetRemoteGuarantee() throws Exception { + Ignite ignite = startGrid(0); + Ignite remote = startGrid(1); + + final IgniteEvents evts = ignite.events(); + + evts.enableLocal(EVTS_TX); + + evts.remoteListen(null, + (IgnitePredicate<Event>)e -> { + assert e instanceof TransactionStateChangedEvent; + + TransactionStateChangedEvent evt = (TransactionStateChangedEvent)e; + + Transaction tx = evt.tx(); + + if (tx.timeout() == 0) + tx.rollback(); + + return true; + }, + EVT_TX_STARTED); + + try (Transaction tx = ignite.transactions().txStart( + TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ, 100, 2)) { + tx.commit(); + } + + try (Transaction tx = remote.transactions().txStart( + TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ, 100, 2)) { + tx.commit(); + } + + try (Transaction tx = ignite.transactions().txStart()) { + tx.commit(); + + fail("Should fail prior this line."); + } + catch (TransactionRollbackException ignored) { + // No-op. + } + + try (Transaction tx = remote.transactions().txStart()) { + tx.commit(); + + fail("Should fail prior this line."); + } + catch (TransactionRollbackException ignored) { + // No-op. + } + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxStateChangeEventTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxStateChangeEventTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxStateChangeEventTest.java new file mode 100644 index 0000000..4f7df7a --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxStateChangeEventTest.java @@ -0,0 +1,213 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.transactions; + +import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.IgniteEvents; +import org.apache.ignite.events.Event; +import org.apache.ignite.events.TransactionStateChangedEvent; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.lang.IgnitePredicate; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.apache.ignite.transactions.Transaction; +import org.apache.ignite.transactions.TransactionConcurrency; +import org.apache.ignite.transactions.TransactionIsolation; +import org.apache.ignite.transactions.TransactionState; + +import static org.apache.ignite.events.EventType.EVTS_TX; +import static org.apache.ignite.events.EventType.EVT_TX_COMMITTED; +import static org.apache.ignite.events.EventType.EVT_TX_RESUMED; +import static org.apache.ignite.events.EventType.EVT_TX_ROLLED_BACK; +import static org.apache.ignite.events.EventType.EVT_TX_STARTED; +import static org.apache.ignite.events.EventType.EVT_TX_SUSPENDED; + +/** + * Tests transaction state change event. + */ +public class TxStateChangeEventTest extends GridCommonAbstractTest { + /** Label. */ + private final String lb = "testLabel"; + + /** Timeout. */ + private final long timeout = 404; + + /** Creation. */ + private AtomicBoolean creation = new AtomicBoolean(); + + /** Commit. */ + private AtomicBoolean commit = new AtomicBoolean(); + + /** Rollback. */ + private AtomicBoolean rollback = new AtomicBoolean(); + + /** Suspend. */ + private AtomicBoolean suspend = new AtomicBoolean(); + + /** Resume. */ + private AtomicBoolean resume = new AtomicBoolean(); + + /** + * + */ + public void testLocal() throws Exception { + test(true); + } + + /** + * + */ + public void testRemote() throws Exception { + test(false); + } + + /** + * + */ + private void test(boolean loc) throws Exception { + Ignite ignite = startGrid(0); + + final IgniteEvents evts = ignite.events(); + + evts.enableLocal(EVTS_TX); + + if (loc) + evts.localListen((IgnitePredicate<Event>)e -> { + assert e instanceof TransactionStateChangedEvent; + + checkEvent((TransactionStateChangedEvent)e); + + return true; + }, EVTS_TX); + else + evts.remoteListen(null, + (IgnitePredicate<Event>)e -> { + assert e instanceof TransactionStateChangedEvent; + + checkEvent((TransactionStateChangedEvent)e); + + return true; + }, + EVTS_TX); + + IgniteCache cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); + + try (Transaction tx = ignite.transactions().withLabel(lb).txStart( + TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE, timeout, 3)) { + cache.put(1, 1); + + tx.commit(); + } + + assertTrue(creation.get() && + commit.get() && + !rollback.get() && + !suspend.get() && + !resume.get()); + + creation.set(false); + commit.set(false); + rollback.set(false); + suspend.set(false); + resume.set(false); + + try (Transaction tx = ignite.transactions().withLabel(lb).txStart( + TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE, timeout, 3)) { + cache.put(1, 1); + + tx.suspend(); + + U.sleep(100); + + tx.resume(); + + tx.rollback(); + } + + assertTrue(creation.get() && + !commit.get() && + rollback.get() && + suspend.get() && + resume.get()); + } + + /** + * @param evt Event. + */ + private void checkEvent(TransactionStateChangedEvent evt) { + Transaction tx = evt.tx(); + + assertEquals(tx.timeout(), timeout); + + switch (evt.type()) { + case EVT_TX_STARTED: { + assertFalse(creation.get()); + assertEquals(tx.state(), TransactionState.ACTIVE); + + if (lb.equals(tx.label())) + creation.set(true); + + break; + } + + case EVT_TX_COMMITTED: { + assertFalse(commit.get()); + assertEquals(tx.state(), TransactionState.COMMITTED); + + commit.set(true); + + break; + } + + case EVT_TX_ROLLED_BACK: { + assertFalse(commit.get()); + assertEquals(tx.state(), TransactionState.ROLLED_BACK); + + rollback.set(true); + + break; + } + + case EVT_TX_SUSPENDED: { + assertFalse(commit.get()); + assertEquals(tx.state(), TransactionState.SUSPENDED); + + suspend.set(true); + + break; + } + + case EVT_TX_RESUMED: { + assertFalse(commit.get()); + assertEquals(tx.state(), TransactionState.ACTIVE); + + resume.set(true); + + break; + } + } + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxTimeoutTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxTimeoutTest.java deleted file mode 100644 index 4d8a49a..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxTimeoutTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.transactions; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteEvents; -import org.apache.ignite.events.Event; -import org.apache.ignite.events.TransactionStartedEvent; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.apache.ignite.transactions.TransactionRollbackException; - -import static org.apache.ignite.events.EventType.EVTS_TX; -import static org.apache.ignite.events.EventType.EVT_TX_STARTED; - -/** - * Tests transaction timeout. - */ -public class TxTimeoutTest extends GridCommonAbstractTest { - /** - * - */ - public void testTimeoutSetLocalGuarantee() throws Exception { - Ignite ignite = startGrid(0); - - final IgniteEvents evts = ignite.events(); - - evts.enableLocal(EVTS_TX); - - evts.localListen((IgnitePredicate<Event>)e -> { - assert e instanceof TransactionStartedEvent; - - TransactionStartedEvent evt = (TransactionStartedEvent)e; - - Transaction tx = evt.tx().tx(); - - if (tx.timeout() < 200) - tx.rollback(); - - return true; - }, EVT_TX_STARTED); - - try (Transaction tx = ignite.transactions().txStart( - TransactionConcurrency.OPTIMISTIC, - TransactionIsolation.REPEATABLE_READ, - 200, - 2)) { - tx.commit(); - } - - try (Transaction tx = ignite.transactions().txStart( - TransactionConcurrency.OPTIMISTIC, - TransactionIsolation.REPEATABLE_READ, - 100, - 2)) { - tx.commit(); - - fail("Should fail prior this line."); - } - catch (TransactionRollbackException ignored) { - // No-op. - } - - try (Transaction tx = ignite.transactions().txStart()) { - tx.commit(); - - fail("Should fail prior this line."); - } - catch (TransactionRollbackException ignored) { - // No-op. - } - } - - /** - * - */ - public void testTimeoutSetRemoteGuarantee() throws Exception { - Ignite ignite = startGrid(0); - Ignite remote = startGrid(1); - - final IgniteEvents evts = ignite.events(); - - evts.enableLocal(EVTS_TX); - - evts.remoteListen(null, - (IgnitePredicate<Event>)e -> { - assert e instanceof TransactionStartedEvent; - - TransactionStartedEvent evt = (TransactionStartedEvent)e; - - Transaction tx = evt.tx().tx(); - - if (tx.timeout() == 0) - tx.rollback(); - - return true; - }, - EVT_TX_STARTED); - - try (Transaction tx = ignite.transactions().txStart( - TransactionConcurrency.OPTIMISTIC, - TransactionIsolation.REPEATABLE_READ, - 100, - 2)) { - tx.commit(); - } - - try (Transaction tx = remote.transactions().txStart( - TransactionConcurrency.OPTIMISTIC, - TransactionIsolation.REPEATABLE_READ, - 100, - 2)) { - tx.commit(); - } - - try (Transaction tx = ignite.transactions().txStart()) { - tx.commit(); - - fail("Should fail prior this line."); - } - catch (TransactionRollbackException ignored) { - // No-op. - } - - try (Transaction tx = remote.transactions().txStart()) { - tx.commit(); - - fail("Should fail prior this line."); - } - catch (TransactionRollbackException ignored) { - // No-op. - } - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - super.afterTest(); - - stopAllGrids(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/de0b1a70/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java index b7b2539..0612b49 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java @@ -53,7 +53,7 @@ import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTime import org.apache.ignite.internal.processors.cache.transactions.TxRollbackAsyncNearCacheTest; import org.apache.ignite.internal.processors.cache.transactions.TxRollbackAsyncTest; import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTopologyChangeTest; -import org.apache.ignite.internal.processors.cache.transactions.TxTimeoutTest; +import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnIncorrectParamsTest; /** * Test suite. @@ -87,7 +87,7 @@ public class IgniteCacheTestSuite6 extends TestSuite { suite.addTestSuite(TxOptimisticPrepareOnUnstableTopologyTest.class); suite.addTestSuite(TxLabelTest.class); - suite.addTestSuite(TxTimeoutTest.class); + suite.addTestSuite(TxRollbackOnIncorrectParamsTest.class); suite.addTestSuite(TxMultiCacheAsyncOpsTest.class);
