ignite git commit: ignite-627

2018-10-30 Thread sboikov
Repository: ignite
Updated Branches:
  refs/heads/ignite-627 0ed37afb3 -> f9c06b853


ignite-627


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f9c06b85
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f9c06b85
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f9c06b85

Branch: refs/heads/ignite-627
Commit: f9c06b853038a76c392ace3a6b4ac200dcd7fbe7
Parents: 0ed37af
Author: sboikov 
Authored: Tue Oct 30 09:23:59 2018 +0300
Committer: sboikov 
Committed: Tue Oct 30 09:23:59 2018 +0300

--
 .../atomic/IgniteCacheAtomicProtocolTest.java   | 101 ++-
 1 file changed, 96 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ignite/blob/f9c06b85/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
--
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
index 1c6b8cb..d54143b 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
@@ -879,14 +879,36 @@ public class IgniteCacheAtomicProtocolTest extends 
GridCommonAbstractTest {
 /**
  * @throws Exception If failed.
  */
-public void testNearEntryUpdateRace() throws Exception {
+public void testNearEntryUpdateRace_Put() throws Exception {
+nearEntryUpdateRace("put");
+}
+
+/**
+ * @throws Exception If failed.
+ */
+public void testNearEntryUpdateRace_PutIfAbsent() throws Exception {
+nearEntryUpdateRace("putIfAbsent");
+}
+
+/**
+ * @throws Exception If failed.
+ */
+public void testNearEntryUpdateRace_Invoke() throws Exception {
+nearEntryUpdateRace("invoke");
+}
+
+/**
+ * @param cacheOp Cache operation.
+ * @throws Exception If failed.
+ */
+private void nearEntryUpdateRace(String cacheOp) throws Exception {
 ccfg = cacheConfiguration(1, FULL_SYNC);
 
 client = false;
 
 Ignite srv0 = startGrid(0);
 
-IgniteCache srvCache = srv0.cache(TEST_CACHE);
+IgniteCache srvCache = srv0.cache(TEST_CACHE);
 
 int key = 0;
 
@@ -896,13 +918,28 @@ public class IgniteCacheAtomicProtocolTest extends 
GridCommonAbstractTest {
 
 Ignite client1 = startGrid(1);
 
-IgniteCache nearCache = 
client1.createNearCache(TEST_CACHE, new NearCacheConfiguration<>());
+IgniteCache nearCache = 
client1.createNearCache(TEST_CACHE, new NearCacheConfiguration<>());
 
 testSpi(srv0).blockMessages(GridNearAtomicUpdateResponse.class, 
client1.name());
 
 IgniteInternalFuture nearPutFut = GridTestUtils.runAsync(new 
Runnable() {
 @Override public void run() {
-nearCache.put(key, 1);
+switch (cacheOp) {
+case "put":
+nearCache.put(key, 1);
+break;
+
+case "putIfAbsent":
+assertTrue(nearCache.putIfAbsent(key, 1));
+break;
+
+case "invoke":
+nearCache.invoke(key, new SetValueEntryProcessor(1));
+break;
+
+default:
+fail("Invalid operation: " + cacheOp);
+}
 }
 });
 
@@ -916,7 +953,61 @@ public class IgniteCacheAtomicProtocolTest extends 
GridCommonAbstractTest {
 
 nearPutFut.get();
 
-assertEquals(2, nearCache.get(key));
+assertEquals((Integer)2, nearCache.get(key));
+}
+
+/**
+ * @throws Exception If failed.
+ */
+public void testNearEntryUpdateRace_PutAll() throws Exception {
+ccfg = cacheConfiguration(1, FULL_SYNC);
+
+client = false;
+
+Ignite srv0 = startGrid(0);
+
+IgniteCache srvCache = srv0.cache(TEST_CACHE);
+
+final int keys = 100;
+
+ccfg = null;
+
+client = true;
+
+Ignite client1 = startGrid(1);
+
+IgniteCache nearCache = 
client1.createNearCache(TEST_CACHE, new NearCacheConfiguration<>());
+
+testSpi(srv0).blockMessages(GridNearAtomicUpdateResponse.class, 
client1.name());
+
+IgniteInternalFuture nearPutFut = GridTestUtils.runAsync(new 
Runnable() {
+@Override public void run() {
+

ignite git commit: ignite-627

2018-10-29 Thread sboikov
Repository: ignite
Updated Branches:
  refs/heads/ignite-627 [created] 7aa249870


ignite-627


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7aa24987
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7aa24987
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7aa24987

Branch: refs/heads/ignite-627
Commit: 7aa249870ce7963cda4ad25fb2566b46a4fcf596
Parents: 797e7af
Author: sboikov 
Authored: Fri Oct 26 13:21:07 2018 +0300
Committer: sboikov 
Committed: Tue Oct 30 08:54:21 2018 +0300

--
 .../GridNearAtomicAbstractUpdateFuture.java | 293 ++-
 .../GridNearAtomicSingleUpdateFuture.java   |  34 ++-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  69 +++--
 .../distributed/near/GridNearAtomicCache.java   | 198 +
 .../distributed/near/GridNearCacheEntry.java|   4 +-
 ...idCacheValueConsistencyAbstractSelfTest.java |   6 -
 .../atomic/IgniteCacheAtomicProtocolTest.java   |  44 +++
 7 files changed, 410 insertions(+), 238 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ignite/blob/7aa24987/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
--
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
index 983b18a..83d0bb7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
@@ -36,16 +36,25 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
 import 
org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException;
 import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
 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.GridCacheFutureAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheMvccManager;
 import org.apache.ignite.internal.processors.cache.GridCacheOperation;
 import org.apache.ignite.internal.processors.cache.GridCacheReturn;
+import org.apache.ignite.internal.processors.cache.GridCacheUpdateAtomicResult;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import 
org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtInvalidPartitionException;
+import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache;
+import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
 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;
@@ -55,7 +64,10 @@ import org.jetbrains.annotations.Nullable;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static 
org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
+import static 
org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
 import static 
org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+import static 
org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
+import static org.apache.ignite.internal.processors.dr.GridDrType.DR_NONE;
 
 /**
  * Base for near atomic update futures.
@@ -142,6 +154,9 @@ public abstract class GridNearAtomicAbstractUpdateFuture 
extends GridCacheFuture
 /** Operation result. */
 protected GridCacheReturn opRes;
 
+/** */
+protected Map reservedEntries;
+
 /**
  * Constructor.
  *
@@ -242,29 +257,40 @@ public