You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/09/17 12:09:33 UTC

[01/18] ignite git commit: IGNITE-1435 Platform .Net: Make it possible to sign core assembly with msbuild

Repository: ignite
Updated Branches:
  refs/heads/ignite-gg-10760 96ddd1bad -> 33ee61caf


IGNITE-1435 Platform .Net: Make it possible to sign core assembly with msbuild


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

Branch: refs/heads/ignite-gg-10760
Commit: 3e694599b59ca2d941f76c2ffe8b103888c41e9f
Parents: 1ff4a52
Author: ptupitsyn <pt...@gridgain.com>
Authored: Fri Sep 11 17:50:07 2015 +0300
Committer: ptupitsyn <pt...@gridgain.com>
Committed: Fri Sep 11 17:50:07 2015 +0300

----------------------------------------------------------------------
 .../main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3e694599/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
index 5f2c018..26385e3 100644
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
+++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
@@ -37,10 +37,10 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyFileVersion("1.4.0")]
 
 [assembly: CLSCompliant(true)]
-[assembly: InternalsVisibleTo("Apache.Ignite")]
 
-#if !EXCLUDE_TESTS
+#if !EXCLUDE_INTERNALS_VISIBLE_TO
 
+[assembly: InternalsVisibleTo("Apache.Ignite")]
 [assembly: InternalsVisibleTo("Apache.Ignite.Core.Tests")]
 
 #endif
\ No newline at end of file


[12/18] ignite git commit: ignite-1171 Test for reproducing added

Posted by vo...@apache.org.
ignite-1171 Test for reproducing added


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

Branch: refs/heads/ignite-gg-10760
Commit: e75917d47aaa34d8ff6219245668959fb68f0227
Parents: 5f5220a
Author: agura <ag...@gridgain.com>
Authored: Wed Sep 16 18:23:16 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Wed Sep 16 18:23:16 2015 +0300

----------------------------------------------------------------------
 .../distributed/CacheAffEarlySelfTest.java      | 245 +++++++++++++++++++
 .../ignite/testsuites/IgniteBasicTestSuite.java |   5 +
 2 files changed, 250 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e75917d4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffEarlySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffEarlySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffEarlySelfTest.java
