ignite git commit: ignite-647 Fixed issues with dynamic cache start when fair affinity is used

2015-12-23 Thread sboikov
Repository: ignite
Updated Branches:
  refs/heads/ignite-1537 53482a76a -> 21ea9f1d2


ignite-647 Fixed issues with dynamic cache start when fair affinity is used


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

Branch: refs/heads/ignite-1537
Commit: 21ea9f1d246a0bdbec24c02971d2631baa51bd95
Parents: 53482a7
Author: sboikov 
Authored: Wed Dec 23 15:12:10 2015 +0300
Committer: sboikov 
Committed: Wed Dec 23 15:12:10 2015 +0300

--
 .../processors/cache/GridCacheProcessor.java   |  3 ++-
 .../preloader/GridDhtPartitionsExchangeFuture.java |  3 ++-
 .../apache/ignite/IgniteCacheAffinitySelfTest.java |  7 ---
 .../fair/FairAffinityDynamicCacheSelfTest.java | 17 ++---
 .../cache/CrossCacheTxRandomOperationsTest.java|  2 --
 5 files changed, 6 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ignite/blob/21ea9f1d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
--
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 380c163..ff02e70 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1961,7 +1961,8 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
 if (req.initiatingNodeId() == null)
 desc.staticallyConfigured(true);
 
-desc.receivedOnDiscovery(true);
+if (joiningNodeId.equals(ctx.localNodeId()))
+desc.receivedOnDiscovery(true);
 
 DynamicCacheDescriptor old = 
registeredCaches.put(maskNull(req.cacheName()), desc);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/21ea9f1d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
--
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 854726f..a6ff51f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -419,7 +419,8 @@ public class GridDhtPartitionsExchangeFuture extends 
GridFutureAdapter affNodes = CU.affinityNodes(cacheCtx, 
exchId.topologyVersion());
 
-return !exchId.nodeId().equals(cctx.localNodeId()) ||
+return 
exchId.topologyVersion().equals(cacheCtx.startTopologyVersion()) ||
+!exchId.nodeId().equals(cctx.localNodeId()) ||
 (affNodes.size() == 1 && affNodes.contains(cctx.localNode()));
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/21ea9f1d/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
--
diff --git 
a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java 
b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
index 3d76268..5b08f62 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
@@ -92,17 +92,10 @@ public class IgniteCacheAffinitySelfTest extends 
IgniteCacheAbstractTest {
 return new NearCacheConfiguration();
 }
 
