You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2018/04/18 13:40:24 UTC
ignite git commit: IGNITE-7512 Check for null before
validateKeyAndValue in GridDhtAtomicCache.updateWithBatch - Fixes #3429.
Repository: ignite
Updated Branches:
refs/heads/master 14c032ae2 -> 9d184c9c0
IGNITE-7512 Check for null before validateKeyAndValue in GridDhtAtomicCache.updateWithBatch - Fixes #3429.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9d184c9c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9d184c9c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9d184c9c
Branch: refs/heads/master
Commit: 9d184c9c08496fa7bd5f37e12dc37d4618576713
Parents: 14c032a
Author: skalashnikov <sk...@gridgain.com>
Authored: Wed Apr 18 16:37:20 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 18 16:37:20 2018 +0300
----------------------------------------------------------------------
.../dht/atomic/GridDhtAtomicCache.java | 3 +-
.../local/atomic/GridLocalAtomicCache.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 5 +-
.../query/IgniteSqlNotNullConstraintTest.java | 71 +++++++++++++++++++-
4 files changed, 77 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d184c9c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index e3ad382..44f2b15 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -2071,7 +2071,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
validation = true;
- ctx.validateKeyAndValue(entry.key(), updated);
+ if (updated != null)
+ ctx.validateKeyAndValue(entry.key(), updated);
}
}
catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d184c9c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 6cb50f2..dad1052 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -1074,7 +1074,7 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
if (computed != null)
invokeRes = CacheInvokeResult.fromResult(ctx.unwrapTemporary(computed));
- if (invokeEntry.modified()) {
+ if (invokeEntry.modified() && updated != null) {
validation = true;
ctx.validateKeyAndValue(entry.key(), updated);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d184c9c/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 c2a2842..7a7f65f 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
@@ -1256,7 +1256,10 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
key0 = invokeEntry.key();
}
- ctx.validateKeyAndValue(txEntry.key(), ctx.toCacheObject(val0));
+ val0 = ctx.toCacheObject(val0);
+
+ if (val0 != null)
+ ctx.validateKeyAndValue(txEntry.key(), (CacheObject)val0);
if (res != null)
ret.addEntryProcessResult(ctx, txEntry.key(), key0, res, null, txEntry.keepBinary());
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d184c9c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
index 1f4e018..183138b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlNotNullConstraintTest.java
@@ -681,6 +681,72 @@ public class IgniteSqlNotNullConstraintTest extends GridCommonAbstractTest {
}
/** */
+ public void testAtomicOrImplicitTxInvokeDelete() throws Exception {
+ executeWithAllCaches(new TestClosure() {
+ @Override public void run() throws Exception {
+ cache.put(key1, okValue);
+
+ cache.invoke(key1, new TestEntryProcessor(null));
+
+ assertEquals(0, cache.size());
+ }
+ });
+ }
+
+ /** */
+ public void testAtomicOrImplicitTxInvokeAllDelete() throws Exception {
+ executeWithAllCaches(new TestClosure() {
+ @Override public void run() throws Exception {
+ cache.put(key1, okValue);
+ cache.put(key2, okValue);
+
+ cache.invokeAll(F.asMap(
+ key1, new TestEntryProcessor(null),
+ key2, new TestEntryProcessor(null)));
+
+ assertEquals(0, cache.size());
+ }
+ });
+ }
+
+ /** */
+ public void testTxInvokeDelete() throws Exception {
+ executeWithAllTxCaches(new TestClosure() {
+ @Override public void run() throws Exception {
+ cache.put(key1, okValue);
+
+ try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
+ cache.invoke(key1, new TestEntryProcessor(null));
+
+ tx.commit();
+ }
+
+ assertEquals(0, cache.size());
+ }
+ });
+ }
+
+ /** */
+ public void testTxInvokeAllDelete() throws Exception {
+ executeWithAllTxCaches(new TestClosure() {
+ @Override public void run() throws Exception {
+ cache.put(key1, okValue);
+ cache.put(key2, okValue);
+
+ try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
+ cache.invokeAll(F.asMap(
+ key1, new TestEntryProcessor(null),
+ key2, new TestEntryProcessor(null)));
+
+ tx.commit();
+ }
+
+ assertEquals(0, cache.size());
+ }
+ });
+ }
+
+ /** */
public void testDynamicTableCreateNotNullFieldsAllowed() throws Exception {
executeSql("CREATE TABLE test(id INT PRIMARY KEY, field INT NOT NULL)");
@@ -1137,7 +1203,10 @@ public class IgniteSqlNotNullConstraintTest extends GridCommonAbstractTest {
@Override public Object process(MutableEntry<Integer, Person> entry,
Object... objects) throws EntryProcessorException {
- entry.setValue(value);
+ if (value == null)
+ entry.remove();
+ else
+ entry.setValue(value);
return null;
}