new file mode 100644
index 0000000..7f0ca11
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffEarlySelfTest.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Random;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteFutureTimeoutException;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class CacheAffEarlySelfTest extends GridCommonAbstractTest {
+    /** Grid count. */
+    private static int GRID_CNT = 8;
+
+    /** Operation timeout. */
+    private static long OP_TIMEOUT = 5000;
+
+    /** Always dump threads or only once per operation. */
+    private static boolean ALWAYS_DUMP_THREADS = false;
+
+    /** Stopped. */
+    private volatile boolean stopped;
+
+    /** Iteration. */
+    private int iters = 10;
+
+    /** Concurrent. */
+    private boolean concurrent = true;
+
+    /** Futs. */
+    private Collection<IgniteInternalFuture<?>> futs = new ArrayList<>(GRID_CNT);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder(true);
+        finder.setAddresses(Collections.singletonList("127.0.0.1:47500..47510"));
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+        discoSpi.setIpFinder(finder);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        OptimizedMarshaller marsh = new OptimizedMarshaller();
+        marsh.setRequireSerializable(false);
+
+        cfg.setMarshaller(marsh);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 6 * 60 * 1000L;
+    }
+
+    /**
+     *
+     */
+    public void testStartNodes() throws Exception {
+        for (int i = 0; i < iters; i++) {
+            try {
+                System.out.println("*** Iteration " + (i + 1) + '/' + iters);
+
+                IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+                    @Override public void run() {
+                        try {
+                            doTest();
+                        }
+                        catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }, 1);
+
+                fut.get(30000);
+            }
+            catch (IgniteFutureTimeoutCheckedException e) {
+                // No-op.
+            }
+            finally {
+                stopAllGrids(true);
+            }
+        }
+    }
+
+    /**
+     *
+     */
+    public void doTest() throws Exception {
+        for (int i = 0; i < GRID_CNT; i++) {
+            final int idx = i;
+
+            final Ignite grid = concurrent ? null : startGrid(idx);
+
+            IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+                @Override public void run() {
+                    Random rnd = new Random();
+
+                    try {
+                        final Ignite ignite = grid == null ? startGrid(idx) : grid;
+
+                        final IgniteCache<UUID, UUID> cache = getCache(ignite).withAsync();
+
+                        CacheAffEarlySelfTest.this.execute(cache, new IgniteInClosure<IgniteCache<UUID,UUID>>() {
+                            @Override public void apply(IgniteCache<UUID, UUID> entries) {
+                                cache.put(ignite.cluster().localNode().id(), UUID.randomUUID());
+                            }
+                        });
+
+                        while (!stopped) {
+                            int val = Math.abs(rnd.nextInt(100));
+                            if (val >= 0 && val < 40)
+                                execute(cache, new IgniteInClosure<IgniteCache<UUID, UUID>>() {
+                                    @Override public void apply(IgniteCache<UUID, UUID> entries) {
+                                        cache.containsKey(ignite.cluster().localNode().id());
+                                    }
+                                });
+                            else if (val >= 40 && val < 80)
+                                execute(cache, new IgniteInClosure<IgniteCache<UUID, UUID>>() {
+                                    @Override public void apply(IgniteCache<UUID, UUID> entries) {
+                                        cache.get(ignite.cluster().localNode().id());
+                                    }
+                                });
+                            else
+                                execute(cache, new IgniteInClosure<IgniteCache<UUID, UUID>>() {
+                                    @Override public void apply(IgniteCache<UUID, UUID> entries) {
+                                        cache.put(ignite.cluster().localNode().id(), UUID.randomUUID());
+                                    }
+                                });
+
+                            Thread.sleep(50);
+                        }
+                    }
+                    catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            }, 1);
+
+            futs.add(fut);
+        }
+
+        Thread.sleep(10000);
+
+        stopped = true;
+
+        for (IgniteInternalFuture<?> fut : futs)
+            fut.get();
+    }
+
+    /**
+     * @param cache Cache.
+     * @param c Closure.
+     */
+    private void execute(IgniteCache<UUID, UUID> cache, IgniteInClosure<IgniteCache<UUID, UUID>> c) {
+        c.apply(cache);
+
+        IgniteFuture<Object> fut = cache.future();
+
+        boolean success = false;
+
+        int iter = 0;
+
+        while (!success) {
+            try {
+                fut.get(OP_TIMEOUT);
+
+                success = true;
+            }
+            catch (IgniteFutureTimeoutException e) {
+                debug(iter == 0 || ALWAYS_DUMP_THREADS);
+            }
+
+            iter++;
+        }
+    }
+
+    /**
+     *
+     */
+    private void debug(boolean dumpThreads) {
+        log.info("DUMPING DEBUG INFO:");
+
+        for (Ignite ignite : G.allGrids())
+            ((IgniteKernal)ignite).dumpDebugInfo();
+
+        if (dumpThreads) {
+            U.dumpThreads(null);
+
+            U.dumpThreads(log);
+        }
+    }
+
+    /**
+     * @param grid Grid.
+     */
+    private IgniteCache<UUID, UUID> getCache(Ignite grid) {
+        CacheConfiguration<UUID, UUID> ccfg = defaultCacheConfiguration();
+
+        ccfg.setCacheMode(CacheMode.PARTITIONED);
+        ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+        ccfg.setBackups(1);
+        ccfg.setNearConfiguration(null);
+
+        return grid.getOrCreateCache(ccfg);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e75917d4/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 1a9913f..390807c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.processors.affinity.GridAffinityProcessorRende
 import org.apache.ignite.internal.processors.cache.GridProjectionForCachesOnDaemonNodeSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteDaemonNodeMarshallerCacheTest;
 import org.apache.ignite.internal.processors.cache.OffHeapTieredTransactionSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheAffEarlySelfTest;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessorSelfTest;
 import org.apache.ignite.internal.processors.continuous.GridEventConsumeSelfTest;
 import org.apache.ignite.internal.processors.continuous.GridMessageListenSelfTest;
@@ -68,6 +69,9 @@ public class IgniteBasicTestSuite extends TestSuite {
     public static TestSuite suite(Set<Class> ignoredTests) throws Exception {
         TestSuite suite = new TestSuite("Ignite Basic Test Suite");
 
+        suite.addTest(new TestSuite(CacheAffEarlySelfTest.class));
+
+/*
         suite.addTest(IgniteLangSelfTestSuite.suite());
         suite.addTest(IgniteUtilSelfTestSuite.suite(ignoredTests));
         suite.addTest(IgniteMarshallerSelfTestSuite.suite(ignoredTests));
@@ -110,6 +114,7 @@ public class IgniteBasicTestSuite extends TestSuite {
         suite.addTestSuite(OffHeapTieredTransactionSelfTest.class);
         suite.addTestSuite(IgniteSlowClientDetectionSelfTest.class);
         suite.addTestSuite(IgniteDaemonNodeMarshallerCacheTest.class);
+*/
 
         return suite;
     }


[04/18] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.4' into ignite-1.4

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


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

Branch: refs/heads/ignite-gg-10760
Commit: 6bd0f8f405268214c62e2289a0081a238053fc11
Parents: 72e270c dcd8b42
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Sep 15 16:55:19 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Sep 15 16:55:19 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java    |  10 +-
 .../dht/GridClientPartitionTopology.java        | 104 +++++++++++--------
 .../dht/GridDhtPartitionTopology.java           |   4 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |   7 +-
 .../cache/transactions/IgniteTxHandler.java     |   2 +-
 .../ignite/internal/util/IgniteUtils.java       |  16 +++
 .../processors/igfs/IgfsAbstractSelfTest.java   |   3 +-
 .../testsuites/IgniteHadoopTestSuite.java       |   6 +-
 ...CacheScanPartitionQueryFallbackSelfTest.java |  54 ++++------
 9 files changed, 114 insertions(+), 92 deletions(-)
----------------------------------------------------------------------



[13/18] ignite git commit: Basic suite tests uncommented

Posted by vo...@apache.org.
Basic suite tests uncommented


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

Branch: refs/heads/ignite-gg-10760
Commit: 6187241ecf68a9541172c98e85e86cecdc0fe7e9
Parents: e75917d
Author: agura <ag...@gridgain.com>
Authored: Wed Sep 16 18:36:34 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Wed Sep 16 18:36:34 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java | 5 -----
 1 file changed, 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6187241e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 390807c..1a9913f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -36,7 +36,6 @@ import org.apache.ignite.internal.processors.affinity.GridAffinityProcessorRende
 import org.apache.ignite.internal.processors.cache.GridProjectionForCachesOnDaemonNodeSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteDaemonNodeMarshallerCacheTest;
 import org.apache.ignite.internal.processors.cache.OffHeapTieredTransactionSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.CacheAffEarlySelfTest;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessorSelfTest;
 import org.apache.ignite.internal.processors.continuous.GridEventConsumeSelfTest;
 import org.apache.ignite.internal.processors.continuous.GridMessageListenSelfTest;
@@ -69,9 +68,6 @@ public class IgniteBasicTestSuite extends TestSuite {
     public static TestSuite suite(Set<Class> ignoredTests) throws Exception {
         TestSuite suite = new TestSuite("Ignite Basic Test Suite");
 
-        suite.addTest(new TestSuite(CacheAffEarlySelfTest.class));
-
-/*
         suite.addTest(IgniteLangSelfTestSuite.suite());
         suite.addTest(IgniteUtilSelfTestSuite.suite(ignoredTests));
         suite.addTest(IgniteMarshallerSelfTestSuite.suite(ignoredTests));
@@ -114,7 +110,6 @@ public class IgniteBasicTestSuite extends TestSuite {
         suite.addTestSuite(OffHeapTieredTransactionSelfTest.class);
         suite.addTestSuite(IgniteSlowClientDetectionSelfTest.class);
         suite.addTestSuite(IgniteDaemonNodeMarshallerCacheTest.class);
-*/
 
         return suite;
     }


[18/18] ignite git commit: Merge branch 'ignite-1282' into ignite-gg-10760

Posted by vo...@apache.org.
Merge branch 'ignite-1282' into ignite-gg-10760


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

Branch: refs/heads/ignite-gg-10760
Commit: 33ee61caf1c9b9c9530f516c632d462519a23e5e
Parents: 96ddd1b 837de67
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 17 13:10:07 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 17 13:10:07 2015 +0300

----------------------------------------------------------------------
 .../configuration/NearCacheConfiguration.java   |  18 +-
 .../distributed/dht/GridDhtLocalPartition.java  |  26 +-
 .../query/GridCacheDistributedQueryFuture.java  |  27 +-
 .../cache/query/GridCacheLocalQueryFuture.java  |   5 +
 .../cache/query/GridCacheQueryAdapter.java      | 170 ++++++++-----
 .../query/GridCacheQueryFutureAdapter.java      |  11 +-
 .../cache/query/GridCacheQueryManager.java      |  30 ++-
 .../distributed/CacheAffEarlySelfTest.java      | 245 +++++++++++++++++++
 .../GridCacheSwapScanQueryAbstractSelfTest.java | 118 ++++-----
 .../processors/igfs/IgfsAbstractSelfTest.java   |   5 +-
 ...CacheScanPartitionQueryFallbackSelfTest.java | 244 +++++-------------
 .../Properties/AssemblyInfo.cs                  |   4 +-
 .../ignite/visor/commands/VisorConsole.scala    |  31 ++-
 .../yardstick/IgniteBenchmarkArguments.java     |  24 +-
 .../org/apache/ignite/yardstick/IgniteNode.java |  12 +-
 15 files changed, 612 insertions(+), 358 deletions(-)
----------------------------------------------------------------------



[08/18] ignite git commit: added near eviction policy for yardstick

Posted by vo...@apache.org.
added near eviction policy for yardstick


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

Branch: refs/heads/ignite-gg-10760
Commit: 8e2520474fdf6e073a54e5d8a23b32fb266d5b4c
Parents: 6bd0f8f
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Sep 15 17:09:23 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Sep 15 17:09:23 2015 +0300

----------------------------------------------------------------------
 .../yardstick/IgniteBenchmarkArguments.java     | 24 ++++++++++----------
 .../org/apache/ignite/yardstick/IgniteNode.java | 12 +++++++---
 2 files changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8e252047/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 9710443..6e9059d 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -53,6 +53,10 @@ public class IgniteBenchmarkArguments {
     private boolean nearCacheFlag = false;
 
     /** */
+    @Parameter(names = {"-ncs", "--nearCacheSize"}, description = "Near cache size")
+    private int nearCacheSize;
+
+    /** */
     @Parameter(names = {"-wom", "--writeOrderMode"}, description = "Write ordering mode")
     private CacheAtomicWriteOrderMode orderMode;
 
@@ -81,10 +85,6 @@ public class IgniteBenchmarkArguments {
     private String restTcpHost;
 
     /** */
-    @Parameter(names = {"-ss", "--syncSend"}, description = "Synchronous send")
-    private boolean syncSnd;
-
-    /** */
     @Parameter(names = {"-r", "--range"}, description = "Key range")
     private int range = 1_000_000;
 
@@ -162,6 +162,13 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
+     * @return Near cache size ({@code 0} for unlimited).
+     */
+    public int getNearCacheSize() {
+        return nearCacheSize;
+    }
+
+    /**
      * @return Synchronization.
      */
     public CacheWriteSynchronizationMode syncMode() {
@@ -211,13 +218,6 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
-     * @return {@code True} if sending is synchronous.
-     */
-    public boolean isSyncSend() {
-        return syncSnd;
-    }
-
-    /**
      * @return Key range, from {@code 0} to this number.
      */
     public int range() {
@@ -278,4 +278,4 @@ public class IgniteBenchmarkArguments {
     @Override public String toString() {
         return GridToStringBuilder.toString(IgniteBenchmarkArguments.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/8e252047/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index 8c3bc45..ea3bd07 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -86,8 +86,14 @@ public class IgniteNode implements BenchmarkServer {
             if (cl)
                 c.setClientMode(true);
 
-            if (args.isNearCache())
-                cc.setNearConfiguration(new NearCacheConfiguration());
+            if (args.isNearCache()) {
+                NearCacheConfiguration nearCfg = new NearCacheConfiguration();
+
+                if (args.getNearCacheSize() != 0)
+                    nearCfg.setNearEvictionPolicy(new LruEvictionPolicy(args.getNearCacheSize()));
+
+                cc.setNearConfiguration(nearCfg);
+            }
 
             cc.setWriteSynchronizationMode(args.syncMode());
 
@@ -204,4 +210,4 @@ public class IgniteNode implements BenchmarkServer {
     public Ignite ignite() {
         return ignite;
     }
-}
\ No newline at end of file
+}


[07/18] ignite git commit: IGFS: Reverted back some test changes.

Posted by vo...@apache.org.
IGFS: Reverted back some test changes.


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

Branch: refs/heads/ignite-gg-10760
Commit: 7a71b206227452706bbee4e9b64b2294eb39750d
Parents: cb7d972
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 17:08:16 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 17:08:16 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsAbstractSelfTest.java       | 8 +++++---
 .../internal/processors/igfs/IgfsDualAbstractSelfTest.java   | 6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7a71b206/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 3e63cdc..0a1e626 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -2296,12 +2296,11 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
      * Create the file in the given IGFS and write provided data chunks to it.
      *
      * @param file File.
-     * @param overwrite Overwrite flag.
      * @param chunks Data chunks.
      * @throws IOException In case of IO exception.
      */
-    protected static void createFile(UniversalFileSystemAdapter uni, IgfsPath file, boolean overwrite,
-        @Nullable byte[]... chunks) throws IOException {
+    protected static void createFile(UniversalFileSystemAdapter uni, IgfsPath file, @Nullable byte[]... chunks)
+        throws IOException {
         OutputStream os = null;
 
         try {
@@ -2689,5 +2688,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
 
         if (igfsEx != null)
             clear(igfsEx);
+
+        // Clear the filesystem.
+        uni.format();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/7a71b206/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 9527459..683054b 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
@@ -1129,7 +1129,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
         create(igfsSecondary, paths(DIR, SUBDIR), null);
         create(igfs, null, null);
 
-        createFile(igfsSecondary, FILE, true, chunk);
+        createFile(igfsSecondary, FILE, chunk);
 
         checkFileContent(igfs, FILE, chunk);
     }
@@ -1348,7 +1348,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
 
         igfsSecondaryFileSystem.update(SUBDIR, props);
 
-        createFile(igfsSecondary, FILE, true, /*BLOCK_SIZE,*/ chunk);
+        createFile(igfsSecondary, FILE, /*BLOCK_SIZE,*/ chunk);
 
         appendFile(igfs, FILE, chunk);
 
@@ -1375,7 +1375,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
         igfsSecondaryFileSystem.update(DIR, propsDir);
         igfsSecondaryFileSystem.update(SUBDIR, propsSubDir);
 
-        createFile(igfsSecondary, FILE, true, /*BLOCK_SIZE,*/ chunk);
+        createFile(igfsSecondary, FILE, /*BLOCK_SIZE,*/ chunk);
 
         appendFile(igfs, FILE, chunk);
 


[14/18] ignite git commit: IGNITE-1498 Added support for -cfg=path command line option.

Posted by vo...@apache.org.
IGNITE-1498 Added support for -cfg=path command line option.


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

Branch: refs/heads/ignite-gg-10760
Commit: cd6a1d513adab5a24b33a9315bfd083c2f4383ee
Parents: 6187241
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Sep 17 14:33:00 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Sep 17 14:33:00 2015 +0700

----------------------------------------------------------------------
 .../ignite/visor/commands/VisorConsole.scala    | 31 +++++++++++++-------
 1 file changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cd6a1d51/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
index bcfc6e0..627f795 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
@@ -84,13 +84,14 @@ class VisorConsole {
 
         if (hasArgFlag("?", argLst) || hasArgFlag("help", argLst)) {
             println("Usage:")
-            println(s"    $progName [?]|[{-v}{-np}]|[{-b=<batch commands file path>} {-e=command1;command2}]")
+            println(s"    $progName [? | -help]|[{-v}{-np} {-cfg=<path>}]|[{-b=<path>} {-e=command1;command2;...}]")
             println("    Where:")
-            println("        ?, /help, -help - show this message.")
-            println("        -v              - verbose mode (quiet by default).")
-            println("        -np             - no pause on exit (pause by default)")
-            println("        -b              - batch mode with file)")
-            println("        -e              - batch mode with commands)")
+            println("        ?, /help, -help      - show this message.")
+            println("        -v                   - verbose mode (quiet by default).")
+            println("        -np                  - no pause on exit (pause by default).")
+            println("        -cfg=<path>          - connect with specified configuration.")
+            println("        -b=<path>            - batch mode with file.")
+            println("        -e==cmd1;cmd2;...    - batch mode with commands.")
 
             visor.quit()
         }
@@ -99,14 +100,22 @@ class VisorConsole {
     }
 
     protected def buildReader(argLst: ArgList) = {
+        val cfgFile = argValue("cfg", argLst)
         val batchFile = argValue("b", argLst)
         val batchCommand = argValue("e", argLst)
 
+        cfgFile.foreach(cfg => {
+            if (batchFile.isDefined || batchCommand.isDefined) {
+                visor.warn("Options can't contains both -cfg and one of -b or -e options.")
+
+                visor.quit()
+            }
+
+            visor.searchCmd("open").foreach(_.withArgs("-cpath=" + cfg))
+        })
+
         if (batchFile.isDefined && batchCommand.isDefined) {
-            visor.warn(
-                "Illegal options can't contains both command file and commands",
-                s"Usage: $progName {-b=<batch commands file path>} {-e=command1;command2}"
-            )
+            visor.warn("Options can't contains both command file and commands.")
 
             visor.quit()
         }
@@ -303,7 +312,7 @@ object VisorConsole extends VisorConsole with App {
     addCommands()
 
     private val argLst = parse(args.mkString(" "))
-    
+
     private val reader = buildReader(argLst)
 
     visor.reader(reader)


[17/18] ignite git commit: Merge branch 'ignite-1435' of https://github.com/ptupitsyn/ignite into ignite-1282

Posted by vo...@apache.org.
Merge branch 'ignite-1435' of https://github.com/ptupitsyn/ignite into ignite-1282


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

Branch: refs/heads/ignite-gg-10760
Commit: 837de6725659326123dcff6f9fcc56f3366e1e8c
Parents: e942cae 3e69459
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 17 12:48:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 17 12:48:27 2015 +0300

----------------------------------------------------------------------
 .../main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/837de672/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --cc modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
index 1876e24,26385e3..1bcb658
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
+++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
@@@ -33,14 -33,14 +33,14 @@@ using System.Runtime.InteropServices
  
  [assembly: Guid("97db45a8-f922-456a-a819-7b3c6e5e03ba")]
  
 -[assembly: AssemblyVersion("1.4.0")]
 -[assembly: AssemblyFileVersion("1.4.0")]
 +[assembly: AssemblyVersion("1.5.0")]
 +[assembly: AssemblyFileVersion("1.5.0")]
  
  [assembly: CLSCompliant(true)]
- [assembly: InternalsVisibleTo("Apache.Ignite")]
  
- #if !EXCLUDE_TESTS
+ #if !EXCLUDE_INTERNALS_VISIBLE_TO
  
+ [assembly: InternalsVisibleTo("Apache.Ignite")]
  [assembly: InternalsVisibleTo("Apache.Ignite.Core.Tests")]
  
  #endif


[05/18] ignite git commit: IGFS: Reverted back some test changes.

Posted by vo...@apache.org.
IGFS: Reverted back some test changes.


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

Branch: refs/heads/ignite-gg-10760
Commit: 126e68bee16d7f31a7c1ae6810fe40d5ea3f8a34
Parents: ae1e1dc
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 17:03:00 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 17:03:00 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/igfs/IgfsAbstractSelfTest.java | 7 ++++---
 .../internal/processors/igfs/IgfsDualAbstractSelfTest.java    | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/126e68be/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 076c269..3e63cdc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -2295,13 +2295,13 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
     /**
      * Create the file in the given IGFS and write provided data chunks to it.
      *
-     * @param uni File system adapter.
      * @param file File.
+     * @param overwrite Overwrite flag.
      * @param chunks Data chunks.
      * @throws IOException In case of IO exception.
      */
-    protected static void createFile(UniversalFileSystemAdapter uni, IgfsPath file, @Nullable byte[]... chunks)
-        throws IOException {
+    protected static void createFile(UniversalFileSystemAdapter uni, IgfsPath file, boolean overwrite,
+        @Nullable byte[]... chunks) throws IOException {
         OutputStream os = null;
 
         try {
@@ -2313,6 +2313,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
             U.closeQuiet(os);
 
             IgfsEx igfsEx = uni.getAdapter(IgfsEx.class);
+
             if (igfsEx != null)
                 awaitFileClose(igfsEx.asSecondary(), file);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/126e68be/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 683054b..9527459 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
@@ -1129,7 +1129,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
         create(igfsSecondary, paths(DIR, SUBDIR), null);
         create(igfs, null, null);
 
-        createFile(igfsSecondary, FILE, chunk);
+        createFile(igfsSecondary, FILE, true, chunk);
 
         checkFileContent(igfs, FILE, chunk);
     }
@@ -1348,7 +1348,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
 
         igfsSecondaryFileSystem.update(SUBDIR, props);
 
-        createFile(igfsSecondary, FILE, /*BLOCK_SIZE,*/ chunk);
+        createFile(igfsSecondary, FILE, true, /*BLOCK_SIZE,*/ chunk);
 
         appendFile(igfs, FILE, chunk);
 
@@ -1375,7 +1375,7 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
         igfsSecondaryFileSystem.update(DIR, propsDir);
         igfsSecondaryFileSystem.update(SUBDIR, propsSubDir);
 
-        createFile(igfsSecondary, FILE, /*BLOCK_SIZE,*/ chunk);
+        createFile(igfsSecondary, FILE, true, /*BLOCK_SIZE,*/ chunk);
 
         appendFile(igfs, FILE, chunk);
 


[03/18] ignite git commit: fixed javadoc ignite-1.4

Posted by vo...@apache.org.
fixed javadoc ignite-1.4


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

Branch: refs/heads/ignite-gg-10760
Commit: 72e270c63e99ac17a077b26fb39302f603d15188
Parents: 3f75c1c
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Sep 15 16:55:00 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Sep 15 16:55:00 2015 +0300

----------------------------------------------------------------------
 .../configuration/NearCacheConfiguration.java     | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/72e270c6/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
index bbaa030..3c59bd6 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
@@ -25,7 +25,12 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import static org.apache.ignite.configuration.CacheConfiguration.DFLT_NEAR_START_SIZE;
 
 /**
- * Client cache configuration.
+ * Client (near) cache configuration.
+ * <p>
+ * Distributed cache can also be fronted by a Near cache,
+ * which is a smaller local cache that stores most recently
+ * or most frequently accessed data. Just like with a partitioned cache,
+ * the user can control the size of the near cache and its eviction policies.
  */
 public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /** */
@@ -45,6 +50,8 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /**
+     * Creates near cache configuration copying properties from passed in configuration.
+     *
      * @param ccfg Configuration to copy.
      */
     public NearCacheConfiguration(NearCacheConfiguration<K, V> ccfg) {
@@ -55,13 +62,20 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /**
+     * Gets near eviction policy. By default, returns {@code null}
+     * which means that evictions are disabled for near cache.
+     *
      * @return Near eviction policy.
+     * @see CacheConfiguration#getEvictionPolicy()
+     * @see CacheConfiguration#isEvictSynchronized()
      */
     public EvictionPolicy<K, V> getNearEvictionPolicy() {
         return nearEvictPlc;
     }
 
     /**
+     * Sets near eviction policy.
+     *
      * @param nearEvictPlc Near eviction policy.
      * @return {@code this} for chaining.
      */
@@ -97,4 +111,4 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     @Override public String toString() {
         return S.toString(NearCacheConfiguration.class, this, super.toString());
     }
-}
\ No newline at end of file
+}


[06/18] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.4' into ignite-1.4

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


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

Branch: refs/heads/ignite-gg-10760
Commit: cb7d972e6dfe7db70ac42a9a1889a661a2c26819
Parents: 126e68b 6bd0f8f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 15 17:03:19 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 15 17:03:19 2015 +0300

----------------------------------------------------------------------
 .../configuration/NearCacheConfiguration.java   | 18 ++++++-
 ...CacheScanPartitionQueryFallbackSelfTest.java | 54 ++++++++------------
 2 files changed, 37 insertions(+), 35 deletions(-)
----------------------------------------------------------------------



[16/18] ignite git commit: Merge branch 'master' into ignite-1282

Posted by vo...@apache.org.
Merge branch 'master' into ignite-1282


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

Branch: refs/heads/ignite-gg-10760
Commit: e942cae9e628150094d24805c268212dd094f3ab
Parents: 25c9f60 c311c3c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 17 10:45:59 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 17 10:45:59 2015 +0300

----------------------------------------------------------------------
 .../configuration/NearCacheConfiguration.java   |  18 +-
 .../distributed/dht/GridDhtLocalPartition.java  |  26 +-
 .../query/GridCacheDistributedQueryFuture.java  |  27 +-
 .../cache/query/GridCacheLocalQueryFuture.java  |   5 +
 .../cache/query/GridCacheQueryAdapter.java      | 170 ++++++++-----
 .../query/GridCacheQueryFutureAdapter.java      |  11 +-
 .../cache/query/GridCacheQueryManager.java      |  30 ++-
 .../distributed/CacheAffEarlySelfTest.java      | 245 +++++++++++++++++++
 .../GridCacheSwapScanQueryAbstractSelfTest.java | 118 ++++-----
 .../processors/igfs/IgfsAbstractSelfTest.java   |   5 +-
 ...CacheScanPartitionQueryFallbackSelfTest.java | 244 +++++-------------
 .../ignite/visor/commands/VisorConsole.scala    |  31 ++-
 .../yardstick/IgniteBenchmarkArguments.java     |  24 +-
 .../org/apache/ignite/yardstick/IgniteNode.java |  12 +-
 14 files changed, 610 insertions(+), 356 deletions(-)
----------------------------------------------------------------------



[09/18] ignite git commit: Merge remote-tracking branch 'origin/ignite-1.4' into ignite-1.4

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


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

Branch: refs/heads/ignite-gg-10760
Commit: f8577cab29faa87dd337295e3dbac68f0b94ac63
Parents: 8e25204 7a71b20
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Sep 15 17:09:37 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Sep 15 17:09:37 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/igfs/IgfsAbstractSelfTest.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[11/18] ignite git commit: IGNITE-1239 - Fixed scan query failover on changing topology.

Posted by vo...@apache.org.
IGNITE-1239 - Fixed scan query failover on changing topology.


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

Branch: refs/heads/ignite-gg-10760
Commit: 5f5220af0449fd3957d011fcef954b19da852e18
Parents: d928ef4
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 16 18:06:40 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 16 18:06:40 2015 +0300

----------------------------------------------------------------------
 .../query/GridCacheDistributedQueryFuture.java  |  27 ++-
 .../cache/query/GridCacheLocalQueryFuture.java  |   5 +
 .../cache/query/GridCacheQueryAdapter.java      | 170 ++++++++------
 .../query/GridCacheQueryFutureAdapter.java      |  11 +-
 .../cache/query/GridCacheQueryManager.java      |  30 ++-
 .../GridCacheSwapScanQueryAbstractSelfTest.java | 118 +++++-----
 ...CacheScanPartitionQueryFallbackSelfTest.java | 224 ++++++-------------
 7 files changed, 287 insertions(+), 298 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5f5220af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryFuture.java
index 1d547c5..e745e30 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryFuture.java
@@ -27,6 +27,7 @@ import java.util.concurrent.CountDownLatch;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.P1;
@@ -142,9 +143,24 @@ public class GridCacheDistributedQueryFuture<K, V, R> extends GridCacheQueryFutu
         }
 
         if (callOnPage)
-            // We consider node departure as a reception of last empty
-            // page from this node.
-            onPage(nodeId, Collections.emptyList(), null, true);
+            onPage(nodeId, Collections.emptyList(),
+                new ClusterTopologyCheckedException("Remote node has left topology: " + nodeId), true);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void awaitFirstPage() throws IgniteCheckedException {
+        try {
+            firstPageLatch.await();
+
+            if (isDone() && error() != null)
+                // Throw the exception if future failed.
+                get();
+        }
+        catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+
+            throw new IgniteInterruptedCheckedException(e);
+        }
     }
 
     /** {@inheritDoc} */
@@ -229,9 +245,12 @@ public class GridCacheDistributedQueryFuture<K, V, R> extends GridCacheQueryFutu
 
     /** {@inheritDoc} */
     @Override public boolean onDone(Collection<R> res, Throwable err) {
+        boolean done = super.onDone(res, err);
+
+        // Must release the lath after onDone() in order for a waiting thread to see an exception, if any.
         firstPageLatch.countDown();
 
-        return super.onDone(res, err);
+        return done;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/5f5220af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
index 46af18a..248dfa8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheLocalQueryFuture.java
@@ -77,6 +77,11 @@ public class GridCacheLocalQueryFuture<K, V, R> extends GridCacheQueryFutureAdap
         // No-op.
     }
 
+    /** {@inheritDoc} */
+    @Override public void awaitFirstPage() throws IgniteCheckedException {
+        get();
+    }
+
     /** */
     private class LocalQueryRunnable implements GridPlainRunnable {
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/5f5220af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index 3ac5746..855e239 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.query;
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Deque;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.Queue;
@@ -34,6 +35,7 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnreservedPartitionException;
@@ -41,14 +43,13 @@ import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.P1;
+import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.A;
 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;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.lang.IgniteClosure;
-import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.lang.IgniteReducer;
 import org.apache.ignite.plugin.security.SecurityPermission;
 import org.jetbrains.annotations.Nullable;
@@ -63,13 +64,6 @@ import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryTy
  * Query adapter.
  */
 public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
-    /** Is local node predicate. */
-    private static final IgnitePredicate<ClusterNode> IS_LOC_NODE = new IgnitePredicate<ClusterNode>() {
-        @Override public boolean apply(ClusterNode n) {
-            return n.isLocal();
-        }
-    };
-
     /** */
     private final GridCacheContext<?, ?> cctx;
 
@@ -446,7 +440,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
 
         cctx.checkSecurity(SecurityPermission.CACHE_READ);
 
-        if (nodes.isEmpty())
+        if (nodes.isEmpty() && (type != SCAN || part == null))
             return new GridCacheQueryErrorFuture<>(cctx.kernalContext(), new ClusterGroupEmptyCheckedException());
 
         if (log.isDebugEnabled())
@@ -477,8 +471,8 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
         if (type == SQL_FIELDS || type == SPI)
             return (CacheQueryFuture<R>)(loc ? qryMgr.queryFieldsLocal(bean) :
                 qryMgr.queryFieldsDistributed(bean, nodes));
-        else if (type == SCAN && part != null && nodes.size() > 1)
-            return new CacheQueryFallbackFuture<>(nodes, part, bean, qryMgr, cctx);
+        else if (type == SCAN && part != null && !cctx.isLocal())
+            return new CacheQueryFallbackFuture<>(part, bean, qryMgr, cctx);
         else
             return (CacheQueryFuture<R>)(loc ? qryMgr.queryLocal(bean) : qryMgr.queryDistributed(bean, nodes));
     }
@@ -581,37 +575,48 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
         /** Partition. */
         private final int part;
 
+        /** Flag indicating that a first item has been returned to a user. */
+        private boolean firstItemReturned;
+
         /**
-         * @param nodes Backups.
          * @param part Partition.
          * @param bean Bean.
          * @param qryMgr Query manager.
          * @param cctx Cache context.
          */
-        public CacheQueryFallbackFuture(Collection<ClusterNode> nodes, int part, GridCacheQueryBean bean,
+        private CacheQueryFallbackFuture(int part, GridCacheQueryBean bean,
             GridCacheQueryManager qryMgr, GridCacheContext cctx) {
-            this.nodes = fallbacks(nodes);
             this.bean = bean;
             this.qryMgr = qryMgr;
             this.cctx = cctx;
             this.part = part;
 
+            nodes = fallbacks(cctx.discovery().topologyVersionEx());
+
             init();
         }
 
         /**
-         * @param nodes Nodes.
+         * @param topVer Topology version.
          * @return Nodes for query execution.
          */
-        private Queue<ClusterNode> fallbacks(Collection<ClusterNode> nodes) {
-            Queue<ClusterNode> fallbacks = new LinkedList<>();
+        private Queue<ClusterNode> fallbacks(AffinityTopologyVersion topVer) {
+            Deque<ClusterNode> fallbacks = new LinkedList<>();
+            Collection<ClusterNode> owners = new HashSet<>();
 
-            ClusterNode node = F.first(F.view(nodes, IS_LOC_NODE));
+            for (ClusterNode node : cctx.topology().owners(part, topVer)) {
+                if (node.isLocal())
+                    fallbacks.addFirst(node);
+                else
+                    fallbacks.add(node);
 
-            if (node != null)
-                fallbacks.add(node);
+                owners.add(node);
+            }
 
-            fallbacks.addAll(node != null ? F.view(nodes, F.not(IS_LOC_NODE)) : nodes);
+            for (ClusterNode node : cctx.topology().moving(part)) {
+                if (!owners.contains(node))
+                    fallbacks.add(node);
+            }
 
             return fallbacks;
         }
@@ -623,53 +628,9 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
         private void init() {
             final ClusterNode node = nodes.poll();
 
-            GridCacheQueryFutureAdapter<?, ?, R> fut0 = (GridCacheQueryFutureAdapter<?, ?, R>)(node.isLocal() ?
+            fut = (GridCacheQueryFutureAdapter<?, ?, R>)(node.isLocal() ?
                 qryMgr.queryLocal(bean) :
                 qryMgr.queryDistributed(bean, Collections.singleton(node)));
-
-            fut0.listen(new IgniteInClosure<IgniteInternalFuture<Collection<R>>>() {
-                @Override public void apply(IgniteInternalFuture<Collection<R>> fut) {
-                    try {
-                        onDone(fut.get());
-                    }
-                    catch (IgniteClientDisconnectedCheckedException e) {
-                        onDone(e);
-                    }
-                    catch (IgniteCheckedException e) {
-                        if (e.hasCause(GridDhtUnreservedPartitionException.class)) {
-                            unreservedTopVer = ((GridDhtUnreservedPartitionException)e.getCause()).topologyVersion();
-
-                            assert unreservedTopVer != null;
-                        }
-
-                        if (F.isEmpty(nodes)) {
-                            final AffinityTopologyVersion topVer = unreservedTopVer;
-
-                            if (topVer != null && --unreservedNodesRetryCnt > 0) {
-                                cctx.affinity().affinityReadyFuture(topVer).listen(
-                                    new IgniteInClosure<IgniteInternalFuture<AffinityTopologyVersion>>() {
-                                        @Override public void apply(
-                                            IgniteInternalFuture<AffinityTopologyVersion> future) {
-
-                                            nodes = fallbacks(cctx.topology().owners(part, topVer));
-
-                                            // Race is impossible here because query retries are executed one by one.
-                                            unreservedTopVer = null;
-
-                                            init();
-                                        }
-                                    });
-                            }
-                            else
-                                onDone(e);
-                        }
-                        else
-                            init();
-                    }
-                }
-            });
-
-            fut = fut0;
         }
 
         /** {@inheritDoc} */
@@ -683,8 +644,81 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
         }
 
         /** {@inheritDoc} */
+        @Override public Collection<R> get() throws IgniteCheckedException {
+            assert false;
+
+            return super.get();
+        }
+
+        /** {@inheritDoc} */
         @Override public R next() {
-            return fut.next();
+            if (firstItemReturned)
+                return fut.next();
+
+            while (true) {
+                try {
+                    fut.awaitFirstPage();
+
+                    firstItemReturned = true;
+
+                    return fut.next();
+                }
+                catch (IgniteClientDisconnectedCheckedException e) {
+                    throw CU.convertToCacheException(e);
+                }
+                catch (IgniteCheckedException e) {
+                    retryIfPossible(e);
+                }
+            }
+        }
+
+        /**
+         * @param e Exception for query run.
+         */
+        private void retryIfPossible(IgniteCheckedException e) {
+            try {
+                IgniteInternalFuture<?> retryFut;
+
+                if (e.hasCause(GridDhtUnreservedPartitionException.class)) {
+                    AffinityTopologyVersion waitVer = ((GridDhtUnreservedPartitionException)e.getCause()).topologyVersion();
+
+                    assert waitVer != null;
+
+                    retryFut = cctx.affinity().affinityReadyFuture(waitVer);
+                }
+                else if (e.hasCause(ClusterTopologyCheckedException.class)) {
+                    ClusterTopologyCheckedException topEx = X.cause(e, ClusterTopologyCheckedException.class);
+
+                    retryFut = topEx.retryReadyFuture();
+                }
+                else if (e.hasCause(ClusterGroupEmptyCheckedException.class)) {
+                    ClusterGroupEmptyCheckedException ex = X.cause(e, ClusterGroupEmptyCheckedException.class);
+
+                    retryFut = ex.retryReadyFuture();
+                }
+                else
+                    throw CU.convertToCacheException(e);
+
+                if (F.isEmpty(nodes)) {
+                    if (--unreservedNodesRetryCnt > 0) {
+                        if (retryFut != null)
+                            retryFut.get();
+
+                        nodes = fallbacks(unreservedTopVer == null ? cctx.discovery().topologyVersionEx() : unreservedTopVer);
+
+                        unreservedTopVer = null;
+
+                        init();
+                    }
+                    else
+                        throw CU.convertToCacheException(e);
+                }
+                else
+                    init();
+            }
+            catch (IgniteCheckedException ex) {
+                throw CU.convertToCacheException(ex);
+            }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/5f5220af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
index ad9ee39..2a4fbda 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
@@ -183,6 +183,13 @@ public abstract class GridCacheQueryFutureAdapter<K, V, R> extends GridFutureAda
     }
 
     /**
+     * Waits for the first page to be received from remote node(s), if any.
+     *
+     * @throws IgniteCheckedException If query execution failed with an error.
+     */
+    public abstract void awaitFirstPage() throws IgniteCheckedException;
+
+    /**
      * Returns next page for the query.
      *
      * @return Next page or {@code null} if no more pages available.
@@ -380,13 +387,13 @@ public abstract class GridCacheQueryFutureAdapter<K, V, R> extends GridFutureAda
                 synchronized (mux) {
                     enqueue(Collections.emptyList());
 
-                    onPage(nodeId, true);
-
                     onDone(nodeId != null ?
                         new IgniteCheckedException("Failed to execute query on node [query=" + qry +
                             ", nodeId=" + nodeId + "]", err) :
                         new IgniteCheckedException("Failed to execute query locally: " + qry, err));
 
+                    onPage(nodeId, true);
+
                     mux.notifyAll();
                 }
             else {

http://git-wip-us.apache.org/repos/asf/ignite/blob/5f5220af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 1d934d8..25ace1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -33,8 +33,9 @@ import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheMetricsImpl;
 import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.CachePeekModes;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
 import org.apache.ignite.internal.processors.cache.GridCacheInternal;
 import org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheOffheapSwapEntry;
@@ -819,8 +820,12 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
         final GridDhtCacheAdapter dht = cctx.isLocal() ? null : (cctx.isNear() ? cctx.near().dht() : cctx.dht());
 
+        final GridCacheAdapter cache = dht != null ? dht : cctx.cache();
+
         final ExpiryPolicy plc = cctx.expiry();
 
+        final AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();
+
         final boolean backups = qry.includeBackups() || cctx.isReplicated();
 
         final GridCloseableIteratorAdapter<IgniteBiTuple<K, V>> heapIt =
@@ -841,8 +846,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                     else if (part < 0 || part >= cctx.affinity().partitions())
                         iter = F.emptyIterator();
                     else {
-                        AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();
-
                         locPart = dht.topology().localPartition(part, topVer, false);
 
                         // double check for owning state
@@ -899,7 +902,15 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                         V val;
 
                         try {
-                            val = prj.localPeek(key, CachePeekModes.ONHEAP_ONLY, expiryPlc);
+                            GridCacheEntryEx entry = cache.peekEx(key);
+
+                            CacheObject cacheVal =
+                                entry != null ? entry.peek(true, false, false, topVer, expiryPlc) : null;
+
+                            val = cacheVal != null ? (V)cacheVal.value(cctx.cacheObjectContext(), false) : null;
+                        }
+                        catch (GridCacheEntryRemovedException e) {
+                            val = null;
                         }
                         catch (IgniteCheckedException e) {
                             if (log.isDebugEnabled())
@@ -1557,7 +1568,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                 }
             }
             catch (Throwable e) {
-                U.error(log, "Failed to run query [qry=" + qryInfo + ", node=" + cctx.nodeId() + "]", e);
+                if (!X.hasCause(e, GridDhtUnreservedPartitionException.class))
+                    U.error(log, "Failed to run query [qry=" + qryInfo + ", node=" + cctx.nodeId() + "]", e);
 
                 onPageReady(loc, qryInfo, null, true, e);
 
@@ -1572,8 +1584,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                             res.closeIfNotShared(recipient(qryInfo.senderId(), qryInfo.requestId()));
                         }
                         catch (IgniteCheckedException e) {
-                            U.error(log, "Failed to close local iterator [qry=" + qryInfo + ", node=" +
-                                cctx.nodeId() + "]", e);
+                            if (!X.hasCause(e, GridDhtUnreservedPartitionException.class))
+                                U.error(log, "Failed to close local iterator [qry=" + qryInfo + ", node=" +
+                                    cctx.nodeId() + "]", e);
                         }
                     }
                 }
@@ -1694,7 +1707,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                     fut.get().closeIfNotShared(recipient(sndId, reqId));
                 }
                 catch (IgniteCheckedException e) {
-                    U.error(log, "Failed to close iterator.", e);
+                    if (!X.hasCause(e, GridDhtUnreservedPartitionException.class))
+                        U.error(log, "Failed to close iterator.", e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5f5220af/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
index 6f4a4ab..94c8d00 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheSwapScanQueryAbstractSelfTest.java
@@ -19,13 +19,16 @@ package org.apache.ignite.internal.processors.cache.query;
 
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
+import javax.cache.Cache;
+import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -115,13 +118,13 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
      * @throws Exception If failed.
      */
     public void testQuery() throws Exception {
-        checkQuery(((IgniteKernal)grid(0)).internalCache(ATOMIC_CACHE_NAME), false);
+        checkQuery(grid(0).cache(ATOMIC_CACHE_NAME), false);
 
-        checkQuery(((IgniteKernal)grid(0)).internalCache(TRANSACTIONAL_CACHE_NAME), false);
+        checkQuery(grid(0).cache(TRANSACTIONAL_CACHE_NAME), false);
 
-        checkQuery(((IgniteKernal)grid(0)).internalCache(ATOMIC_CACHE_NAME), true);
+        checkQuery(grid(0).cache(ATOMIC_CACHE_NAME), true);
 
-        checkQuery(((IgniteKernal)grid(0)).internalCache(TRANSACTIONAL_CACHE_NAME), true);
+        checkQuery(grid(0).cache(TRANSACTIONAL_CACHE_NAME), true);
     }
 
     /**
@@ -130,16 +133,18 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
      * @throws Exception If failed.
      */
     @SuppressWarnings("unchecked")
-    private void checkQuery(GridCacheAdapter cache, boolean scanPartitions) throws Exception {
+    private void checkQuery(IgniteCache cache, boolean scanPartitions) throws Exception {
         final int ENTRY_CNT = 500;
 
         Map<Integer, Map<Key, Person>> entries = new HashMap<>();
 
+        Affinity<Object> aff = ignite(0).affinity(cache.getName());
+
         for (int i = 0; i < ENTRY_CNT; i++) {
             Key key = new Key(i);
             Person val = new Person("p-" + i, i);
 
-            int part = cache.context().affinity().partition(key);
+            int part = aff.partition(key);
 
             cache.getAndPut(key, val);
 
@@ -152,24 +157,26 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
         }
 
         try {
-            int partitions = scanPartitions ? cache.context().affinity().partitions() : 1;
+            int partitions = scanPartitions ? aff.partitions() : 1;
 
             for (int i = 0; i < partitions; i++) {
-                CacheQuery<Map.Entry<Key, Person>> qry = cache.context().queries().createScanQuery(
-                    new IgniteBiPredicate<Key, Person>() {
-                        @Override public boolean apply(Key key, Person p) {
-                            assertEquals(key.id, (Integer)p.salary);
+                ScanQuery<Key, Person> qry = new ScanQuery<>(new IgniteBiPredicate<Key, Person>() {
+                    @Override public boolean apply(Key key, Person p) {
+                        assertEquals(key.id, (Integer)p.salary);
+
+                        return key.id % 2 == 0;
+                    }
+                });
 
-                            return key.id % 2 == 0;
-                        }
-                    }, (scanPartitions ? i : null), false);
+                if (scanPartitions)
+                    qry.setPartition(i);
 
-                Collection<Map.Entry<Key, Person>> res = qry.execute().get();
+                List<Cache.Entry<Key, Person>> res = cache.query(qry).getAll();
 
                 if (!scanPartitions)
                     assertEquals(ENTRY_CNT / 2, res.size());
 
-                for (Map.Entry<Key, Person> e : res) {
+                for (Cache.Entry<Key, Person> e : res) {
                     Key k = e.getKey();
                     Person p = e.getValue();
 
@@ -183,9 +190,12 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
                     }
                 }
 
-                qry = cache.context().queries().createScanQuery(null, (scanPartitions ? i : null), false);
+                qry = new ScanQuery<>();
+
+                if (scanPartitions)
+                    qry.setPartition(i);
 
-                res = qry.execute().get();
+                res = cache.query(qry).getAll();
 
                 if (!scanPartitions)
                     assertEquals(ENTRY_CNT, res.size());
@@ -204,23 +214,22 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
      * @param expCnt Expected entries in query result.
      * @throws Exception If failed.
      */
-    private void testMultithreaded(final GridCacheAdapter cache, final int expCnt) throws Exception {
+    private void testMultithreaded(final IgniteCache cache, final int expCnt) throws Exception {
         log.info("Starting multithreaded queries.");
 
         GridTestUtils.runMultiThreaded(new Callable<Void>() {
             @SuppressWarnings("unchecked")
             @Override public Void call() throws Exception {
-                CacheQuery<Map.Entry<Key, Person>> qry = cache.context().queries().createScanQuery(
-                    new IgniteBiPredicate<Key, Person>() {
-                        @Override public boolean apply(Key key, Person p) {
-                            assertEquals(key.id, (Integer)p.salary);
+                ScanQuery<Key, Person> qry = new ScanQuery<>(new IgniteBiPredicate<Key, Person>() {
+                    @Override public boolean apply(Key key, Person p) {
+                        assertEquals(key.id, (Integer)p.salary);
 
-                            return key.id % 2 == 0;
-                        }
-                    }, null, false);
+                        return key.id % 2 == 0;
+                    }
+                });
 
                 for (int i = 0; i < 250; i++) {
-                    Collection<Map.Entry<Key, Person>> res = qry.execute().get();
+                    List<Cache.Entry<Key, Person>> res = cache.query(qry).getAll();
 
                     assertEquals(expCnt, res.size());
 
@@ -237,9 +246,9 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
      * @throws Exception If failed.
      */
     public void testQueryPrimitives() throws Exception {
-        checkQueryPrimitives(((IgniteKernal)grid(0)).internalCache(ATOMIC_CACHE_NAME));
+        checkQueryPrimitives(grid(0).cache(ATOMIC_CACHE_NAME));
 
-        checkQueryPrimitives(((IgniteKernal)grid(0)).internalCache(TRANSACTIONAL_CACHE_NAME));
+        checkQueryPrimitives(grid(0).cache(TRANSACTIONAL_CACHE_NAME));
     }
 
     /**
@@ -247,27 +256,26 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
      * @throws Exception If failed.
      */
     @SuppressWarnings("unchecked")
-    private void checkQueryPrimitives(GridCacheAdapter cache) throws Exception {
+    private void checkQueryPrimitives(IgniteCache cache) throws Exception {
         final int ENTRY_CNT = 500;
 
         for (int i = 0; i < ENTRY_CNT; i++)
-            cache.getAndPut(String.valueOf(i), (long) i);
+            cache.getAndPut(String.valueOf(i), (long)i);
 
         try {
-            CacheQuery<Map.Entry<String, Long>> qry = cache.context().queries().createScanQuery(
-                new IgniteBiPredicate<String, Long>() {
-                    @Override public boolean apply(String key, Long val) {
-                        assertEquals(key, String.valueOf(val));
+            ScanQuery<String, Long> qry = new ScanQuery<>(new IgniteBiPredicate<String, Long>() {
+                @Override public boolean apply(String key, Long val) {
+                    assertEquals(key, String.valueOf(val));
 
-                        return val % 2 == 0;
-                    }
-                }, null, false);
+                    return val % 2 == 0;
+                }
+            });
 
-            Collection<Map.Entry<String, Long>> res = qry.execute().get();
+            Collection<Cache.Entry<String, Long>> res = cache.query(qry).getAll();
 
             assertEquals(ENTRY_CNT / 2, res.size());
 
-            for (Map.Entry<String, Long> e : res) {
+            for (Cache.Entry<String, Long> e : res) {
                 String key = e.getKey();
                 Long val = e.getValue();
 
@@ -276,9 +284,9 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
                 assertEquals(0, val % 2);
             }
 
-            qry = cache.context().queries().createScanQuery(null, null, false);
+            qry = new ScanQuery<>();
 
-            res = qry.execute().get();
+            res = cache.query(qry).getAll();
 
             assertEquals(ENTRY_CNT, res.size());
         }
@@ -292,9 +300,9 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
      * @throws Exception If failed.
      */
     public void testQueryValueByteArray() throws Exception {
-        checkQueryValueByteArray(((IgniteKernal)grid(0)).internalCache(ATOMIC_CACHE_NAME));
+        checkQueryValueByteArray(grid(0).cache(ATOMIC_CACHE_NAME));
 
-        checkQueryValueByteArray(((IgniteKernal)grid(0)).internalCache(TRANSACTIONAL_CACHE_NAME));
+        checkQueryValueByteArray(grid(0).cache(TRANSACTIONAL_CACHE_NAME));
     }
 
     /**
@@ -302,27 +310,27 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
      * @throws Exception If failed.
      */
     @SuppressWarnings("unchecked")
-    private void checkQueryValueByteArray(GridCacheAdapter cache) throws Exception {
+    private void checkQueryValueByteArray(IgniteCache cache) throws Exception {
         final int ENTRY_CNT = 100;
 
         for (int i = 0; i < ENTRY_CNT; i++)
             cache.getAndPut(i, new byte[i]);
 
         try {
-            CacheQuery<Map.Entry<Integer, byte[]>> qry = cache.context().queries().createScanQuery(
+            ScanQuery<Integer, byte[]> qry = new ScanQuery<>(
                 new IgniteBiPredicate<Integer, byte[]>() {
                     @Override public boolean apply(Integer key, byte[] val) {
                         assertEquals(key, (Integer)val.length);
 
                         return key % 2 == 0;
                     }
-                }, null, false);
+                });
 
-            Collection<Map.Entry<Integer, byte[]>> res = qry.execute().get();
+            Collection<Cache.Entry<Integer, byte[]>> res = cache.query(qry).getAll();
 
             assertEquals(ENTRY_CNT / 2, res.size());
 
-            for (Map.Entry<Integer, byte[]> e : res) {
+            for (Cache.Entry<Integer, byte[]> e : res) {
                 Integer key = e.getKey();
                 byte[] val = e.getValue();
 
@@ -331,9 +339,9 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
                 assertEquals(0, key % 2);
             }
 
-            qry = cache.context().queries().createScanQuery(null, null, false);
+            qry = new ScanQuery<>();
 
-            res = qry.execute().get();
+            res = cache.query(qry).getAll();
 
             assertEquals(ENTRY_CNT, res.size());
         }
@@ -419,9 +427,9 @@ public abstract class GridCacheSwapScanQueryAbstractSelfTest extends GridCommonA
 
         /** {@inheritDoc} */
         @Override public int hashCode() {
-            int result = name != null ? name.hashCode() : 0;
+            int res = name != null ? name.hashCode() : 0;
 
-            return 31 * result + salary;
+            return 31 * res + salary;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/5f5220af/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
index 1ef470a..02b213e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
@@ -22,36 +22,29 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeSet;
 import java.util.UUID;
 import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
-import org.apache.ignite.internal.processors.cache.query.CacheQuery;
-import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
-import org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -91,18 +84,15 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
     /** Expected first node ID. */
     private static UUID expNodeId;
 
-    /** Expected fallback node ID. */
-    private static UUID expFallbackNodeId;
-
     /** Communication SPI factory. */
     private CommunicationSpiFactory commSpiFactory;
 
-    /** Latch. */
-    private static CountDownLatch latch;
-
     /** Test entries. */
     private Map<Integer, Map<Integer, Integer>> entries = new HashMap<>();
 
+    /** */
+    private boolean syncRebalance;
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -120,6 +110,10 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
         ccfg.setBackups(backups);
+
+        if (syncRebalance)
+            ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
+
         ccfg.setNearConfiguration(null);
 
         cfg.setCacheConfiguration(ccfg);
@@ -144,7 +138,8 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
             int part = anyLocalPartition(cache.context());
 
-            CacheQuery<Map.Entry<Integer, Integer>> qry = cache.context().queries().createScanQuery(null, part, false);
+            QueryCursor<Cache.Entry<Integer, Integer>> qry =
+                cache.query(new ScanQuery<Integer, Integer>().setPartition(part));
 
             doTestScanQuery(qry, part);
         }
@@ -174,7 +169,8 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
             expNodeId = tup.get2();
 
-            CacheQuery<Map.Entry<Integer, Integer>> qry = cache.context().queries().createScanQuery(null, part, false);
+            QueryCursor<Cache.Entry<Integer, Integer>> qry =
+                cache.query(new ScanQuery<Integer, Integer>().setPartition(part));
 
             doTestScanQuery(qry, part);
         }
@@ -184,16 +180,22 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
     }
 
     /**
-     * Scan should activate fallback mechanism when new nodes join topology and rebalancing happens in parallel with
-     * scan query.
-     *
      * @throws Exception In case of error.
      */
     public void testScanFallbackOnRebalancing() throws Exception {
+        scanFallbackOnRebalancing(false);
+    }
+
+    /**
+     * @param cur If {@code true} tests query cursor.
+     * @throws Exception In case of error.
+     */
+    private void scanFallbackOnRebalancing(final boolean cur) throws Exception {
         cacheMode = CacheMode.PARTITIONED;
         clientMode = false;
-        backups = 1;
+        backups = 2;
         commSpiFactory = new TestFallbackOnRebalancingCommunicationSpiFactory();
+        syncRebalance = true;
 
         try {
             Ignite ignite = startGrids(GRID_CNT);
@@ -214,6 +216,8 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
                             Thread.sleep(3000);
 
+                            info("Will stop grid: " + getTestGridName(id));
+
                             stopGrid(id);
 
                             if (done.get())
@@ -224,7 +228,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
                         return null;
                     }
-                }, GRID_CNT);
+                }, 2);
 
             final AtomicInteger nodeIdx = new AtomicInteger();
 
@@ -233,18 +237,24 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
                     @Override public Object call() throws Exception {
                         int nodeId = nodeIdx.getAndIncrement();
 
-                        IgniteCacheProxy<Integer, Integer> cache = (IgniteCacheProxy<Integer, Integer>)
-                            grid(nodeId).<Integer, Integer>cache(null);
+                        IgniteCache<Integer, Integer> cache = grid(nodeId).cache(null);
+
+                        int cntr = 0;
 
                         while (!done.get()) {
-                            IgniteBiTuple<Integer, UUID> tup = remotePartition(cache.context());
+                            int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(null).partitions());
 
-                            int part = tup.get1();
+                            if (cntr++ % 100 == 0)
+                                info("Running query [node=" + nodeId + ", part=" + part + ']');
 
-                            CacheQuery<Map.Entry<Integer, Integer>> qry = cache.context().queries().createScanQuery(
-                                null, part, false);
+                            try (QueryCursor<Cache.Entry<Integer, Integer>> cur0 =
+                                     cache.query(new ScanQuery<Integer, Integer>(part).setPageSize(5))) {
 
-                            doTestScanQuery(qry, part);
+                                if (cur)
+                                    doTestScanQueryCursor(cur0, part);
+                                else
+                                    doTestScanQuery(cur0, part);
+                            }
                         }
 
                         return null;
@@ -269,9 +279,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
      *
      * @throws Exception In case of error.
      */
-    public void testScanFallbackOnRebalancingCursor() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1239");
-
+    public void testScanFallbackOnRebalancingCursor1() throws Exception {
         cacheMode = CacheMode.PARTITIONED;
         clientMode = false;
         backups = 1;
@@ -308,15 +316,19 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
                         IgniteCache<Integer, Integer> cache = grid(nodeId).cache(null);
 
+                        int cntr = 0;
+
                         while (!done.get()) {
                             int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(null).partitions());
 
-                            QueryCursor<Cache.Entry<Integer, Integer>> cur =
-                                cache.query(new ScanQuery<Integer, Integer>(part));
+                            if (cntr++ % 100 == 0)
+                                info("Running query [node=" + nodeId + ", part=" + part + ']');
 
-                            U.debug(log, "Running query [node=" + nodeId + ", part=" + part + ']');
+                            try (QueryCursor<Cache.Entry<Integer, Integer>> cur =
+                                     cache.query(new ScanQuery<Integer, Integer>(part).setPageSize(5))) {
 
-                            doTestScanQueryCursor(cur, part);
+                                doTestScanQueryCursor(cur, part);
+                            }
                         }
 
                         return null;
@@ -332,95 +344,15 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
     }
 
     /**
-     * Scan should try first remote node and fallbacks to second remote node.
-     *
      * @throws Exception If failed.
      */
-    public void testScanFallback() throws Exception {
-        cacheMode = CacheMode.PARTITIONED;
-        backups = 1;
-        commSpiFactory = new TestFallbackCommunicationSpiFactory();
-
-        final Set<Integer> candidates = new TreeSet<>();
-
-        final AtomicBoolean test = new AtomicBoolean(false);
-
-        for(int j = 0; j < 2; j++) {
-            clientMode = true;
-
-            latch = new CountDownLatch(1);
-
-            try {
-                final Ignite ignite0 = startGrid(0);
-
-                clientMode = false;
-
-                final IgniteEx ignite1 = startGrid(1);
-                final IgniteEx ignite2 = startGrid(2);
-                startGrid(3);
-
-                if (test.get()) {
-                    expNodeId = ignite1.localNode().id();
-                    expFallbackNodeId = ignite2.localNode().id();
-                }
-
-                final IgniteCacheProxy<Integer, Integer> cache = fillCache(ignite0);
-
-                if (!test.get()) {
-                    candidates.addAll(localPartitions(ignite1));
-
-                    candidates.retainAll(localPartitions(ignite2));
-                }
-
-                Runnable run = new Runnable() {
-                    @Override public void run() {
-                        try {
-                            startGrid(4);
-                            startGrid(5);
-
-                            awaitPartitionMapExchange();
-
-                            if (!test.get()) {
-                                candidates.removeAll(localPartitions(ignite1));
-
-                                F.retain(candidates, false, localPartitions(ignite2));
-                            }
-
-                            latch.countDown();
-                        }
-                        catch (Exception e) {
-                            e.printStackTrace();
-                        }
-
-                    }
-                };
-
-                Integer part = null;
-                CacheQuery<Map.Entry<Integer, Integer>> qry = null;
-
-                if (test.get()) {
-                    part = F.first(candidates);
-
-                    qry = cache.context().queries().createScanQuery(null, part, false);
-                }
-
-                new Thread(run).start();
-
-                if (test.get())
-                    doTestScanQuery(qry, part);
-                else
-                    latch.await();
-            }
-            finally {
-                test.set(true);
-
-                stopAllGrids();
-            }
-        }
+    public void testScanFallbackOnRebalancingCursor2() throws Exception {
+        scanFallbackOnRebalancing(true);
     }
 
     /**
      * @param ignite Ignite.
+     * @return Cache.
      */
     protected IgniteCacheProxy<Integer, Integer> fillCache(Ignite ignite) {
         IgniteCacheProxy<Integer, Integer> cache =
@@ -444,16 +376,14 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
     /**
      * @param qry Query.
+     * @param part Partition.
      */
-    protected void doTestScanQuery(CacheQuery<Map.Entry<Integer, Integer>> qry, int part)
-        throws IgniteCheckedException {
-        CacheQueryFuture<Map.Entry<Integer, Integer>> fut = qry.execute();
-
-        Collection<Map.Entry<Integer, Integer>> qryEntries = fut.get();
+    protected void doTestScanQuery(QueryCursor<Cache.Entry<Integer, Integer>> qry, int part) {
+        Collection<Cache.Entry<Integer, Integer>> qryEntries = qry.getAll();
 
         Map<Integer, Integer> map = entries.get(part);
 
-        for (Map.Entry<Integer, Integer> e : qryEntries)
+        for (Cache.Entry<Integer, Integer> e : qryEntries)
             assertEquals(map.get(e.getKey()), e.getValue());
 
         assertEquals("Invalid number of entries for partition: " + part, map.size(), qryEntries.size());
@@ -464,7 +394,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
      * @param part Partition number.
      */
     protected void doTestScanQueryCursor(
-        QueryCursor<Cache.Entry<Integer, Integer>> cur, int part) throws IgniteCheckedException {
+        QueryCursor<Cache.Entry<Integer, Integer>> cur, int part) {
 
         Map<Integer, Integer> map = entries.get(part);
 
@@ -483,6 +413,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
     /**
      * @param cctx Cctx.
+     * @return Local partition.
      */
     private static int anyLocalPartition(GridCacheContext<?, ?> cctx) {
         return F.first(cctx.topology().localPartitions()).id();
@@ -490,6 +421,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
     /**
      * @param cctx Cctx.
+     * @return Remote partition.
      */
     private IgniteBiTuple<Integer, UUID> remotePartition(final GridCacheContext cctx) {
         ClusterNode node = F.first(cctx.kernalContext().grid().cluster().forRemotes().nodes());
@@ -505,6 +437,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
     /**
      * @param ignite Ignite.
+     * @return Local partitions.
      */
     private Set<Integer> localPartitions(Ignite ignite) {
         GridCacheContext cctx = ((IgniteCacheProxy)ignite.cache(null)).context();
@@ -528,7 +461,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
      */
     private interface CommunicationSpiFactory {
         /**
-         * Creates communication SPI instance.
+         * @return Communication SPI instance.
          */
         TcpCommunicationSpi create();
     }
@@ -541,13 +474,13 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
         @Override public TcpCommunicationSpi create() {
             return new TcpCommunicationSpi() {
                 @Override public void sendMessage(ClusterNode node, Message msg,
-                    IgniteInClosure<IgniteException> ackClosure) throws IgniteSpiException {
+                    IgniteInClosure<IgniteException> ackC) throws IgniteSpiException {
                     Object origMsg = ((GridIoMessage)msg).message();
 
                     if (origMsg instanceof GridCacheQueryRequest)
                         fail(); //should use local node
 
-                    super.sendMessage(node, msg, ackClosure);
+                    super.sendMessage(node, msg, ackC);
                 }
             };
         }
@@ -561,44 +494,13 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
         @Override public TcpCommunicationSpi create() {
             return new TcpCommunicationSpi() {
                 @Override public void sendMessage(ClusterNode node, Message msg,
-                    IgniteInClosure<IgniteException> ackClosure) throws IgniteSpiException {
+                    IgniteInClosure<IgniteException> ackC) throws IgniteSpiException {
                     Object origMsg = ((GridIoMessage)msg).message();
 
                     if (origMsg instanceof GridCacheQueryRequest)
                         assertEquals(expNodeId, node.id());
 
-                    super.sendMessage(node, msg, ackClosure);
-                }
-            };
-        }
-    }
-
-    /**
-     *
-     */
-    private static class TestFallbackCommunicationSpiFactory implements CommunicationSpiFactory {
-        /** {@inheritDoc} */
-        @Override public TcpCommunicationSpi create() {
-            return new TcpCommunicationSpi() {
-                @Override public void sendMessage(ClusterNode node, Message msg,
-                    IgniteInClosure<IgniteException> ackClosure) throws IgniteSpiException {
-                    Object origMsg = ((GridIoMessage)msg).message();
-
-                    if (origMsg instanceof GridCacheQueryRequest) {
-                        if (latch.getCount() > 0)
-                            assertEquals(expNodeId, node.id());
-                        else
-                            assertEquals(expFallbackNodeId, node.id());
-
-                        try {
-                            latch.await();
-                        }
-                        catch (InterruptedException e) {
-                            throw new IgniteSpiException(e);
-                        }
-                    }
-
-                    super.sendMessage(node, msg, ackClosure);
+                    super.sendMessage(node, msg, ackC);
                 }
             };
         }


[15/18] ignite git commit: Merge branch 'ignite-1.4'

Posted by vo...@apache.org.
Merge branch 'ignite-1.4'


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

Branch: refs/heads/ignite-gg-10760
Commit: c311c3c9e53398dd510839ea02efc541054461fe
Parents: 6e48c9c cd6a1d5
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 17 10:44:39 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 17 10:44:39 2015 +0300

----------------------------------------------------------------------
 .../configuration/NearCacheConfiguration.java   |  18 +-
 .../distributed/dht/GridDhtLocalPartition.java  |  26 +-
 .../query/GridCacheDistributedQueryFuture.java  |  27 +-
 .../cache/query/GridCacheLocalQueryFuture.java  |   5 +
 .../cache/query/GridCacheQueryAdapter.java      | 170 ++++++++-----
 .../query/GridCacheQueryFutureAdapter.java      |  11 +-
 .../cache/query/GridCacheQueryManager.java      |  30 ++-
 .../distributed/CacheAffEarlySelfTest.java      | 245 +++++++++++++++++++
 .../GridCacheSwapScanQueryAbstractSelfTest.java | 118 ++++-----
 .../processors/igfs/IgfsAbstractSelfTest.java   |   5 +-
 ...CacheScanPartitionQueryFallbackSelfTest.java | 244 +++++-------------
 .../ignite/visor/commands/VisorConsole.scala    |  31 ++-
 .../yardstick/IgniteBenchmarkArguments.java     |  24 +-
 .../org/apache/ignite/yardstick/IgniteNode.java |  12 +-
 14 files changed, 610 insertions(+), 356 deletions(-)
----------------------------------------------------------------------



[10/18] ignite git commit: import optimize

Posted by vo...@apache.org.
import optimize


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

Branch: refs/heads/ignite-gg-10760
Commit: d928ef4ae0ae7fadbb05dacfc97ca6402657894d
Parents: f8577ca
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Sep 16 02:28:35 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Sep 16 02:28:35 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLocalPartition.java  | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d928ef4a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 956f2bf..2deabfe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -17,18 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.atomic.AtomicStampedReference;
-import java.util.concurrent.locks.ReentrantLock;
-import javax.cache.CacheException;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.internal.IgniteInternalFuture;
@@ -58,6 +46,18 @@ import org.jetbrains.annotations.NotNull;
 import org.jsr166.ConcurrentHashMap8;
 import org.jsr166.LongAdder8;
 
+import javax.cache.CacheException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.atomic.AtomicStampedReference;
+import java.util.concurrent.locks.ReentrantLock;
+
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE;
 import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_OBJECT_UNLOADED;
 import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.EVICTED;
@@ -787,4 +787,4 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
             "createTime", U.format(createTime),
             "mapPubSize", mapPubSize);
     }
-}
\ No newline at end of file
+}


[02/18] ignite git commit: Fixed test to really check query result.

Posted by vo...@apache.org.
Fixed test to really check query result.


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

Branch: refs/heads/ignite-gg-10760
Commit: dcd8b42aa696bafbb4d7c11a9cf1520d54539001
Parents: ae1e1dc
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 15 16:44:05 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 15 16:44:05 2015 +0300

----------------------------------------------------------------------
 ...CacheScanPartitionQueryFallbackSelfTest.java | 54 ++++++++------------
 1 file changed, 21 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dcd8b42a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
index df310b4..1ef470a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
@@ -146,7 +146,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
             CacheQuery<Map.Entry<Integer, Integer>> qry = cache.context().queries().createScanQuery(null, part, false);
 
-            doTestScanQuery(qry);
+            doTestScanQuery(qry, part);
         }
         finally {
             stopAllGrids();
@@ -176,7 +176,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
             CacheQuery<Map.Entry<Integer, Integer>> qry = cache.context().queries().createScanQuery(null, part, false);
 
-            doTestScanQuery(qry);
+            doTestScanQuery(qry, part);
         }
         finally {
             stopAllGrids();
@@ -198,7 +198,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
         try {
             Ignite ignite = startGrids(GRID_CNT);
 
-            final IgniteCacheProxy<Integer, Integer> cache = fillCache(ignite);
+            fillCache(ignite);
 
             final AtomicBoolean done = new AtomicBoolean(false);
 
@@ -211,6 +211,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
                         while (!done.get()) {
                             startGrid(id);
+
                             Thread.sleep(3000);
 
                             stopGrid(id);
@@ -240,15 +241,10 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
 
                             int part = tup.get1();
 
-                            try {
-                                CacheQuery<Map.Entry<Integer, Integer>> qry = cache.context().queries().createScanQuery(
-                                    null, part, false);
+                            CacheQuery<Map.Entry<Integer, Integer>> qry = cache.context().queries().createScanQuery(
+                                null, part, false);
 
-                                doTestScanQuery(qry);
-                            }
-                            catch (ClusterGroupEmptyCheckedException e) {
-                                log.warning("Invalid partition: " + part, e);
-                            }
+                            doTestScanQuery(qry, part);
                         }
 
                         return null;
@@ -315,17 +311,12 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
                         while (!done.get()) {
                             int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(null).partitions());
 
-                            try {
-                                QueryCursor<Cache.Entry<Integer, Integer>> cur =
-                                    cache.query(new ScanQuery<Integer, Integer>(part));
+                            QueryCursor<Cache.Entry<Integer, Integer>> cur =
+                                cache.query(new ScanQuery<Integer, Integer>(part));
 
-                                U.debug(log, "Running query [node=" + nodeId + ", part=" + part + ']');
+                            U.debug(log, "Running query [node=" + nodeId + ", part=" + part + ']');
 
-                                doTestScanQueryCursor(cur, part);
-                            }
-                            catch (ClusterGroupEmptyCheckedException e) {
-                                log.warning("Invalid partition: " + part, e);
-                            }
+                            doTestScanQueryCursor(cur, part);
                         }
 
                         return null;
@@ -404,7 +395,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
                     }
                 };
 
-                int part;
+                Integer part = null;
                 CacheQuery<Map.Entry<Integer, Integer>> qry = null;
 
                 if (test.get()) {
@@ -416,7 +407,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
                 new Thread(run).start();
 
                 if (test.get())
-                    doTestScanQuery(qry);
+                    doTestScanQuery(qry, part);
                 else
                     latch.await();
             }
@@ -454,20 +445,18 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
     /**
      * @param qry Query.
      */
-    protected void doTestScanQuery(
-        CacheQuery<Map.Entry<Integer, Integer>> qry) throws IgniteCheckedException {
+    protected void doTestScanQuery(CacheQuery<Map.Entry<Integer, Integer>> qry, int part)
+        throws IgniteCheckedException {
         CacheQueryFuture<Map.Entry<Integer, Integer>> fut = qry.execute();
 
-        Collection<Map.Entry<Integer, Integer>> expEntries = fut.get();
+        Collection<Map.Entry<Integer, Integer>> qryEntries = fut.get();
 
-        for (Map.Entry<Integer, Integer> e : expEntries) {
-            Map<Integer, Integer> map = entries.get(((GridCacheQueryAdapter)qry).partition());
+        Map<Integer, Integer> map = entries.get(part);
 
-            if (map == null)
-                assertTrue(expEntries.isEmpty());
-            else
-                assertEquals(map.get(e.getKey()), e.getValue());
-        }
+        for (Map.Entry<Integer, Integer> e : qryEntries)
+            assertEquals(map.get(e.getKey()), e.getValue());
+
+        assertEquals("Invalid number of entries for partition: " + part, map.size(), qryEntries.size());
     }
 
     /**
@@ -484,7 +473,6 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
         int cnt = 0;
 
         for (Cache.Entry<Integer, Integer> e : cur) {
-
             assertEquals(map.get(e.getKey()), e.getValue());
 
             cnt++;