You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/09/27 15:18:45 UTC
[9/9] ignite git commit: ignite-3601
ignite-3601
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/72da2db6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/72da2db6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/72da2db6
Branch: refs/heads/ignite-3601p
Commit: 72da2db6cde261546700ee19910d6069145cfd3c
Parents: 8f92420
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 27 18:18:20 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 27 18:18:20 2016 +0300
----------------------------------------------------------------------
.../transactions/IgniteTxLocalAdapter.java | 4 +-
.../CacheSerializableTransactionsTest.java | 47 ++++++++++----------
.../testsuites/IgniteCacheTestSuite4.java | 2 +
3 files changed, 27 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/72da2db6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index ce6275e..c12e595 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -2274,10 +2274,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
if (hasFilters) {
success = isAll(e.context(), key, cacheVal, filter);
- if (!success) {
- e.op(READ);
+ if (!success)
e.value(cacheVal, false, false);
- }
}
else
success = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/72da2db6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
index e3d321c..6a73f79 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
@@ -709,6 +709,7 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
/**
* @param noVal If {@code true} there is no cache value when read in tx.
+ * @param needVer If {@code true} then gets entry, otherwise just value.
* @throws Exception If failed.
*/
private void txConflictRead(boolean noVal, boolean needVer) throws Exception {
@@ -735,28 +736,21 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
cache.put(key, expVal);
}
- try {
- try (Transaction tx = txs.txStart(OPTIMISTIC, SERIALIZABLE)) {
- if (needVer) {
- CacheEntry<Integer, Integer> val = cache.getEntry(key);
-
- assertEquals(expVal, val == null ? null : val.getValue());
- }
- else {
- Integer val = cache.get(key);
-
- assertEquals(expVal, val);
- }
+ try (Transaction tx = txs.txStart(OPTIMISTIC, SERIALIZABLE)) {
+ if (needVer) {
+ CacheEntry<Integer, Integer> val = cache.getEntry(key);
- updateKey(cache, key, 1);
+ assertEquals(expVal, val == null ? null : val.getValue());
+ }
+ else {
+ Integer val = cache.get(key);
- tx.commit();
+ assertEquals(expVal, val);
}
- fail();
- }
- catch (TransactionOptimisticException e) {
- log.info("Expected exception: " + e);
+ updateKey(cache, key, 1);
+
+ tx.commit();
}
checkValue(key, 1, cache.getName());
@@ -1356,14 +1350,21 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
checkValue(key, 2, cache.getName());
- try (Transaction tx = txs.txStart(OPTIMISTIC, SERIALIZABLE)) {
- Object old = cache.getAndPutIfAbsent(key, 4);
+ try {
+ try (Transaction tx = txs.txStart(OPTIMISTIC, SERIALIZABLE)) {
+ Object old = cache.getAndPutIfAbsent(key, 4);
- assertEquals(2, old);
+ assertEquals(2, old);
- updateKey(cache, key, 3);
+ updateKey(cache, key, 3);
- tx.commit();
+ tx.commit();
+ }
+
+ fail();
+ }
+ catch (TransactionOptimisticException e) {
+ log.info("Expected exception: " + e);
}
checkValue(key, 3, cache.getName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/72da2db6/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index c494e73..bcbc059 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticReadC
import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticRepeatableReadSeltTest;
import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticSerializableSeltTest;
import org.apache.ignite.internal.processors.cache.CacheOffheapMapEntrySelfTest;
+import org.apache.ignite.internal.processors.cache.CachePutIfAbsentTestTest;
import org.apache.ignite.internal.processors.cache.CacheReadThroughAtomicRestartSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReadThroughLocalAtomicRestartSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReadThroughLocalRestartSelfTest;
@@ -326,6 +327,7 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(IgniteCachePrimarySyncTest.class);
suite.addTestSuite(IgniteTxCachePrimarySyncTest.class);
suite.addTestSuite(IgniteTxCacheWriteSynchronizationModesMultithreadedTest.class);
+ suite.addTestSuite(CachePutIfAbsentTestTest.class);
suite.addTestSuite(MarshallerCacheJobRunNodeRestartTest.class);