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 2017/04/19 11:44:24 UTC

[1/9] ignite git commit: Attempt to fix awaitPartitionMapExchange: wait for last exchange completion to avoid races with cache destroy.

Repository: ignite
Updated Branches:
  refs/heads/ignite-1561-1 6c142012b -> 714828213


Attempt to fix awaitPartitionMapExchange: wait for last exchange completion to avoid races with cache destroy.


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

Branch: refs/heads/ignite-1561-1
Commit: d38348432a2b8b66999c6410ec4f5c1ef050191d
Parents: 36e7e19
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 19 12:46:31 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 19 12:46:31 2017 +0300

----------------------------------------------------------------------
 .../junits/common/GridCommonAbstractTest.java   | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d3834843/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 81f5caf..cef35e5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -544,6 +544,27 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
 
         Set<String> names = new HashSet<>();
 
+        Ignite crd = null;
+
+        for (Ignite g : G.allGrids()) {
+            ClusterNode node = g.cluster().localNode();
+
+            if (crd == null || node.order() < crd.cluster().localNode().order()) {
+                crd = g;
+
+                if (node.order() == 1)
+                    break;
+            }
+        }
+
+        if (crd == null)
+            return;
+
+        AffinityTopologyVersion waitTopVer = ((IgniteKernal)crd).context().discovery().topologyVersionEx();
+
+        if (waitTopVer.topologyVersion() <= 0)
+            waitTopVer = new AffinityTopologyVersion(1, 0);
+
         for (Ignite g : G.allGrids()) {
             if (nodes != null && !nodes.contains(g.cluster().localNode()))
                 continue;
@@ -560,6 +581,19 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
             else
                 startTime = g0.context().discovery().gridStartTime();
 
+            IgniteInternalFuture<?> exchFut =
+                g0.context().cache().context().exchange().affinityReadyFuture(waitTopVer);
+
+            if (exchFut != null && !exchFut.isDone()) {
+                try {
+                    exchFut.get(timeout);
+                }
+                catch (IgniteCheckedException e) {
+                    log.error("Failed to wait for exchange [topVer=" + waitTopVer +
+                        ", node=" + g0.name() + ']', e);
+                }
+            }
+
             for (IgniteCacheProxy<?, ?> c : g0.context().cache().jcaches()) {
                 CacheConfiguration cfg = c.context().config();
 


[8/9] ignite git commit: Minor corrections in tests.

Posted by sb...@apache.org.
Minor corrections in tests.


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

Branch: refs/heads/ignite-1561-1
Commit: 5dab5fb65d97921d7e28e04283a3d47d00c44a25
Parents: fb1dea7
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Apr 19 14:22:00 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 19 14:22:00 2017 +0300

----------------------------------------------------------------------
 ...ServiceProcessorMultiNodeConfigSelfTest.java | 23 ++++++++-------
 .../GridServiceProcessorMultiNodeSelfTest.java  | 31 ++++++++++----------
 2 files changed, 27 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5dab5fb6/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java
index 16e5e30..bd47b53 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java
@@ -55,7 +55,6 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
 
     /** {@inheritDoc} */
     @Override protected ServiceConfiguration[] services() {
-        List<ServiceConfiguration> cfgs = new ArrayList<>();
 
         ServiceConfiguration cfg = new ServiceConfiguration();
 
@@ -64,6 +63,8 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
         cfg.setTotalCount(1);
         cfg.setService(new DummyService());
 
+        List<ServiceConfiguration> cfgs = new ArrayList<>();
+
         cfgs.add(cfg);
 
         cfg = new ServiceConfiguration();
@@ -201,12 +202,12 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
 
         checkCount(name, g.services().serviceDescriptors(), nodeCount());
 
-        int extraNodes = 2;
-
         CountDownLatch latch = new CountDownLatch(1);
 
         DummyService.exeLatch(name, latch);
 
+        int extraNodes = 2;
+
         startExtraNodes(extraNodes);
 
         try {
@@ -270,10 +271,10 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
 
             waitForDeployment(name, nodeCount() + newNodes);
 
+            // Since we start extra nodes, there may be extra start and cancel events,
+            // so we check only the difference between start and cancel and
+            // not start and cancel events individually.
             assertEquals(name, newNodes,  DummyService.started(name) - DummyService.cancelled(name));
-// Next may fails. Server can be restarted on unstable topology.
-//            assertEquals(name, newNodes, DummyService.started(name));
-//            assertEquals(name, 0, DummyService.cancelled(name));
 
             checkCount(name, g.services().serviceDescriptors(), nodeCount() + newNodes);
         }
@@ -294,12 +295,13 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
         Ignite g = randomGrid();
 
         int servers = 2;
-        int clients = 2;
 
         CountDownLatch latch = new CountDownLatch(servers);
 
         DummyService.exeLatch(name, latch);
 
+        int clients = 2;
+
         startExtraNodes(servers, clients);
 
         try {
@@ -307,11 +309,10 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
 
             waitForDeployment(name, nodeCount() + servers);
 
+            // Since we start extra nodes, there may be extra start and cancel events,
+            // so we check only the difference between start and cancel and
+            // not start and cancel events individually.
             assertEquals(name, servers,  DummyService.started(name) - DummyService.cancelled(name));
-// Next may fails. Server can be restarted on unstable topology.
-//            assertEquals(name, servers, DummyService.started(name));
-//            assertEquals(name, 0, DummyService.cancelled(name));
-
 
             checkCount(name, g.services().serviceDescriptors(), nodeCount() + servers);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5dab5fb6/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
index 32d1462..df7ddf1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
@@ -152,12 +152,13 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
             assertEquals(name, 0, DummyService.cancelled(name));
 
             int servers = 2;
-            int clients = 2;
 
             latch = new CountDownLatch(servers);
 
             DummyService.exeLatch(name, latch);
 
+            int clients = 2;
+
             startExtraNodes(servers, clients);
 
             try {
@@ -165,12 +166,11 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
 
                 waitForDeployment(name, servers);
 
+                // Since we start extra nodes, there may be extra start and cancel events,
+                // so we check only the difference between start and cancel and
+                // not start and cancel events individually.
                 assertEquals(name, nodeCount() + servers,  DummyService.started(name) - DummyService.cancelled(name));
 
-//                 Next may fails. Server can be restarted on unstable topology.
-//                assertEquals(name, nodeCount() + servers, DummyService.started(name));
-//                assertEquals(name, 0, DummyService.cancelled(name));
-
                 checkCount(name, g.services().serviceDescriptors(), nodeCount() + servers);
             }
             finally {
@@ -241,13 +241,12 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
 
                 waitForDeployment(name, prestartedNodes + extraNodes);
 
+                // Since we start extra nodes, there may be extra start and cancel events,
+                // so we check only the difference between start and cancel and
+                // not start and cancel events individually.
                 assertEquals(name, prestartedNodes + extraNodes,
                     DummyService.started(name) - DummyService.cancelled(name));
 
-//                 Next may fails. Server can be restarted on unstable topology.
-//                assertEquals(name, prestartedNodes + extraNodes, DummyService.started(name));
-//                assertEquals(name, 0, DummyService.cancelled(name));
-
                 checkCount(name, g.services().serviceDescriptors(), prestartedNodes + extraNodes);
             }
             finally {
@@ -262,6 +261,7 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
     /**
      * @throws Exception If failed.
      */
+    @SuppressWarnings("deprecation")
     public void testDeployLimits() throws Exception {
         final String name = "serviceWithLimitsUpdateTopology";
 
@@ -299,25 +299,24 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
 
         checkCount(name, g.services().serviceDescriptors(), nodeCount());
 
-        int extraNodes = 2;
-
         latch = new CountDownLatch(1);
 
         DummyService.exeLatch(name, latch);
 
-        startExtraNodes(2);
+        int extraNodes = 2;
+
+        startExtraNodes(extraNodes);
 
         try {
             latch.await();
 
             waitForDeployment(name, totalInstances);
 
+            // Since we start extra nodes, there may be extra start and cancel events,
+            // so we check only the difference between start and cancel and
+            // not start and cancel events individually.
             assertEquals(name, totalInstances,  DummyService.started(name) - DummyService.cancelled(name));
 
-//            Next may fails. Server can be restarted on unstable topology.
-//            assertEquals(name, totalInstances, DummyService.started(name));
-//            assertEquals(name, 0, DummyService.cancelled(name));
-
             checkCount(name, g.services().serviceDescriptors(), totalInstances);
         }
         finally {


[6/9] ignite git commit: Fixed service deployment tests.

Posted by sb...@apache.org.
Fixed service deployment tests.


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

Branch: refs/heads/ignite-1561-1
Commit: 15359bc0b048c1a6a4093ea8998b343374667d43
Parents: b47f29d
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Wed Apr 19 06:30:30 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 19 14:03:12 2017 +0300

----------------------------------------------------------------------
 .../GridServiceProcessorAbstractSelfTest.java   |  17 +++
 ...ServiceProcessorMultiNodeConfigSelfTest.java |  40 +++----
 .../GridServiceProcessorMultiNodeSelfTest.java  | 113 ++++++++++---------
 3 files changed, 95 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/15359bc0/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
index b9076b9..fafd24e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
@@ -30,7 +30,9 @@ import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
+import org.apache.ignite.internal.util.lang.GridAbsPredicateX;
 import org.apache.ignite.internal.util.typedef.CA;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.lang.IgniteFuture;
@@ -783,6 +785,21 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
     }
 
     /**
+     * @param srvcName Service name
+     * @param expectedDeps Expected number of service deployments
+     *
+     */
+    protected boolean waitForDeployment(final String srvcName, final int expectedDeps) throws IgniteInterruptedCheckedException {
+        final Ignite g = randomGrid();
+
+        return GridTestUtils.waitForCondition(new GridAbsPredicateX() {
+            @Override public boolean applyx() {
+                return actualCount(srvcName, g.services().serviceDescriptors())  == expectedDeps;
+            }
+        }, 1500);
+    }
+
+    /**
      * Counter service.
      */
     protected interface CounterService {

http://git-wip-us.apache.org/repos/asf/ignite/blob/15359bc0/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java
index 9da62c0..16e5e30 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeConfigSelfTest.java
@@ -22,7 +22,6 @@ import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.util.lang.GridAbsPredicateX;
 import org.apache.ignite.services.ServiceConfiguration;
 import org.apache.ignite.testframework.GridTestUtils;
@@ -213,32 +212,20 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
         try {
             latch.await();
 
+            waitForDeployment(name, nodeCount() + 1);
+
             checkCount(name, g.services().serviceDescriptors(), nodeCount() + 1);
         }
         finally {
             stopExtraNodes(extraNodes);
         }
 
-        assertEquals(name, 1, DummyService.cancelled(name));
-
         waitForDeployment(name, nodeCount());
 
-        checkCount(name, g.services().serviceDescriptors(), nodeCount());
-    }
-
-    /**
-     * @param srvcName Service name
-     * @param expectedDeps Expected number of service deployments
-     *
-     */
-    private boolean waitForDeployment(final String srvcName, final int expectedDeps) throws IgniteInterruptedCheckedException {
-        final Ignite g = randomGrid();
+        // Service can be redeployed when nodes is stopping one-by-one.
+        assertEquals(0, DummyService.started(name) - DummyService.cancelled(name));
 
-        return GridTestUtils.waitForCondition(new GridAbsPredicateX() {
-            @Override public boolean applyx() {
-                return actualCount(srvcName, g.services().serviceDescriptors())  == expectedDeps;
-            }
-        }, 1500);
+        checkCount(name, g.services().serviceDescriptors(), nodeCount());
     }
 
     /**
@@ -281,8 +268,12 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
         try {
             latch.await();
 
-            assertEquals(name, newNodes, DummyService.started(name));
-            assertEquals(name, 0, DummyService.cancelled(name));
+            waitForDeployment(name, nodeCount() + newNodes);
+
+            assertEquals(name, newNodes,  DummyService.started(name) - DummyService.cancelled(name));
+// Next may fails. Server can be restarted on unstable topology.
+//            assertEquals(name, newNodes, DummyService.started(name));
+//            assertEquals(name, 0, DummyService.cancelled(name));
 
             checkCount(name, g.services().serviceDescriptors(), nodeCount() + newNodes);
         }
@@ -314,8 +305,13 @@ public class GridServiceProcessorMultiNodeConfigSelfTest extends GridServiceProc
         try {
             latch.await();
 
-            assertEquals(name, servers, DummyService.started(name));
-            assertEquals(name, 0, DummyService.cancelled(name));
+            waitForDeployment(name, nodeCount() + servers);
+
+            assertEquals(name, servers,  DummyService.started(name) - DummyService.cancelled(name));
+// Next may fails. Server can be restarted on unstable topology.
+//            assertEquals(name, servers, DummyService.started(name));
+//            assertEquals(name, 0, DummyService.cancelled(name));
+
 
             checkCount(name, g.services().serviceDescriptors(), nodeCount() + servers);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/15359bc0/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
index 50f5999..32d1462 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorMultiNodeSelfTest.java
@@ -90,7 +90,7 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
         // Store a cache key.
         g.cache(CACHE_NAME).put(affKey, affKey.toString());
 
-        String name = "serviceAffinityUpdateTopology";
+        final String name = "serviceAffinityUpdateTopology";
 
         IgniteServices svcs = g.services();
 
@@ -125,9 +125,7 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
         Ignite client = startGrid("client", getConfiguration("client").setClientMode(true));
 
         try {
-            final int prestartedNodes = nodeCount() + 1;
-
-            String name = "serviceOnEachNodeButClientUpdateTopology";
+            final String name = "serviceOnEachNodeButClientUpdateTopology";
 
             Ignite g = randomGrid();
 
@@ -135,9 +133,9 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
 
             DummyService.exeLatch(name, latch);
 
-        IgniteServices svcs = g.services();
+            IgniteServices svcs = g.services();
 
-        IgniteFuture<?> fut = svcs.deployNodeSingletonAsync(name, new DummyService());
+            IgniteFuture<?> fut = svcs.deployNodeSingletonAsync(name, new DummyService());
 
             info("Deployed service: " + name);
 
@@ -150,8 +148,8 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
             // Ensure service is deployed
             assertNotNull(client.services().serviceProxy(name, Service.class, false, 2000));
 
-            TestCase.assertEquals(name, nodeCount(), DummyService.started(name));
-            TestCase.assertEquals(name, 0, DummyService.cancelled(name));
+            assertEquals(name, nodeCount(), DummyService.started(name));
+            assertEquals(name, 0, DummyService.cancelled(name));
 
             int servers = 2;
             int clients = 2;
@@ -165,12 +163,13 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
             try {
                 latch.await();
 
-                // Ensure service is deployed
-                assertNotNull(grid(prestartedNodes + servers - 1)
-                    .services().serviceProxy(name, Service.class, false, 2000));
+                waitForDeployment(name, servers);
+
+                assertEquals(name, nodeCount() + servers,  DummyService.started(name) - DummyService.cancelled(name));
 
-                TestCase.assertEquals(name, nodeCount() + servers, DummyService.started(name));
-                TestCase.assertEquals(name, 0, DummyService.cancelled(name));
+//                 Next may fails. Server can be restarted on unstable topology.
+//                assertEquals(name, nodeCount() + servers, DummyService.started(name));
+//                assertEquals(name, 0, DummyService.cancelled(name));
 
                 checkCount(name, g.services().serviceDescriptors(), nodeCount() + servers);
             }
@@ -191,7 +190,7 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
         Ignite client = startGrid("client", getConfiguration("client").setClientMode(true));
 
         try {
-            String name = "serviceOnEachNodeUpdateTopology";
+            final String name = "serviceOnEachNodeUpdateTopology";
 
             Ignite g = randomGrid();
 
@@ -223,8 +222,8 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
             // Ensure service is deployed
             assertNotNull(client.services().serviceProxy(name, Service.class, false, 2000));
 
-            TestCase.assertEquals(name, prestartedNodes, DummyService.started(name));
-            TestCase.assertEquals(name, 0, DummyService.cancelled(name));
+            assertEquals(name, prestartedNodes, DummyService.started(name));
+            assertEquals(name, 0, DummyService.cancelled(name));
 
             int servers = 2;
             int clients = 2;
@@ -240,11 +239,14 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
             try {
                 latch.await();
 
-                // Ensure service is deployed
-                assertNotNull(client.services().serviceProxy(name, Service.class, false, 2000));
+                waitForDeployment(name, prestartedNodes + extraNodes);
+
+                assertEquals(name, prestartedNodes + extraNodes,
+                    DummyService.started(name) - DummyService.cancelled(name));
 
-                TestCase.assertEquals(name, prestartedNodes + extraNodes, DummyService.started(name));
-                TestCase.assertEquals(name, 0, DummyService.cancelled(name));
+//                 Next may fails. Server can be restarted on unstable topology.
+//                assertEquals(name, prestartedNodes + extraNodes, DummyService.started(name));
+//                assertEquals(name, 0, DummyService.cancelled(name));
 
                 checkCount(name, g.services().serviceDescriptors(), prestartedNodes + extraNodes);
             }
@@ -261,60 +263,65 @@ public class GridServiceProcessorMultiNodeSelfTest extends GridServiceProcessorA
      * @throws Exception If failed.
      */
     public void testDeployLimits() throws Exception {
-            String name = "serviceWithLimitsUpdateTopology";
+        final String name = "serviceWithLimitsUpdateTopology";
 
-            Ignite g = randomGrid();
+        Ignite g = randomGrid();
 
-            final int totalInstances = nodeCount() + 1;
+        final int totalInstances = nodeCount() + 1;
 
-            CountDownLatch latch = new CountDownLatch(nodeCount());
+        CountDownLatch latch = new CountDownLatch(nodeCount());
 
-            DummyService.exeLatch(name, latch);
+        DummyService.exeLatch(name, latch);
 
-            ServiceConfiguration srvcCfg = new ServiceConfiguration();
+        ServiceConfiguration srvcCfg = new ServiceConfiguration();
 
-            srvcCfg.setName(name);
-            srvcCfg.setMaxPerNodeCount(1);
-            srvcCfg.setTotalCount(totalInstances);
-            srvcCfg.setService(new DummyService());
+        srvcCfg.setName(name);
+        srvcCfg.setMaxPerNodeCount(1);
+        srvcCfg.setTotalCount(totalInstances);
+        srvcCfg.setService(new DummyService());
 
-            IgniteServices svcs = g.services().withAsync();
+        IgniteServices svcs = g.services().withAsync();
 
-            svcs.deploy(srvcCfg);
+        svcs.deploy(srvcCfg);
 
-            IgniteFuture<?> fut = svcs.future();
+        IgniteFuture<?> fut = svcs.future();
 
-            info("Deployed service: " + name);
+        info("Deployed service: " + name);
 
-            fut.get();
+        fut.get();
 
-            info("Finished waiting for service future: " + name);
+        info("Finished waiting for service future: " + name);
 
-            latch.await();
+        latch.await();
 
-            TestCase.assertEquals(name, nodeCount(), DummyService.started(name));
-            TestCase.assertEquals(name, 0, DummyService.cancelled(name));
+        assertEquals(name, nodeCount(), DummyService.started(name));
+        assertEquals(name, 0, DummyService.cancelled(name));
 
-            checkCount(name, g.services().serviceDescriptors(), nodeCount());
+        checkCount(name, g.services().serviceDescriptors(), nodeCount());
 
-            int extraNodes = 2;
+        int extraNodes = 2;
 
-            latch = new CountDownLatch(1);
+        latch = new CountDownLatch(1);
 
-            DummyService.exeLatch(name, latch);
+        DummyService.exeLatch(name, latch);
 
-            startExtraNodes(2);
+        startExtraNodes(2);
 
-            try {
-                latch.await();
+        try {
+            latch.await();
 
-                TestCase.assertEquals(name, totalInstances, DummyService.started(name));
-                TestCase.assertEquals(name, 0, DummyService.cancelled(name));
+            waitForDeployment(name, totalInstances);
 
-                checkCount(name, g.services().serviceDescriptors(), totalInstances);
-            }
-            finally {
-                stopExtraNodes(extraNodes);
-            }
+            assertEquals(name, totalInstances,  DummyService.started(name) - DummyService.cancelled(name));
+
+//            Next may fails. Server can be restarted on unstable topology.
+//            assertEquals(name, totalInstances, DummyService.started(name));
+//            assertEquals(name, 0, DummyService.cancelled(name));
+
+            checkCount(name, g.services().serviceDescriptors(), totalInstances);
+        }
+        finally {
+            stopExtraNodes(extraNodes);
+        }
     }
 }
\ No newline at end of file


[3/9] ignite git commit: Merge remote-tracking branch 'origin/ignite-2.0' into ignite-2.0

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-2.0' into ignite-2.0


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

Branch: refs/heads/ignite-1561-1
Commit: 2ded758ad1f1663aea05ca943ecf509b1574c0bf
Parents: 22d5e55 d383484
Author: devozerov <vo...@gridgain.com>
Authored: Wed Apr 19 12:54:34 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Apr 19 12:54:34 2017 +0300

----------------------------------------------------------------------
 .../junits/common/GridCommonAbstractTest.java   | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------



[4/9] ignite git commit: IGNITE-4993 - Fixing distributed joins on segmented index.

Posted by sb...@apache.org.
IGNITE-4993 - Fixing distributed joins on segmented index.


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

Branch: refs/heads/ignite-1561-1
Commit: 800b8bd90033ab64f4299ba242cc89b1f4c98417
Parents: 2ded758
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Apr 19 13:55:02 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 19 13:55:35 2017 +0300

----------------------------------------------------------------------
 .../query/h2/opt/GridH2IndexBase.java           | 31 +++++++++++---------
 .../query/IgniteSqlSegmentedIndexSelfTest.java  |  2 +-
 2 files changed, 18 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/800b8bd9/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 7163834..0eac559 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -413,9 +413,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
 
         GridCacheContext<?, ?> cctx = getTable().rowDescriptor().context();
 
-        boolean isLocal = qctx.distributedJoinMode() == LOCAL_ONLY;
-
-        return new DistributedLookupBatch(cctx, ucast, affColId, isLocal);
+        return new DistributedLookupBatch(cctx, ucast, affColId);
     }
 
     /**
@@ -1086,9 +1084,6 @@ public abstract class GridH2IndexBase extends BaseIndex {
         final int affColId;
 
         /** */
-        private final boolean localQuery;
-
-        /** */
         GridH2QueryContext qctx;
 
         /** */
@@ -1113,13 +1108,11 @@ public abstract class GridH2IndexBase extends BaseIndex {
          * @param cctx Cache Cache context.
          * @param ucast Unicast or broadcast query.
          * @param affColId Affinity column ID.
-         * @param localQuery Local query flag.
          */
-        DistributedLookupBatch(GridCacheContext<?, ?> cctx, boolean ucast, int affColId, boolean localQuery) {
+        DistributedLookupBatch(GridCacheContext<?, ?> cctx, boolean ucast, int affColId) {
             this.cctx = cctx;
             this.ucast = ucast;
             this.affColId = affColId;
-            this.localQuery = localQuery;
         }
 
         /**
@@ -1191,25 +1184,26 @@ public abstract class GridH2IndexBase extends BaseIndex {
 
             Object affKey = affColId == -1 ? null : getAffinityKey(firstRow, lastRow);
 
+            boolean locQry = localQuery();
+
             List<SegmentKey> segmentKeys;
-            Future<Cursor> fut;
 
             if (affKey != null) {
                 // Affinity key is provided.
                 if (affKey == EXPLICIT_NULL) // Affinity key is explicit null, we will not find anything.
                     return false;
 
-                segmentKeys = F.asList(rangeSegment(cctx, qctx, affKey, localQuery));
+                segmentKeys = F.asList(rangeSegment(cctx, qctx, affKey, locQry));
             }
             else {
                 // Affinity key is not provided or is not the same in upper and lower bounds, we have to broadcast.
                 if (broadcastSegments == null)
-                    broadcastSegments = broadcastSegments(qctx, cctx, localQuery);
+                    broadcastSegments = broadcastSegments(qctx, cctx, locQry);
 
                 segmentKeys = broadcastSegments;
             }
 
-            if (localQuery && segmentKeys.isEmpty())
+            if (locQry && segmentKeys.isEmpty())
                 return false; // Nothing to do
 
             assert !F.isEmpty(segmentKeys) : segmentKeys;
@@ -1250,7 +1244,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
                     batchFull = true;
             }
 
-            fut = new DoneFuture<>(segmentKeys.size() == 1 ?
+            Future<Cursor> fut = new DoneFuture<>(segmentKeys.size() == 1 ?
                 new UnicastCursor(rangeId, segmentKeys, rangeStreams) :
                 new BroadcastCursor(rangeId, segmentKeys, rangeStreams));
 
@@ -1265,6 +1259,15 @@ public abstract class GridH2IndexBase extends BaseIndex {
         }
 
         /**
+         * @return {@code True} if local query execution is enforced.
+         */
+        private boolean localQuery() {
+            assert qctx != null : "Missing query context: " + this;
+
+            return qctx.distributedJoinMode() == LOCAL_ONLY;
+        }
+
+        /**
          *
          */
         private void startStreams() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/800b8bd9/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
index 1715a56..586b81e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
@@ -90,7 +90,7 @@ public class IgniteSqlSegmentedIndexSelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
-        startGridsMultiThreaded(nodesCount(), false);
+        startGrids(nodesCount());
     }
 
     /** {@inheritDoc} */


[2/9] ignite git commit: IGNITE-3523 IGFS: Remove "initialize default path modes" feature. This closes #1786.

Posted by sb...@apache.org.
IGNITE-3523 IGFS: Remove "initialize default path modes" feature. This closes #1786.


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

Branch: refs/heads/ignite-1561-1
Commit: 22d5e55bee69403c4f9f8da9c113751ce110aa2d
Parents: 36e7e19
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Apr 19 12:54:14 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Apr 19 12:54:14 2017 +0300

----------------------------------------------------------------------
 .../configuration/FileSystemConfiguration.java  |  54 +-------
 .../internal/processors/igfs/IgfsImpl.java      |  22 +---
 .../igfs/IgfsAbstractBaseSelfTest.java          |   9 --
 .../igfs/IgfsDualAbstractSelfTest.java          |  33 -----
 .../processors/igfs/IgfsModesSelfTest.java      | 130 -------------------
 .../igfs/HadoopFIleSystemFactorySelfTest.java   |  12 +-
 6 files changed, 14 insertions(+), 246 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
index 337506c..d667fe8 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
@@ -76,9 +76,6 @@ public class FileSystemConfiguration {
     /** Default IPC endpoint enabled flag. */
     public static final boolean DFLT_IPC_ENDPOINT_ENABLED = true;
 
-    /** Default value of whether to initialize default path modes. */
-    public static final boolean DFLT_INIT_DFLT_PATH_MODES = false;
-
     /** Default value of metadata co-location flag. */
     public static final boolean DFLT_COLOCATE_META = true;
 
@@ -145,9 +142,6 @@ public class FileSystemConfiguration {
     /** Maximum range length. */
     private long maxTaskRangeLen;
 
-    /** Whether to initialize default path modes. */
-    private boolean initDfltPathModes = DFLT_INIT_DFLT_PATH_MODES;
-
     /** Metadata co-location flag. */
     private boolean colocateMeta = DFLT_COLOCATE_META;
 
@@ -191,7 +185,6 @@ public class FileSystemConfiguration {
         fragmentizerThrottlingBlockLen = cfg.getFragmentizerThrottlingBlockLength();
         fragmentizerThrottlingDelay = cfg.getFragmentizerThrottlingDelay();
         secondaryFs = cfg.getSecondaryFileSystem();
-        initDfltPathModes = cfg.isInitializeDefaultPathModes();
         ipcEndpointCfg = cfg.getIpcEndpointConfiguration();
         ipcEndpointEnabled = cfg.isIpcEndpointEnabled();
         maxSpace = cfg.getMaxSpaceSize();
@@ -579,15 +572,6 @@ public class FileSystemConfiguration {
      * <p>
      * If path doesn't correspond to any specified prefix or mappings are not provided, then
      * {@link #getDefaultMode()} is used.
-     * <p>
-     * If {@link #isInitializeDefaultPathModes()} is set to {@code true}, the following path modes will be created
-     * by default:
-     * <li>{@code /ignite/primary} and all it's sub-folders will always work in {@code PRIMARY} mode.</li>
-     * <p>
-     * And in case secondary file system URI is provided:
-     * <li>{@code /ignite/proxy} and all it's sub-folders will always work in {@code PROXY} mode.</li>
-     * <li>{@code /ignite/sync} and all it's sub-folders will always work in {@code DUAL_SYNC} mode.</li>
-     * <li>{@code /ignite/async} and all it's sub-folders will always work in {@code DUAL_ASYNC} mode.</li>
      *
      * @return Map of paths to {@code IGFS} modes.
      */
@@ -644,6 +628,7 @@ public class FileSystemConfiguration {
      * Sets delay in milliseconds for which fragmentizer is paused.
      *
      * @param fragmentizerThrottlingDelay Delay in milliseconds.
+     * @return {@code this} for chaining.
      */
     public FileSystemConfiguration setFragmentizerThrottlingDelay(long fragmentizerThrottlingDelay) {
         this.fragmentizerThrottlingDelay = fragmentizerThrottlingDelay;
@@ -759,43 +744,6 @@ public class FileSystemConfiguration {
     }
 
     /**
-     * Get whether to initialize default path modes.
-     * <p>
-     * When set to {@code true} Ignite will automatically create the following path modes:
-     * <ul>
-     *     <li>{@code /ignite/primary} - will work in {@link IgfsMode#PRIMARY} mode;</li>
-     *     <li>{@code /ignite/sync} - will work in {@link IgfsMode#DUAL_SYNC} mode (only if secondary file system
-     *         is set);</li>
-     *     <li>{@code /ignite/async} - will work in {@link IgfsMode#DUAL_ASYNC} mode (only if secondary file system
-     *         is set);</li>
-     *     <li>{@code /ignite/proxy} - will work in {@link IgfsMode#PROXY} mode (only if secondary file system
-     *         is set).</li>
-     * </ul>
-     * See {@link #getPathModes()} for more information about path modes.
-     * <p>
-     * Defaults to {@link #DFLT_INIT_DFLT_PATH_MODES}.
-     *
-     * @return {@code True} if default path modes will be initialized.
-     */
-    public boolean isInitializeDefaultPathModes() {
-        return initDfltPathModes;
-    }
-
-    /**
-     * Set whether to initialize default path modes.
-     * <p>
-     * See {@link #isInitializeDefaultPathModes()} for more information.
-     *
-     * @param initDfltPathModes Whether to initialize default path modes.
-     * @return {@code this} for chaining.
-     */
-    public FileSystemConfiguration setInitializeDefaultPathModes(boolean initDfltPathModes) {
-        this.initDfltPathModes = initDfltPathModes;
-
-        return this;
-    }
-
-    /**
      * Get whether to co-locate metadata on a single node.
      * <p>
      * Normally Ignite spread ownership of particular keys among all cache nodes. Transaction with keys owned by

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 1c0fbc2..6a7400c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -199,28 +199,10 @@ public final class IgfsImpl implements IgfsEx {
             dfltMode = cfg.getDefaultMode();
 
         Map<String, IgfsMode> cfgModes = new LinkedHashMap<>();
-        Map<String, IgfsMode> dfltModes = new LinkedHashMap<>(4, 1.0f);
-
-        if (cfg.isInitializeDefaultPathModes() && IgfsUtils.isDualMode(dfltMode)) {
-            dfltModes.put("/ignite/primary", PRIMARY);
-
-            if (secondaryFs != null) {
-                dfltModes.put("/ignite/proxy", PROXY);
-                dfltModes.put("/ignite/sync", DUAL_SYNC);
-                dfltModes.put("/ignite/async", DUAL_ASYNC);
-            }
-        }
-
-        cfgModes.putAll(dfltModes);
 
         if (cfg.getPathModes() != null) {
-            for (Map.Entry<String, IgfsMode> e : cfg.getPathModes().entrySet()) {
-                if (!dfltModes.containsKey(e.getKey()))
-                    cfgModes.put(e.getKey(), e.getValue());
-                else
-                    U.warn(log, "Ignoring path mode because it conflicts with Ignite reserved path " +
-                        "(use another path) [mode=" + e.getValue() + ", path=" + e.getKey() + ']');
-            }
+            for (Map.Entry<String, IgfsMode> e : cfg.getPathModes().entrySet())
+                cfgModes.put(e.getKey(), e.getValue());
         }
 
         ArrayList<T2<IgfsPath, IgfsMode>> modes = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
index 47a768e..d215815 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
@@ -211,13 +211,6 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest {
     }
 
     /**
-     * @return Relaxed consistency flag.
-     */
-    protected boolean initializeDefaultPathModes() {
-        return false;
-    }
-
-    /**
      * @return Client flag.
      */
     protected boolean client() {
@@ -369,8 +362,6 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest {
         igfsCfg.setRelaxedConsistency(relaxedConsistency());
         igfsCfg.setFragmentizerEnabled(fragmentizerEnabled());
 
-        igfsCfg.setInitializeDefaultPathModes(initializeDefaultPathModes());
-
         CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
 
         dataCacheCfg.setNearConfiguration(null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
index 7b83cfc..12f46da 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
@@ -51,39 +51,6 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
         super(mode);
     }
 
-    /** {@inheritDoc} */
-    @Override protected boolean initializeDefaultPathModes() {
-        // Enable default modes in order to test various modes.
-        return true;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDefaultDirectories() throws Exception {
-        IgfsPath gg = new IgfsPath("/ignite");
-        IgfsPath[] paths = paths(
-            gg, new IgfsPath(gg, "sync"), new IgfsPath(gg, "async"), new IgfsPath(gg, "primary"));
-
-        create(igfs, paths, null);
-
-        for (IgfsPath p : paths)
-            assert igfs.exists(p);
-
-        assert igfs.modeResolver().resolveMode(gg) == mode;
-
-        if (mode != PROXY) {
-            assert igfs.modeResolver().resolveMode(new IgfsPath(gg, "sync")) == IgfsMode.DUAL_SYNC;
-            assert igfs.modeResolver().resolveMode(new IgfsPath(gg, "async")) == IgfsMode.DUAL_ASYNC;
-            assert igfs.modeResolver().resolveMode(new IgfsPath(gg, "primary")) == IgfsMode.PRIMARY;
-            assert !igfsSecondary.exists("/ignite/primary"); // PRIMARY mode path must exist in upper level fs only.
-        }
-
-        // All the child paths of "/ignite/" must be visible in listings:
-        assert igfs.listFiles(gg).size() == 3;
-        assert igfs.listPaths(gg).size() == 3;
-    }
-
     /**
      * Test existence check when the path exists only remotely.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java
index 40ac0e1..0720d55 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsModesSelfTest.java
@@ -100,7 +100,6 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest {
 
         igfsCfg.setName("igfs");
         igfsCfg.setBlockSize(512 * 1024);
-        igfsCfg.setInitializeDefaultPathModes(true);
 
         if (setNullMode)
             igfsCfg.setDefaultMode(null);
@@ -217,135 +216,6 @@ public class IgfsModesSelfTest extends IgfsCommonAbstractTest {
     }
 
     /**
-     * Test predefined path modes for PRIMARY mode.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDefaultFoldersPrimary() throws Exception {
-        setSecondaryFs = true;
-
-        mode = DUAL_ASYNC;
-
-        startUp();
-
-        checkMode("/ignite/primary", PRIMARY);
-        checkMode("/ignite/primary/", PRIMARY);
-        checkMode("/ignite/primary/subfolder", PRIMARY);
-        checkMode("/ignite/primary/folder/file.txt", PRIMARY);
-        checkMode("/ignite/primaryx", DUAL_ASYNC);
-        checkMode("/ignite/primaryx/", DUAL_ASYNC);
-        checkMode("/ignite/primaryx/subfolder", DUAL_ASYNC);
-        checkMode("/ignite/primaryx/folder/file.txt", DUAL_ASYNC);
-    }
-
-    /**
-     * Test predefined path modes for all modes except of PRIMARY mode.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDefaultFoldersNonPrimary() throws Exception {
-        setSecondaryFs = true;
-
-        mode = DUAL_ASYNC;
-
-        startUp();
-
-        checkMode("/ignite/proxy", PROXY);
-        checkMode("/ignite/proxy/", PROXY);
-        checkMode("/ignite/proxy/subfolder", PROXY);
-        checkMode("/ignite/proxy/folder/file.txt", PROXY);
-        checkMode("/ignite/proxyx", mode);
-        checkMode("/ignite/proxyx/", mode);
-        checkMode("/ignite/proxyx/subfolder", mode);
-        checkMode("/ignite/proxyx/folder/file.txt", mode);
-
-        checkMode("/userdir/ignite/proxy", mode);
-        checkMode("/userdir/ignite/proxy/", mode);
-        checkMode("/userdir/ignite/proxy/subfolder", mode);
-        checkMode("/userdir/ignite/proxy/folder/file.txt", mode);
-
-        checkMode("/ignite/sync", DUAL_SYNC);
-        checkMode("/ignite/sync/", DUAL_SYNC);
-        checkMode("/ignite/sync/subfolder", DUAL_SYNC);
-        checkMode("/ignite/sync/folder/file.txt", DUAL_SYNC);
-
-        checkMode("/ignite/syncx", mode);
-        checkMode("/ignite/syncx/", mode);
-        checkMode("/ignite/syncx/subfolder", mode);
-        checkMode("/ignite/syncx/folder/file.txt", mode);
-
-        checkMode("/userdir/ignite/sync", mode);
-        checkMode("/userdir/ignite/sync/", mode);
-        checkMode("/userdir/ignite/sync/subfolder", mode);
-        checkMode("/userdir/ignite/sync/folder/file.txt", mode);
-
-        checkMode("/ignite/async", DUAL_ASYNC);
-        checkMode("/ignite/async/", DUAL_ASYNC);
-        checkMode("/ignite/async/subfolder", DUAL_ASYNC);
-        checkMode("/ignite/async/folder/file.txt", DUAL_ASYNC);
-
-        checkMode("/ignite/asyncx", mode);
-        checkMode("/ignite/asyncx/", mode);
-        checkMode("/ignite/asyncx/subfolder", mode);
-        checkMode("/ignite/asyncx/folder/file.txt", mode);
-
-        checkMode("/userdir/ignite/async", mode);
-        checkMode("/userdir/ignite/async/", mode);
-        checkMode("/userdir/ignite/async/subfolder", mode);
-        checkMode("/userdir/ignite/async/folder/file.txt", mode);
-    }
-
-    /**
-     * Ensure that in case secondary file system URI is not provided, all predefined have no special mappings. This test
-     * doesn't make sense for PRIMARY mode since in case URI is not provided DUAL_* modes automatically transforms to
-     * PRIMARY and for PROXY mode we will have an exception during startup.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDefaultsNoSecondaryUriNonPrimary() throws Exception {
-        startUp();
-
-        checkMode("/ignite/proxy", PRIMARY);
-        checkMode("/ignite/proxy/", PRIMARY);
-        checkMode("/ignite/proxy/subfolder", PRIMARY);
-        checkMode("/ignite/proxy/folder/file.txt", PRIMARY);
-
-        checkMode("/ignite/sync", PRIMARY);
-        checkMode("/ignite/sync/", PRIMARY);
-        checkMode("/ignite/sync/subfolder", PRIMARY);
-        checkMode("/ignite/sync/folder/file.txt", PRIMARY);
-
-        checkMode("/ignite/async", PRIMARY);
-        checkMode("/ignite/async/", PRIMARY);
-        checkMode("/ignite/async/subfolder", PRIMARY);
-        checkMode("/ignite/async/folder/file.txt", PRIMARY);
-    }
-
-    /**
-     * Ensure that it is impossible to override mappings for /ignite/* folders.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDefaultFoldersOverride() throws Exception {
-        setSecondaryFs = true;
-
-        mode = DUAL_ASYNC;
-
-        pathModes(
-            F.t("/ignite/primary", PROXY),
-            F.t("/ignite/proxy", DUAL_SYNC),
-            F.t("/ignite/sync", DUAL_ASYNC),
-            F.t("/ignite/async", PRIMARY));
-
-        startUp();
-
-        checkMode("/ignite/primary", PRIMARY);
-        checkMode("/ignite/proxy", PROXY);
-        checkMode("/ignite/sync", DUAL_SYNC);
-        checkMode("/ignite/async", DUAL_ASYNC);
-    }
-
-    /**
      * Ensure that DUAL_ASYNC mode is set by default.
      *
      * @throws Exception If failed.

http://git-wip-us.apache.org/repos/asf/ignite/blob/22d5e55b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
index 1793a05..04ef263 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.hadoop.impl.igfs;
 
+import java.util.HashMap;
+import java.util.Map;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -224,7 +226,6 @@ public class HadoopFIleSystemFactorySelfTest extends IgfsCommonAbstractTest {
         igfsCfg.setDefaultMode(dfltMode);
         igfsCfg.setIpcEndpointConfiguration(endpointCfg);
         igfsCfg.setSecondaryFileSystem(secondaryFs);
-        igfsCfg.setInitializeDefaultPathModes(true);
 
         CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
 
@@ -243,6 +244,15 @@ public class HadoopFIleSystemFactorySelfTest extends IgfsCommonAbstractTest {
         igfsCfg.setDataCacheConfiguration(dataCacheCfg);
         igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
 
+        if (secondaryFs != null) {
+            Map<String, IgfsMode> modes = new HashMap<>();
+            modes.put("/ignite/sync/", IgfsMode.DUAL_SYNC);
+            modes.put("/ignite/async/", IgfsMode.DUAL_ASYNC);
+            modes.put("/ignite/proxy/", IgfsMode.PROXY);
+
+            igfsCfg.setPathModes(modes);
+        }
+
         IgniteConfiguration cfg = new IgniteConfiguration();
 
         cfg.setIgniteInstanceName(name);


[5/9] ignite git commit: IGNITE-4925 Fix IgniteCacheBinaryObjectsScanSelfTest.testScanNoClasses - Fixes #1750.

Posted by sb...@apache.org.
IGNITE-4925 Fix IgniteCacheBinaryObjectsScanSelfTest.testScanNoClasses - Fixes #1750.


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

Branch: refs/heads/ignite-1561-1
Commit: b47f29d83f25037c5bf3cfe489b7120a238c7120
Parents: 800b8bd
Author: Evgenii Zhuravlev <ez...@gridgain.com>
Authored: Wed Apr 19 14:01:21 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 19 14:01:21 2017 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheBinaryObjectsScanSelfTest.java      | 11 +++++++++--
 .../cache/IgniteCacheEntryListenerAbstractTest.java      |  2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b47f29d8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java
index 666505b..e0da1f6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryObjectsScanSelfTest.java
@@ -17,10 +17,12 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import java.util.ArrayList;
 import java.util.List;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -127,9 +129,14 @@ public class IgniteCacheBinaryObjectsScanSelfTest extends GridCommonAbstractTest
             assertEquals(PERSON_CLS_NAME, entry.getValue().getClass().getName());
         }
 
-        entries = cache.query(new ScanQuery<>(1023)).getAll();
+        entries = new ArrayList<>();
 
-        assertFalse(entries.isEmpty());
+        int partCnt = client.affinity("testCache").partitions();
+
+        for (int i = 0; i < partCnt; i++)
+            entries.addAll(cache.query(new ScanQuery<>(i)).getAll());
+
+        assertEquals(100, entries.size());
 
         for (Cache.Entry<Object, Object> entry : entries) {
             assertEquals(PERSON_KEY_CLS_NAME, entry.getKey().getClass().getName());

http://git-wip-us.apache.org/repos/asf/ignite/blob/b47f29d8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
index e0e2771..ef2f156 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
@@ -329,7 +329,7 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
                 if (!eagerTtl()) {
                     U.sleep(1100);
 
-                    assertNull(primaryCache(key, cache.getName()).get(key(key)));
+                    assertNull(primaryCache(key(key), cache.getName()).get(key(key)));
 
                     evtsLatch.await(5000, MILLISECONDS);
 


[7/9] ignite git commit: Fixed javadoc.

Posted by sb...@apache.org.
Fixed javadoc.


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

Branch: refs/heads/ignite-1561-1
Commit: fb1dea79e6bbdadd5152818276d71b77c5f18942
Parents: 15359bc
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Wed Apr 19 06:45:08 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 19 14:03:21 2017 +0300

----------------------------------------------------------------------
 .../repository/support/IgniteRepositoryFactory.java          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fb1dea79/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java
index bceee1f..de2549f 100644
--- a/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java
+++ b/modules/spring-data/src/main/java/org/apache/ignite/springdata/repository/support/IgniteRepositoryFactory.java
@@ -153,11 +153,11 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
     }
 
     /**
-     * @param s
-     * @return
+     * @param qry Query string.
+     * @return {@code true} if query is SQLFieldsQuery.
      */
-    private boolean isFieldQuery(String s) {
-        return s.matches("^SELECT.*") && !s.matches("^SELECT\\s+(?:\\w+\\.)?+\\*.*");
+    private boolean isFieldQuery(String qry) {
+        return qry.matches("^SELECT.*") && !qry.matches("^SELECT\\s+(?:\\w+\\.)?+\\*.*");
     }
 }
 


[9/9] ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-2.0' into ignite-1561-1

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-2.0' into ignite-1561-1


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

Branch: refs/heads/ignite-1561-1
Commit: 71482821324dcf152e24e06469122541d47823e9
Parents: 6c14201 5dab5fb
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 19 14:44:07 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 19 14:44:07 2017 +0300

----------------------------------------------------------------------
 .../configuration/FileSystemConfiguration.java  |  54 +-------
 .../internal/processors/igfs/IgfsImpl.java      |  22 +---
 .../IgniteCacheBinaryObjectsScanSelfTest.java   |  11 +-
 .../IgniteCacheEntryListenerAbstractTest.java   |   2 +-
 .../igfs/IgfsAbstractBaseSelfTest.java          |   9 --
 .../igfs/IgfsDualAbstractSelfTest.java          |  33 -----
 .../processors/igfs/IgfsModesSelfTest.java      | 130 -------------------
 .../GridServiceProcessorAbstractSelfTest.java   |  17 +++
 ...ServiceProcessorMultiNodeConfigSelfTest.java |  49 ++++---
 .../GridServiceProcessorMultiNodeSelfTest.java  | 114 ++++++++--------
 .../junits/common/GridCommonAbstractTest.java   |  34 +++++
 .../igfs/HadoopFIleSystemFactorySelfTest.java   |  12 +-
 .../query/h2/opt/GridH2IndexBase.java           |  31 +++--
 .../query/IgniteSqlSegmentedIndexSelfTest.java  |   2 +-
 .../support/IgniteRepositoryFactory.java        |   8 +-
 15 files changed, 180 insertions(+), 348 deletions(-)
----------------------------------------------------------------------