-/** {@inheritDoc} */
-@Override protected void beforeTestsStarted() throws Exception {
-fail("Enable when https://issues.apache.org/jira/browse/IGNITE-647 is 
fixed.");
-}
-
 /**
  * @throws Exception if failed.
  */
 public void testAffinity() throws Exception {
-fail("Enable when https://issues.apache.org/jira/browse/IGNITE-647 is 
fixed.");
-
 checkAffinity();
 
 stopGrid(gridCount() - 1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/21ea9f1d/modules/core/src/test/java/org/apache/ignite/cache/affinity/fa

ignite git commit: ignite-647 Fixed issues with dynamic cache start when fair affinity is used

2015-12-23 Thread sboikov
Repository: ignite
Updated Branches:
  refs/heads/ignite-1537 21ea9f1d2 -> 0adfd928b


ignite-647 Fixed issues with dynamic cache start when fair affinity is used


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

Branch: refs/heads/ignite-1537
Commit: 0adfd928b6b6ae6f8000232c2f82b8b51613560e
Parents: 21ea9f1
Author: sboikov 
Authored: Wed Dec 23 16:51:12 2015 +0300
Committer: sboikov 
Committed: Wed Dec 23 16:51:12 2015 +0300

--
 .../GridDhtPartitionsExchangeFuture.java | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ignite/blob/0adfd928/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
--
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index a6ff51f..a10294f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -329,6 +329,19 @@ public class GridDhtPartitionsExchangeFuture extends 
GridFutureAdapter cacheCtx = cctx.cacheContext(cacheId);
+
+return cacheCtx != null && F.eq(cacheCtx.startTopologyVersion(), 
topVer);
+}
+
+/**
+ * @param cacheId Cache ID.
+ * @return {@code True} if non-client cache was added during this exchange.
+ */
+private boolean cacheStarted(int cacheId) {
 if (!F.isEmpty(reqs)) {
 for (DynamicCacheChangeRequest req : reqs) {
 if (req.start() && !req.clientStartOnly()) {
@@ -338,9 +351,7 @@ public class GridDhtPartitionsExchangeFuture extends 
GridFutureAdapter cacheCtx = cctx.cacheContext(cacheId);
-
-return cacheCtx != null && F.eq(cacheCtx.startTopologyVersion(), 
topVer);
+return false;
 }
 
 /**
@@ -419,7 +430,7 @@ public class GridDhtPartitionsExchangeFuture extends 
GridFutureAdapter affNodes = CU.affinityNodes(cacheCtx, 
exchId.topologyVersion());
 
-return 
exchId.topologyVersion().equals(cacheCtx.startTopologyVersion()) ||
+return cacheStarted(cacheCtx.cacheId()) ||
 !exchId.nodeId().equals(cctx.localNodeId()) ||
 (affNodes.size() == 1 && affNodes.contains(cctx.localNode()));
 }



ignite git commit: ignite-647 Fixed issues with dynamic cache start when fair affinity is used

2015-12-23 Thread sboikov
Repository: ignite
Updated Branches:
  refs/heads/ignite-1537 0adfd928b -> 185c28ae6


ignite-647 Fixed issues with dynamic cache start when fair affinity is used


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

Branch: refs/heads/ignite-1537
Commit: 185c28ae66c24c5c4d446f37c416a0091de61f8d
Parents: 0adfd92
Author: sboikov 
Authored: Wed Dec 23 17:48:52 2015 +0300
Committer: sboikov 
Committed: Wed Dec 23 17:48:52 2015 +0300

--
 .../dht/atomic/GridDhtAtomicCache.java  | 89 --
 ...ridNearOptimisticTxPrepareFutureAdapter.java | 12 ++-
 ...yMetadataUpdateChangingTopologySelfTest.java | 96 +---
 3 files changed, 110 insertions(+), 87 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ignite/blob/185c28ae/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 634a9ea..393413e 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
@@ -1290,59 +1290,48 @@ public class GridDhtAtomicCache extends 
GridDhtCacheAdapter {
 
 GridCacheReturn retVal = null;
 
-IgniteTxManager tm = ctx.tm();
+if (keys.size() > 1 && // 
Several keys ...
+writeThrough() && !req.skipStore() &&  // 
and store is enabled ...
+!ctx.store().isLocal() &&  // 
and this is not local store ...
+!ctx.dr().receiveEnabled() // 
and no DR.
+) {
+// This method can only be used when there are no 
replicated entries in the batch.
+UpdateBatchResult updRes = updateWithBatch(node,
+hasNear,
+req,
+res,
+locked,
+ver,
+dhtFut,
+completionCb,
+ctx.isDrEnabled(),
+taskName,
+expiry,
+sndPrevVal);
 
-// Needed for metadata cache transaction.
-boolean set = 
tm.setTxTopologyHint(req.topologyVersion());
+deleted = updRes.deleted();
+dhtFut = updRes.dhtFuture();
 
-try {
-if (keys.size() > 1 && 
// Several keys ...
-writeThrough() && !req.skipStore() &&  
// and store is enabled ...
-!ctx.store().isLocal() &&  
// and this is not local store ...
-!ctx.dr().receiveEnabled() 
// and no DR.
-) {
-// This method can only be used when there are 
no replicated entries in the batch.
-UpdateBatchResult updRes = 
updateWithBatch(node,
-hasNear,
-req,
-res,
-locked,
-ver,
-dhtFut,
-completionCb,
-ctx.isDrEnabled(),
-taskName,
-expiry,
-sndPrevVal);
-
-deleted = updRes.deleted();
-dhtFut = updRes.dhtFuture();
-
-if (req.operation() == TRANSFORM)
-retVal = updRes.invokeResults();
-}
-else {
-UpdateSingleResult updRes = updat

[09/11] ignite git commit: ignite-647 Fixed issues with dynamic cache start when fair affinity is used

2015-12-23 Thread sboikov
ignite-647 Fixed issues with dynamic cache start when fair affinity is used


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

Branch: refs/heads/ignite-1537
Commit: 6d6be6b4c650eb22b89c1a2d3e77e018ec4b2c51
Parents: 185c28a
Author: sboikov 
Authored: Thu Dec 24 09:04:00 2015 +0300
Committer: sboikov 
Committed: Thu Dec 24 09:04:00 2015 +0300

--
 .../processors/cache/binary/CacheObjectBinaryProcessorImpl.java   | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ignite/blob/6d6be6b4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
--
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 7493a43..2209ec9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -491,6 +491,9 @@ public class CacheObjectBinaryProcessorImpl extends 
IgniteCacheObjectProcessorIm
 
 AffinityTopologyVersion topVer = 
ctx.cache().context().lockedTopologyVersion(null);
 
+if (topVer == null)
+topVer = 
ctx.cache().context().exchange().readyAffinityVersion();
+
 BinaryObjectException err = metaDataCache.invoke(topVer, key, new 
MetadataProcessor(mergedMeta));
 
 if (err != null)