You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/09/12 11:18:40 UTC

[01/49] ignite git commit: Fixed GridQueryParsingTest.

Repository: ignite
Updated Branches:
  refs/heads/ignite-comm-opts1 deb4979c3 -> 58ba70ce4


Fixed GridQueryParsingTest.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 12fd4976f482ebc43831754645e34042c9073b2d
Parents: d6449ff
Author: sboikov <sb...@gridgain.com>
Authored: Thu Aug 25 12:29:04 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Aug 25 12:29:04 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/query/h2/sql/GridQueryParsingTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/12fd4976/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index ce1f241..1d54bbf 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -301,7 +301,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
     private static String normalizeSql(String sql) {
         return sql.toLowerCase()
             .replaceAll("/\\*(?:.|\r|\n)*?\\*/", " ")
-            .replaceAll("\\s*on\\s+1\\s*=\\s*1\\s*", " ")
+            .replaceAll("\\s*on\\s+1\\s*=\\s*1\\s*", " on true ")
             .replaceAll("\\s+", " ")
             .replaceAll("\\( +", "(")
             .replaceAll(" +\\)", ")")


[20/49] ignite git commit: IGNITE-3611: IGFS: Slight refactoring to listPaths() and listFiles() methods.

Posted by sb...@apache.org.
IGNITE-3611: IGFS: Slight refactoring to listPaths() and listFiles() methods.


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

Branch: refs/heads/ignite-comm-opts1
Commit: bf9371a3ddb020209a6b031e11282706e19c58cb
Parents: 008cf64
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Sep 5 17:05:05 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 17:05:05 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsImpl.java      | 73 +++++++++++---------
 .../processors/igfs/IgfsProcessorSelfTest.java  | 11 +--
 .../processors/igfs/IgfsStreamsSelfTest.java    |  2 +-
 3 files changed, 46 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bf9371a3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index c704e00..3b25c82 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.igfs;
 
-import java.util.Set;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
@@ -68,7 +67,6 @@ import org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallabl
 import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.A;
@@ -791,7 +789,7 @@ public final class IgfsImpl implements IgfsEx {
 
                 IgfsMode mode = resolveMode(path);
 
-                Collection<String> files = new HashSet<>();
+                Collection<IgfsPath> files = new HashSet<>();
 
                 if (IgfsUtils.isDualMode(mode)) {
                     assert secondaryFs != null;
@@ -799,8 +797,10 @@ public final class IgfsImpl implements IgfsEx {
                     try {
                         Collection<IgfsPath> children = secondaryFs.listPaths(path);
 
-                        for (IgfsPath child : children)
-                            files.add(child.name());
+                        files.addAll(children);
+
+                        if (!modeRslvr.hasPrimaryChild(path))
+                            return files;
                     }
                     catch (Exception e) {
                         U.error(log, "List paths in DUAL mode failed [path=" + path + ']', e);
@@ -809,20 +809,17 @@ public final class IgfsImpl implements IgfsEx {
                     }
                 }
 
-                if (!IgfsUtils.isDualMode(mode) || modeRslvr.hasPrimaryChild(path)) {
-                    IgniteUuid fileId = meta.fileId(path);
+                IgfsEntryInfo info = primaryInfoForListing(path);
 
-                    if (fileId != null)
-                        files.addAll(meta.directoryListing(fileId).keySet());
-                    else if (mode == PRIMARY)
-                        throw new IgfsPathNotFoundException("Failed to list files (path not found): " + path);
+                if (info != null) {
+                    // Perform the listing.
+                    for (String child : info.listing().keySet())
+                        files.add(new IgfsPath(path, child));
                 }
+                else if (mode == PRIMARY)
+                    throw new IgfsPathNotFoundException("Failed to list paths (path not found): " + path);
 
-                return F.viewReadOnly(files, new C1<String, IgfsPath>() {
-                    @Override public IgfsPath apply(String e) {
-                        return new IgfsPath(path, e);
-                    }
-                });
+                return files;
             }
         });
     }
@@ -841,7 +838,7 @@ public final class IgfsImpl implements IgfsEx {
 
                 IgfsMode mode = resolveMode(path);
 
-                Set<IgfsFile> files = new HashSet<>();
+                Collection<IgfsFile> files = new HashSet<>();
 
                 if (IgfsUtils.isDualMode(mode)) {
                     assert secondaryFs != null;
@@ -865,27 +862,22 @@ public final class IgfsImpl implements IgfsEx {
                     }
                 }
 
-                IgniteUuid fileId = meta.fileId(path);
-
-                if (fileId != null) {
-                    IgfsEntryInfo info = meta.info(fileId);
+                IgfsEntryInfo info = primaryInfoForListing(path);
 
-                    // Handle concurrent deletion.
-                    if (info != null) {
-                        if (info.isFile())
-                            // If this is a file, return its description.
-                            return Collections.<IgfsFile>singleton(new IgfsFileImpl(path, info,
-                                data.groupBlockSize()));
+                if (info != null) {
+                    if (info.isFile())
+                        // If this is a file, return its description.
+                        return Collections.<IgfsFile>singleton(new IgfsFileImpl(path, info,
+                            data.groupBlockSize()));
 
-                        // Perform the listing.
-                        for (Map.Entry<String, IgfsListingEntry> e : info.listing().entrySet()) {
-                            IgfsEntryInfo childInfo = meta.info(e.getValue().fileId());
+                    // Perform the listing.
+                    for (Map.Entry<String, IgfsListingEntry> e : info.listing().entrySet()) {
+                        IgfsEntryInfo childInfo = meta.info(e.getValue().fileId());
 
-                            if (childInfo != null) {
-                                IgfsPath childPath = new IgfsPath(path, e.getKey());
+                        if (childInfo != null) {
+                            IgfsPath childPath = new IgfsPath(path, e.getKey());
 
-                                files.add(new IgfsFileImpl(childPath, childInfo, data.groupBlockSize()));
-                            }
+                            files.add(new IgfsFileImpl(childPath, childInfo, data.groupBlockSize()));
                         }
                     }
                 }
@@ -897,6 +889,19 @@ public final class IgfsImpl implements IgfsEx {
         });
     }
 
+    /**
+     * Get primary file system info for listing operation.
+     *
+     * @param path Path.
+     * @return Info or {@code null} if not found.
+     * @throws IgniteCheckedException If failed.
+     */
+    private IgfsEntryInfo primaryInfoForListing(IgfsPath path) throws IgniteCheckedException {
+        IgniteUuid fileId = meta.fileId(path);
+
+        return fileId != null ? meta.info(fileId) : null;
+    }
+
     /** {@inheritDoc} */
     @Override public long usedSpaceSize() {
         return metrics().localSpaceSize();

http://git-wip-us.apache.org/repos/asf/ignite/blob/bf9371a3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
index 269706e..c854970 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
@@ -400,12 +400,12 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
         igfs.delete(path("/A1/B1/C3"), false);
         assertNull(igfs.info(path("/A1/B1/C3")));
 
-        assertEquals(Collections.<IgfsPath>emptyList(), igfs.listPaths(path("/A1/B1")));
+        assertTrue(F.isEmpty(igfs.listPaths(path("/A1/B1"))));
 
         igfs.delete(path("/A2/B2"), true);
         assertNull(igfs.info(path("/A2/B2")));
 
-        assertEquals(Collections.<IgfsPath>emptyList(), igfs.listPaths(path("/A2")));
+        assertTrue(F.isEmpty(igfs.listPaths(path("/A2"))));
 
         assertEquals(Arrays.asList(path("/A"), path("/A1"), path("/A2")), sorted(igfs.listPaths(path("/"))));
 
@@ -416,13 +416,14 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
         igfs.delete(path("/A"), true);
         igfs.delete(path("/A1"), true);
         igfs.delete(path("/A2"), true);
-        assertEquals(Collections.<IgfsPath>emptyList(), igfs.listPaths(path("/")));
+
+        assertTrue(F.isEmpty(igfs.listPaths(path("/"))));
 
         // Delete root when it is empty:
         igfs.delete(path("/"), false);
         igfs.delete(path("/"), true);
 
-        assertEquals(Collections.<IgfsPath>emptyList(), igfs.listPaths(path("/")));
+        assertTrue(F.isEmpty(igfs.listPaths(path("/"))));
 
         for (Cache.Entry<Object, Object> e : metaCache)
             info("Entry in cache [key=" + e.getKey() + ", val=" + e.getValue() + ']');
@@ -603,7 +604,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
         // Cleanup.
         igfs.format();
 
-        assertEquals(Collections.<IgfsPath>emptyList(), igfs.listPaths(root));
+        assertTrue(F.isEmpty(igfs.listPaths(root)));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/bf9371a3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
index 2af8c5c..44560e3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
@@ -198,7 +198,7 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest {
         long max = 100L * CFG_BLOCK_SIZE / WRITING_THREADS_CNT;
 
         for (long size = 0; size <= max; size = size * 15 / 10 + 1) {
-            assertEquals(Collections.<IgfsPath>emptyList(), fs.listPaths(root));
+            assertTrue(F.isEmpty(fs.listPaths(root)));
 
             testCreateFile(path, size, new Random().nextInt());
         }


[11/49] ignite git commit: IGNITE-3646: IGFS: Added test for symlinked mkdirs on local secondary file system. This closes #1013.

Posted by sb...@apache.org.
IGNITE-3646: IGFS: Added test for symlinked mkdirs on local secondary file system. This closes #1013.


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

Branch: refs/heads/ignite-comm-opts1
Commit: fc2fe7bf1905675258d40932a4ff649156c17488
Parents: f8ae674
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Sun Sep 4 17:12:35 2016 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Sun Sep 4 17:12:35 2016 +0300

----------------------------------------------------------------------
 ...SecondaryFileSystemDualAbstractSelfTest.java | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fc2fe7bf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java
index df7d782..8baaf4a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java
@@ -61,7 +61,9 @@ public abstract class IgfsLocalSecondaryFileSystemDualAbstractSelfTest extends I
     private final File fileLinkSrc = new File(FS_WORK_DIR + File.separatorChar + "file");
 
 
-    /** Constructor.
+    /**
+     * Constructor.
+     *
      * @param mode IGFS mode.
      */
     public IgfsLocalSecondaryFileSystemDualAbstractSelfTest(IgfsMode mode) {
@@ -172,6 +174,22 @@ public abstract class IgfsLocalSecondaryFileSystemDualAbstractSelfTest extends I
      *
      * @throws Exception If failed.
      */
+    public void testMkdirsInsideSymlink() throws Exception {
+        if (U.isWindows())
+            return;
+
+        createSymlinks();
+
+        igfs.mkdirs(SUBSUBDIR);
+
+        assertTrue(Files.isDirectory(dirLinkDest.toPath().resolve("subdir/subsubdir")));
+        assertTrue(Files.isDirectory(dirLinkSrc.toPath().resolve("subdir/subsubdir")));
+    }
+
+    /**
+     *
+     * @throws Exception If failed.
+     */
     public void testUsedSpaceSize() throws Exception {
         final int DIRS_COUNT = 5;
         final int DIRS_MAX_DEEP = 3;


[02/49] ignite git commit: Merge remote-tracking branch 'remotes/community/ignite-1.6.6' into ignite-1.6.7

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-1.6.6' into ignite-1.6.7


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

Branch: refs/heads/ignite-comm-opts1
Commit: 12f532986677c30a716f73aeaa7d3587dd701f55
Parents: 70e69cb 12fd497
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 1 17:05:15 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 1 17:05:15 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/query/h2/sql/GridQueryParsingTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[12/49] ignite git commit: IGNITE-3829: Additional fix.

Posted by sb...@apache.org.
IGNITE-3829: Additional fix.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 3aa13f716934a6ccfe49f8bf99ec3b654e263900
Parents: fc2fe7b
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Sep 5 10:19:48 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 10:19:48 2016 +0300

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


http://git-wip-us.apache.org/repos/asf/ignite/blob/3aa13f71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index ecd27f7..82e67ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -709,10 +709,15 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
             if (meta != null) {
                 String name = meta.affinityKeyFieldName();
 
-                affKeyFields.putIfAbsent(meta.typeId(), new T1<>(meta.field(name)));
+                if (name != null) {
+                    BinaryField field = meta.field(name);
 
-                if (name != null)
-                    return po.field(name);
+                    affKeyFields.putIfAbsent(meta.typeId(), new T1<>(field));
+
+                    return field.value(po);
+                }
+                else
+                    affKeyFields.putIfAbsent(meta.typeId(), new T1<BinaryField>(null));
             }
             else if (po instanceof BinaryObjectEx) {
                 int typeId = ((BinaryObjectEx)po).typeId();


[37/49] ignite git commit: IGNITE-3856: IGFS: Support direct PROXY mode invocation in method: mkdirs. This closes #1047.

Posted by sb...@apache.org.
IGNITE-3856: IGFS: Support direct PROXY mode invocation in method: mkdirs. This closes #1047.


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

Branch: refs/heads/ignite-comm-opts1
Commit: cc595021491a79d6ccf343a156d6e21389b68ff8
Parents: b3bdca7
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Thu Sep 8 15:15:22 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 8 15:15:22 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsImpl.java      | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cc595021/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index fd32745..a6d5b77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -798,14 +798,24 @@ public final class IgfsImpl implements IgfsEx {
 
                 IgfsMode mode = resolveMode(path);
 
-                if (mode == PRIMARY)
-                    meta.mkdirs(path, props0);
-                else {
-                    assert IgfsUtils.isDualMode(mode);;
+                switch (mode) {
+                    case PRIMARY:
+                        meta.mkdirs(path, props0);
 
-                    await(path);
+                        break;
+
+                    case DUAL_ASYNC:
+                    case DUAL_SYNC:
+                        await(path);
+
+                        meta.mkdirsDual(secondaryFs, path, props0);
+
+                        break;
 
-                    meta.mkdirsDual(secondaryFs, path, props0);
+                    case PROXY:
+                        secondaryFs.mkdirs(path, props0);
+
+                        break;
                 }
 
                 return null;


[43/49] ignite git commit: IGNITE-3828: Added wrapper for DataStreamerImpl keys to minimize impact of hash code collisions. This closes #1034.

Posted by sb...@apache.org.
IGNITE-3828: Added wrapper for DataStreamerImpl keys to minimize impact of hash code collisions. This closes #1034.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 6c3993d9d4b2126a4ef9699fdb3c0d296b03dea7
Parents: 65c92fa
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Fri Sep 9 13:09:40 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 9 13:09:40 2016 +0300

----------------------------------------------------------------------
 .../datastreamer/DataStreamerImpl.java          | 69 +++++++++++++++-----
 1 file changed, 51 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6c3993d9/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index a3bae24..05e6488 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -39,6 +39,7 @@ import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.cache.CacheException;
 import javax.cache.expiry.ExpiryPolicy;
+
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
@@ -139,7 +140,6 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
     /** Cache name ({@code null} for default cache). */
     private final String cacheName;
 
-
     /** Per-node buffer size. */
     @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
     private int bufSize = DFLT_PER_NODE_BUFFER_SIZE;
@@ -512,7 +512,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
 
             activeFuts.add(resFut);
 
-            Collection<KeyCacheObject> keys =
+            Collection<KeyCacheObjectWrapper> keys =
                 new GridConcurrentHashSet<>(entries.size(), U.capacity(entries.size()), 1);
 
             Collection<DataStreamerEntry> entries0 = new ArrayList<>(entries.size());
@@ -521,7 +521,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
                 KeyCacheObject key = cacheObjProc.toCacheKeyObject(cacheObjCtx, null, entry.getKey(), true);
                 CacheObject val = cacheObjProc.toCacheObject(cacheObjCtx, entry.getValue(), true);
 
-                keys.add(key);
+                keys.add(new KeyCacheObjectWrapper(key));
 
                 entries0.add(new DataStreamerEntry(key, val));
             }
@@ -572,13 +572,13 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
 
             activeFuts.add(resFut);
 
-            Collection<KeyCacheObject> keys = null;
+            Collection<KeyCacheObjectWrapper> keys = null;
 
             if (entries.size() > 1) {
                 keys = new GridConcurrentHashSet<>(entries.size(), U.capacity(entries.size()), 1);
 
                 for (DataStreamerEntry entry : entries)
-                    keys.add(entry.getKey());
+                    keys.add(new KeyCacheObjectWrapper(entry.getKey()));
             }
 
             load0(entries, resFut, keys, 0);
@@ -641,7 +641,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
     private void load0(
         Collection<? extends DataStreamerEntry> entries,
         final GridFutureAdapter<Object> resFut,
-        @Nullable final Collection<KeyCacheObject> activeKeys,
+        @Nullable final Collection<KeyCacheObjectWrapper> activeKeys,
         final int remaps
     ) {
         assert entries != null;
@@ -729,7 +729,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
 
                         if (activeKeys != null) {
                             for (DataStreamerEntry e : entriesForNode)
-                                activeKeys.remove(e.getKey());
+                                activeKeys.remove(new KeyCacheObjectWrapper(e.getKey()));
 
                             if (activeKeys.isEmpty())
                                 resFut.onDone();
@@ -1103,7 +1103,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
      * @throws org.apache.ignite.plugin.security.SecurityException If permissions are not enough for streaming.
      */
     private void checkSecurityPermission(SecurityPermission perm)
-        throws org.apache.ignite.plugin.security.SecurityException{
+        throws org.apache.ignite.plugin.security.SecurityException {
         if (!ctx.security().enabled())
             return;
 
@@ -1172,8 +1172,8 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
          * @param newEntries Infos.
          * @param topVer Topology version.
          * @param lsnr Listener for the operation future.
-         * @throws IgniteInterruptedCheckedException If failed.
          * @return Future for operation.
+         * @throws IgniteInterruptedCheckedException If failed.
          */
         @Nullable GridFutureAdapter<?> update(Iterable<DataStreamerEntry> newEntries,
             AffinityTopologyVersion topVer,
@@ -1221,7 +1221,6 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
 
         /**
          * @return Future if any submitted.
-         *
          * @throws IgniteInterruptedCheckedException If thread has been interrupted.
          */
         @Nullable IgniteInternalFuture<?> flush() throws IgniteInterruptedCheckedException {
@@ -1273,13 +1272,12 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
         private void incrementActiveTasks() throws IgniteInterruptedCheckedException {
             if (timeout == DFLT_UNLIMIT_TIMEOUT)
                 U.acquire(sem);
-            else
-                if (!U.tryAcquire(sem, timeout, TimeUnit.MILLISECONDS)) {
-                    if (log.isDebugEnabled())
-                        log.debug("Failed to add parallel operation.");
+            else if (!U.tryAcquire(sem, timeout, TimeUnit.MILLISECONDS)) {
+                if (log.isDebugEnabled())
+                    log.debug("Failed to add parallel operation.");
 
-                    throw new IgniteDataStreamerTimeoutException("Data streamer exceeded timeout when starts parallel operation.");
-                }
+                throw new IgniteDataStreamerTimeoutException("Data streamer exceeded timeout when starts parallel operation.");
+            }
         }
 
         /**
@@ -1307,7 +1305,8 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
 
             try {
                 incrementActiveTasks();
-            } catch (IgniteDataStreamerTimeoutException e) {
+            }
+            catch (IgniteDataStreamerTimeoutException e) {
                 curFut.onDone(e);
                 throw e;
             }
@@ -1574,7 +1573,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
                 if (depCls != null)
                     cls0 = depCls;
                 else {
-                    for (Iterator<Object> it = objs.iterator(); (cls0 == null || U.isJdk(cls0)) && it.hasNext();) {
+                    for (Iterator<Object> it = objs.iterator(); (cls0 == null || U.isJdk(cls0)) && it.hasNext(); ) {
                         Object o = it.next();
 
                         if (o != null)
@@ -1696,4 +1695,38 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
             return PUBLIC_POOL;
         }
     }
+
+    /**
+     * Key object wrapper. Using identity equals prevents slow down in case of hash code collision.
+     */
+    private static class KeyCacheObjectWrapper {
+        /** key object */
+        private final KeyCacheObject key;
+
+        /**
+         * Constructor
+         *
+         * @param key key object
+         */
+        KeyCacheObjectWrapper(KeyCacheObject key) {
+            assert key != null;
+
+            this.key = key;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            return o instanceof KeyCacheObjectWrapper && this.key == ((KeyCacheObjectWrapper)o).key;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return key.hashCode();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(KeyCacheObjectWrapper.class, this);
+        }
+    }
 }


[34/49] ignite git commit: IGNITE-3854 IGFS: Support direct PROXY mode invocation in method: rename. This closes #1042.

Posted by sb...@apache.org.
IGNITE-3854 IGFS: Support direct PROXY mode invocation in method: rename. This closes #1042.


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

Branch: refs/heads/ignite-comm-opts1
Commit: e1c7937dabb3508183ccbd9afa3f76d5aaa67236
Parents: 9389328
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Sep 7 17:39:13 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 17:39:13 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsImpl.java      | 24 ++++++++++++++------
 1 file changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e1c7937d/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 27618be..12d2830 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -710,17 +710,27 @@ public final class IgfsImpl implements IgfsEx {
                     throw new IgfsInvalidPathException("Cannot move file to a path with different eviction " +
                         "exclude setting (need to copy and remove)");
 
-                if (mode != PRIMARY) {
-                    assert IgfsUtils.isDualMode(mode); // PROXY mode explicit usage is forbidden.
+                switch (mode) {
+                    case PRIMARY:
+                        meta.move(src, dest);
 
-                    await(src, dest);
+                        break;
 
-                    meta.renameDual(secondaryFs, src, dest);
+                    case DUAL_ASYNC:
+                    case DUAL_SYNC:
+                        await(src, dest);
 
-                    return null;
-                }
+                        meta.renameDual(secondaryFs, src, dest);
 
-                meta.move(src, dest);
+                        break;
+
+                    default:
+                        assert mode == PROXY : "Unknown mode: " + mode;
+
+                        secondaryFs.rename(src, dest);
+
+                        break;
+                }
 
                 return null;
             }


[29/49] ignite git commit: IGNITE-3705: CPP: Fixed warnings for MSVC 14.0. This closes #1038.

Posted by sb...@apache.org.
IGNITE-3705: CPP: Fixed warnings for MSVC 14.0. This closes #1038.


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

Branch: refs/heads/ignite-comm-opts1
Commit: d672f2989582fe7259260a25f0a8ed26f31f5b09
Parents: b5121ad
Author: Igor Sapego <is...@gridgain.com>
Authored: Wed Sep 7 14:28:06 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 14:28:06 2016 +0300

----------------------------------------------------------------------
 modules/platforms/cpp/common/include/ignite/ignite_error.h | 9 +++++++++
 modules/platforms/cpp/odbc/os/win/src/system/ui/window.cpp | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d672f298/modules/platforms/cpp/common/include/ignite/ignite_error.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/ignite_error.h b/modules/platforms/cpp/common/include/ignite/ignite_error.h
index a41a42f..17a24dc 100644
--- a/modules/platforms/cpp/common/include/ignite/ignite_error.h
+++ b/modules/platforms/cpp/common/include/ignite/ignite_error.h
@@ -72,6 +72,11 @@
     throw ignite::IgniteError(code, stream.str().c_str()); \
 }
 
+#ifdef _MSC_VER
+#   pragma warning(push)
+#   pragma warning(disable : 4275)
+#endif //_MSC_VER
+
 namespace ignite
 {
     namespace java
@@ -282,4 +287,8 @@ namespace ignite
     };    
 }
 
+#ifdef _MSC_VER
+#   pragma warning(pop)
+#endif //_MSC_VER
+
 #endif //_IGNITE_IGNITE_ERROR
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d672f298/modules/platforms/cpp/odbc/os/win/src/system/ui/window.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/win/src/system/ui/window.cpp b/modules/platforms/cpp/odbc/os/win/src/system/ui/window.cpp
index 1143f01..aca23eb 100644
--- a/modules/platforms/cpp/odbc/os/win/src/system/ui/window.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system/ui/window.cpp
@@ -89,7 +89,7 @@ namespace ignite
                         width,
                         height,
                         parent ? parent->GetHandle() : NULL,
-                        reinterpret_cast<HMENU>(id),
+                        reinterpret_cast<HMENU>(static_cast<ptrdiff_t>(id)),
                         GetHInstance(),
                         this
                     );


[14/49] ignite git commit: IGNITE-2974: ODBC: Added "socketSendBufferSize" and "socketReceiveBufferSize" configuration parameters. This closes #994.

Posted by sb...@apache.org.
IGNITE-2974: ODBC: Added "socketSendBufferSize" and "socketReceiveBufferSize" configuration parameters. This closes #994.


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

Branch: refs/heads/ignite-comm-opts1
Commit: d65228e42ec9c84182b8c9c9c8d06a0056d5eed2
Parents: a760918
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Mon Sep 5 11:20:26 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 11:20:26 2016 +0300

----------------------------------------------------------------------
 .../ignite/configuration/OdbcConfiguration.java | 64 ++++++++++++++++++++
 .../internal/processors/odbc/OdbcProcessor.java |  8 +--
 .../odbc/OdbcProcessorValidationSelfTest.java   | 21 ++++++-
 3 files changed, 86 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d65228e4/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java
index 3746995..c098e09 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.configuration;
 
+import org.apache.ignite.internal.util.typedef.internal.S;
+
 /**
  * ODBC configuration.
  */
@@ -30,12 +32,21 @@ public class OdbcConfiguration {
     /** Default maximum TCP port range value. */
     public static final int DFLT_TCP_PORT_TO = 10810;
 
+    /** Default socket send and receive buffer size. */
+    public static final int DFLT_SOCK_BUF_SIZE = 0;
+
     /** Default max number of open cursors per connection. */
     public static final int DFLT_MAX_OPEN_CURSORS = 128;
 
     /** Endpoint address. */
     private String endpointAddr;
 
+    /** Socket send buffer size. */
+    private int sockSndBufSize = DFLT_SOCK_BUF_SIZE;
+
+    /** Socket receive buffer size. */
+    private int sockRcvBufSize = DFLT_SOCK_BUF_SIZE;
+
     /** Max number of opened cursors per connection. */
     private int maxOpenCursors = DFLT_MAX_OPEN_CURSORS;
 
@@ -57,6 +68,8 @@ public class OdbcConfiguration {
 
         endpointAddr = cfg.getEndpointAddress();
         maxOpenCursors = cfg.getMaxOpenCursors();
+        sockRcvBufSize = cfg.getSocketReceiveBufferSize();
+        sockSndBufSize = cfg.getSocketSendBufferSize();
     }
 
     /**
@@ -115,4 +128,55 @@ public class OdbcConfiguration {
 
         return this;
     }
+
+    /**
+     * Gets socket send buffer size. When set to zero, operation system default will be used.
+     * <p>
+     * Defaults to {@link #DFLT_SOCK_BUF_SIZE}
+     *
+     * @return Socket send buffer size in bytes.
+     */
+    public int getSocketSendBufferSize() {
+        return sockSndBufSize;
+    }
+
+    /**
+     * Sets socket send buffer size. See {@link #getSocketSendBufferSize()} for more information.
+     *
+     * @param sockSndBufSize Socket send buffer size in bytes.
+     * @return This instance for chaining.
+     */
+    public OdbcConfiguration setSocketSendBufferSize(int sockSndBufSize) {
+        this.sockSndBufSize = sockSndBufSize;
+
+        return this;
+    }
+
+    /**
+     * Gets socket receive buffer size. When set to zero, operation system default will be used.
+     * <p>
+     * Defaults to {@link #DFLT_SOCK_BUF_SIZE}.
+     *
+     * @return Socket receive buffer size in bytes.
+     */
+    public int getSocketReceiveBufferSize() {
+        return sockRcvBufSize;
+    }
+
+    /**
+     * Sets socket receive buffer size. See {@link #getSocketReceiveBufferSize()} for more information.
+     *
+     * @param sockRcvBufSize Socket receive buffer size in bytes.
+     * @return This instance for chaining.
+     */
+    public OdbcConfiguration setSocketReceiveBufferSize(int sockRcvBufSize) {
+        this.sockRcvBufSize = sockRcvBufSize;
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(OdbcConfiguration.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/d65228e4/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
index ead8901..adfdc22 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
@@ -46,9 +46,6 @@ public class OdbcProcessor extends GridProcessorAdapter {
     /** Default TCP direct buffer flag. */
     private static final boolean DFLT_TCP_DIRECT_BUF = false;
 
-    /** Default socket send and receive buffer size. */
-    private static final int DFLT_SOCK_BUF_SIZE = 32 * 1024;
-
     /** Busy lock. */
     private final GridSpinBusyLock busyLock = new GridSpinBusyLock();
 
@@ -113,11 +110,10 @@ public class OdbcProcessor extends GridProcessorAdapter {
                             .tcpNoDelay(DFLT_TCP_NODELAY)
                             .directBuffer(DFLT_TCP_DIRECT_BUF)
                             .byteOrder(ByteOrder.nativeOrder())
-                            .socketSendBufferSize(DFLT_SOCK_BUF_SIZE)
-                            .socketReceiveBufferSize(DFLT_SOCK_BUF_SIZE)
+                            .socketSendBufferSize(odbcCfg.getSocketSendBufferSize())
+                            .socketReceiveBufferSize(odbcCfg.getSocketReceiveBufferSize())
                             .filters(new GridNioCodecFilter(new OdbcBufferedParser(), log, false))
                             .directMode(false)
-                            .idleTimeout(Long.MAX_VALUE)
                             .build();
 
                         srv0.start();

http://git-wip-us.apache.org/repos/asf/ignite/blob/d65228e4/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java
index 751f0ae..bb08c6c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java
@@ -94,7 +94,7 @@ public class OdbcProcessorValidationSelfTest extends GridCommonAbstractTest {
     /**
      * Test start with invalid address format.
      *
-     * @throws Exception
+     * @throws Exception If failed.
      */
     public void testAddressInvalidFormat() throws Exception {
         check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:"), false);
@@ -115,6 +115,25 @@ public class OdbcProcessorValidationSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test connection parameters: sendBufferSize, receiveBufferSize, connectionTimeout.
+     *
+     * @throws Exception If failed.
+     */
+    public void testConnectionParams() throws Exception {
+        check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9998..10000")
+            .setSocketSendBufferSize(4 * 1024), true);
+
+        check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9998..10000")
+            .setSocketReceiveBufferSize(4 * 1024), true);
+
+        check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9998..10000")
+            .setSocketSendBufferSize(-64 * 1024), false);
+
+        check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9998..10000")
+            .setSocketReceiveBufferSize(-64 * 1024), false);
+    }
+
+    /**
      * Perform check.
      *
      * @param odbcCfg ODBC configuration.


[21/49] ignite git commit: IGNITE-2629: ODBC: Requests are now processed asynchronously in separate thread pool. This closes #996.

Posted by sb...@apache.org.
IGNITE-2629: ODBC: Requests are now processed asynchronously in separate thread pool. This closes #996.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 2c397d2fb8851b25aa5f0a5589ad1deffbe7eee9
Parents: bf9371a
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Mon Sep 5 17:38:47 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 17:38:47 2016 +0300

----------------------------------------------------------------------
 .../ignite/configuration/OdbcConfiguration.java | 34 +++++++++++++++-
 .../internal/processors/odbc/OdbcProcessor.java | 41 ++++++++++++++++++--
 .../odbc/OdbcProcessorValidationSelfTest.java   | 16 +++++++-
 3 files changed, 83 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2c397d2f/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java
index c098e09..8fe1665 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/OdbcConfiguration.java
@@ -38,6 +38,9 @@ public class OdbcConfiguration {
     /** Default max number of open cursors per connection. */
     public static final int DFLT_MAX_OPEN_CURSORS = 128;
 
+    /** Default size of thread pool. */
+    public static final int DFLT_THREAD_POOL_SIZE = IgniteConfiguration.DFLT_PUBLIC_THREAD_CNT;
+
     /** Endpoint address. */
     private String endpointAddr;
 
@@ -50,6 +53,9 @@ public class OdbcConfiguration {
     /** Max number of opened cursors per connection. */
     private int maxOpenCursors = DFLT_MAX_OPEN_CURSORS;
 
+    /** Thread pool size. */
+    private int threadPoolSize = DFLT_THREAD_POOL_SIZE;
+
     /**
      * Creates ODBC server configuration with all default values.
      */
@@ -58,8 +64,7 @@ public class OdbcConfiguration {
     }
 
     /**
-     * Creates ODBC server configuration by copying all properties from
-     * given configuration.
+     * Creates ODBC server configuration by copying all properties from given configuration.
      *
      * @param cfg ODBC server configuration.
      */
@@ -70,6 +75,7 @@ public class OdbcConfiguration {
         maxOpenCursors = cfg.getMaxOpenCursors();
         sockRcvBufSize = cfg.getSocketReceiveBufferSize();
         sockSndBufSize = cfg.getSocketSendBufferSize();
+        threadPoolSize = cfg.getThreadPoolSize();
     }
 
     /**
@@ -175,6 +181,30 @@ public class OdbcConfiguration {
         return this;
     }
 
+    /**
+     * Size of thread pool that is in charge of processing ODBC tasks.
+     * <p>
+     * Defaults {@link #DFLT_THREAD_POOL_SIZE}.
+     *
+     * @return Thread pool that is in charge of processing ODBC tasks.
+     */
+    public int getThreadPoolSize() {
+        return threadPoolSize;
+    }
+
+    /**
+     * Sets thread pool that is in charge of processing ODBC tasks. See {@link #getThreadPoolSize()} for more
+     * information.
+     *
+     * @param threadPoolSize Thread pool that is in charge of processing ODBC tasks.
+     * @return This instance for chaining.
+     */
+    public OdbcConfiguration setThreadPoolSize(int threadPoolSize) {
+        this.threadPoolSize = threadPoolSize;
+
+        return this;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(OdbcConfiguration.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/2c397d2f/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
index adfdc22..a672d7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
@@ -18,20 +18,27 @@
 package org.apache.ignite.internal.processors.odbc;
 
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.OdbcConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.processors.GridProcessorAdapter;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.HostAndPortRange;
+import org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter;
 import org.apache.ignite.internal.util.nio.GridNioCodecFilter;
+import org.apache.ignite.internal.util.nio.GridNioFilter;
 import org.apache.ignite.internal.util.nio.GridNioServer;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.spi.IgnitePortProtocol;
+import org.apache.ignite.thread.IgniteThreadPoolExecutor;
 
 import java.net.InetAddress;
 import java.nio.ByteOrder;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
 
 /**
  * ODBC processor.
@@ -49,9 +56,12 @@ public class OdbcProcessor extends GridProcessorAdapter {
     /** Busy lock. */
     private final GridSpinBusyLock busyLock = new GridSpinBusyLock();
 
-    /** OBCD TCP Server. */
+    /** ODBC TCP Server. */
     private GridNioServer<byte[]> srv;
 
+    /** ODBC executor service. */
+    private ExecutorService odbcExecSvc;
+
     /**
      * @param ctx Kernal context.
      */
@@ -61,11 +71,13 @@ public class OdbcProcessor extends GridProcessorAdapter {
 
     /** {@inheritDoc} */
     @Override public void start() throws IgniteCheckedException {
-        OdbcConfiguration odbcCfg = ctx.config().getOdbcConfiguration();
+        IgniteConfiguration cfg = ctx.config();
+
+        OdbcConfiguration odbcCfg = cfg.getOdbcConfiguration();
 
         if (odbcCfg != null) {
             try {
-                Marshaller marsh = ctx.config().getMarshaller();
+                Marshaller marsh = cfg.getMarshaller();
 
                 if (marsh != null && !(marsh instanceof BinaryMarshaller))
                     throw new IgniteCheckedException("ODBC can only be used with BinaryMarshaller (please set it " +
@@ -87,6 +99,16 @@ public class OdbcProcessor extends GridProcessorAdapter {
                     );
                 }
 
+                assertParameter(odbcCfg.getThreadPoolSize() > 0, "threadPoolSize > 0");
+
+                odbcExecSvc = new IgniteThreadPoolExecutor(
+                    "odbc",
+                    cfg.getGridName(),
+                    odbcCfg.getThreadPoolSize(),
+                    odbcCfg.getThreadPoolSize(),
+                    0,
+                    new LinkedBlockingQueue<Runnable>());
+
                 InetAddress host;
 
                 try {
@@ -100,6 +122,11 @@ public class OdbcProcessor extends GridProcessorAdapter {
 
                 for (int port = hostPort.portFrom(); port <= hostPort.portTo(); port++) {
                     try {
+                        GridNioFilter[] filters = new GridNioFilter[] {
+                            new GridNioAsyncNotifyFilter(ctx.gridName(), odbcExecSvc, log),
+                            new GridNioCodecFilter(new OdbcBufferedParser(), log, false)
+                        };
+
                         GridNioServer<byte[]> srv0 = GridNioServer.<byte[]>builder()
                             .address(host)
                             .port(port)
@@ -112,7 +139,7 @@ public class OdbcProcessor extends GridProcessorAdapter {
                             .byteOrder(ByteOrder.nativeOrder())
                             .socketSendBufferSize(odbcCfg.getSocketSendBufferSize())
                             .socketReceiveBufferSize(odbcCfg.getSocketReceiveBufferSize())
-                            .filters(new GridNioCodecFilter(new OdbcBufferedParser(), log, false))
+                            .filters(filters)
                             .directMode(false)
                             .build();
 
@@ -154,6 +181,12 @@ public class OdbcProcessor extends GridProcessorAdapter {
 
             ctx.ports().deregisterPorts(getClass());
 
+            if (odbcExecSvc != null) {
+                U.shutdownNow(getClass(), odbcExecSvc, log);
+
+                odbcExecSvc = null;
+            }
+
             if (log.isDebugEnabled())
                 log.debug("ODBC processor stopped.");
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2c397d2f/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java
index bb08c6c..aaee2a9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcProcessorValidationSelfTest.java
@@ -134,11 +134,22 @@ public class OdbcProcessorValidationSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test thread pool size.
+     *
+     * @throws Exception If failed.
+     */
+    public void testThreadPoolSize() throws Exception {
+        check(new OdbcConfiguration().setThreadPoolSize(0), false);
+        check(new OdbcConfiguration().setThreadPoolSize(-1), false);
+
+        check(new OdbcConfiguration().setThreadPoolSize(4), true);
+    }
+
+    /**
      * Perform check.
      *
      * @param odbcCfg ODBC configuration.
-     * @param success Success flag.
-     * @throws Exception If failed.
+     * @param success Success flag. * @throws Exception If failed.
      */
     @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
     private void check(OdbcConfiguration odbcCfg, boolean success) throws Exception {
@@ -160,4 +171,5 @@ public class OdbcProcessorValidationSelfTest extends GridCommonAbstractTest {
             }, IgniteException.class, null);
         }
     }
+
 }


[48/49] ignite git commit: Merge ignite-1.7.2 to master.

Posted by sb...@apache.org.
Merge ignite-1.7.2 to master.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 04514fe062025ce412bad762e691b37cdeb83729
Parents: 241b793 35d6a56
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Sep 12 15:27:04 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Sep 12 15:27:04 2016 +0700

----------------------------------------------------------------------
 .../ignite/configuration/OdbcConfiguration.java |  98 +++-
 .../local/LocalIgfsSecondaryFileSystem.java     |  15 +-
 .../apache/ignite/internal/GridLoggerProxy.java |   3 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  17 +-
 .../ignite/internal/binary/BinaryContext.java   |   3 +
 .../internal/binary/BinaryMarshaller.java       |  28 +-
 .../internal/binary/BinaryReaderExImpl.java     |  24 +
 .../internal/binary/BinaryReaderHandles.java    |   2 +-
 .../internal/binary/BinaryWriterExImpl.java     |  18 +
 .../binary/builder/BinaryObjectBuilderImpl.java |   2 +-
 .../client/GridClientConfiguration.java         |   1 -
 .../internal/cluster/ClusterGroupAdapter.java   |   2 +-
 .../cluster/ClusterNodeLocalMapImpl.java        |   3 +-
 .../processors/cache/GridCacheAdapter.java      |   2 +-
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../processors/cache/GridCacheProcessor.java    |   5 +-
 .../processors/cache/GridCacheTtlManager.java   |  24 +-
 .../processors/cache/IgniteCacheProxy.java      |  41 ++
 .../binary/CacheObjectBinaryProcessorImpl.java  |  40 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   2 +-
 .../cache/query/GridCacheSqlQuery.java          |  11 +-
 .../datastreamer/DataStreamerImpl.java          |  88 ++--
 .../processors/igfs/IgfsDataManager.java        |   2 +-
 .../internal/processors/igfs/IgfsImpl.java      | 216 +++++---
 .../local/LocalFileSystemSizeVisitor.java       |  60 +++
 .../processors/odbc/OdbcMessageParser.java      |  10 +-
 .../internal/processors/odbc/OdbcProcessor.java |  54 +-
 .../processors/odbc/OdbcRequestHandler.java     |  31 +-
 .../processors/odbc/escape/OdbcEscapeType.java  |  13 +-
 .../processors/odbc/escape/OdbcEscapeUtils.java |  58 ++-
 .../query/PlatformAbstractQueryCursor.java      |  11 +-
 .../cache/query/PlatformFieldsQueryCursor.java  |   6 +
 .../processors/task/GridTaskWorker.java         |   2 +-
 .../ignite/internal/util/IgniteUtils.java       |  60 ++-
 .../ignite/marshaller/AbstractMarshaller.java   |  41 +-
 .../AbstractNodeNameAwareMarshaller.java        | 142 ++++++
 .../ignite/marshaller/MarshallerUtils.java      |  58 +++
 .../ignite/marshaller/jdk/JdkMarshaller.java    |  40 +-
 .../optimized/OptimizedMarshaller.java          |  12 +-
 .../sharedfs/SharedFsCheckpointSpi.java         |   7 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  11 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  29 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  20 +-
 .../ignite/stream/socket/SocketStreamer.java    |  18 +-
 .../ignite/internal/ClusterGroupSelfTest.java   |   2 +-
 .../internal/GridEventStorageSelfTest.java      |  97 +++-
 .../binary/BinaryMarshallerSelfTest.java        |  38 ++
 .../BinaryObjectBuilderAdditionalSelfTest.java  |  14 +
 .../cache/GridLocalIgniteSerializationTest.java | 378 ++++++++++++++
 .../IgniteCacheExpiryPolicyAbstractTest.java    |  14 +-
 .../GridCacheQueryTransformerSelfTest.java      |   9 +-
 .../igfs/IgfsAbstractBaseSelfTest.java          |   7 +-
 .../processors/igfs/IgfsAbstractSelfTest.java   |  31 +-
 ...SecondaryFileSystemDualAbstractSelfTest.java |  63 ++-
 .../processors/igfs/IgfsMaxSizeSelfTest.java    | 122 +++++
 .../processors/igfs/IgfsProcessorSelfTest.java  |  11 +-
 .../processors/igfs/IgfsProxySelfTest.java      |  32 ++
 .../processors/igfs/IgfsStreamsSelfTest.java    |   2 +-
 .../odbc/OdbcEscapeSequenceSelfTest.java        | 210 +++++++-
 .../odbc/OdbcProcessorValidationSelfTest.java   |  37 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |   2 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   2 +
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |   3 +
 .../query/h2/opt/GridH2ValueCacheObject.java    |   8 -
 ...niteBinaryObjectLocalQueryArgumentsTest.java |  28 ++
 ...aryObjectQueryArgumentsOffheapLocalTest.java |  28 ++
 ...teBinaryObjectQueryArgumentsOffheapTest.java |  30 ++
 .../IgniteBinaryObjectQueryArgumentsTest.java   | 472 +++++++++++++++++-
 .../query/h2/sql/GridQueryParsingTest.java      |   2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   9 +
 .../ignite/impl/binary/binary_reader_impl.h     |   2 +-
 .../common/include/ignite/common/concurrent.h   |   5 +-
 .../cpp/common/include/ignite/ignite_error.h    |  11 +-
 .../platforms/cpp/common/src/ignite_error.cpp   |   2 +-
 .../cpp/core-test/src/cache_query_test.cpp      | 300 ++++++++---
 modules/platforms/cpp/core/Makefile.am          |   1 +
 modules/platforms/cpp/core/include/Makefile.am  |   1 +
 .../include/ignite/cache/query/query_cursor.h   |   6 +-
 .../ignite/cache/query/query_fields_cursor.h    |   4 +-
 .../ignite/impl/cache/query/query_batch.h       | 148 ++++++
 .../impl/cache/query/query_fields_row_impl.h    |  30 +-
 .../ignite/impl/cache/query/query_impl.h        |  30 +-
 .../platforms/cpp/core/project/vs/core.vcxproj  |   2 +
 .../cpp/core/project/vs/core.vcxproj.filters    |   6 +
 .../core/src/impl/cache/query/query_batch.cpp   |  52 ++
 .../core/src/impl/cache/query/query_impl.cpp    | 180 ++++---
 modules/platforms/cpp/odbc-test/Makefile.am     |   2 +
 .../odbc-test/include/sql_test_suite_fixture.h  |   6 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   2 +
 .../project/vs/odbc-test.vcxproj.filters        |   6 +
 .../cpp/odbc-test/src/configuration_test.cpp    |  14 +-
 .../cpp/odbc-test/src/queries_test.cpp          |   1 +
 .../src/sql_date_time_functions_test.cpp        | 213 ++++++++
 .../cpp/odbc-test/src/sql_outer_join_test.cpp   | 498 +++++++++++++++++++
 .../odbc-test/src/sql_string_functions_test.cpp |  63 +++
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  25 +-
 .../include/ignite/odbc/config/configuration.h  |  52 +-
 .../cpp/odbc/include/ignite/odbc/result_page.h  |   3 -
 .../odbc/system/ui/dsn_configuration_window.h   |   8 +
 .../src/system/ui/dsn_configuration_window.cpp  |  23 +-
 .../cpp/odbc/os/win/src/system/ui/window.cpp    |   2 +-
 modules/platforms/cpp/odbc/src/column.cpp       |  14 +-
 .../cpp/odbc/src/config/configuration.cpp       |  30 +-
 .../cpp/odbc/src/config/connection_info.cpp     |  24 +-
 modules/platforms/cpp/odbc/src/dsn_config.cpp   |  14 +-
 .../platforms/cpp/odbc/src/query/data_query.cpp |   2 +-
 .../Impl/Cache/Query/FieldsQueryCursor.cs       |   3 +
 .../docker/compose/docker-compose.yml           |  14 +-
 108 files changed, 4161 insertions(+), 621 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/04514fe0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/04514fe0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/04514fe0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 846f6ea,62c2eb3..2717b06
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@@ -126,9 -126,10 +127,10 @@@ public class IgniteBasicTestSuite exten
          GridTestUtils.addTestIfNeeded(suite, IgniteDaemonNodeMarshallerCacheTest.class, ignoredTests);
          suite.addTestSuite(IgniteMarshallerCacheConcurrentReadWriteTest.class);
          suite.addTestSuite(GridNodeMetricsLogSelfTest.class);
+         suite.addTestSuite(GridLocalIgniteSerializationTest.class);
  
          suite.addTestSuite(IgniteExceptionInNioWorkerSelfTest.class);
 -
 +        suite.addTestSuite(IgniteLocalNodeMapBeforeStartTest.class);
          suite.addTestSuite(OdbcProcessorValidationSelfTest.class);
          suite.addTestSuite(OdbcEscapeSequenceSelfTest.class);
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/04514fe0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
----------------------------------------------------------------------


[39/49] ignite git commit: Web Console beta-3. Fixed typo in docker.

Posted by sb...@apache.org.
Web Console beta-3. Fixed typo in docker.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 79745ee6d549b0eca8f29608ce0c4d0c2efcfd6c
Parents: 2a117fe
Author: Andrey Novikov <an...@apache.org>
Authored: Fri Sep 9 13:21:26 2016 +0700
Committer: Andrey Novikov <an...@apache.org>
Committed: Fri Sep 9 13:21:26 2016 +0700

----------------------------------------------------------------------
 modules/web-console/docker/compose/docker-compose.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/79745ee6/modules/web-console/docker/compose/docker-compose.yml
----------------------------------------------------------------------
diff --git a/modules/web-console/docker/compose/docker-compose.yml b/modules/web-console/docker/compose/docker-compose.yml
index 4f83ba0..a2c2f8b 100644
--- a/modules/web-console/docker/compose/docker-compose.yml
+++ b/modules/web-console/docker/compose/docker-compose.yml
@@ -35,18 +35,18 @@ backend:
     # Port for serving frontend API
     - server_port=3000
     # Cookie session secret
-    - server_sessionSecret="CHANGE ME"
+    - server_sessionSecret=CHANGE ME
     # URL for mongodb connection
     - mongodb_url=mongodb://mongodb/console
     # Port for web-agent.
     - agentServer_port=3001
     # Mail connection settings. Leave empty if no needed. See also settings, https://github.com/nodemailer/nodemailer
-    - mail_service=""
-    - mail_sign=""
-    - mail_greeting=""
-    - mail_from=""
-    - mail_auth_user=""
-    - mail_auth_pass=""
+    - mail_service=
+    - mail_sign=
+    - mail_greeting=
+    - mail_from=
+    - mail_auth_user=
+    - mail_auth_pass=
 
 frontend:
   image: ignite/web-console-frontend


[26/49] ignite git commit: IGNITE-2208 Queries with object arguments doesn't work wth BinaryMarshaller: use 'toBinary' for arguments conversion.

Posted by sb...@apache.org.
IGNITE-2208 Queries with object arguments doesn't work wth BinaryMarshaller: use 'toBinary' for arguments conversion.


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

Branch: refs/heads/ignite-comm-opts1
Commit: bdc1b10cabcefb6684adcdb22bb6106e44148516
Parents: 385355a
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 6 14:45:01 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 6 14:45:01 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/IgniteCacheProxy.java      | 12 +++++-----
 .../IgniteBinaryObjectQueryArgumentsTest.java   | 25 ++++++++++----------
 2 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc1b10c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 8b2e605..81d4b49 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -777,11 +777,13 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
                 final SqlQuery sqlQry = (SqlQuery) qry;
 
                 convertToBinary(sqlQry.getArgs());
-            } else if (qry instanceof SpiQuery) {
+            }
+            else if (qry instanceof SpiQuery) {
                 final SpiQuery spiQry = (SpiQuery) qry;
 
                 convertToBinary(spiQry.getArgs());
-            } else if (qry instanceof SqlFieldsQuery) {
+            }
+            else if (qry instanceof SqlFieldsQuery) {
                 final SqlFieldsQuery fieldsQry = (SqlFieldsQuery) qry;
 
                 convertToBinary(fieldsQry.getArgs());
@@ -798,10 +800,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
         if (args == null)
             return;
 
-        for (int i = 0; i < args.length; i++) {
-            if (args[i] != null && !BinaryUtils.isBinaryType(args[i].getClass()))
-                args[i] = ctx.toCacheObject(args[i]);
-        }
+        for (int i = 0; i < args.length; i++)
+            args[i] = ctx.cacheObjects().binary().toBinary(args[i]);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc1b10c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
index 8a0c5c8..d87b8b5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
@@ -56,31 +56,31 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
     private static final int NODES = 3;
 
     /** */
-    public static final String PRIM_CACHE = "prim-cache";
+    private static final String PRIM_CACHE = "prim-cache";
 
     /** */
-    public static final String STR_CACHE = "str-cache";
+    private static final String STR_CACHE = "str-cache";
 
     /** */
-    public static final String ENUM_CACHE = "enum-cache";
+    private static final String ENUM_CACHE = "enum-cache";
 
     /** */
-    public static final String UUID_CACHE = "uuid-cache";
+    private static final String UUID_CACHE = "uuid-cache";
 
     /** */
-    public static final String DATE_CACHE = "date-cache";
+    private static final String DATE_CACHE = "date-cache";
 
     /** */
-    public static final String TIMESTAMP_CACHE = "timestamp-cache";
+    private static final String TIMESTAMP_CACHE = "timestamp-cache";
 
     /** */
-    public static final String BIG_DECIMAL_CACHE = "decimal-cache";
+    private static final String BIG_DECIMAL_CACHE = "decimal-cache";
 
     /** */
-    public static final String OBJECT_CACHE = "obj-cache";
+    private static final String OBJECT_CACHE = "obj-cache";
 
     /** */
-    public static final String FIELD_CACHE = "field-cache";
+    private static final String FIELD_CACHE = "field-cache";
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -110,6 +110,7 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
     }
 
     /**
+     * @param cacheName Cache name.
      * @return Cache config.
      */
     protected CacheConfiguration getCacheConfiguration(final String cacheName) {
@@ -368,7 +369,7 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
     }
 
     /**
-     * @throws Exception
+     * @throws Exception If failed.
      */
     public void testFieldSearch() throws Exception {
         final IgniteCache<Integer, SearchValue> cache = ignite(0).cache(FIELD_CACHE);
@@ -455,7 +456,7 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
         /**
          * @param id Key.
          */
-        public TestKey(int id) {
+        TestKey(int id) {
             this.id = id;
         }
 
@@ -536,7 +537,7 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
          * @param person Person.
          * @param enumKey Enum.
          */
-        public SearchValue(
+        SearchValue(
             final UUID uuid,
             final String str,
             final BigDecimal decimal,


[10/49] ignite git commit: IGNITE-3651 IGFS: Implemented "usedSpaceSize()" operation for local secondary file system. This closes #1009.

Posted by sb...@apache.org.
IGNITE-3651 IGFS: Implemented "usedSpaceSize()" operation for local secondary file system. This closes #1009.


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

Branch: refs/heads/ignite-comm-opts1
Commit: f8ae67456703e63e3afc9bb5c21d81d576d59448
Parents: d06eaa23
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Sun Sep 4 17:09:08 2016 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Sun Sep 4 17:09:08 2016 +0300

----------------------------------------------------------------------
 .../local/LocalIgfsSecondaryFileSystem.java     | 15 ++++-
 .../local/LocalFileSystemSizeVisitor.java       | 60 ++++++++++++++++++++
 ...SecondaryFileSystemDualAbstractSelfTest.java | 43 ++++++++++++++
 3 files changed, 117 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f8ae6745/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
index 519f472..36080f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/local/LocalIgfsSecondaryFileSystem.java
@@ -27,6 +27,7 @@ import org.apache.ignite.igfs.IgfsPathNotFoundException;
 import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
 import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystemPositionedReadable;
 import org.apache.ignite.internal.processors.igfs.secondary.local.LocalFileSystemIgfsFile;
+import org.apache.ignite.internal.processors.igfs.secondary.local.LocalFileSystemSizeVisitor;
 import org.apache.ignite.internal.processors.igfs.secondary.local.LocalIgfsSecondaryFileSystemPositionedReadable;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -42,6 +43,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.file.Files;
 import java.nio.file.LinkOption;
+import java.nio.file.Path;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.Collection;
 import java.util.Collections;
@@ -301,7 +303,18 @@ public class LocalIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, Li
 
     /** {@inheritDoc} */
     @Override public long usedSpaceSize() {
-        throw new UnsupportedOperationException("usedSpaceSize operation is not yet supported.");
+        Path p = fileForPath(new IgfsPath("/")).toPath();
+
+        try {
+            LocalFileSystemSizeVisitor visitor = new LocalFileSystemSizeVisitor();
+
+            Files.walkFileTree(p, visitor);
+
+            return visitor.size();
+        }
+        catch (IOException e) {
+            throw new IgfsException("Failed to calculate used space size.", e);
+        }
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/f8ae6745/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/secondary/local/LocalFileSystemSizeVisitor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/secondary/local/LocalFileSystemSizeVisitor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/secondary/local/LocalFileSystemSizeVisitor.java
new file mode 100644
index 0000000..222b749
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/secondary/local/LocalFileSystemSizeVisitor.java
@@ -0,0 +1,60 @@
+/*
+ * 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.igfs.secondary.local;
+
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.FileVisitor;
+import java.nio.file.Path;
+import java.nio.file.attribute.BasicFileAttributes;
+
+/**
+ * File visitor to get occupied file system size.
+ */
+public class LocalFileSystemSizeVisitor implements FileVisitor<Path> {
+    /** File size accumulator. */
+    private long size;
+
+    /** {@inheritDoc} */
+    @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
+        return FileVisitResult.CONTINUE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+        size += attrs.size();
+        return FileVisitResult.CONTINUE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
+        return FileVisitResult.CONTINUE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
+        return FileVisitResult.CONTINUE;
+    }
+
+    /**
+     * @return Total size of visited files.
+     */
+    public long size() {
+        return size;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f8ae6745/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java
index 1d1ce8d..df7d782 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
 import org.apache.ignite.igfs.secondary.local.LocalIgfsSecondaryFileSystem;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiInClosure;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.File;
@@ -32,6 +33,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.file.Files;
 import java.util.Collection;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * Abstract test for Hadoop 1.0 file system stack.
@@ -170,6 +172,47 @@ public abstract class IgfsLocalSecondaryFileSystemDualAbstractSelfTest extends I
      *
      * @throws Exception If failed.
      */
+    public void testUsedSpaceSize() throws Exception {
+        final int DIRS_COUNT = 5;
+        final int DIRS_MAX_DEEP = 3;
+        final int FILES_COUNT = 10;
+        final AtomicLong totalSize = new AtomicLong();
+
+        IgniteBiInClosure<Integer, IgfsPath> createHierarchy = new IgniteBiInClosure<Integer, IgfsPath>() {
+            @Override public void apply(Integer level, IgfsPath levelDir) {
+                try {
+                    for (int i = 0; i < FILES_COUNT; ++i) {
+                        IgfsPath filePath = new IgfsPath(levelDir, "file" + Integer.toString(i));
+
+                        createFile(igfs, filePath, true, chunk);
+
+                        totalSize.getAndAdd(chunk.length);
+                    }
+
+                    if (level < DIRS_MAX_DEEP) {
+                        for (int dir = 0; dir < DIRS_COUNT; dir++) {
+                            IgfsPath dirPath = new IgfsPath(levelDir, "dir" + Integer.toString(dir));
+
+                            igfs.mkdirs(dirPath);
+
+                            apply(level + 1, dirPath);
+                        }
+                    }
+                } catch (Exception e) {
+                    fail(e.getMessage());
+                }
+            }
+        };
+
+        createHierarchy.apply(1, new IgfsPath("/dir"));
+
+        assertEquals(totalSize.get(), igfs.metrics().secondarySpaceSize());
+    }
+
+    /**
+     *
+     * @throws Exception If failed.
+     */
     private void createSymlinks() throws Exception {
         assert dirLinkDest.mkdir();
 


[27/49] ignite git commit: Fixed IgniteCacheExpiryPolicyAbstractTest.testZeroOnAccess.

Posted by sb...@apache.org.
Fixed IgniteCacheExpiryPolicyAbstractTest.testZeroOnAccess.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 224cae1dd5dc5d95843c6ea1a72f61f27ea35cb4
Parents: bdc1b10
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 7 10:18:20 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 7 10:18:20 2016 +0300

----------------------------------------------------------------------
 .../distributed/CacheLateAffinityAssignmentTest.java  |  4 ----
 .../expiry/IgniteCacheExpiryPolicyAbstractTest.java   | 14 +++++++++++++-
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/224cae1d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
index 4fb17e8..7e37450 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
@@ -1743,10 +1743,6 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
 
         final List<CacheConfiguration> ccfgs = new ArrayList<>();
 
-        ccfgs.add(cacheConfiguration("ac1", ATOMIC, 0));
-        ccfgs.add(cacheConfiguration("ac2", ATOMIC, 1));
-        ccfgs.add(cacheConfiguration("ac3", ATOMIC, 2));
-
         ccfgs.add(cacheConfiguration("tc1", TRANSACTIONAL, 0));
         ccfgs.add(cacheConfiguration("tc2", TRANSACTIONAL, 1));
         ccfgs.add(cacheConfiguration("tc3", TRANSACTIONAL, 2));

http://git-wip-us.apache.org/repos/asf/ignite/blob/224cae1d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index 794519a..f22ca6d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@ -230,7 +230,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
             zeroOnAccess(key);
         }
 
-        IgniteCache<Integer, Object> cache = jcache(0);
+        final IgniteCache<Integer, Object> cache = jcache(0);
 
         Integer key = primaryKey(cache);
 
@@ -240,12 +240,24 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
 
         cache.get(key); // Access using get.
 
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return !cache.iterator().hasNext();
+            }
+        }, 1000);
+
         assertFalse(cache.iterator().hasNext());
 
         cache0.put(key, 1);
 
         assertNotNull(cache.iterator().next()); // Access using iterator.
 
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return !cache.iterator().hasNext();
+            }
+        }, 1000);
+
         assertFalse(cache.iterator().hasNext());
     }
 


[31/49] ignite git commit: IGNITE-3851 IGFS: Support direct PROXY mode invocation in method: exists. This closes #1039.

Posted by sb...@apache.org.
IGNITE-3851 IGFS: Support direct PROXY mode invocation in method: exists. This closes #1039.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 88d027d280ba437a69d8100db1e0e6a5f034188c
Parents: 2703648
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Sep 7 17:20:25 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 17:20:25 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsImpl.java      | 25 +++++++++------
 .../igfs/IgfsAbstractBaseSelfTest.java          |  7 ++---
 .../processors/igfs/IgfsProxySelfTest.java      | 32 ++++++++++++++++++++
 3 files changed, 51 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/88d027d2/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 3b25c82..642352e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -236,7 +236,17 @@ public final class IgfsImpl implements IgfsEx {
             modes = new ArrayList<>(cfgModes.size());
 
             for (Map.Entry<String, IgfsMode> mode : cfgModes.entrySet()) {
-                IgfsMode mode0 = secondaryFs == null ? mode.getValue() == PROXY ? PROXY : PRIMARY : mode.getValue();
+                IgfsMode mode0;
+
+                if (mode.getValue() == PROXY) {
+                    if (secondaryFs == null)
+                        throw new IgniteCheckedException("Mode cannot be PROXY if secondary file system hasn't" +
+                            " been defined: " + mode.getKey());
+
+                    mode0 = PROXY;
+                }
+                else
+                    mode0 = secondaryFs == null ? PRIMARY : mode.getValue();
 
                 try {
                     modes.add(new T2<>(new IgfsPath(mode.getKey()), mode0));
@@ -539,8 +549,10 @@ public final class IgfsImpl implements IgfsEx {
 
                         break;
 
-                    default:
-                        assert false : "Unknown mode.";
+                    case PROXY:
+                        res = secondaryFs.exists(path);
+
+                        break;
                 }
 
                 return res;
@@ -1741,12 +1753,7 @@ public final class IgfsImpl implements IgfsEx {
      * @return Mode.
      */
     private IgfsMode resolveMode(IgfsPath path) {
-        IgfsMode mode = modeRslvr.resolveMode(path);
-
-        if (mode == PROXY)
-            throw new IgfsInvalidPathException("PROXY mode cannot be used in IGFS directly: " + path);
-
-        return mode;
+        return modeRslvr.resolveMode(path);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/88d027d2/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
index 9575bd0..03f24a4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
@@ -64,8 +64,9 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMemoryMode.ONHEAP_TIERED;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.igfs.IgfsMode.DUAL_ASYNC;
+import static org.apache.ignite.igfs.IgfsMode.DUAL_SYNC;
 import static org.apache.ignite.igfs.IgfsMode.PRIMARY;
-import static org.apache.ignite.igfs.IgfsMode.PROXY;
 
 /**
  * Test fo regular igfs operations.
@@ -205,12 +206,10 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest {
      * @param memoryMode Memory mode.
      */
     protected IgfsAbstractBaseSelfTest(IgfsMode mode, CacheMemoryMode memoryMode) {
-        assert mode != null && mode != PROXY;
-
         this.mode = mode;
         this.memoryMode = memoryMode;
 
-        dual = mode != PRIMARY;
+        dual = (mode == DUAL_SYNC || mode == DUAL_ASYNC);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/88d027d2/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProxySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProxySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProxySelfTest.java
new file mode 100644
index 0000000..3b8c606
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProxySelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.igfs;
+
+import static org.apache.ignite.igfs.IgfsMode.PROXY;
+
+/**
+ * Tests for PRIMARY mode.
+ */
+public class IgfsProxySelfTest extends IgfsAbstractSelfTest {
+    /**
+     * Constructor.
+     */
+    public IgfsProxySelfTest() {
+        super(PROXY);
+    }
+}
\ No newline at end of file


[13/49] ignite git commit: IGNITE-3750: ODBC: Added tests for date/time types. This closes #1002.

Posted by sb...@apache.org.
IGNITE-3750: ODBC: Added tests for date/time types. This closes #1002.


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

Branch: refs/heads/ignite-comm-opts1
Commit: a760918757bee71ab28495496f94e9067ef17888
Parents: 3aa13f7
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Sep 5 10:36:38 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 10:36:38 2016 +0300

----------------------------------------------------------------------
 .../processors/odbc/OdbcMessageParser.java      |  10 +-
 modules/platforms/cpp/odbc-test/Makefile.am     |   1 +
 .../odbc-test/include/sql_test_suite_fixture.h  |   6 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   1 +
 .../project/vs/odbc-test.vcxproj.filters        |   3 +
 .../cpp/odbc-test/src/queries_test.cpp          |   1 +
 .../src/sql_date_time_functions_test.cpp        | 213 +++++++++++++++++++
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  17 ++
 modules/platforms/cpp/odbc/src/column.cpp       |  14 +-
 .../cpp/odbc/src/config/connection_info.cpp     |  16 +-
 10 files changed, 261 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
index a751eb2..3accf74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
@@ -232,8 +232,14 @@ public class OdbcMessageParser {
 
                     writer.writeInt(row.size());
 
-                    for (Object obj : row)
-                        writer.writeObjectDetached(obj);
+                    for (Object obj : row) {
+                        if (obj instanceof java.sql.Timestamp)
+                            writer.writeTimestamp((java.sql.Timestamp)obj);
+                        else if (obj instanceof java.util.Date)
+                            writer.writeDate((java.util.Date)obj);
+                        else
+                            writer.writeObjectDetached(obj);
+                    }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am
index c3dd86a..a22e247 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -70,6 +70,7 @@ ignite_odbc_tests_SOURCES = \
     src/sql_operators_test.cpp \
     src/sql_value_expressions_test.cpp \
     src/sql_types_test.cpp \
+    src/sql_date_time_functions_test.cpp \
     src/sql_outer_join_test.cpp \
     ../odbc/src/cursor.cpp \
     ../odbc/src/config/connection_info.cpp \

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h b/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
index 9e482da..6d26818 100644
--- a/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
+++ b/modules/platforms/cpp/odbc-test/include/sql_test_suite_fixture.h
@@ -186,6 +186,12 @@ namespace ignite
 
     template<>
     void SqlTestSuiteFixture::CheckSingleResult<double>(const char* request);
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<Date>(const char* request);
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<Timestamp>(const char* request);
 }
 
 #endif //_IGNITE_ODBC_TEST_SQL_TEST_SUIT_FIXTURE

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
index b85f1e6..98a1e58 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
@@ -171,6 +171,7 @@
     <ClCompile Include="..\..\src\row_test.cpp" />
     <ClCompile Include="..\..\src\sql_aggregate_functions_test.cpp" />
     <ClCompile Include="..\..\src\sql_outer_join_test.cpp" />
+    <ClCompile Include="..\..\src\sql_date_time_functions_test.cpp" />
     <ClCompile Include="..\..\src\sql_test_suite_fixture.cpp" />
     <ClCompile Include="..\..\src\sql_numeric_functions_test.cpp" />
     <ClCompile Include="..\..\src\sql_operators_test.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
index ee5df76..f348ee7 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
@@ -109,6 +109,9 @@
     <ClCompile Include="..\..\src\sql_outer_join_test.cpp">
       <Filter>Code</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\sql_date_time_functions_test.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\test_type.h">

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index 4ba3a63..7c10527 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -121,6 +121,7 @@ struct QueriesTestSuiteFixture
         cfg.jvmOpts.push_back("-Djava.compiler=NONE");
         cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
         cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
+        cfg.jvmOpts.push_back("-Duser.timezone=GMT");
 
 #ifdef IGNITE_TESTS_32
         cfg.jvmInitMem = 256;

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp
new file mode 100644
index 0000000..f89cc3d
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp
@@ -0,0 +1,213 @@
+/*
+ * 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.
+ */
+
+#ifndef _MSC_VER
+#   define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include "sql_test_suite_fixture.h"
+
+using namespace ignite;
+
+using namespace boost::unit_test;
+
+BOOST_FIXTURE_TEST_SUITE(SqlDateTimeFunctionTestSuite, ignite::SqlTestSuiteFixture)
+
+BOOST_AUTO_TEST_CASE(TestCurrentDate)
+{
+    CheckSingleResult<Date>("SELECT {fn CURRENT_DATE()}");
+}
+
+BOOST_AUTO_TEST_CASE(TestCurdate)
+{
+    CheckSingleResult<Date>("SELECT {fn CURDATE()}");
+}
+
+BOOST_AUTO_TEST_CASE(TestCurrentTime)
+{
+    CheckSingleResult<Timestamp>("SELECT {fn CURRENT_TIME()}");
+}
+
+BOOST_AUTO_TEST_CASE(TestCurtime)
+{
+    CheckSingleResult<Timestamp>("SELECT {fn CURTIME()}");
+}
+
+BOOST_AUTO_TEST_CASE(TestCurrentTimestamp)
+{
+    CheckSingleResult<Timestamp>("SELECT {fn CURRENT_TIMESTAMP()}");
+}
+
+BOOST_AUTO_TEST_CASE(TestDayname)
+{
+    TestType in;
+
+    in.dateField = impl::binary::BinaryUtils::MakeDateGmt(2016, 8, 29);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<std::string>("SELECT {fn DAYNAME(dateField)} FROM TestType", "Monday");
+}
+
+BOOST_AUTO_TEST_CASE(TestDayofmonth)
+{
+    TestType in;
+
+    in.dateField = impl::binary::BinaryUtils::MakeDateGmt(2016, 8, 29);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn DAYOFMONTH(dateField)} FROM TestType", 29);
+    CheckSingleResult<int32_t>("SELECT {fn DAY_OF_MONTH(dateField)} FROM TestType", 29);
+}
+
+BOOST_AUTO_TEST_CASE(TestDayofweek)
+{
+    TestType in;
+
+    in.dateField = impl::binary::BinaryUtils::MakeDateGmt(2016, 8, 29);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn DAYOFWEEK(dateField)} FROM TestType", 2);
+    CheckSingleResult<int32_t>("SELECT {fn DAY_OF_WEEK(dateField)} FROM TestType", 2);
+}
+
+BOOST_AUTO_TEST_CASE(TestDayofyear)
+{
+    TestType in;
+
+    in.dateField = impl::binary::BinaryUtils::MakeDateGmt(2016, 8, 29);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn DAYOFYEAR(dateField)} FROM TestType", 242);
+    CheckSingleResult<int32_t>("SELECT {fn DAY_OF_YEAR(dateField)} FROM TestType", 242);
+}
+
+BOOST_AUTO_TEST_CASE(TestExtract)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn EXTRACT(YEAR FROM timestampField)} FROM TestType", 2016);
+    CheckSingleResult<int32_t>("SELECT {fn EXTRACT(MONTH FROM timestampField)} FROM TestType", 2);
+    CheckSingleResult<int32_t>("SELECT {fn EXTRACT(DAY FROM timestampField)} FROM TestType", 24);
+    CheckSingleResult<int32_t>("SELECT {fn EXTRACT(HOUR FROM timestampField)} FROM TestType", 13);
+    CheckSingleResult<int32_t>("SELECT {fn EXTRACT(MINUTE FROM timestampField)} FROM TestType", 45);
+    CheckSingleResult<int32_t>("SELECT {fn EXTRACT(SECOND FROM timestampField)} FROM TestType", 23);
+}
+
+BOOST_AUTO_TEST_CASE(TestHour)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn HOUR(timestampField)} FROM TestType", 13);
+}
+
+BOOST_AUTO_TEST_CASE(TestMinute)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn MINUTE(timestampField)} FROM TestType", 45);
+}
+
+BOOST_AUTO_TEST_CASE(TestMonth)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn MONTH(timestampField)} FROM TestType", 2);
+}
+
+BOOST_AUTO_TEST_CASE(TestMonthname)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<std::string>("SELECT {fn MONTHNAME(timestampField)} FROM TestType", "February");
+}
+
+BOOST_AUTO_TEST_CASE(TestNow)
+{
+    CheckSingleResult<Timestamp>("SELECT {fn NOW()}");
+}
+
+BOOST_AUTO_TEST_CASE(TestQuarter)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn QUARTER(timestampField)} FROM TestType", 1);
+}
+
+BOOST_AUTO_TEST_CASE(TestSecond)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn SECOND(timestampField)} FROM TestType", 23);
+}
+
+BOOST_AUTO_TEST_CASE(TestWeek)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn WEEK(timestampField)} FROM TestType", 9);
+}
+
+BOOST_AUTO_TEST_CASE(TestYear)
+{
+    TestType in;
+
+    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<int32_t>("SELECT {fn YEAR(timestampField)} FROM TestType", 2016);
+}
+
+BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
index 657b854..e9a8fc5 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
@@ -34,6 +34,7 @@ namespace ignite
         cfg.jvmOpts.push_back("-Djava.compiler=NONE");
         cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
         cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
+        cfg.jvmOpts.push_back("-Duser.timezone=GMT");
 
 #ifdef IGNITE_TESTS_32
         cfg.jvmInitMem = 256;
@@ -268,4 +269,20 @@ namespace ignite
 
         CheckSingleResult0(request, SQL_C_DOUBLE, &res, 0, 0);
     }
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<Date>(const char* request)
+    {
+        SQL_DATE_STRUCT res;
+
+        CheckSingleResult0(request, SQL_C_DATE, &res, 0, 0);
+    }
+
+    template<>
+    void SqlTestSuiteFixture::CheckSingleResult<Timestamp>(const char* request)
+    {
+        SQL_TIMESTAMP_STRUCT res;
+
+        CheckSingleResult0(request, SQL_C_TIMESTAMP, &res, 0, 0);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc/src/column.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/column.cpp b/modules/platforms/cpp/odbc/src/column.cpp
index ec779ac..b076a12 100644
--- a/modules/platforms/cpp/odbc/src/column.cpp
+++ b/modules/platforms/cpp/odbc/src/column.cpp
@@ -58,7 +58,7 @@ namespace
      * complex type.
      * @return Column type header.
      */
-    int8_t ReadColumnHeader(ignite::impl::interop::InteropInputStream& stream)
+    int8_t ReadColumnHeader(InteropInputStream& stream)
     {
         using namespace ignite::impl::binary;
 
@@ -130,10 +130,10 @@ namespace ignite
             // No-op.
         }
 
-        Column::Column(ignite::impl::binary::BinaryReaderImpl& reader) :
+        Column::Column(BinaryReaderImpl& reader) :
             type(0), startPos(-1), endPos(-1), offset(0), size(0)
         {
-            ignite::impl::interop::InteropInputStream* stream = reader.GetStream();
+            InteropInputStream* stream = reader.GetStream();
 
             if (!stream)
                 return;
@@ -294,12 +294,8 @@ namespace ignite
             size = sizeTmp;
         }
 
-        SqlResult Column::ReadToBuffer(ignite::impl::binary::BinaryReaderImpl& reader,
-            app::ApplicationDataBuffer& dataBuf)
+        SqlResult Column::ReadToBuffer(BinaryReaderImpl& reader, app::ApplicationDataBuffer& dataBuf)
         {
-            using namespace ignite::impl::binary;
-            using namespace ignite::impl::interop;
-
             if (!IsValid())
                 return SQL_RESULT_ERROR;
 
@@ -310,7 +306,7 @@ namespace ignite
                 return SQL_RESULT_NO_DATA;
             }
 
-            ignite::impl::interop::InteropInputStream* stream = reader.GetStream();
+            InteropInputStream* stream = reader.GetStream();
 
             if (!stream)
                 return SQL_RESULT_ERROR;

http://git-wip-us.apache.org/repos/asf/ignite/blob/a7609187/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index ca8d1a0..ee2c22b 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -254,7 +254,11 @@ namespace ignite
 #ifdef SQL_TIMEDATE_FUNCTIONS
                 // Bitmask enumerating the scalar date and time functions supported
                 // by the driver and associated data source.
-                intParams[SQL_TIMEDATE_FUNCTIONS] = 0;
+                intParams[SQL_TIMEDATE_FUNCTIONS] = SQL_FN_TD_CURRENT_DATE | SQL_FN_TD_CURRENT_TIME |
+                    SQL_FN_TD_CURRENT_TIMESTAMP | SQL_FN_TD_CURDATE | SQL_FN_TD_CURTIME | SQL_FN_TD_DAYNAME |
+                    SQL_FN_TD_DAYOFMONTH | SQL_FN_TD_DAYOFWEEK | SQL_FN_TD_DAYOFYEAR | SQL_FN_TD_EXTRACT |
+                    SQL_FN_TD_HOUR | SQL_FN_TD_MINUTE | SQL_FN_TD_MONTH | SQL_FN_TD_MONTHNAME | SQL_FN_TD_NOW |
+                    SQL_FN_TD_QUARTER | SQL_FN_TD_SECOND | SQL_FN_TD_WEEK | SQL_FN_TD_YEAR;
 #endif // SQL_TIMEDATE_FUNCTIONS
 
 #ifdef SQL_TIMEDATE_ADD_INTERVALS
@@ -272,15 +276,7 @@ namespace ignite
 #ifdef SQL_DATETIME_LITERALS
                 // Bitmask enumerating the SQL-92 datetime literals supported by
                 // the data source.
-                intParams[SQL_DATETIME_LITERALS] = SQL_DL_SQL92_INTERVAL_HOUR |
-                    SQL_DL_SQL92_DATE | SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND |
-                    SQL_DL_SQL92_TIME | SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND |
-                    SQL_DL_SQL92_TIMESTAMP | SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE |
-                    SQL_DL_SQL92_INTERVAL_YEAR | SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND |
-                    SQL_DL_SQL92_INTERVAL_MONTH | SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR |
-                    SQL_DL_SQL92_INTERVAL_DAY | SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE |
-                    SQL_DL_SQL92_INTERVAL_MINUTE | SQL_DL_SQL92_INTERVAL_SECOND |
-                    SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH;
+                intParams[SQL_DATETIME_LITERALS] =  SQL_DL_SQL92_DATE | SQL_DL_SQL92_TIME | SQL_DL_SQL92_TIMESTAMP;
 #endif // SQL_DATETIME_LITERALS
 
 #ifdef SQL_SYSTEM_FUNCTIONS


[30/49] ignite git commit: IGNITE-3423 IGFS: Fixed incorrect result of IgfsGlobalSpaceTask for IGFS of unlimited size. This closes #1032.

Posted by sb...@apache.org.
IGNITE-3423 IGFS: Fixed incorrect result of IgfsGlobalSpaceTask for IGFS of unlimited size. This closes #1032.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 2703648f380037a833e55a52a6c33e844a9e48fc
Parents: d672f29
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Sep 7 17:12:34 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 17:12:34 2016 +0300

----------------------------------------------------------------------
 .../processors/igfs/IgfsDataManager.java        |   2 +-
 .../processors/igfs/IgfsMaxSizeSelfTest.java    | 122 +++++++++++++++++++
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |   3 +
 3 files changed, 126 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2703648f/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
index 1397e4e..5e2c6b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
@@ -250,7 +250,7 @@ public class IgfsDataManager extends IgfsManager {
      * @return Maximum number of bytes for IGFS data cache.
      */
     public long maxSpaceSize() {
-        return dataCachePrj.igfsDataSpaceMax();
+        return (igfsCtx.configuration().getMaxSpaceSize() <= 0) ? 0 : dataCachePrj.igfsDataSpaceMax();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/2703648f/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMaxSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMaxSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMaxSizeSelfTest.java
new file mode 100644
index 0000000..c376c52
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMaxSizeSelfTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.igfs;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.FileSystemConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
+import org.apache.ignite.internal.IgniteEx;
+
+/**
+ * Check max size limit.
+ */
+@SuppressWarnings("ConstantConditions")
+public class IgfsMaxSizeSelfTest extends IgfsCommonAbstractTest {
+    /** Work directory. */
+    private static long maxSize;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
+
+        igfsCfg.setDataCacheName("dataCache");
+        igfsCfg.setMetaCacheName("metaCache");
+        igfsCfg.setName("test");
+
+        if (maxSize > 0)
+            igfsCfg.setMaxSpaceSize(maxSize);
+
+        CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
+
+        dataCacheCfg.setName("dataCache");
+        dataCacheCfg.setCacheMode(CacheMode.PARTITIONED);
+        dataCacheCfg.setNearConfiguration(null);
+        dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(2));
+        dataCacheCfg.setBackups(0);
+        dataCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+        dataCacheCfg.setOffHeapMaxMemory(0);
+
+        CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
+
+        metaCacheCfg.setName("metaCache");
+        metaCacheCfg.setNearConfiguration(null);
+        metaCacheCfg.setCacheMode(CacheMode.REPLICATED);
+        metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        metaCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
+        cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg);
+        cfg.setFileSystemConfiguration(igfsCfg);
+        cfg.setGridName(gridName);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDefaultOrZero() throws  Exception {
+        IgniteEx ig = startGrid(0);
+
+        try {
+            assertEquals(0, ((IgfsImpl)ig.igfsx("test")).globalSpace().spaceTotal());
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNegative() throws  Exception {
+        maxSize = -1;
+
+        IgniteEx ig = startGrid(0);
+
+        try {
+            assertEquals(0, ((IgfsImpl)ig.igfsx("test")).globalSpace().spaceTotal());
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPositive() throws  Exception {
+        maxSize = 1 << 20;
+
+        IgniteEx ig = startGrid(0);
+
+        try {
+            assertEquals(maxSize, ((IgfsImpl)ig.igfsx("test")).globalSpace().spaceTotal());
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/2703648f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
index 44199d4..0241068 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsCachePerBlockLruEvictionPo
 import org.apache.ignite.internal.processors.igfs.IgfsCacheSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsDualAsyncClientSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsDualSyncClientSelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsMaxSizeSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsPrimaryClientSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsDataManagerSelfTest;
 import org.apache.ignite.internal.processors.igfs.IgfsDualAsyncSelfTest;
@@ -148,6 +149,8 @@ public class IgniteIgfsTestSuite extends TestSuite {
         // TODO: Enable when IGFS failover is fixed.
         //suite.addTestSuite(IgfsBackupFailoverSelfTest.class);
 
+        suite.addTestSuite(IgfsMaxSizeSelfTest.class);
+
         return suite;
     }
 }
\ No newline at end of file


[18/49] ignite git commit: IGNITE-3819: ODBC: Improved error logging. This closes #1024.

Posted by sb...@apache.org.
IGNITE-3819: ODBC: Improved error logging. This closes #1024.


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

Branch: refs/heads/ignite-comm-opts1
Commit: e3533010b584ba986196f9c7dbc36359aebd829e
Parents: df8163f
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Sep 5 15:02:07 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 15:02:07 2016 +0300

----------------------------------------------------------------------
 .../processors/odbc/OdbcRequestHandler.java     | 31 +++++++++++++++-----
 1 file changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e3533010/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
index 3f7d505..69bbc74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteProductVersion;
 
@@ -97,16 +98,16 @@ public class OdbcRequestHandler {
                     return executeQuery(reqId, (OdbcQueryExecuteRequest)req);
 
                 case FETCH_SQL_QUERY:
-                    return fetchQuery((OdbcQueryFetchRequest)req);
+                    return fetchQuery(reqId, (OdbcQueryFetchRequest)req);
 
                 case CLOSE_SQL_QUERY:
-                    return closeQuery((OdbcQueryCloseRequest)req);
+                    return closeQuery(reqId, (OdbcQueryCloseRequest)req);
 
                 case GET_COLUMNS_META:
-                    return getColumnsMeta((OdbcQueryGetColumnsMetaRequest)req);
+                    return getColumnsMeta(reqId, (OdbcQueryGetColumnsMetaRequest)req);
 
                 case GET_TABLES_META:
-                    return getTablesMeta((OdbcQueryGetTablesMetaRequest)req);
+                    return getTablesMeta(reqId, (OdbcQueryGetTablesMetaRequest)req);
             }
 
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, "Unsupported ODBC request: " + req);
@@ -189,6 +190,8 @@ public class OdbcRequestHandler {
         catch (Exception e) {
             qryCursors.remove(qryId);
 
+            U.error(log, "Failed to execute SQL query [reqId=" + reqId + ", req=" + req + ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }
@@ -196,10 +199,11 @@ public class OdbcRequestHandler {
     /**
      * {@link OdbcQueryCloseRequest} command handler.
      *
+     * @param reqId Request ID.
      * @param req Execute query request.
      * @return Response.
      */
-    private OdbcResponse closeQuery(OdbcQueryCloseRequest req) {
+    private OdbcResponse closeQuery(long reqId, OdbcQueryCloseRequest req) {
         try {
             QueryCursor cur = qryCursors.get(req.queryId()).get1();
 
@@ -217,6 +221,8 @@ public class OdbcRequestHandler {
         catch (Exception e) {
             qryCursors.remove(req.queryId());
 
+            U.error(log, "Failed to close SQL query [reqId=" + reqId + ", req=" + req.queryId() + ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }
@@ -224,10 +230,11 @@ public class OdbcRequestHandler {
     /**
      * {@link OdbcQueryFetchRequest} command handler.
      *
+     * @param reqId Request ID.
      * @param req Execute query request.
      * @return Response.
      */
-    private OdbcResponse fetchQuery(OdbcQueryFetchRequest req) {
+    private OdbcResponse fetchQuery(long reqId, OdbcQueryFetchRequest req) {
         try {
             Iterator cur = qryCursors.get(req.queryId()).get2();
 
@@ -244,6 +251,8 @@ public class OdbcRequestHandler {
             return new OdbcResponse(res);
         }
         catch (Exception e) {
+            U.error(log, "Failed to fetch SQL query result [reqId=" + reqId + ", req=" + req + ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }
@@ -251,10 +260,11 @@ public class OdbcRequestHandler {
     /**
      * {@link OdbcQueryGetColumnsMetaRequest} command handler.
      *
+     * @param reqId Request ID.
      * @param req Get columns metadata request.
      * @return Response.
      */
-    private OdbcResponse getColumnsMeta(OdbcQueryGetColumnsMetaRequest req) {
+    private OdbcResponse getColumnsMeta(long reqId, OdbcQueryGetColumnsMetaRequest req) {
         try {
             List<OdbcColumnMeta> meta = new ArrayList<>();
 
@@ -298,6 +308,8 @@ public class OdbcRequestHandler {
             return new OdbcResponse(res);
         }
         catch (Exception e) {
+            U.error(log, "Failed to get columns metadata [reqId=" + reqId + ", req=" + req + ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }
@@ -305,10 +317,11 @@ public class OdbcRequestHandler {
     /**
      * {@link OdbcQueryGetTablesMetaRequest} command handler.
      *
+     * @param reqId Request ID.
      * @param req Get tables metadata request.
      * @return Response.
      */
-    private OdbcResponse getTablesMeta(OdbcQueryGetTablesMetaRequest req) {
+    private OdbcResponse getTablesMeta(long reqId, OdbcQueryGetTablesMetaRequest req) {
         try {
             List<OdbcTableMeta> meta = new ArrayList<>();
 
@@ -340,6 +353,8 @@ public class OdbcRequestHandler {
             return new OdbcResponse(res);
         }
         catch (Exception e) {
+            U.error(log, "Failed to get tables metadata [reqId=" + reqId + ", req=" + req + ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }


[06/49] ignite git commit: IGNITE-3829: Optimized affinity key field name handling.

Posted by sb...@apache.org.
IGNITE-3829: Optimized affinity key field name handling.


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

Branch: refs/heads/ignite-comm-opts1
Commit: e3c4868d6737e5a0f0b90f99666242865add750c
Parents: 7bb961f
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 2 18:23:09 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 2 18:23:09 2016 +0300

----------------------------------------------------------------------
 .../binary/CacheObjectBinaryProcessorImpl.java  | 35 ++++++++++++++++----
 1 file changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e3c4868d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 0337874..ecd27f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -40,6 +40,7 @@ import org.apache.ignite.IgniteBinary;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.binary.BinaryBasicNameMapper;
+import org.apache.ignite.binary.BinaryField;
 import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectBuilder;
 import org.apache.ignite.binary.BinaryObjectException;
@@ -89,6 +90,7 @@ import org.apache.ignite.internal.util.lang.GridMapEntry;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.T1;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -159,6 +161,9 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
     /** Metadata updates collected before metadata cache is initialized. */
     private final Map<Integer, BinaryMetadata> metaBuf = new ConcurrentHashMap<>();
 
+    /** Cached affinity key field names. */
+    private final ConcurrentHashMap<Integer, T1<BinaryField>> affKeyFields = new ConcurrentHashMap<>();
+
     /**
      * @param ctx Kernal context.
      */
@@ -684,22 +689,38 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
      * @return Affinity key.
      */
     public Object affinityKey(BinaryObject po) {
+        // Fast path for already cached field.
+        if (po instanceof BinaryObjectEx) {
+            int typeId = ((BinaryObjectEx)po).typeId();
+
+            T1<BinaryField> fieldHolder = affKeyFields.get(typeId);
+
+            if (fieldHolder != null) {
+                BinaryField field = fieldHolder.get();
+
+                return field != null ? field.value(po) : po;
+            }
+        }
+
+        // Slow path if affinity field is not cached yet.
         try {
             BinaryType meta = po instanceof BinaryObjectEx ? ((BinaryObjectEx)po).rawType() : po.type();
 
             if (meta != null) {
-                String affKeyFieldName = meta.affinityKeyFieldName();
+                String name = meta.affinityKeyFieldName();
+
+                affKeyFields.putIfAbsent(meta.typeId(), new T1<>(meta.field(name)));
 
-                if (affKeyFieldName != null)
-                    return po.field(affKeyFieldName);
+                if (name != null)
+                    return po.field(name);
             }
             else if (po instanceof BinaryObjectEx) {
-                int id = ((BinaryObjectEx)po).typeId();
+                int typeId = ((BinaryObjectEx)po).typeId();
 
-                String affKeyFieldName = binaryCtx.affinityKeyFieldName(id);
+                String name = binaryCtx.affinityKeyFieldName(typeId);
 
-                if (affKeyFieldName != null)
-                    return po.field(affKeyFieldName);
+                if (name != null)
+                    return po.field(name);
             }
         }
         catch (BinaryObjectException e) {


[24/49] ignite git commit: Fixed GridQueryParsingTest.

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


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

Branch: refs/heads/ignite-comm-opts1
Commit: e23a94fbab4040f60b7a8ef3638aaebe4b9ba5f6
Parents: 8970b3e
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 6 11:34:14 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 6 11:34:14 2016 +0300

----------------------------------------------------------------------
 .../processors/query/h2/sql/GridQueryParsingTest.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e23a94fb/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index cf000e9..d559d2e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -292,7 +292,10 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
      * @param sql2 Sql 2.
      */
     private void assertSqlEquals(String sql1, String sql2) {
-        assertEquals(normalizeSql(sql1), normalizeSql(sql2));
+        String nsql1 = normalizeSql(sql1);
+        String nsql2 = normalizeSql(sql2);
+
+        assertEquals(nsql1, nsql2);
     }
 
     /**
@@ -301,7 +304,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
     private static String normalizeSql(String sql) {
         return sql.toLowerCase()
             .replaceAll("/\\*(?:.|\r|\n)*?\\*/", " ")
-            .replaceAll("\\s*on\\s+1\\s*=\\s*1\\s*", " ")
+            .replaceAll("\\s*on\\s+1\\s*=\\s*1\\s*", " on true ")
             .replaceAll("\\s+", " ")
             .replaceAll("\\( +", "(")
             .replaceAll(" +\\)", ")")
@@ -314,9 +317,9 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
     private void checkQuery(String qry) throws Exception {
         Prepared prepared = parse(qry);
 
-        GridSqlQueryParser ses = new GridSqlQueryParser();
+        GridSqlQuery gQry = new GridSqlQueryParser().parse(prepared);
 
-        String res = ses.parse(prepared).getSQL();
+        String res = gQry.getSQL();
 
         System.out.println(normalizeSql(res));
 


[41/49] ignite git commit: IGNITE-2649: Ensured correct local Ignite instance processing during serialization and deserialization.

Posted by sb...@apache.org.
IGNITE-2649: Ensured correct local Ignite instance processing during serialization and deserialization.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 59527c5649afd3576d944d42299cf49416972562
Parents: 1cc502d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 9 12:27:55 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 9 13:01:16 2016 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/GridLoggerProxy.java |   3 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  17 +-
 .../ignite/internal/binary/BinaryContext.java   |   3 +
 .../internal/binary/BinaryMarshaller.java       |  21 +-
 .../internal/binary/BinaryReaderExImpl.java     |  24 ++
 .../internal/binary/BinaryWriterExImpl.java     |  18 +
 .../client/GridClientConfiguration.java         |   1 -
 .../internal/cluster/ClusterGroupAdapter.java   |   2 +-
 .../cluster/ClusterNodeLocalMapImpl.java        |   3 +-
 .../processors/cache/GridCacheAdapter.java      |   2 +-
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../processors/cache/GridCacheProcessor.java    |   5 +-
 .../ignite/internal/util/IgniteUtils.java       |  60 ++-
 .../ignite/marshaller/AbstractMarshaller.java   |  41 +-
 .../AbstractNodeNameAwareMarshaller.java        | 142 +++++++
 .../ignite/marshaller/MarshallerUtils.java      |  58 +++
 .../ignite/marshaller/jdk/JdkMarshaller.java    |  40 +-
 .../optimized/OptimizedMarshaller.java          |  12 +-
 .../sharedfs/SharedFsCheckpointSpi.java         |   7 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  11 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  29 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  20 +-
 .../ignite/stream/socket/SocketStreamer.java    |  18 +-
 .../ignite/internal/ClusterGroupSelfTest.java   |   2 +-
 .../cache/GridLocalIgniteSerializationTest.java | 378 +++++++++++++++++++
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |   2 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   2 +
 27 files changed, 818 insertions(+), 105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
index 295ee1c..b26921b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java
@@ -202,10 +202,9 @@ public class GridLoggerProxy implements IgniteLogger, LifecycleAware, Externaliz
         try {
             IgniteBiTuple<String, Object> t = stash.get();
 
-            String gridNameR = t.get1();
             Object ctgrR = t.get2();
 
-            IgniteLogger log = IgnitionEx.gridx(gridNameR).log();
+            IgniteLogger log = IgnitionEx.localIgnite().log();
 
             return ctgrR != null ? log.getLogger(ctgrR) : log;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 30f1d15..b54c17d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -77,6 +77,7 @@ import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.logger.LoggerNodeIdAware;
 import org.apache.ignite.logger.java.JavaLogger;
 import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.mxbean.IgnitionMXBean;
 import org.apache.ignite.plugin.segmentation.SegmentationPolicy;
@@ -1278,17 +1279,21 @@ public class IgnitionEx {
     }
 
     /**
-     * Gets the grid, which is owner of current thread. An Exception is thrown if
-     * current thread is not an {@link IgniteThread}.
+     * Gets a name of the grid from thread local config, which is owner of current thread.
      *
      * @return Grid instance related to current thread
      * @throws IllegalArgumentException Thrown to indicate, that current thread is not an {@link IgniteThread}.
      */
     public static IgniteKernal localIgnite() throws IllegalArgumentException {
-        if (Thread.currentThread() instanceof IgniteThread)
+        String name = U.getCurrentIgniteName();
+
+        if (U.isCurrentIgniteNameSet(name))
+            return gridx(name);
+        else if (Thread.currentThread() instanceof IgniteThread)
             return gridx(((IgniteThread)Thread.currentThread()).getGridName());
         else
-            throw new IllegalArgumentException("This method should be accessed under " + IgniteThread.class.getName());
+            throw new IllegalArgumentException("Ignite grid name thread local must be set or" +
+                " this method should be accessed under " + IgniteThread.class.getName());
     }
 
     /**
@@ -1297,7 +1302,7 @@ public class IgnitionEx {
      * @param name Grid name.
      * @return Grid instance.
      */
-    public static IgniteKernal gridx(@Nullable String name) {
+    private static IgniteKernal gridx(@Nullable String name) {
         IgniteNamedInstance grid = name != null ? grids.get(name) : dfltGrid;
 
         IgniteKernal res;
@@ -1929,6 +1934,8 @@ public class IgnitionEx {
                     marsh = new BinaryMarshaller();
             }
 
+            MarshallerUtils.setNodeName(marsh, cfg.getGridName());
+
             myCfg.setMarshaller(marsh);
 
             if (myCfg.getPeerClassLoadingLocalClassPathExclude() == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 97afef1..0d66970 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -82,6 +82,7 @@ import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.marshaller.MarshallerContext;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
@@ -251,6 +252,8 @@ public class BinaryContext {
         assert metaHnd != null;
         assert igniteCfg != null;
 
+        MarshallerUtils.setNodeName(optmMarsh, igniteCfg.getGridName());
+
         this.metaHnd = metaHnd;
         this.igniteCfg = igniteCfg;
         this.log = log;

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java
index 39015e5..168c61a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java
@@ -24,7 +24,7 @@ import java.io.OutputStream;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.AbstractMarshaller;
+import org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller;
 import org.apache.ignite.marshaller.MarshallerContext;
 import org.jetbrains.annotations.Nullable;
 import sun.misc.Unsafe;
@@ -33,7 +33,7 @@ import sun.misc.Unsafe;
  * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects
  * in the binary format.
  */
-public class BinaryMarshaller extends AbstractMarshaller {
+public class BinaryMarshaller extends AbstractNodeNameAwareMarshaller {
     /** */
     private GridBinaryMarshaller impl;
 
@@ -67,15 +67,6 @@ public class BinaryMarshaller extends AbstractMarshaller {
     }
 
     /**
-     * Returns currently set {@link MarshallerContext}.
-     *
-     * @return Marshaller context.
-     */
-    public MarshallerContext getContext() {
-        return ctx;
-    }
-
-    /**
      * Sets {@link BinaryContext}.
      * <p/>
      * @param ctx Binary context.
@@ -88,12 +79,12 @@ public class BinaryMarshaller extends AbstractMarshaller {
     }
 
     /** {@inheritDoc} */
-    @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
+    @Override protected byte[] marshal0(@Nullable Object obj) throws IgniteCheckedException {
         return impl.marshal(obj);
     }
 
     /** {@inheritDoc} */
-    @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
+    @Override protected void marshal0(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
         byte[] arr = marshal(obj);
 
         try {
@@ -105,12 +96,12 @@ public class BinaryMarshaller extends AbstractMarshaller {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+    @Override protected <T> T unmarshal0(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
         return impl.deserialize(bytes, clsLdr);
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+    @Override protected <T> T unmarshal0(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
         ByteArrayOutputStream buf = new ByteArrayOutputStream();
 
         // we have to fully read the InputStream because GridBinaryMarshaller requires support of a method that

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
index 194b1be..775f237 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
@@ -34,6 +34,7 @@ import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryReader;
 import org.apache.ignite.internal.binary.streams.BinaryInputStream;
+import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -1442,6 +1443,22 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
      * @throws BinaryObjectException If failed.
      */
     @Nullable Object deserialize() throws BinaryObjectException {
+        String newName = ctx.configuration().getGridName();
+        String oldName = IgniteUtils.setCurrentIgniteName(newName);
+
+        try {
+            return deserialize0();
+        }
+        finally {
+            IgniteUtils.restoreOldIgniteName(oldName, newName);
+        }
+    }
+
+    /**
+     * @return Deserialized object.
+     * @throws BinaryObjectException If failed.
+     */
+    @Nullable private Object deserialize0() throws BinaryObjectException {
         Object obj;
 
         byte flag = in.readByte();
@@ -2050,6 +2067,13 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
     }
 
     /**
+     * @return Binary context.
+     */
+    public BinaryContext context() {
+        return ctx;
+    }
+
+    /**
      * Flag.
      */
     private enum Flag {

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
index 9450482..21fb2bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
@@ -23,6 +23,7 @@ import org.apache.ignite.binary.BinaryRawWriter;
 import org.apache.ignite.binary.BinaryWriter;
 import org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream;
 import org.apache.ignite.internal.binary.streams.BinaryOutputStream;
+import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.jetbrains.annotations.Nullable;
 
@@ -138,6 +139,23 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
     void marshal(Object obj, boolean enableReplace) throws BinaryObjectException {
+        String newName = ctx.configuration().getGridName();
+        String oldName = IgniteUtils.setCurrentIgniteName(newName);
+
+        try {
+            marshal0(obj, enableReplace);
+        }
+        finally {
+            IgniteUtils.restoreOldIgniteName(oldName, newName);
+        }
+    }
+
+    /**
+     * @param obj Object.
+     * @param enableReplace Object replacing enabled flag.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+     */
+    private void marshal0(Object obj, boolean enableReplace) throws BinaryObjectException {
         assert obj != null;
 
         Class<?> cls = obj.getClass();

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
index e9d2958..cac1bb3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientConfiguration.java
@@ -157,7 +157,6 @@ public class GridClientConfiguration {
         tcpNoDelay = cfg.isTcpNoDelay();
         topRefreshFreq = cfg.getTopologyRefreshFrequency();
         daemon = cfg.isDaemon();
-        marshaller = cfg.getMarshaller();
 
         setDataConfigurations(cfg.getDataConfigurations());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index c664f1e..648c86d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -727,7 +727,7 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
      */
     protected Object readResolve() throws ObjectStreamException {
         try {
-            IgniteKernal g = IgnitionEx.gridx(gridName);
+            IgniteKernal g = IgnitionEx.localIgnite();
 
             return ids != null ? new ClusterGroupAdapter(g.context(), subjId, ids) :
                 new ClusterGroupAdapter(g.context(), subjId, p);

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterNodeLocalMapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterNodeLocalMapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterNodeLocalMapImpl.java
index 4890231..3147b12 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterNodeLocalMapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterNodeLocalMapImpl.java
@@ -26,6 +26,7 @@ import java.io.ObjectStreamException;
 import java.util.concurrent.ConcurrentMap;
 import org.apache.ignite.IgniteCluster;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -89,7 +90,7 @@ public class ClusterNodeLocalMapImpl<K, V> extends ConcurrentHashMap8<K, V> impl
      */
     protected Object readResolve() throws ObjectStreamException {
         try {
-            return IgnitionEx.gridx(stash.get()).cluster().nodeLocalMap();
+            return IgnitionEx.localIgnite().cluster().nodeLocalMap();
         }
         catch (IllegalStateException e) {
             throw U.withCause(new InvalidObjectException(e.getMessage()), e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 1ac94a4..fe6bb1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4639,7 +4639,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
         try {
             IgniteBiTuple<String, String> t = stash.get();
 
-            return IgnitionEx.gridx(t.get1()).cachex(t.get2());
+            return IgnitionEx.localIgnite().cachex(t.get2());
         }
         catch (IllegalStateException e) {
             throw U.withCause(new InvalidObjectException(e.getMessage()), e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index ba923df..dc9c766 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -2019,7 +2019,7 @@ public class GridCacheContext<K, V> implements Externalizable {
         try {
             IgniteBiTuple<String, String> t = stash.get();
 
-            IgniteKernal grid = IgnitionEx.gridx(t.get1());
+            IgniteKernal grid = IgnitionEx.localIgnite();
 
             GridCacheAdapter<K, V> cache = grid.internalCache(t.get2());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index e104b87..6640db8 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -116,6 +116,7 @@ import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.lifecycle.LifecycleAware;
 import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.spi.IgniteNodeValidationResult;
 import org.jetbrains.annotations.Nullable;
@@ -185,7 +186,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     private IdentityHashMap<CacheStore, ThreadLocal> sesHolders = new IdentityHashMap<>();
 
     /** Must use JDK marshaller since it is used by discovery to fire custom events. */
-    private Marshaller marshaller = new JdkMarshaller();
+    private final Marshaller marshaller;
 
     /** Count down latch for caches. */
     private final CountDownLatch cacheStartedLatch = new CountDownLatch(1);
@@ -205,6 +206,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         caches = new ConcurrentHashMap<>();
         jCacheProxies = new ConcurrentHashMap<>();
         stopSeq = new LinkedList<>();
+
+        marshaller = MarshallerUtils.jdkMarshaller(ctx.gridName());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index a480b87..cdaeab1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -254,7 +254,7 @@ import static org.apache.ignite.internal.util.GridUnsafe.staticFieldOffset;
 /**
  * Collection of utility methods used throughout the system.
  */
-@SuppressWarnings({"UnusedReturnValue", "UnnecessaryFullyQualifiedName"})
+@SuppressWarnings({"UnusedReturnValue", "UnnecessaryFullyQualifiedName", "RedundantStringConstructorCall"})
 public abstract class IgniteUtils {
     /** {@code True} if {@code unsafe} should be used for array copy. */
     private static final boolean UNSAFE_BYTE_ARR_CP = unsafeByteArrayCopyAvailable();
@@ -490,6 +490,16 @@ public abstract class IgniteUtils {
     /** Object.toString() */
     private static Method toStringMtd;
 
+    /** Empty local Ignite name. */
+    public static final String LOC_IGNITE_NAME_EMPTY = new String();
+
+    /** Local Ignite name thread local. */
+    private static final ThreadLocal<String> LOC_IGNITE_NAME = new ThreadLocal<String>() {
+        @Override protected String initialValue() {
+            return LOC_IGNITE_NAME_EMPTY;
+        }
+    };
+
     /**
      * Initializes enterprise check.
      */
@@ -9612,4 +9622,52 @@ public abstract class IgniteUtils {
     public static <T extends Comparable<? super T>> T max(T t0, T t1) {
         return t0.compareTo(t1) > 0 ? t0 : t1;
     }
+
+    /**
+     * Get current Ignite name.
+     *
+     * @return Current Ignite name.
+     */
+    @Nullable public static String getCurrentIgniteName() {
+        return LOC_IGNITE_NAME.get();
+    }
+
+    /**
+     * Check if current Ignite name is set.
+     *
+     * @param name Name to check.
+     * @return {@code True} if set.
+     */
+    @SuppressWarnings("StringEquality")
+    public static boolean isCurrentIgniteNameSet(@Nullable String name) {
+        return name != LOC_IGNITE_NAME_EMPTY;
+    }
+
+    /**
+     * Set current Ignite name.
+     *
+     * @param newName New name.
+     * @return Old name.
+     */
+    @SuppressWarnings("StringEquality")
+    @Nullable public static String setCurrentIgniteName(@Nullable String newName) {
+        String oldName = LOC_IGNITE_NAME.get();
+
+        if (oldName != newName)
+            LOC_IGNITE_NAME.set(newName);
+
+        return oldName;
+    }
+
+    /**
+     * Restore old Ignite name.
+     *
+     * @param oldName Old name.
+     * @param curName Current name.
+     */
+    @SuppressWarnings("StringEquality")
+    public static void restoreOldIgniteName(@Nullable String oldName, @Nullable String curName) {
+        if (oldName != curName)
+            LOC_IGNITE_NAME.set(oldName);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java
index dd5bad0..6c3428e 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractMarshaller.java
@@ -17,12 +17,9 @@
 
 package org.apache.ignite.marshaller;
 
-import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.util.GridByteArrayList;
 import org.apache.ignite.internal.util.io.GridByteArrayInputStream;
 import org.apache.ignite.internal.util.io.GridByteArrayOutputStream;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.jetbrains.annotations.Nullable;
 
 /**
  * Base class for marshallers. Provides default implementations of methods
@@ -37,7 +34,6 @@ public abstract class AbstractMarshaller implements Marshaller {
     /** Context. */
     protected MarshallerContext ctx;
 
-
     /**
      * Undeployment callback invoked when class loader is being undeployed.
      *
@@ -47,38 +43,15 @@ public abstract class AbstractMarshaller implements Marshaller {
      */
     public abstract void onUndeploy(ClassLoader ldr);
 
-    /** {@inheritDoc} */
-    @Override public void setContext(MarshallerContext ctx) {
-        this.ctx = ctx;
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
-        GridByteArrayOutputStream out = null;
-
-        try {
-            out = new GridByteArrayOutputStream(DFLT_BUFFER_SIZE);
-
-            marshal(obj, out);
-
-            return out.toByteArray();
-        }
-        finally {
-            U.close(out, null);
-        }
+    /**
+     * @return Marshaller context.
+     */
+    public MarshallerContext getContext() {
+        return ctx;
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T unmarshal(byte[] arr, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
-        GridByteArrayInputStream in = null;
-
-        try {
-            in = new GridByteArrayInputStream(arr, 0, arr.length);
-
-            return unmarshal(in, clsLdr);
-        }
-        finally {
-            U.close(in, null);
-        }
+    @Override public void setContext(MarshallerContext ctx) {
+        this.ctx = ctx;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractNodeNameAwareMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractNodeNameAwareMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractNodeNameAwareMarshaller.java
new file mode 100644
index 0000000..559ac73
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/AbstractNodeNameAwareMarshaller.java
@@ -0,0 +1,142 @@
+/*
+ * 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.marshaller;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * Marshaller allowing for {@link Ignition#localIgnite()} calls.
+ */
+public abstract class AbstractNodeNameAwareMarshaller extends AbstractMarshaller {
+    /** Whether node name is set. */
+    private volatile boolean nodeNameSet;
+
+    /** Node name. */
+    private volatile String nodeName = U.LOC_IGNITE_NAME_EMPTY;
+
+    /**
+     * Set node name.
+     *
+     * @param nodeName Node name.
+     */
+    @SuppressWarnings("unchecked")
+    public void nodeName(@Nullable String nodeName) {
+        if (!nodeNameSet) {
+            this.nodeName = nodeName;
+
+            nodeNameSet = true;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
+        String oldNodeName = IgniteUtils.setCurrentIgniteName(nodeName);
+
+        try {
+            return marshal0(obj);
+        }
+        finally {
+            IgniteUtils.restoreOldIgniteName(oldNodeName, nodeName);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
+        String oldNodeName = IgniteUtils.setCurrentIgniteName(nodeName);
+
+        try {
+            marshal0(obj, out);
+        }
+        finally {
+            IgniteUtils.restoreOldIgniteName(oldNodeName, nodeName);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T unmarshal(byte[] arr, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+        String oldNodeName = IgniteUtils.setCurrentIgniteName(nodeName);
+
+        try {
+            return unmarshal0(arr, clsLdr);
+        }
+        finally {
+            IgniteUtils.restoreOldIgniteName(oldNodeName, nodeName);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+        String oldNodeName = IgniteUtils.setCurrentIgniteName(nodeName);
+
+        try {
+            return unmarshal0(in, clsLdr);
+        }
+        finally {
+            IgniteUtils.restoreOldIgniteName(oldNodeName, nodeName);
+        }
+    }
+
+    /**
+     * Marshals object to the output stream. This method should not close
+     * given output stream.
+     *
+     * @param obj Object to marshal.
+     * @param out Output stream to marshal into.
+     * @throws IgniteCheckedException If marshalling failed.
+     */
+    protected abstract void marshal0(@Nullable Object obj, OutputStream out) throws IgniteCheckedException;
+
+    /**
+     * Marshals object to byte array.
+     *
+     * @param obj Object to marshal.
+     * @return Byte array.
+     * @throws IgniteCheckedException If marshalling failed.
+     */
+    protected abstract byte[] marshal0(@Nullable Object obj) throws IgniteCheckedException;
+
+    /**
+     * Unmarshals object from the input stream using given class loader.
+     * This method should not close given input stream.
+     *
+     * @param <T> Type of unmarshalled object.
+     * @param in Input stream.
+     * @param clsLdr Class loader to use.
+     * @return Unmarshalled object.
+     * @throws IgniteCheckedException If unmarshalling failed.
+     */
+    protected abstract <T> T unmarshal0(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException;
+
+    /**
+     * Unmarshals object from byte array using given class loader.
+     *
+     * @param <T> Type of unmarshalled object.
+     * @param arr Byte array.
+     * @param clsLdr Class loader to use.
+     * @return Unmarshalled object.
+     * @throws IgniteCheckedException If unmarshalling failed.
+     */
+    protected abstract <T> T unmarshal0(byte[] arr, @Nullable ClassLoader clsLdr) throws IgniteCheckedException;
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java b/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java
new file mode 100644
index 0000000..9668baf
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java
@@ -0,0 +1,58 @@
+/*
+ * 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.marshaller;
+
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Utility marshaller methods.
+ */
+public class MarshallerUtils {
+    /**
+     * Set node name to marshaller context if possible.
+     *
+     * @param marsh Marshaller instance.
+     * @param nodeName Node name.
+     */
+    public static void setNodeName(Marshaller marsh, @Nullable String nodeName) {
+        if (marsh instanceof AbstractNodeNameAwareMarshaller)
+            ((AbstractNodeNameAwareMarshaller)marsh).nodeName(nodeName);
+    }
+
+    /**
+     * Create JDK marshaller with provided node name.
+     *
+     * @param nodeName Node name.
+     * @return JDK marshaller.
+     */
+    public static JdkMarshaller jdkMarshaller(@Nullable String nodeName) {
+        JdkMarshaller marsh = new JdkMarshaller();
+
+        setNodeName(new JdkMarshaller(), nodeName);
+
+        return marsh;
+    }
+
+    /**
+     * Private constructor.
+     */
+    private MarshallerUtils() {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java
index deb3953..7a130d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/jdk/JdkMarshaller.java
@@ -23,9 +23,11 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.util.io.GridByteArrayInputStream;
+import org.apache.ignite.internal.util.io.GridByteArrayOutputStream;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.AbstractMarshaller;
+import org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -63,9 +65,9 @@ import org.jetbrains.annotations.Nullable;
  * <br>
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
  */
-public class JdkMarshaller extends AbstractMarshaller {
+public class JdkMarshaller extends AbstractNodeNameAwareMarshaller {
     /** {@inheritDoc} */
-    @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
+    @Override protected void marshal0(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
         assert out != null;
 
         ObjectOutputStream objOut = null;
@@ -87,8 +89,24 @@ public class JdkMarshaller extends AbstractMarshaller {
     }
 
     /** {@inheritDoc} */
+    @Override protected byte[] marshal0(@Nullable Object obj) throws IgniteCheckedException {
+        GridByteArrayOutputStream out = null;
+
+        try {
+            out = new GridByteArrayOutputStream(DFLT_BUFFER_SIZE);
+
+            marshal(obj, out);
+
+            return out.toByteArray();
+        }
+        finally {
+            U.close(out, null);
+        }
+    }
+
+    /** {@inheritDoc} */
     @SuppressWarnings({"unchecked"})
-    @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+    @Override protected <T> T unmarshal0(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
         assert in != null;
 
         if (clsLdr == null)
@@ -115,6 +133,20 @@ public class JdkMarshaller extends AbstractMarshaller {
     }
 
     /** {@inheritDoc} */
+    @Override protected <T> T unmarshal0(byte[] arr, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+        GridByteArrayInputStream in = null;
+
+        try {
+            in = new GridByteArrayInputStream(arr, 0, arr.length);
+
+            return unmarshal(in, clsLdr);
+        }
+        finally {
+            U.close(in, null);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public void onUndeploy(ClassLoader ldr) {
         // No-op.
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
index b3caca2..37f7acb 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
@@ -27,7 +27,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.AbstractMarshaller;
+import org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 import sun.misc.Unsafe;
@@ -82,7 +82,7 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_OPTIMIZED_MARSHALL
  * <br>
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
  */
-public class OptimizedMarshaller extends AbstractMarshaller {
+public class OptimizedMarshaller extends AbstractNodeNameAwareMarshaller {
     /** Use default {@code serialVersionUID} for {@link Serializable} classes. */
     public static final boolean USE_DFLT_SUID =
         IgniteSystemProperties.getBoolean(IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID, false);
@@ -158,7 +158,7 @@ public class OptimizedMarshaller extends AbstractMarshaller {
     }
 
     /** {@inheritDoc} */
-    @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
+    @Override protected void marshal0(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
         assert out != null;
 
         OptimizedObjectOutputStream objOut = null;
@@ -181,7 +181,7 @@ public class OptimizedMarshaller extends AbstractMarshaller {
     }
 
     /** {@inheritDoc} */
-    @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
+    @Override protected byte[] marshal0(@Nullable Object obj) throws IgniteCheckedException {
         OptimizedObjectOutputStream objOut = null;
 
         try {
@@ -203,7 +203,7 @@ public class OptimizedMarshaller extends AbstractMarshaller {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+    @Override protected <T> T unmarshal0(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
         assert in != null;
 
         OptimizedObjectInputStream objIn = null;
@@ -232,7 +232,7 @@ public class OptimizedMarshaller extends AbstractMarshaller {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public <T> T unmarshal(byte[] arr, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+    @Override protected <T> T unmarshal0(byte[] arr, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
         assert arr != null;
 
         OptimizedObjectInputStream objIn = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
index 36a4ea6..092c864 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
@@ -35,6 +35,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.resources.LoggerResource;
@@ -214,8 +215,10 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
 
         this.gridName = gridName;
 
-        marsh = ignite.configuration().getMarshaller() instanceof BinaryMarshaller ? new JdkMarshaller() :
-            ignite.configuration().getMarshaller();
+        if (ignite.configuration().getMarshaller() instanceof BinaryMarshaller)
+            marsh = MarshallerUtils.jdkMarshaller(ignite.name());
+        else
+            marsh = ignite.configuration().getMarshaller();
 
         folder = getNextSharedPath();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 1e71888..bf7f519 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -64,6 +64,7 @@ import org.apache.ignite.internal.util.typedef.internal.LT;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.apache.ignite.spi.IgniteSpiContext;
 import org.apache.ignite.spi.IgniteSpiException;
 import org.apache.ignite.spi.IgniteSpiOperationTimeoutHelper;
@@ -430,7 +431,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
         try {
             sockWriter.sendMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), evt,
-                spi.marsh.marshal(evt)));
+                spi.marshaller().marshal(evt)));
         }
         catch (IgniteCheckedException e) {
             throw new IgniteSpiException("Failed to marshal custom event: " + evt, e);
@@ -684,7 +685,7 @@ class ClientImpl extends TcpDiscoveryImpl {
             Map<String, Object> attrs = new HashMap<>(node.getAttributes());
 
             attrs.put(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS,
-                spi.marsh.marshal(attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS)));
+                spi.marshaller().marshal(attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS)));
 
             node.setAttributes(attrs);
         }
@@ -885,7 +886,7 @@ class ClientImpl extends TcpDiscoveryImpl {
                         TcpDiscoveryAbstractMessage msg;
 
                         try {
-                            msg = spi.marsh.unmarshal(in, U.resolveClassLoader(spi.ignite().configuration()));
+                            msg = spi.marshaller().unmarshal(in, U.resolveClassLoader(spi.ignite().configuration()));
                         }
                         catch (IgniteCheckedException e) {
                             if (log.isDebugEnabled())
@@ -1215,7 +1216,7 @@ class ClientImpl extends TcpDiscoveryImpl {
                         List<TcpDiscoveryAbstractMessage> msgs = null;
 
                         while (!isInterrupted()) {
-                            TcpDiscoveryAbstractMessage msg = spi.marsh.unmarshal(in,
+                            TcpDiscoveryAbstractMessage msg = spi.marshaller().unmarshal(in,
                                 U.resolveClassLoader(spi.ignite().configuration()));
 
                             if (msg instanceof TcpDiscoveryClientReconnectMessage) {
@@ -1976,7 +1977,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
                     if (node != null && node.visible()) {
                         try {
-                            DiscoverySpiCustomMessage msgObj = msg.message(spi.marsh,
+                            DiscoverySpiCustomMessage msgObj = msg.message(spi.marshaller(),
                                 U.resolveClassLoader(spi.ignite().configuration()));
 
                             notifyDiscovery(EVT_DISCOVERY_CUSTOM_EVT, topVer, node, allVisibleNodes(), msgObj);

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 6db1e87..135a737 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -743,7 +743,8 @@ class ServerImpl extends TcpDiscoveryImpl {
     /** {@inheritDoc} */
     @Override public void sendCustomEvent(DiscoverySpiCustomMessage evt) {
         try {
-            msgWorker.addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), evt, spi.marsh.marshal(evt)));
+            msgWorker.addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), evt,
+                spi.marshaller().marshal(evt)));
         }
         catch (IgniteCheckedException e) {
             throw new IgniteSpiException("Failed to marshal custom event: " + evt, e);
@@ -826,7 +827,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                         Map<String, Object> attrs = new HashMap<>(locNode.attributes());
 
-                        attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, spi.marsh.marshal(subj));
+                        attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, spi.marshaller().marshal(subj));
                         attrs.remove(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS);
 
                         locNode.setAttributes(attrs);
@@ -1242,7 +1243,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             Map<String, Object> attrs = new HashMap<>(node.getAttributes());
 
             attrs.put(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS,
-                spi.marsh.marshal(attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS)));
+                spi.marshaller().marshal(attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS)));
 
             node.setAttributes(attrs);
         }
@@ -1265,7 +1266,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (credBytes == null)
                 return null;
 
-            return spi.marsh.unmarshal(credBytes, null);
+            return spi.marshaller().unmarshal(credBytes, null);
         }
         catch (IgniteCheckedException e) {
             throw new IgniteSpiException("Failed to unmarshal node security credentials: " + node.id(), e);
@@ -2379,7 +2380,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 for (ClientMessageWorker clientMsgWorker : clientMsgWorkers.values()) {
                     if (msgBytes == null) {
                         try {
-                            msgBytes = spi.marsh.marshal(msg);
+                            msgBytes = spi.marshaller().marshal(msg);
                         }
                         catch (IgniteCheckedException e) {
                             U.error(log, "Failed to marshal message: " + msg, e);
@@ -2398,7 +2399,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                         if (clientMsgWorker.clientNodeId.equals(node.id())) {
                             try {
-                                msg0 = spi.marsh.unmarshal(msgBytes,
+                                msg0 = spi.marshaller().unmarshal(msgBytes,
                                     U.resolveClassLoader(spi.ignite().configuration()));
 
                                 prepareNodeAddedMessage(msg0, clientMsgWorker.clientNodeId, null, null, null);
@@ -3156,7 +3157,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                             // Stick in authentication subject to node (use security-safe attributes for copy).
                             Map<String, Object> attrs = new HashMap<>(node.getAttributes());
 
-                            attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, spi.marsh.marshal(subj));
+                            attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, spi.marshaller().marshal(subj));
 
                             node.setAttributes(attrs);
                         }
@@ -3804,7 +3805,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         else {
                             SecurityContext subj = spi.nodeAuth.authenticateNode(node, cred);
 
-                            SecurityContext coordSubj = spi.marsh.unmarshal(
+                            SecurityContext coordSubj = spi.marshaller().unmarshal(
                                 node.<byte[]>attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT),
                                 U.resolveClassLoader(spi.ignite().configuration()));
 
@@ -4859,7 +4860,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                     DiscoverySpiCustomMessage msgObj = null;
 
                     try {
-                        msgObj = msg.message(spi.marsh, U.resolveClassLoader(spi.ignite().configuration()));
+                        msgObj = msg.message(spi.marshaller(), U.resolveClassLoader(spi.ignite().configuration()));
                     }
                     catch (Throwable e) {
                         U.error(log, "Failed to unmarshal discovery custom message.", e);
@@ -4871,7 +4872,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         if (nextMsg != null) {
                             try {
                                 TcpDiscoveryCustomEventMessage ackMsg = new TcpDiscoveryCustomEventMessage(
-                                    getLocalNodeId(), nextMsg, spi.marsh.marshal(nextMsg));
+                                    getLocalNodeId(), nextMsg, spi.marshaller().marshal(nextMsg));
 
                                 ackMsg.topologyVersion(msg.topologyVersion());
 
@@ -5005,7 +5006,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 if (node != null) {
                     try {
-                        DiscoverySpiCustomMessage msgObj = msg.message(spi.marsh,
+                        DiscoverySpiCustomMessage msgObj = msg.message(spi.marshaller(),
                             U.resolveClassLoader(spi.ignite().configuration()));
 
                         lsnr.onDiscovery(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
@@ -5016,7 +5017,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                             msgObj);
 
                         if (msgObj.isMutable())
-                            msg.message(msgObj, spi.marsh.marshal(msgObj));
+                            msg.message(msgObj, spi.marshaller().marshal(msgObj));
                     }
                     catch (Throwable e) {
                         U.error(log, "Failed to unmarshal discovery custom message.", e);
@@ -5454,7 +5455,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 while (!isInterrupted()) {
                     try {
-                        TcpDiscoveryAbstractMessage msg = spi.marsh.unmarshal(in,
+                        TcpDiscoveryAbstractMessage msg = spi.marshaller().unmarshal(in,
                             U.resolveClassLoader(spi.ignite().configuration()));
 
                         msg.senderNodeId(nodeId);
@@ -5945,7 +5946,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 byte[] msgBytes = msgT.get2();
 
                 if (msgBytes == null)
-                    msgBytes = spi.marsh.marshal(msg);
+                    msgBytes = spi.marshaller().marshal(msg);
 
                 if (msg instanceof TcpDiscoveryClientAckResponse) {
                     if (clientVer == null) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 3d6df89..426eb8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -64,6 +64,7 @@ import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.resources.LoggerResource;
@@ -342,7 +343,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
     protected volatile long gridStartTime;
 
     /** Marshaller. */
-    protected final Marshaller marsh = new JdkMarshaller();
+    private final Marshaller marsh = new JdkMarshaller();
 
     /** Statistics. */
     protected final TcpDiscoveryStatistics stats = new TcpDiscoveryStatistics();
@@ -1379,7 +1380,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         IgniteCheckedException err = null;
 
         try {
-            marsh.marshal(msg, out);
+            marshaller().marshal(msg, out);
         }
         catch (IgniteCheckedException e) {
             err = e;
@@ -1463,7 +1464,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         try {
             sock.setSoTimeout((int)timeout);
 
-            T res = marsh.unmarshal(in == null ? sock.getInputStream() : in,
+            T res = marshaller().unmarshal(in == null ? sock.getInputStream() : in,
                 U.resolveClassLoader(ignite.configuration()));
 
             return res;
@@ -1681,7 +1682,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
         for (Map.Entry<Integer, Serializable> entry : data.entrySet()) {
             try {
-                byte[] bytes = marsh.marshal(entry.getValue());
+                byte[] bytes = marshaller().marshal(entry.getValue());
 
                 data0.put(entry.getKey(), bytes);
             }
@@ -1712,7 +1713,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
         for (Map.Entry<Integer, byte[]> entry : data.entrySet()) {
             try {
-                Serializable compData = marsh.unmarshal(entry.getValue(), clsLdr);
+                Serializable compData = marshaller().unmarshal(entry.getValue(), clsLdr);
 
                 data0.put(entry.getKey(), compData);
             }
@@ -1989,6 +1990,15 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         impl.brakeConnection();
     }
 
+    /**
+     * @return Marshaller.
+     */
+    protected Marshaller marshaller() {
+        MarshallerUtils.setNodeName(marsh, gridName);
+
+        return marsh;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(TcpDiscoverySpi.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
index 21204c7..a5b89e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
@@ -35,7 +35,8 @@ import org.apache.ignite.internal.util.nio.GridNioServerListenerAdapter;
 import org.apache.ignite.internal.util.nio.GridNioSession;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.marshaller.jdk.JdkMarshaller;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.apache.ignite.stream.StreamAdapter;
 import org.apache.ignite.stream.StreamTupleExtractor;
 import org.jetbrains.annotations.Nullable;
@@ -173,7 +174,7 @@ public class SocketStreamer<T, K, V> extends StreamAdapter<T, K, V> {
             new GridDelimitedParser(delim, directMode);
 
         if (converter == null)
-            converter = new DefaultConverter<>();
+            converter = new DefaultConverter<>(getIgnite().name());
 
         GridNioFilter codec = new GridNioCodecFilter(parser, log, directMode);
 
@@ -216,12 +217,21 @@ public class SocketStreamer<T, K, V> extends StreamAdapter<T, K, V> {
      */
     private static class DefaultConverter<T> implements SocketMessageConverter<T> {
         /** Marshaller. */
-        private static final JdkMarshaller MARSH = new JdkMarshaller();
+        private final Marshaller marsh;
+
+        /**
+         * Constructor.
+         *
+         * @param gridName Grid name.
+         */
+        private DefaultConverter(@Nullable String gridName) {
+            marsh = MarshallerUtils.jdkMarshaller(gridName);
+        }
 
         /** {@inheritDoc} */
         @Override public T convert(byte[] msg) {
             try {
-                return MARSH.unmarshal(msg, null);
+                return marsh.unmarshal(msg, null);
             }
             catch (IgniteCheckedException e) {
                 throw new IgniteException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
index 18eb3b7..9c74bd8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
@@ -211,7 +211,7 @@ public class ClusterGroupSelfTest extends ClusterGroupAbstractTest {
      * @throws Exception If failed.
      */
     public void testAgeClusterGroupSerialization() throws Exception {
-        Marshaller marshaller = getConfiguration().getMarshaller();
+        Marshaller marshaller = ignite.configuration().getMarshaller();
 
         ClusterGroup grp = ignite.cluster().forYoungest();
         ClusterNode node = grp.node();

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalIgniteSerializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalIgniteSerializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalIgniteSerializationTest.java
new file mode 100644
index 0000000..9737d12
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridLocalIgniteSerializationTest.java
@@ -0,0 +1,378 @@
+/*
+ * 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;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.concurrent.Callable;
+
+/**
+ * Test for local Ignite instance processing during serialization/deserialization.
+ */
+public class GridLocalIgniteSerializationTest extends GridCommonAbstractTest {
+    /** */
+    private static final String CACHE_NAME = "cache_name";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
+        final IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        if (gridName != null && gridName.startsWith("binary"))
+            cfg.setMarshaller(new BinaryMarshaller());
+
+        return cfg;
+    }
+
+    /**
+     * Test that calling {@link Ignition#localIgnite()}
+     * is safe for binary marshaller.
+     *
+     * @throws Exception If failed.
+     */
+    public void testPutGetSimple() throws Exception {
+        checkPutGet(new SimpleTestObject("one"), null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutGetSerializable() throws Exception {
+        checkPutGet(new SerializableTestObject("test"), null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutGetExternalizable() throws Exception {
+        checkPutGet(new ExternalizableTestObject("test"), null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutGetBinarylizable() throws Exception {
+        checkPutGet(new BinarylizableTestObject("test"), "binaryIgnite");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkPutGet(final TestObject obj, final String gridName) throws Exception {
+
+
+        // Run async to emulate user thread.
+        GridTestUtils.runAsync(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                try (final Ignite ignite = startGrid(gridName)) {
+                    if (ignite.configuration().getMarshaller() instanceof AbstractNodeNameAwareMarshaller) {
+                        final IgniteCache<Integer, TestObject> cache = ignite.getOrCreateCache(CACHE_NAME);
+
+                        assertNull(obj.ignite());
+
+                        cache.put(1, obj);
+
+                        assertNotNull(obj.ignite());
+
+                        final TestObject loadedObj = cache.get(1);
+
+                        assertNotNull(loadedObj.ignite());
+
+                        assertEquals(obj, loadedObj);
+                    }
+                }
+
+                return null;
+            }
+        }).get();
+    }
+
+    /**
+     *
+     */
+    private interface TestObject {
+        /**
+         * @return Ignite instance.
+         */
+        Ignite ignite();
+    }
+
+    /**
+     * Test object.
+     */
+    private static class SimpleTestObject implements TestObject {
+        /** */
+        private final String val;
+
+        /** */
+        private transient Ignite ignite;
+
+        /** */
+        private SimpleTestObject(final String val) {
+            this.val = val;
+        }
+
+        /**
+         * @return Object.
+         */
+        @SuppressWarnings("unused")
+        private Object readResolve() {
+            ignite = Ignition.localIgnite();
+
+            return this;
+        }
+
+        /**
+         * @return Object.
+         */
+        @SuppressWarnings("unused")
+        private Object writeReplace() {
+            ignite = Ignition.localIgnite();
+
+            return this;
+        }
+
+        /** */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final SimpleTestObject simpleTestObj = (SimpleTestObject) o;
+
+            return val != null ? val.equals(simpleTestObj.val) : simpleTestObj.val == null;
+
+        }
+
+        /** */
+        @Override public int hashCode() {
+            return val != null ? val.hashCode() : 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Ignite ignite() {
+            return ignite;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class SerializableTestObject implements Serializable, TestObject {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private String val;
+
+        /** */
+        private transient Ignite ignite;
+
+        /**
+         *
+         */
+        public SerializableTestObject() {
+        }
+
+        /**
+         * @param val Value
+         */
+        public SerializableTestObject(final String val) {
+            this.val = val;
+        }
+
+        /**
+         * @param out Object output.
+         * @throws IOException If fail.
+         */
+        private void writeObject(ObjectOutputStream out) throws IOException {
+            U.writeString(out, val);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /**
+         * @param in Object input.
+         * @throws IOException If fail.
+         */
+        private void readObject(ObjectInputStream in) throws IOException {
+            val = U.readString(in);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final SerializableTestObject that = (SerializableTestObject) o;
+
+            return val != null ? val.equals(that.val) : that.val == null;
+
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return val != null ? val.hashCode() : 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Ignite ignite() {
+            return ignite;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class ExternalizableTestObject implements Externalizable, TestObject {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private String val;
+
+        /** */
+        private transient Ignite ignite;
+
+        /**
+         *
+         */
+        public ExternalizableTestObject() {
+        }
+
+        /**
+         * @param val Value.
+         */
+        public ExternalizableTestObject(final String val) {
+            this.val = val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(final ObjectOutput out) throws IOException {
+            U.writeString(out, val);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+            val = U.readString(in);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final ExternalizableTestObject that = (ExternalizableTestObject) o;
+
+            return val != null ? val.equals(that.val) : that.val == null;
+
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return val != null ? val.hashCode() : 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Ignite ignite() {
+            return ignite;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class BinarylizableTestObject implements Binarylizable, TestObject {
+        /** */
+        private String val;
+
+        /** */
+        private transient Ignite ignite;
+
+        /**
+         *
+         */
+        public BinarylizableTestObject() {
+        }
+
+        /**
+         * @param val Value.
+         */
+        public BinarylizableTestObject(final String val) {
+            this.val = val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeBinary(final BinaryWriter writer) throws BinaryObjectException {
+            writer.rawWriter().writeString(val);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readBinary(final BinaryReader reader) throws BinaryObjectException {
+            val = reader.rawReader().readString();
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final BinarylizableTestObject that = (BinarylizableTestObject) o;
+
+            return val != null ? val.equals(that.val) : that.val == null;
+
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return val != null ? val.hashCode() : 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Ignite ignite() {
+            return ignite;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index d5ea46c..035c6fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -2061,7 +2061,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
                 if (msg instanceof TcpDiscoveryCustomEventMessage) {
                     try {
                         DiscoveryCustomMessage custMsg = GridTestUtils.getFieldValue(
-                            ((TcpDiscoveryCustomEventMessage)msg).message(marsh, U.gridClassLoader()), "delegate");
+                            ((TcpDiscoveryCustomEventMessage)msg).message(marshaller(), U.gridClassLoader()), "delegate");
 
                         if (custMsg instanceof StartRoutineAckDiscoveryMessage) {
                             log.info("Skip message send and stop node: " + msg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/59527c56/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 6bb2c11..62c2eb3 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
@@ -35,6 +35,7 @@ import org.apache.ignite.internal.GridStopWithCancelSelfTest;
 import org.apache.ignite.internal.IgniteSlowClientDetectionSelfTest;
 import org.apache.ignite.internal.MarshallerContextLockingSelfTest;
 import org.apache.ignite.internal.processors.affinity.GridAffinityProcessorRendezvousSelfTest;
+import org.apache.ignite.internal.processors.cache.GridLocalIgniteSerializationTest;
 import org.apache.ignite.internal.processors.cache.GridProjectionForCachesOnDaemonNodeSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteDaemonNodeMarshallerCacheTest;
 import org.apache.ignite.internal.processors.cache.IgniteMarshallerCacheConcurrentReadWriteTest;
@@ -125,6 +126,7 @@ public class IgniteBasicTestSuite extends TestSuite {
         GridTestUtils.addTestIfNeeded(suite, IgniteDaemonNodeMarshallerCacheTest.class, ignoredTests);
         suite.addTestSuite(IgniteMarshallerCacheConcurrentReadWriteTest.class);
         suite.addTestSuite(GridNodeMetricsLogSelfTest.class);
+        suite.addTestSuite(GridLocalIgniteSerializationTest.class);
 
         suite.addTestSuite(IgniteExceptionInNioWorkerSelfTest.class);
 


[46/49] ignite git commit: ignite-comm-opts1

Posted by sb...@apache.org.
ignite-comm-opts1


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

Branch: refs/heads/ignite-comm-opts1
Commit: 32dd9ec87dfcf48f4796419d94fc7e762f910623
Parents: deb4979
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 12 10:43:52 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 12 10:43:52 2016 +0300

----------------------------------------------------------------------
 .../internal/util/nio/GridNioRecoveryDescriptor.java      |  2 +-
 .../apache/ignite/internal/util/nio/GridNioServer.java    | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/32dd9ec8/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
index bf8e26a..29903d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
 /**
  * Recovery information for single node.
  */
-@Deprecated // To be splitted into in/out parts when do need maintain backward compatibility.
+@Deprecated // To be splitted into separate classes for in/out data when do not need maintain backward compatibility.
 public class GridNioRecoveryDescriptor {
     /** Number of acknowledged messages. */
     private long acked;

http://git-wip-us.apache.org/repos/asf/ignite/blob/32dd9ec8/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 450c2a2..e6b6767 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -152,11 +152,11 @@ public class GridNioServer<T> {
     /** Flag indicating if this server should use direct buffers. */
     private final boolean directBuf;
 
-    /** Index to select which thread will serve next socket channel. Using round-robin balancing. */
+    /** Index to select which thread will serve next in socket channel. Using round-robin balancing. */
     @GridToStringExclude
     private final AtomicInteger readBalanceIdx = new AtomicInteger();
 
-    // TODO
+    /** Index to select which thread will serve next out socket channel. Using round-robin balancing. */
     @GridToStringExclude
     private final AtomicInteger writeBalanceIdx = new AtomicInteger(1);
 
@@ -700,10 +700,8 @@ public class GridNioServer<T> {
      * @param req Request to balance.
      */
     private synchronized void offerBalanced(NioOperationFuture req) {
-        assert req.operation() == NioOperation.REGISTER;
-        assert req.socketChannel() != null;
-
-        //U.debug("Req registration: " + req);
+        assert req.operation() == NioOperation.REGISTER : req;
+        assert req.socketChannel() != null : req;
 
         int balanceIdx = req.accepted() ? readBalanceIdx.getAndAdd(2) : writeBalanceIdx.getAndAdd(2);
 


[28/49] ignite git commit: IGNITE-2629: ODBC: GridNioAsyncNotifyFilter should process onSessionOpened synchronously

Posted by sb...@apache.org.
IGNITE-2629: ODBC: GridNioAsyncNotifyFilter should process onSessionOpened synchronously


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

Branch: refs/heads/ignite-comm-opts1
Commit: b5121adff860d96e5954d3466137854f8fae4c27
Parents: 224cae1
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 7 12:44:24 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 7 12:44:24 2016 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/processors/odbc/OdbcProcessor.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b5121adf/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
index a672d7c..9388a8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcProcessor.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter;
 import org.apache.ignite.internal.util.nio.GridNioCodecFilter;
 import org.apache.ignite.internal.util.nio.GridNioFilter;
 import org.apache.ignite.internal.util.nio.GridNioServer;
+import org.apache.ignite.internal.util.nio.GridNioSession;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.Marshaller;
@@ -123,7 +124,11 @@ public class OdbcProcessor extends GridProcessorAdapter {
                 for (int port = hostPort.portFrom(); port <= hostPort.portTo(); port++) {
                     try {
                         GridNioFilter[] filters = new GridNioFilter[] {
-                            new GridNioAsyncNotifyFilter(ctx.gridName(), odbcExecSvc, log),
+                            new GridNioAsyncNotifyFilter(ctx.gridName(), odbcExecSvc, log) {
+                                @Override public void onSessionOpened(GridNioSession ses) throws IgniteCheckedException {
+                                    proceedSessionOpened(ses);
+                                }
+                            },
                             new GridNioCodecFilter(new OdbcBufferedParser(), log, false)
                         };
 


[07/49] ignite git commit: IGNITE-2946: CPP: Optimized GetNext() method for cursors. This closes #992.

Posted by sb...@apache.org.
IGNITE-2946: CPP: Optimized GetNext() method for cursors. This closes #992.


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

Branch: refs/heads/ignite-comm-opts1
Commit: e9c797fd964727882ad6f40f2a452b17ae7c857e
Parents: e3c4868
Author: isapego <is...@gridgain.com>
Authored: Sun Sep 4 16:47:40 2016 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Sun Sep 4 16:47:40 2016 +0300

----------------------------------------------------------------------
 .../query/PlatformAbstractQueryCursor.java      |  11 +-
 .../cache/query/PlatformFieldsQueryCursor.java  |   6 +
 .../ignite/impl/binary/binary_reader_impl.h     |   2 +-
 .../common/include/ignite/common/concurrent.h   |   5 +-
 .../cpp/core-test/src/cache_query_test.cpp      | 243 +++++++++++++------
 modules/platforms/cpp/core/Makefile.am          |   1 +
 modules/platforms/cpp/core/include/Makefile.am  |   1 +
 .../include/ignite/cache/query/query_cursor.h   |   6 +-
 .../ignite/cache/query/query_fields_cursor.h    |   4 +-
 .../ignite/impl/cache/query/query_batch.h       | 148 +++++++++++
 .../impl/cache/query/query_fields_row_impl.h    |  30 +--
 .../ignite/impl/cache/query/query_impl.h        |  30 ++-
 .../platforms/cpp/core/project/vs/core.vcxproj  |   2 +
 .../cpp/core/project/vs/core.vcxproj.filters    |   6 +
 .../core/src/impl/cache/query/query_batch.cpp   |  52 ++++
 .../core/src/impl/cache/query/query_impl.cpp    | 180 ++++++++------
 .../Impl/Cache/Query/FieldsQueryCursor.cs       |   3 +
 17 files changed, 537 insertions(+), 193 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java
index 7422757..ab52b52 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java
@@ -70,13 +70,12 @@ public abstract class PlatformAbstractQueryCursor<T> extends PlatformAbstractTar
                 try {
                     int cntPos = writer.reserveInt();
 
-                    int cnt;
+                    int cnt = 0;
 
-                    for (cnt = 0; cnt < batchSize; cnt++) {
-                        if (iter.hasNext())
-                            write(writer, iter.next());
-                        else
-                            break;
+                    while (cnt < batchSize && iter.hasNext()) {
+                        write(writer, iter.next());
+
+                        cnt++;
                     }
 
                     writer.writeInt(cntPos, cnt);

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformFieldsQueryCursor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformFieldsQueryCursor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformFieldsQueryCursor.java
index a4cdae6..25f86f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformFieldsQueryCursor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformFieldsQueryCursor.java
@@ -41,9 +41,15 @@ public class PlatformFieldsQueryCursor extends PlatformAbstractQueryCursor<List<
     @Override protected void write(BinaryRawWriterEx writer, List vals) {
         assert vals != null;
 
+        int rowSizePos = writer.reserveInt();
+
         writer.writeInt(vals.size());
 
         for (Object val : vals)
             writer.writeObjectDetached(val);
+
+        int rowEndPos = writer.out().position();
+        
+        writer.writeInt(rowSizePos, rowEndPos - rowSizePos);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
index d9f1e1a..8c4b464 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h
@@ -943,7 +943,7 @@ namespace ignite
                  *
                  * @return Stream.
                  */
-                impl::interop::InteropInputStream* GetStream();
+                interop::InteropInputStream* GetStream();
             private:
                 /** Underlying stream. */
                 interop::InteropInputStream* stream;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/common/include/ignite/common/concurrent.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/concurrent.h b/modules/platforms/cpp/common/include/ignite/common/concurrent.h
index 9a475da..465e02e 100644
--- a/modules/platforms/cpp/common/include/ignite/common/concurrent.h
+++ b/modules/platforms/cpp/common/include/ignite/common/concurrent.h
@@ -167,10 +167,9 @@ namespace ignite
                  *
                  * @param other Instance to copy.
                  */
-                SharedPointer(const SharedPointer& other)
+                SharedPointer(const SharedPointer& other) :
+                    impl(other.impl)
                 {
-                    impl = other.impl;
-
                     if (impl)
                         impl->Increment();
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_query_test.cpp b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
index 168f3f9..b8cd612 100644
--- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
@@ -212,63 +212,6 @@ namespace ignite
     }
 }
 
-/** Node started during the test. */
-Ignite grid = Ignite();
-
-/** Cache accessor. */
-Cache<int, QueryPerson> GetCache()
-{
-    return grid.GetCache<int, QueryPerson>("cache");
-}
-
-/**
- * Test setup fixture.
- */
-struct CacheQueryTestSuiteFixture {
-    /**
-     * Constructor.
-     */
-    CacheQueryTestSuiteFixture()
-    {
-        IgniteConfiguration cfg;
-        
-        cfg.jvmOpts.push_back("-Xdebug");
-        cfg.jvmOpts.push_back("-Xnoagent");
-        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-        char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
-        cfg.springCfgPath = std::string(cfgPath).append("/").append("cache-query.xml");
-
-        IgniteError err;
-
-        Ignite grid0 = Ignition::Start(cfg, &err);
-
-        if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
-            BOOST_ERROR(err.GetText());
-
-        grid = grid0;
-    }
-
-    /**
-     * Destructor.
-     */
-    ~CacheQueryTestSuiteFixture()
-    {
-        Ignition::Stop(grid.GetName(), true);
-    }
-};
-
 /**
  * Ensure that HasNext() fails.
  *
@@ -522,6 +465,131 @@ void CheckMultipleGetAll(Cursor& cur, int key1, const std::string& name1,
     }
 }
 
+/**
+ * Test setup fixture.
+ */
+struct CacheQueryTestSuiteFixture
+{
+    Ignite StartNode(const char* name)
+    {
+        IgniteConfiguration cfg;
+
+        cfg.jvmOpts.push_back("-Xdebug");
+        cfg.jvmOpts.push_back("-Xnoagent");
+        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
+        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
+        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
+
+#ifdef IGNITE_TESTS_32
+        cfg.jvmInitMem = 256;
+        cfg.jvmMaxMem = 768;
+#else
+        cfg.jvmInitMem = 1024;
+        cfg.jvmMaxMem = 4096;
+#endif
+
+        cfg.springCfgPath.assign(getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH")).append("/cache-query.xml");
+
+        IgniteError err;
+
+        Ignite grid0 = Ignition::Start(cfg, name, &err);
+
+        if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+            BOOST_ERROR(err.GetText());
+
+        return grid0;
+    }
+
+    void CheckFieldsQueryPages(int32_t pageSize, int32_t pagesNum, int32_t additionalNum)
+    {
+        // Test simple query.
+        Cache<int, QueryPerson> cache = GetPersonCache();
+
+        // Test query with two fields of different type.
+        SqlFieldsQuery qry("select name, age from QueryPerson");
+
+        QueryFieldsCursor cursor = cache.Query(qry);
+        CheckEmpty(cursor);
+
+        const int32_t entryCnt = pageSize * pagesNum + additionalNum; // Number of entries.
+
+        qry.SetPageSize(pageSize);
+
+        for (int i = 0; i < entryCnt; i++)
+        {
+            std::stringstream stream;
+
+            stream << "A" << i;
+
+            cache.Put(i, QueryPerson(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1970 + i),
+                BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)));
+        }
+
+        cursor = cache.Query(qry);
+
+        IgniteError error;
+
+        for (int i = 0; i < entryCnt; i++)
+        {
+            std::stringstream stream;
+
+            stream << "A" << i;
+
+            std::string expected_name = stream.str();
+            int expected_age = i * 10;
+
+            BOOST_REQUIRE(cursor.HasNext(error));
+            BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+
+            QueryFieldsRow row = cursor.GetNext(error);
+            BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+
+            BOOST_REQUIRE(row.HasNext(error));
+            BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+
+            std::string name = row.GetNext<std::string>(error);
+            BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+
+            BOOST_REQUIRE(name == expected_name);
+
+            int age = row.GetNext<int>(error);
+            BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+
+            BOOST_REQUIRE(age == expected_age);
+
+            BOOST_REQUIRE(!row.HasNext());
+        }
+
+        CheckEmpty(cursor);
+    }
+
+    /**
+     * Constructor.
+     */
+    CacheQueryTestSuiteFixture() : 
+        grid(StartNode("Node1"))
+    {
+        // No-op.
+    }
+
+    /**
+     * Destructor.
+     */
+    ~CacheQueryTestSuiteFixture()
+    {
+        Ignition::StopAll(true);
+    }
+
+    /** Person cache accessor. */
+    Cache<int, QueryPerson> GetPersonCache()
+    {
+        return grid.GetCache<int, QueryPerson>("cache");
+    }
+
+    /** Node started during the test. */
+    Ignite grid;
+};
+
 BOOST_FIXTURE_TEST_SUITE(CacheQueryTestSuite, CacheQueryTestSuiteFixture)
 
 /**
@@ -529,7 +597,7 @@ BOOST_FIXTURE_TEST_SUITE(CacheQueryTestSuite, CacheQueryTestSuiteFixture)
  */
 BOOST_AUTO_TEST_CASE(TestSqlQuery)
 {    
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with no results.
     SqlQuery qry("QueryPerson", "age < 20");
@@ -585,7 +653,7 @@ BOOST_AUTO_TEST_CASE(TestSqlQuery)
  */
 BOOST_AUTO_TEST_CASE(TestTextQuery)
 {
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with no results.
     TextQuery qry("QueryPerson", "A1");
@@ -631,7 +699,7 @@ BOOST_AUTO_TEST_CASE(TestTextQuery)
 BOOST_AUTO_TEST_CASE(TestScanQuery)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with no results.
     ScanQuery qry;
@@ -667,7 +735,7 @@ BOOST_AUTO_TEST_CASE(TestScanQuery)
 BOOST_AUTO_TEST_CASE(TestScanQueryPartitioned)
 {
     // Populate cache with data.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     int32_t partCnt = 256;   // Defined in configuration explicitly.   
     int32_t entryCnt = 1000; // Should be greater than partCnt.
@@ -716,7 +784,7 @@ BOOST_AUTO_TEST_CASE(TestScanQueryPartitioned)
 BOOST_AUTO_TEST_CASE(TestFieldsQuerySingle)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with two fields of different type.
     SqlFieldsQuery qry("select age, name from QueryPerson");
@@ -761,7 +829,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQuerySingle)
 BOOST_AUTO_TEST_CASE(TestFieldsQueryExceptions)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with two fields of different type.
     SqlFieldsQuery qry("select age, name from QueryPerson");
@@ -806,7 +874,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryExceptions)
 BOOST_AUTO_TEST_CASE(TestFieldsQueryTwo)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with two fields of different type.
     SqlFieldsQuery qry("select age, name from QueryPerson");
@@ -869,7 +937,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTwo)
 BOOST_AUTO_TEST_CASE(TestFieldsQuerySeveral)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with two fields of different type.
     SqlFieldsQuery qry("select name, age from QueryPerson");
@@ -935,7 +1003,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQuerySeveral)
 BOOST_AUTO_TEST_CASE(TestFieldsQueryDateLess)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with field of type 'Date'.
     SqlFieldsQuery qry("select birthday from QueryPerson where birthday<'1990-01-01'");
@@ -996,7 +1064,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateLess)
 BOOST_AUTO_TEST_CASE(TestFieldsQueryDateMore)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with field of type 'Date'.
     SqlFieldsQuery qry("select birthday from QueryPerson where birthday>'2070-01-01'");
@@ -1057,7 +1125,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateMore)
 BOOST_AUTO_TEST_CASE(TestFieldsQueryDateEqual)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with field of type 'Date'.
     SqlFieldsQuery qry("select birthday from QueryPerson where birthday='2032-01-01'");
@@ -1109,7 +1177,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateEqual)
 BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampLess)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with field of type 'Timestamp'.
     SqlFieldsQuery qry("select recordCreated from QueryPerson where recordCreated<'2016-01-01 01:00:00'");
@@ -1170,7 +1238,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampLess)
 BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampMore)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with field of type 'Timestamp'.
     SqlFieldsQuery qry("select recordCreated from QueryPerson where recordCreated>'2016-01-01 15:30:00'");
@@ -1233,7 +1301,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampMore)
 BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampEqual)
 {
     // Test simple query.
-    Cache<int, QueryPerson> cache = GetCache();
+    Cache<int, QueryPerson> cache = GetPersonCache();
 
     // Test query with field of type 'Timestamp'.
     SqlFieldsQuery qry("select recordCreated from QueryPerson where recordCreated='2016-01-01 09:18:00'");
@@ -1279,4 +1347,37 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampEqual)
     CheckEmpty(cursor);
 }
 
+/**
+ * Test fields query with several pages.
+ */
+BOOST_AUTO_TEST_CASE(TestFieldsQueryPagesSeveral)
+{
+    CheckFieldsQueryPages(32, 8, 1);
+}
+
+/**
+ * Test fields query with page size 1.
+ */
+BOOST_AUTO_TEST_CASE(TestFieldsQueryPageSingle)
+{
+    CheckFieldsQueryPages(1, 100, 0);
+}
+
+/**
+ * Test fields query with page size 0.
+ */
+BOOST_AUTO_TEST_CASE(TestFieldsQueryPageZero)
+{
+    try
+    {
+        CheckFieldsQueryPages(0, 100, 0);
+
+        BOOST_FAIL("Exception expected.");
+    }
+    catch (IgniteError&)
+    {
+        // Expected.
+    }
+}
+
 BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/Makefile.am b/modules/platforms/cpp/core/Makefile.am
index 2b73476..bbb7720 100644
--- a/modules/platforms/cpp/core/Makefile.am
+++ b/modules/platforms/cpp/core/Makefile.am
@@ -59,6 +59,7 @@ libignite_la_SOURCES = \
     src/impl/handle_registry.cpp \
     src/impl/cache/query/query_impl.cpp \
     src/impl/cache/cache_impl.cpp \
+    src/impl/cache/query/query_batch.cpp \
     src/impl/interop/interop_external_memory.cpp \
     src/impl/interop/interop_target.cpp \
     src/impl/transactions/transaction_impl.cpp \

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/Makefile.am b/modules/platforms/cpp/core/include/Makefile.am
index f7159ae..fb84bc5 100644
--- a/modules/platforms/cpp/core/include/Makefile.am
+++ b/modules/platforms/cpp/core/include/Makefile.am
@@ -27,6 +27,7 @@ nobase_include_HEADERS = \
     ignite/impl/cache/query/query_fields_row_impl.h \
     ignite/impl/cache/query/query_impl.h \
     ignite/impl/cache/cache_impl.h \
+    ignite/impl/cache/query/query_batch.h \
     ignite/impl/interop/interop_target.h \
     ignite/impl/interop/interop_external_memory.h \
     ignite/impl/handle_registry.h \

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/include/ignite/cache/query/query_cursor.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/query/query_cursor.h b/modules/platforms/cpp/core/include/ignite/cache/query/query_cursor.h
index 4c46662..61c6813 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/query/query_cursor.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/query/query_cursor.h
@@ -112,7 +112,7 @@ namespace ignite
                     impl::cache::query::QueryCursorImpl* impl0 = impl.Get();
 
                     if (impl0)
-                        return impl0->HasNext(&err);
+                        return impl0->HasNext(err);
                     else
                     {
                         err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, 
@@ -160,7 +160,7 @@ namespace ignite
                     if (impl0) {
                         impl::Out2Operation<K, V> outOp;
 
-                        impl0->GetNext(outOp, &err);
+                        impl0->GetNext(outOp, err);
 
                         if (err.GetCode() == IgniteError::IGNITE_SUCCESS) 
                         {
@@ -215,7 +215,7 @@ namespace ignite
                     if (impl0) {
                         impl::OutQueryGetAllOperation<K, V> outOp(&res);
 
-                        impl0->GetAll(outOp, &err);
+                        impl0->GetAll(outOp, err);
                     }
                     else
                         err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/include/ignite/cache/query/query_fields_cursor.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/query/query_fields_cursor.h b/modules/platforms/cpp/core/include/ignite/cache/query/query_fields_cursor.h
index 3946e1c..36e5f5c 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/query/query_fields_cursor.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/query/query_fields_cursor.h
@@ -108,7 +108,7 @@ namespace ignite
                     impl::cache::query::QueryCursorImpl* impl0 = impl.Get();
 
                     if (impl0)
-                        return impl0->HasNext(&err);
+                        return impl0->HasNext(err);
                     else
                     {
                         err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, 
@@ -153,7 +153,7 @@ namespace ignite
                     impl::cache::query::QueryCursorImpl* impl0 = impl.Get();
 
                     if (impl0)
-                        return impl0->GetNextRow(&err);
+                        return impl0->GetNextRow(err);
                     else
                     {
                         err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_batch.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_batch.h b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_batch.h
new file mode 100644
index 0000000..15d6edb
--- /dev/null
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_batch.h
@@ -0,0 +1,148 @@
+/*
+ * 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.
+ */
+
+#ifndef _IGNITE_CACHE_QUERY_BATCH
+#define _IGNITE_CACHE_QUERY_BATCH
+
+#include <cassert>
+
+#include "ignite/ignite_error.h"
+#include "ignite/impl/ignite_environment.h"
+#include "ignite/impl/operations.h"
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace cache
+        {
+            namespace query
+            {
+                class QueryFieldsRowImpl;
+
+                /**
+                 * Query batch.
+                 */
+                class IGNITE_IMPORT_EXPORT QueryBatch
+                {
+                    typedef common::concurrent::SharedPointer<interop::InteropMemory> MemorySharedPtr;
+
+                public:
+                    /**
+                     * Constructor.
+                     *
+                     * @param env Environment.
+                     * @param mem Batch memory.
+                     */
+                    QueryBatch(IgniteEnvironment& env, MemorySharedPtr mem) :
+                        env(env),
+                        mem(mem),
+                        stream(mem.Get()),
+                        reader(&stream),
+                        size(reader.ReadInt32()),
+                        pos(0)
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Destructor.
+                     */
+                    ~QueryBatch()
+                    {
+                        // No-op.
+                    }
+
+                    /**
+                     * Check whether batch is empty.
+                     *
+                     * @return True if empty.
+                     */
+                    bool IsEmpty() const
+                    {
+                        return size == 0;
+                    }
+
+                    /**
+                     * Get the number of the unread rows in the batch.
+                     *
+                     * @return Number of the unread rows in the batch.
+                     */
+                    int32_t Left() const
+                    {
+                        return size - pos;
+                    }
+
+                    /**
+                     * Check whether next result exists.
+                     *
+                     * @param err Error.
+                     * @return True if exists.
+                     */
+                    int32_t Size()
+                    {
+                        return size;
+                    }
+
+                    /**
+                     * Get next object.
+                     * 
+                     * @param op Operation.
+                     */
+                    void GetNext(OutputOperation& op)
+                    {
+                        assert(Left() > 0);
+
+                        op.ProcessOutput(reader);
+
+                        ++pos;
+                    }
+
+                    /**
+                     * Get next row.
+                     *
+                     * @return Output row.
+                     */
+                    QueryFieldsRowImpl* GetNextRow();
+
+                private:
+                    /** Environment. */
+                    IgniteEnvironment& env;
+
+                    /** Memomy containing the batch. */
+                    MemorySharedPtr mem;
+
+                    /** Stream. */
+                    interop::InteropInputStream stream;
+
+                    /** Reader. */
+                    binary::BinaryReaderImpl reader;
+
+                    /** Result batch size. */
+                    int32_t size;
+
+                    /** Position in memory. */
+                    int32_t pos;
+
+                    IGNITE_NO_COPY_ASSIGNMENT(QueryBatch);
+                };
+            }
+        }
+    }
+}
+
+#endif // _IGNITE_CACHE_QUERY_BATCH

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h
index 233c2d4..82cebd5 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_fields_row_impl.h
@@ -18,16 +18,9 @@
 #ifndef _IGNITE_IMPL_CACHE_QUERY_CACHE_QUERY_FIELDS_ROW_IMPL
 #define _IGNITE_IMPL_CACHE_QUERY_CACHE_QUERY_FIELDS_ROW_IMPL
 
-#include <vector>
-#include <memory>
-
 #include <ignite/common/concurrent.h>
 #include <ignite/ignite_error.h>
 
-#include "ignite/cache/cache_entry.h"
-#include "ignite/impl/cache/query/query_impl.h"
-#include "ignite/impl/operations.h"
-
 namespace ignite
 {
     namespace impl
@@ -45,23 +38,18 @@ namespace ignite
                     typedef common::concurrent::SharedPointer<interop::InteropMemory> SP_InteropMemory;
 
                     /**
-                     * Default constructor.
-                     */
-                    QueryFieldsRowImpl() : mem(0), stream(0), reader(0), size(0), 
-                        processed(0)
-                    {
-                        // No-op.
-                    }
-
-                    /**
                      * Constructor.
                      *
                      * @param mem Memory containig row data.
                      */
-                    QueryFieldsRowImpl(SP_InteropMemory mem) : mem(mem), stream(mem.Get()), 
-                        reader(&stream), size(reader.ReadInt32()), processed(0)
+                    QueryFieldsRowImpl(SP_InteropMemory mem, int32_t rowBegin, int32_t columnNum) :
+                        mem(mem),
+                        stream(mem.Get()),
+                        reader(&stream),
+                        columnNum(columnNum),
+                        processed(0)
                     {
-                        // No-op.
+                        stream.Position(rowBegin);
                     }
 
                     /**
@@ -89,7 +77,7 @@ namespace ignite
                     bool HasNext(IgniteError& err)
                     {
                         if (IsValid())
-                            return processed < size;
+                            return processed < columnNum;
                         else
                         {
                             err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
@@ -165,7 +153,7 @@ namespace ignite
                     binary::BinaryReaderImpl reader;
 
                     /** Number of elements in a row. */
-                    int32_t size;
+                    int32_t columnNum;
 
                     /** Number of elements that have been read by now. */
                     int32_t processed;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_impl.h b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_impl.h
index 0f17c32..4083c7c 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_impl.h
@@ -22,6 +22,7 @@
 
 #include "ignite/impl/ignite_environment.h"
 #include "ignite/impl/operations.h"
+#include "ignite/impl/cache/query/query_batch.h"
 
 namespace ignite
 {
@@ -58,7 +59,7 @@ namespace ignite
                      * @param err Error.
                      * @return True if exists.
                      */
-                    bool HasNext(IgniteError* err);
+                    bool HasNext(IgniteError& err);
 
                     /**
                      * Get next object.
@@ -66,7 +67,7 @@ namespace ignite
                      * @param op Operation.
                      * @param err Error.
                      */
-                    void GetNext(OutputOperation& op, IgniteError* err);
+                    void GetNext(OutputOperation& op, IgniteError& err);
 
                     /**
                      * Get next row.
@@ -74,7 +75,7 @@ namespace ignite
                      * @param err Error.
                      * @return Output row.
                      */
-                    QueryFieldsRowImpl* GetNextRow(IgniteError* err);
+                    QueryFieldsRowImpl* GetNextRow(IgniteError& err);
 
                     /**
                      * Get all cursor entries.
@@ -82,7 +83,7 @@ namespace ignite
                      * @param op Operation.
                      * @param err Error.
                      */
-                    void GetAll(OutputOperation& op, IgniteError* err);
+                    void GetAll(OutputOperation& op, IgniteError& err);
 
                 private:
                     /** Environment. */
@@ -91,15 +92,18 @@ namespace ignite
                     /** Handle to Java object. */
                     jobject javaRef;
 
+                    /** Current result batch. */
+                    QueryBatch* batch;
+
+                    /** Whether cursor has no more elements available. */
+                    bool endReached;
+
                     /** Whether iteration methods were called. */
                     bool iterCalled;
 
                     /** Whether GetAll() method was called. */
                     bool getAllCalled;
 
-                    /** Whether next entry is available. */
-                    bool hasNext;
-
                     IGNITE_NO_COPY_ASSIGNMENT(QueryCursorImpl);
 
                     /**
@@ -108,7 +112,15 @@ namespace ignite
                      * @param err Error.
                      * @return True in case of success, false if an error is thrown.
                      */
-                    bool CreateIteratorIfNeeded(IgniteError* err);
+                    bool CreateIteratorIfNeeded(IgniteError& err);
+
+                   /**
+                     * Get next result batch if update is needed.
+                     *
+                     * @param err Error.
+                     * @return True if operation has been successful.
+                     */
+                    bool GetNextBatchIfNeeded(IgniteError& err);
 
                     /**
                      * Check whether Java-side iterator has next element.
@@ -116,7 +128,7 @@ namespace ignite
                      * @param err Error.
                      * @return True if the next element is available.
                      */
-                    bool IteratorHasNext(IgniteError* err);
+                    bool IteratorHasNext(IgniteError& err);
                 };
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/project/vs/core.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/project/vs/core.vcxproj b/modules/platforms/cpp/core/project/vs/core.vcxproj
index 0797c31..ca14a1d 100644
--- a/modules/platforms/cpp/core/project/vs/core.vcxproj
+++ b/modules/platforms/cpp/core/project/vs/core.vcxproj
@@ -209,6 +209,7 @@
     <ClInclude Include="..\..\include\ignite\ignition.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_updater_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h" />
+    <ClInclude Include="..\..\include\ignite\impl\cache\query\query_batch.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\query\query_fields_row_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\cache\query\query_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\ignite_environment.h" />
@@ -229,6 +230,7 @@
     <ClCompile Include="..\..\src\ignition.cpp" />
     <ClCompile Include="..\..\src\impl\binary\binary_type_updater_impl.cpp" />
     <ClCompile Include="..\..\src\impl\cache\cache_impl.cpp" />
+    <ClCompile Include="..\..\src\impl\cache\query\query_batch.cpp" />
     <ClCompile Include="..\..\src\impl\cache\query\query_impl.cpp" />
     <ClCompile Include="..\..\src\impl\ignite_environment.cpp" />
     <ClCompile Include="..\..\src\impl\ignite_impl.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/project/vs/core.vcxproj.filters b/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
index c90b697..c5fb532 100644
--- a/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
+++ b/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
@@ -43,6 +43,9 @@
     <ClCompile Include="..\..\src\impl\interop\interop_target.cpp">
       <Filter>Code\impl\interop</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\impl\cache\query\query_batch.cpp">
+      <Filter>Code\impl\cache\query</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h">
@@ -138,6 +141,9 @@
     <ClInclude Include="..\..\include\ignite\impl\interop\interop_target.h">
       <Filter>Code\impl\interop</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\ignite\impl\cache\query\query_batch.h">
+      <Filter>Code\impl\cache\query</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <Filter Include="Code">

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/src/impl/cache/query/query_batch.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/cache/query/query_batch.cpp b/modules/platforms/cpp/core/src/impl/cache/query/query_batch.cpp
new file mode 100644
index 0000000..44086af
--- /dev/null
+++ b/modules/platforms/cpp/core/src/impl/cache/query/query_batch.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#include "ignite/impl/cache/query/query_batch.h"
+#include "ignite/impl/cache/query/query_fields_row_impl.h"
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace cache
+        {
+            namespace query
+            {
+                QueryFieldsRowImpl* QueryBatch::GetNextRow()
+                {
+                    assert(Left() > 0);
+
+                    int32_t rowBegin = stream.Position();
+
+                    int32_t rowLen = reader.ReadInt32();
+                    int32_t columnNum = reader.ReadInt32();
+
+                    int32_t dataPos = stream.Position();
+
+                    assert(rowLen >= 4);
+
+                    ++pos;
+
+                    stream.Position(rowBegin + rowLen);
+
+                    return new QueryFieldsRowImpl(mem, dataPos, columnNum);
+                }
+
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
index 880e8b1..73d9924 100644
--- a/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
@@ -35,30 +35,41 @@ namespace ignite
                 /** Operation: get all entries. */
                 const int32_t OP_GET_ALL = 1;
 
+                /** Operation: get multiple entries. */
+                const int32_t OP_GET_BATCH = 2;
+
                 /** Operation: get single entry. */
                 const int32_t OP_GET_SINGLE = 3;
 
                 QueryCursorImpl::QueryCursorImpl(SharedPointer<IgniteEnvironment> env, jobject javaRef) :
-                    env(env), javaRef(javaRef), iterCalled(false), getAllCalled(false), hasNext(false)
+                    env(env),
+                    javaRef(javaRef),
+                    batch(0),
+                    endReached(false),
+                    iterCalled(false),
+                    getAllCalled(false)
                 {
                     // No-op.
                 }
 
                 QueryCursorImpl::~QueryCursorImpl()
                 {
-                    // 1. Close the cursor.
+                    // 1. Releasing memory.
+                    delete batch;
+
+                    // 2. Close the cursor.
                     env.Get()->Context()->QueryCursorClose(javaRef);
 
-                    // 2. Release Java reference.
+                    // 3. Release Java reference.
                     JniContext::Release(javaRef);
                 }
 
-                bool QueryCursorImpl::HasNext(IgniteError* err)
+                bool QueryCursorImpl::HasNext(IgniteError& err)
                 {
                     // Check whether GetAll() was called earlier.
                     if (getAllCalled) 
                     {
-                        *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, 
+                        err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, 
                             "Cannot use HasNext() method because GetAll() was called.");
 
                         return false;
@@ -67,16 +78,21 @@ namespace ignite
                     // Create iterator in Java if needed.
                     if (!CreateIteratorIfNeeded(err))
                         return false;
-                    
-                    return hasNext;
+
+                    // Get next results batch if the end in the current batch
+                    // has been reached.
+                    if (!GetNextBatchIfNeeded(err))
+                        return false;
+
+                    return !endReached;
                 }
 
-                void QueryCursorImpl::GetNext(OutputOperation& op, IgniteError* err)
+                void QueryCursorImpl::GetNext(OutputOperation& op, IgniteError& err)
                 {
                     // Check whether GetAll() was called earlier.
                     if (getAllCalled) 
                     {
-                        *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, 
+                        err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, 
                             "Cannot use GetNext() method because GetAll() was called.");
 
                         return;
@@ -86,75 +102,52 @@ namespace ignite
                     if (!CreateIteratorIfNeeded(err))
                         return;
 
-                    if (hasNext)
-                    {
-                        JniErrorInfo jniErr;
-
-                        SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
-                        
-                        env.Get()->Context()->TargetOutStream(
-                            javaRef, OP_GET_SINGLE, inMem.Get()->PointerLong(), &jniErr);
-
-                        IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
-                        if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
-                        {
-                            InteropInputStream in(inMem.Get());
-
-                            binary::BinaryReaderImpl reader(&in);
-
-                            op.ProcessOutput(reader);
+                    // Get next results batch if the end in the current batch
+                    // has been reached.
+                    if (!GetNextBatchIfNeeded(err))
+                        return;
 
-                            hasNext = IteratorHasNext(err);
-                        }
-                    }
-                    else
+                    if (endReached)
                     {
                         // Ensure we do not overwrite possible previous error.
-                        if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
-                            *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, "No more elements available.");
+                        if (err.GetCode() == IgniteError::IGNITE_SUCCESS)
+                            err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, "No more elements available.");
+
+                        return;
                     }
+
+                    batch->GetNext(op);
                 }
 
-                QueryFieldsRowImpl* QueryCursorImpl::GetNextRow(IgniteError* err)
+                QueryFieldsRowImpl* QueryCursorImpl::GetNextRow(IgniteError& err)
                 {
                     // Create iterator in Java if needed.
                     if (!CreateIteratorIfNeeded(err))
-                        return NULL;
-
-                    if (hasNext)
-                    {
-                        JniErrorInfo jniErr;
-
-                        SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
+                        return 0;
 
-                        env.Get()->Context()->TargetOutStream(javaRef, OP_GET_SINGLE, inMem.Get()->PointerLong(), &jniErr);
+                    // Get next results batch if the end in the current batch
+                    // has been reached.
+                    if (!GetNextBatchIfNeeded(err))
+                        return 0;
 
-                        IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
-                        if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
-                        {
-                            hasNext = IteratorHasNext(err);
-
-                            return new QueryFieldsRowImpl(inMem);
-                        }
-                    }
-                    else
+                    if (endReached)
                     {
                         // Ensure we do not overwrite possible previous error.
-                        if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
-                            *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, "No more elements available.");
+                        if (err.GetCode() == IgniteError::IGNITE_SUCCESS)
+                            err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, "No more elements available.");
+
+                        return 0;
                     }
 
-                    return NULL;
+                    return batch->GetNextRow();
                 }
 
-                void QueryCursorImpl::GetAll(OutputOperation& op, IgniteError* err)
+                void QueryCursorImpl::GetAll(OutputOperation& op, IgniteError& err)
                 {
                     // Check whether any of iterator methods were called.
                     if (iterCalled)
                     {
-                        *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+                        err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
                             "Cannot use GetAll() method because an iteration method was called.");
 
                         return;
@@ -163,7 +156,7 @@ namespace ignite
                     // Check whether GetAll was called before.
                     if (getAllCalled)
                     {
-                        *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
+                        err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
                             "Cannot use GetNext() method because GetAll() was called.");
 
                         return;
@@ -176,7 +169,7 @@ namespace ignite
 
                     env.Get()->Context()->TargetOutStream(javaRef, OP_GET_ALL, inMem.Get()->PointerLong(), &jniErr);
 
-                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err);
 
                     if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
                     {
@@ -190,38 +183,71 @@ namespace ignite
                     }
                 }
 
-                bool QueryCursorImpl::CreateIteratorIfNeeded(IgniteError* err)
+                bool QueryCursorImpl::CreateIteratorIfNeeded(IgniteError& err)
                 {
-                    if (!iterCalled)
-                    {
-                        JniErrorInfo jniErr;
+                    if (iterCalled)
+                        return true;
 
-                        env.Get()->Context()->QueryCursorIterator(javaRef, &jniErr);
+                    JniErrorInfo jniErr;
 
-                        IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+                    env.Get()->Context()->QueryCursorIterator(javaRef, &jniErr);
 
-                        if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
-                        {
-                            iterCalled = true;
+                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err);
+
+                    if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+                        iterCalled = true;
+
+                    return iterCalled;
+                }
+
+                bool QueryCursorImpl::GetNextBatchIfNeeded(IgniteError& err)
+                {
+                    assert(iterCalled);
+
+                    if (endReached || (batch && batch->Left() > 0))
+                        return true;
+
+                    endReached = !IteratorHasNext(err);
+
+                    if (endReached)
+                        return true;
+
+                    JniErrorInfo jniErr;
+
+                    SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
+
+                    env.Get()->Context()->TargetOutStream(
+                        javaRef, OP_GET_BATCH, inMem.Get()->PointerLong(), &jniErr);
+
+                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err);
+
+                    if (jniErr.code != IGNITE_JNI_ERR_SUCCESS)
+                        return false;
+
+                    delete batch;
+
+                    // Needed for exception safety.
+                    batch = 0;
+
+                    batch = new QueryBatch(*env.Get(), inMem);
+
+                    endReached = batch->IsEmpty();
 
-                            hasNext = IteratorHasNext(err);
-                        }
-                        else
-                            return false;
-                    }
-                    
                     return true;
                 }
 
-                bool QueryCursorImpl::IteratorHasNext(IgniteError* err)
+                bool QueryCursorImpl::IteratorHasNext(IgniteError& err)
                 {
                     JniErrorInfo jniErr;
 
                     bool res = env.Get()->Context()->QueryCursorIteratorHasNext(javaRef, &jniErr);
 
-                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err);
+
+                    if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
+                        return res;
 
-                    return jniErr.code == IGNITE_JNI_ERR_SUCCESS && res;
+                    return false;
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e9c797fd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs
index d33fdce..d928418 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs
@@ -52,6 +52,9 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
         [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
         protected override T Read(BinaryReader reader)
         {
+            // Reading and skipping row size in bytes.
+            reader.ReadInt();
+
             int cnt = reader.ReadInt();
 
             return _readerFunc(reader, cnt);


[35/49] ignite git commit: IGNITE-3775: IGFS: Uncommented deadlock tests. This closes #1044.

Posted by sb...@apache.org.
IGNITE-3775: IGFS: Uncommented deadlock tests. This closes #1044.


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

Branch: refs/heads/ignite-comm-opts1
Commit: c85b7021270730e72369dd97aacc3c3dd017851d
Parents: e1c7937
Author: iveselovskiy <iv...@gridgain.com>
Authored: Thu Sep 8 15:10:11 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 8 15:10:11 2016 +0300

----------------------------------------------------------------------
 .../cache/GridCacheAbstractFullApiSelfTest.java |  2 +-
 .../processors/igfs/IgfsAbstractSelfTest.java   | 31 ++++++++++----------
 2 files changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c85b7021/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 3f4d812..a31c82e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -296,7 +296,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         for (int i = 0; i < gridCount(); i++) {
             Boolean clientMode = grid(i).configuration().isClientMode();
 
-            if (clientMode)
+            if (clientMode != null && clientMode) // Can be null in multi jvm tests.
                 continue;
 
             grid(0).services(grid(0).cluster()).deployNodeSingleton(SERVICE_NAME1, new DummyServiceImpl());

http://git-wip-us.apache.org/repos/asf/ignite/blob/c85b7021/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 c9b08d9..89979ad 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
@@ -2290,22 +2290,21 @@ public abstract class IgfsAbstractSelfTest extends IgfsAbstractBaseSelfTest {
     private void checkDeadlocksRepeat(final int lvlCnt, final int childrenDirPerLvl, final int childrenFilePerLvl,
         int primaryLvlCnt, int renCnt, int delCnt,
         int updateCnt, int mkdirsCnt, int createCnt) throws Exception {
-        // TODO: Enable.
-//        if (relaxedConsistency())
-//            return;
-//
-//        for (int i = 0; i < REPEAT_CNT; i++) {
-//            try {
-//                checkDeadlocks(lvlCnt, childrenDirPerLvl, childrenFilePerLvl, primaryLvlCnt, renCnt, delCnt,
-//                    updateCnt, mkdirsCnt, createCnt);
-//
-//                if (i % 10 == 0)
-//                    X.println(" - " + i);
-//            }
-//            finally {
-//                clear(igfs, igfsSecondary);
-//            }
-//        }
+        if (relaxedConsistency())
+            return;
+
+        for (int i = 0; i < REPEAT_CNT; i++) {
+            try {
+                checkDeadlocks(lvlCnt, childrenDirPerLvl, childrenFilePerLvl, primaryLvlCnt, renCnt, delCnt,
+                    updateCnt, mkdirsCnt, createCnt);
+
+                if (i % 10 == 0)
+                    X.println(" - " + i);
+            }
+            finally {
+                clear(igfs, igfsSecondary);
+            }
+        }
     }
 
     /**


[16/49] ignite git commit: IGNITE-3817: Fixed binary object re-build with missing schema.

Posted by sb...@apache.org.
IGNITE-3817: Fixed binary object re-build with missing schema.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 42963e6c99e9b282972e6ad67a813a8038cf580f
Parents: 40d4b6a
Author: Alexander Paschenko <ap...@gridgain.com>
Authored: Mon Sep 5 14:10:39 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 14:10:39 2016 +0300

----------------------------------------------------------------------
 .../binary/builder/BinaryObjectBuilderImpl.java       |  2 +-
 .../binary/BinaryObjectBuilderAdditionalSelfTest.java | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/42963e6c/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index 16c51b0..086da5c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -199,7 +199,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
 
             Map<String, Integer> fieldsMeta = null;
 
-            if (reader != null) {
+            if (reader != null && BinaryUtils.hasSchema(flags)) {
                 BinarySchema schema = reader.schema();
 
                 Map<Integer, Object> assignedFldsById;

http://git-wip-us.apache.org/repos/asf/ignite/blob/42963e6c/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
index f999ad3..24806cb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
@@ -56,6 +56,7 @@ import org.apache.ignite.internal.binary.builder.BinaryBuilderEnum;
 import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
 import org.apache.ignite.internal.binary.mutabletest.GridBinaryMarshalerAwareTestClass;
 import org.apache.ignite.internal.binary.mutabletest.GridBinaryTestClasses;
+import org.apache.ignite.internal.binary.test.GridBinaryTestClass2;
 import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
 import org.apache.ignite.internal.processors.cache.binary.IgniteBinaryImpl;
 import org.apache.ignite.internal.util.lang.GridMapEntry;
@@ -1389,6 +1390,19 @@ public class BinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstractTes
     }
 
     /**
+     * Ensure that object w/o schema can be re-built.
+     */
+    public void testBuildFromObjectWithoutSchema() {
+        BinaryObjectBuilderImpl binBuilder = wrap(new GridBinaryTestClass2());
+
+        BinaryObject binObj = binBuilder.build();
+
+        BinaryObjectBuilderImpl binBuilder2 = wrap(binObj);
+
+        binBuilder2.build();
+    }
+
+    /**
      * @param obj Object.
      * @return Object in binary format.
      */


[23/49] ignite git commit: IGNITE-3628: ODBC: Added ability to configure page size in DSN, changed default value from 32 to 1024. This closes #1014.

Posted by sb...@apache.org.
IGNITE-3628: ODBC: Added ability to configure page size in DSN, changed default value from 32 to 1024. This closes #1014.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 8970b3e3a36b18274b451fddf365627ba23459d6
Parents: 3550829
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Sep 5 18:15:11 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 18:15:11 2016 +0300

----------------------------------------------------------------------
 .../cpp/common/include/ignite/ignite_error.h    |  2 +-
 .../platforms/cpp/common/src/ignite_error.cpp   |  2 +-
 .../cpp/odbc-test/src/configuration_test.cpp    | 14 ++++-
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  2 +-
 .../include/ignite/odbc/config/configuration.h  | 59 ++++++++++++++++----
 .../cpp/odbc/include/ignite/odbc/result_page.h  |  3 -
 .../odbc/system/ui/dsn_configuration_window.h   |  8 +++
 .../src/system/ui/dsn_configuration_window.cpp  | 29 ++++++++--
 .../cpp/odbc/src/config/configuration.cpp       | 32 +++--------
 modules/platforms/cpp/odbc/src/dsn_config.cpp   | 12 +++-
 .../platforms/cpp/odbc/src/query/data_query.cpp |  2 +-
 11 files changed, 113 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/common/include/ignite/ignite_error.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/ignite_error.h b/modules/platforms/cpp/common/include/ignite/ignite_error.h
index 4c0e263..a41a42f 100644
--- a/modules/platforms/cpp/common/include/ignite/ignite_error.h
+++ b/modules/platforms/cpp/common/include/ignite/ignite_error.h
@@ -199,7 +199,7 @@ namespace ignite
          *
          * @param err Error.
          */
-        static void ThrowIfNeeded(IgniteError& err);
+        static void ThrowIfNeeded(const IgniteError& err);
 
         /**
          * Default constructor.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/common/src/ignite_error.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/ignite_error.cpp b/modules/platforms/cpp/common/src/ignite_error.cpp
index 5acbed2..8179184 100644
--- a/modules/platforms/cpp/common/src/ignite_error.cpp
+++ b/modules/platforms/cpp/common/src/ignite_error.cpp
@@ -24,7 +24,7 @@ using namespace ignite::java;
 
 namespace ignite
 {
-    void IgniteError::ThrowIfNeeded(IgniteError& err)
+    void IgniteError::ThrowIfNeeded(const IgniteError& err)
     {
         if (err.code != IGNITE_SUCCESS)
             throw err;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
index 0fd3277..bfdb220 100644
--- a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
@@ -37,6 +37,7 @@ namespace
     const uint16_t testServerPort = 4242;
     const std::string testCacheName = "TestCache";
     const std::string testDsn = "Ignite DSN";
+    const int32_t testPageSize = 4321;
 
     const std::string testAddress = testServerHost + ':' + ignite::common::LexicalCast<std::string>(testServerPort);
 }
@@ -76,12 +77,14 @@ void CheckConnectionConfig(const Configuration& cfg)
     BOOST_CHECK_EQUAL(cfg.GetAddress(), testAddress);
     BOOST_CHECK_EQUAL(cfg.GetCache(), testCacheName);
     BOOST_CHECK_EQUAL(cfg.GetDsn(), std::string());
+    BOOST_CHECK_EQUAL(cfg.GetPageSize(), testPageSize);
 
     std::stringstream constructor;
 
     constructor << "address=" << testAddress << ';'
                 << "cache=" << testCacheName << ';'
-                << "driver={" << testDriverName << "};";
+                << "driver={" << testDriverName << "};"
+                << "page_size=" << testPageSize << ';';
 
     const std::string& expectedStr = constructor.str();
 
@@ -96,6 +99,7 @@ void CheckDsnConfig(const Configuration& cfg)
     BOOST_CHECK_EQUAL(cfg.GetAddress(), Configuration::DefaultValue::address);
     BOOST_CHECK_EQUAL(cfg.GetHost(), std::string());
     BOOST_CHECK_EQUAL(cfg.GetTcpPort(), Configuration::DefaultValue::port);
+    BOOST_CHECK_EQUAL(cfg.GetPageSize(), Configuration::DefaultValue::pageSize);
 }
 
 BOOST_AUTO_TEST_SUITE(ConfigurationTestSuite)
@@ -107,6 +111,7 @@ BOOST_AUTO_TEST_CASE(CheckTestValuesNotEquealDefault)
     BOOST_CHECK_NE(testServerPort, Configuration::DefaultValue::port);
     BOOST_CHECK_NE(testCacheName, Configuration::DefaultValue::cache);
     BOOST_CHECK_NE(testDsn, Configuration::DefaultValue::dsn);
+    BOOST_CHECK_NE(testPageSize, Configuration::DefaultValue::pageSize);
 }
 
 BOOST_AUTO_TEST_CASE(TestConnectStringUppercase)
@@ -117,7 +122,8 @@ BOOST_AUTO_TEST_CASE(TestConnectStringUppercase)
 
     constructor << "DRIVER={" << testDriverName << "};"
                 << "ADDRESS=" << testAddress << ';'
-                << "CACHE=" << testCacheName;
+                << "CACHE=" << testCacheName << ';'
+                << "PAGE_SIZE=" << testPageSize;
 
     const std::string& connectStr = constructor.str();
 
@@ -134,6 +140,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringLowercase)
 
     constructor << "driver={" << testDriverName << "};"
                 << "address=" << testAddress << ';'
+                << "page_size=" << testPageSize << ';'
                 << "cache=" << testCacheName << ';';
 
     const std::string& connectStr = constructor.str();
@@ -151,6 +158,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringZeroTerminated)
 
     constructor << "driver={" << testDriverName << "};"
                 << "address=" << testAddress << ';'
+                << "page_size=" << testPageSize << ';'
                 << "cache=" << testCacheName << ';';
 
     const std::string& connectStr = constructor.str();
@@ -168,6 +176,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringMixed)
 
     constructor << "Driver={" << testDriverName << "};"
                 << "Address=" << testAddress << ';'
+                << "Page_Size=" << testPageSize << ';'
                 << "Cache=" << testCacheName << ';';
 
     const std::string& connectStr = constructor.str();
@@ -185,6 +194,7 @@ BOOST_AUTO_TEST_CASE(TestConnectStringWhitepaces)
 
     constructor << "DRIVER = {" << testDriverName << "} ;\n"
                 << " ADDRESS =" << testAddress << "; "
+                << "   PAGE_SIZE= " << testPageSize << ';'
                 << "CACHE = \n\r" << testCacheName << ';';
 
     const std::string& connectStr = constructor.str();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
index e9a8fc5..29d1d18 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
@@ -131,7 +131,7 @@ namespace ignite
             BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 
         ret = SQLFetch(stmt);
-        BOOST_CHECK(ret == SQL_NO_DATA) ;
+        BOOST_CHECK(ret == SQL_NO_DATA);
     }
 
     template<>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
index f90fa2d..b5f385e 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
@@ -64,6 +64,9 @@ namespace ignite
 
                     /** Connection attribute keyword for protocol version attribute. */
                     static const std::string protocolVersion;
+
+                    /** Connection attribute keyword for fetch results page size attribute. */
+                    static const std::string pageSize;
                 };
 
                 /** Default values for configuration. */
@@ -89,6 +92,9 @@ namespace ignite
 
                     /** Default value for port attribute. */
                     static const uint16_t port;
+
+                    /** Default value for fetch results page size attribute. */
+                    static const int32_t pageSize;
                 };
 
                 /**
@@ -126,7 +132,10 @@ namespace ignite
                  *
                  * @param str Connect string.
                  */
-                void FillFromConnectString(const std::string& str);
+                void FillFromConnectString(const std::string& str)
+                {
+                    FillFromConnectString(str.data(), str.size());
+                }
 
                 /**
                  * Convert configure to connect string.
@@ -158,7 +167,10 @@ namespace ignite
                  *
                  * @param port Server port.
                  */
-                void SetTcpPort(uint16_t port);
+                void SetTcpPort(uint16_t port)
+                {
+                    arguments[Key::port] = common::LexicalCast<std::string>(port);
+                }
 
                 /**
                  * Get DSN.
@@ -251,28 +263,51 @@ namespace ignite
                 }
 
                 /**
-                 * Get argument map.
+                 * Get protocol version.
                  *
-                 * @return Argument map.
+                 * @return Protocol version.
                  */
-                const ArgumentMap& GetMap() const
+                ProtocolVersion GetProtocolVersion() const;
+
+                /**
+                 * Set protocol version.
+                 *
+                 * @param version Version to set.
+                 */
+                void SetProtocolVersion(const std::string& version)
                 {
-                    return arguments;
+                    arguments[Key::protocolVersion] = version;
                 }
 
                 /**
-                 * Get protocol version.
+                 * Get fetch results page size.
                  *
-                 * @return Protocol version.
+                 * @return Fetch results page size.
                  */
-                ProtocolVersion GetProtocolVersion() const;
+                int32_t GetPageSize() const
+                {
+                    return static_cast<int32_t>(GetIntValue(Key::pageSize, DefaultValue::pageSize));
+                }
 
                 /**
-                 * Set protocol version.
+                 * Set fetch results page size.
                  *
-                 * @param version Version to set.
+                 * @param size Fetch results page size.
                  */
-                void SetProtocolVersion(const std::string& version);
+                void SetPageSize(int32_t size)
+                {
+                    arguments[Key::pageSize] = common::LexicalCast<std::string>(size);
+                }
+
+                /**
+                 * Get argument map.
+                 *
+                 * @return Argument map.
+                 */
+                const ArgumentMap& GetMap() const
+                {
+                    return arguments;
+                }
 
                 /**
                  * Get string value from the config.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc/include/ignite/odbc/result_page.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/result_page.h b/modules/platforms/cpp/odbc/include/ignite/odbc/result_page.h
index 3533229..c175487 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/result_page.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/result_page.h
@@ -37,9 +37,6 @@ namespace ignite
             enum { DEFAULT_ALLOCATED_MEMORY = 1024 };
 
         public:
-            // Default result page size.
-            enum { DEFAULT_SIZE = 32 };
-
             /**
              * Constructor.
              */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h b/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
index 034de82..f034a8b 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
@@ -46,6 +46,8 @@ namespace ignite
                         ID_ADDRESS_LABEL,
                         ID_CACHE_EDIT,
                         ID_CACHE_LABEL,
+                        ID_PAGE_SIZE_EDIT,
+                        ID_PAGE_SIZE_LABEL,
                         ID_OK_BUTTON,
                         ID_CANCEL_BUTTON
                     };
@@ -116,6 +118,12 @@ namespace ignite
                     /** DSN cache edit field. */
                     std::auto_ptr<Window> cacheEdit;
 
+                    /** DSN fetch page size edit field label. */
+                    std::auto_ptr<Window> pageSizeLabel;
+
+                    /** DSN fetch page size edit field. */
+                    std::auto_ptr<Window> pageSizeEdit;
+
                     /** Ok button. */
                     std::auto_ptr<Window> okButton;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
index 76132bd..49f87d8 100644
--- a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
@@ -30,7 +30,7 @@ namespace ignite
                 DsnConfigurationWindow::DsnConfigurationWindow(Window* parent, config::Configuration& config):
                     CustomWindow(parent, "IgniteConfigureDsn", "Configure Apache Ignite DSN"),
                     width(360),
-                    height(160),
+                    height(200),
                     connectionSettingsGroupBox(),
                     nameLabel(),
                     nameEdit(),
@@ -38,6 +38,8 @@ namespace ignite
                     addressEdit(),
                     cacheLabel(),
                     cacheEdit(),
+                    pageSizeLabel(),
+                    pageSizeEdit(),
                     okButton(),
                     cancelButton(),
                     config(config),
@@ -111,6 +113,16 @@ namespace ignite
                     cacheLabel = CreateLabel(labelPosX, rowPos, labelSizeX, rowSize, "Cache name:", ID_CACHE_LABEL);
                     cacheEdit = CreateEdit(editPosX, rowPos, editSizeX, rowSize, val, ID_CACHE_EDIT);
 
+                    rowPos += interval + rowSize;
+
+                    std::string tmp = common::LexicalCast<std::string>(config.GetPageSize());
+                    val = tmp.c_str();
+                    pageSizeLabel = CreateLabel(labelPosX, rowPos, labelSizeX,
+                        rowSize, "Page size:", ID_PAGE_SIZE_LABEL);
+
+                    pageSizeEdit = CreateEdit(editPosX, rowPos, editSizeX, 
+                        rowSize, val, ID_PAGE_SIZE_EDIT, ES_NUMBER);
+
                     rowPos += interval * 2 + rowSize;
 
                     connectionSettingsGroupBox = CreateGroupBox(margin, sectionBegin, width - 2 * margin,
@@ -186,18 +198,26 @@ namespace ignite
                     std::string dsn;
                     std::string address;
                     std::string cache;
+                    std::string pageSizeStr;
 
                     nameEdit->GetText(dsn);
                     addressEdit->GetText(address);
                     cacheEdit->GetText(cache);
+                    pageSizeEdit->GetText(pageSizeStr);
+
+                    int32_t pageSize = common::LexicalCast<int32_t>(pageSizeStr);
+
+                    if (pageSize <= 0)
+                        pageSize = config.GetPageSize();
 
                     common::StripSurroundingWhitespaces(address);
                     common::StripSurroundingWhitespaces(dsn);
 
                     LOG_MSG("Retriving arguments:\n");
-                    LOG_MSG("DSN:                %s\n", dsn.c_str());
-                    LOG_MSG("Address:            %s\n", address.c_str());
-                    LOG_MSG("Cache:              %s\n", cache.c_str());
+                    LOG_MSG("DSN:        %s\n", dsn.c_str());
+                    LOG_MSG("Address:    %s\n", address.c_str());
+                    LOG_MSG("Cache:      %s\n", cache.c_str());
+                    LOG_MSG("Page size:  %d\n", pageSize);
 
                     if (dsn.empty())
                         throw IgniteError(IgniteError::IGNITE_ERR_GENERIC, "DSN name can not be empty.");
@@ -205,6 +225,7 @@ namespace ignite
                     cfg.SetDsn(dsn);
                     cfg.SetAddress(address);
                     cfg.SetCache(cache);
+                    cfg.SetPageSize(pageSize);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc/src/config/configuration.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/configuration.cpp b/modules/platforms/cpp/odbc/src/config/configuration.cpp
index f40c74f..74ccaaf 100644
--- a/modules/platforms/cpp/odbc/src/config/configuration.cpp
+++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp
@@ -39,18 +39,19 @@ namespace ignite
             const std::string Configuration::Key::server            = "server";
             const std::string Configuration::Key::port              = "port";
             const std::string Configuration::Key::protocolVersion   = "protocol_version";
+            const std::string Configuration::Key::pageSize          = "page_size";
 
-            const std::string Configuration::DefaultValue::dsn             = "Apache Ignite DSN";
-            const std::string Configuration::DefaultValue::driver          = "Apache Ignite";
-            const std::string Configuration::DefaultValue::cache           = "";
-            const std::string Configuration::DefaultValue::address         = "";
-            const std::string Configuration::DefaultValue::server          = "";
+            const std::string Configuration::DefaultValue::dsn      = "Apache Ignite DSN";
+            const std::string Configuration::DefaultValue::driver   = "Apache Ignite";
+            const std::string Configuration::DefaultValue::cache    = "";
+            const std::string Configuration::DefaultValue::address  = "";
+            const std::string Configuration::DefaultValue::server   = "";
 
-            const uint16_t Configuration::DefaultValue::port = 10800;
+            const uint16_t Configuration::DefaultValue::port    = 10800;
+            const int32_t Configuration::DefaultValue::pageSize = 1024;
 
             const ProtocolVersion& Configuration::DefaultValue::protocolVersion = ProtocolVersion::GetCurrent();
 
-
             Configuration::Configuration() :
                 arguments()
             {
@@ -91,11 +92,6 @@ namespace ignite
                 }
             }
 
-            void Configuration::FillFromConnectString(const std::string& str)
-            {
-                FillFromConnectString(str.data(), str.size());
-            }
-
             std::string Configuration::ToConnectString() const
             {
                 std::stringstream connect_string_buffer;
@@ -145,11 +141,6 @@ namespace ignite
                 }
             }
 
-            void Configuration::SetTcpPort(uint16_t port)
-            {
-                arguments[Key::port] = common::LexicalCast<std::string>(port);
-            }
-
             ProtocolVersion Configuration::GetProtocolVersion() const
             {
                 ArgumentMap::const_iterator it = arguments.find(Key::protocolVersion);
@@ -160,11 +151,6 @@ namespace ignite
                 return DefaultValue::protocolVersion;
             }
 
-            void Configuration::SetProtocolVersion(const std::string& version)
-            {
-                arguments[Key::protocolVersion] = version;
-            }
-
             const std::string& Configuration::GetStringValue(const std::string& key, const std::string& dflt) const
             {
                 ArgumentMap::const_iterator it = arguments.find(common::ToLower(key));
@@ -193,8 +179,6 @@ namespace ignite
                 return dflt;
             }
 
-
-
             void Configuration::ParseAttributeList(const char * str, size_t len, char delimeter, ArgumentMap & args)
             {
                 std::string connect_str(str, len);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc/src/dsn_config.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/dsn_config.cpp b/modules/platforms/cpp/odbc/src/dsn_config.cpp
index 99635dc..356bcaa 100644
--- a/modules/platforms/cpp/odbc/src/dsn_config.cpp
+++ b/modules/platforms/cpp/odbc/src/dsn_config.cpp
@@ -91,21 +91,27 @@ namespace ignite
         void ReadDsnConfiguration(const char* dsn, Configuration& config)
         {
             std::string address = ReadDsnString(dsn, Configuration::Key::address, config.GetAddress().c_str());
+
             std::string server = ReadDsnString(dsn, Configuration::Key::server, config.GetHost().c_str());
+
             uint16_t port = ReadDsnInt(dsn, Configuration::Key::port, config.GetTcpPort());
+
             std::string cache = ReadDsnString(dsn, Configuration::Key::cache, config.GetCache().c_str());
+
             std::string version = ReadDsnString(dsn, Configuration::Key::protocolVersion,
                 config.GetProtocolVersion().ToString().c_str());
 
-            LOG_MSG("%d\n", __LINE__);
+            int32_t pageSize = ReadDsnInt(dsn, Configuration::Key::pageSize, config.GetPageSize());
+
+            if (pageSize <= 0)
+                pageSize = config.GetPageSize();
 
             config.SetAddress(address);
             config.SetHost(server);
             config.SetTcpPort(port);
             config.SetCache(cache);
             config.SetProtocolVersion(version);
-
-            LOG_MSG("%d\n", __LINE__);
+            config.SetPageSize(pageSize);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8970b3e3/modules/platforms/cpp/odbc/src/query/data_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/data_query.cpp b/modules/platforms/cpp/odbc/src/query/data_query.cpp
index 183bbb5..7a25ccb 100644
--- a/modules/platforms/cpp/odbc/src/query/data_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/data_query.cpp
@@ -241,7 +241,7 @@ namespace ignite
             {
                 std::auto_ptr<ResultPage> resultPage(new ResultPage());
 
-                QueryFetchRequest req(cursor->GetQueryId(), ResultPage::DEFAULT_SIZE);
+                QueryFetchRequest req(cursor->GetQueryId(), connection.GetConfiguration().GetPageSize());
                 QueryFetchResponse rsp(*resultPage);
 
                 try


[33/49] ignite git commit: IGNITE-3853 IGFS: Support direct PROXY mode invocation in method: update. This closes #1041.

Posted by sb...@apache.org.
IGNITE-3853 IGFS: Support direct PROXY mode invocation in method: update. This closes #1041.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 9389328afdad8478b16f124f16cb45dde6c33aaf
Parents: 216477e
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Sep 7 17:35:45 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 17:35:45 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsImpl.java      | 52 +++++++++++++-------
 1 file changed, 33 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9389328a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 439e9ba..27618be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -628,36 +628,50 @@ public final class IgfsImpl implements IgfsEx {
 
                 IgfsMode mode = resolveMode(path);
 
-                if (mode != PRIMARY) {
-                    assert IgfsUtils.isDualMode(mode);
+                switch (mode) {
+                    case PRIMARY:
+                    {
+                        List<IgniteUuid> fileIds = meta.idsForPath(path);
 
-                    await(path);
+                        IgniteUuid fileId = fileIds.get(fileIds.size() - 1);
 
-                    IgfsEntryInfo info = meta.updateDual(secondaryFs, path, props);
+                        if (fileId != null) {
+                            IgfsEntryInfo info = meta.updateProperties(fileId, props);
 
-                    if (info == null)
-                        return null;
+                            if (info != null) {
+                                if (evts.isRecordable(EVT_IGFS_META_UPDATED))
+                                    evts.record(new IgfsEvent(path, localNode(), EVT_IGFS_META_UPDATED, props));
 
-                    return new IgfsFileImpl(path, info, data.groupBlockSize());
-                }
+                                return new IgfsFileImpl(path, info, data.groupBlockSize());
+                            }
+                        }
 
-                List<IgniteUuid> fileIds = meta.idsForPath(path);
+                        break;
+                    }
 
-                IgniteUuid fileId = fileIds.get(fileIds.size() - 1);
+                    case DUAL_ASYNC:
+                    case DUAL_SYNC:
+                    {
+                        await(path);
 
-                if (fileId == null)
-                    return null;
+                        IgfsEntryInfo info = meta.updateDual(secondaryFs, path, props);
 
-                IgfsEntryInfo info = meta.updateProperties(fileId, props);
+                        if (info != null)
+                            return new IgfsFileImpl(path, info, data.groupBlockSize());
 
-                if (info != null) {
-                    if (evts.isRecordable(EVT_IGFS_META_UPDATED))
-                        evts.record(new IgfsEvent(path, localNode(), EVT_IGFS_META_UPDATED, props));
+                        break;
+                    }
+
+                    default:
+                        assert mode == PROXY : "Unknown mode: " + mode;
 
-                    return new IgfsFileImpl(path, info, data.groupBlockSize());
+                        IgfsFile file = secondaryFs.update(path, props);
+
+                        if (file != null)
+                            return new IgfsFileImpl(secondaryFs.update(path, props), data.groupBlockSize());
                 }
-                else
-                    return null;
+
+                return null;
             }
         });
     }


[05/49] ignite git commit: Merge remote-tracking branch 'upstream/ignite-1.6.7' into ignite-1.6.7

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


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

Branch: refs/heads/ignite-comm-opts1
Commit: 7bb961fd0a2e78334d33b6bc279c4edc323c246a
Parents: 7a84ab6 ae77653
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 2 18:05:54 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 2 18:05:54 2016 +0300

----------------------------------------------------------------------
 .../store/jdbc/dialect/SQLServerDialect.java    |   2 +-
 .../internal/binary/BinaryMarshaller.java       |   7 +
 .../processors/cache/IgniteCacheProxy.java      |  41 ++
 .../cache/query/GridCacheSqlQuery.java          |  11 +-
 .../processors/odbc/OdbcHandshakeRequest.java   |   8 +-
 .../processors/odbc/OdbcHandshakeResult.java    |  17 +-
 .../processors/odbc/OdbcMessageParser.java      |  22 +-
 .../processors/odbc/OdbcProtocolVersion.java    | 106 +++++
 .../processors/odbc/OdbcRequestHandler.java     |  17 +-
 .../GridCacheQueryTransformerSelfTest.java      |   9 +-
 .../query/h2/opt/GridH2ValueCacheObject.java    |   9 -
 ...niteBinaryObjectLocalQueryArgumentsTest.java |  28 ++
 ...aryObjectQueryArgumentsOffheapLocalTest.java |  28 ++
 ...teBinaryObjectQueryArgumentsOffheapTest.java |  30 ++
 .../IgniteBinaryObjectQueryArgumentsTest.java   | 469 ++++++++++++++++++-
 .../query/h2/sql/GridQueryParsingTest.java      |   2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   9 +
 .../cpp/common/include/ignite/common/utils.h    |  25 +
 .../cpp/common/os/win/src/common/utils.cpp      |  20 +
 modules/platforms/cpp/odbc-test/Makefile.am     |   1 +
 .../odbc-test/config/queries-test-noodbc.xml    | 103 ++++
 .../cpp/odbc-test/config/queries-test.xml       |  31 +-
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   2 +
 .../project/vs/odbc-test.vcxproj.filters        |   6 +
 .../cpp/odbc-test/src/configuration_test.cpp    | 156 ++++--
 .../cpp/odbc-test/src/queries_test.cpp          | 122 +++--
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  14 +-
 modules/platforms/cpp/odbc/Makefile.am          |   2 +
 modules/platforms/cpp/odbc/include/Makefile.am  |   2 +
 .../cpp/odbc/include/ignite/odbc/common_types.h |   3 +
 .../include/ignite/odbc/config/configuration.h  | 207 +++++++-
 .../cpp/odbc/include/ignite/odbc/connection.h   |  47 +-
 .../ignite/odbc/diagnostic/diagnostic_record.h  |   2 +-
 .../cpp/odbc/include/ignite/odbc/dsn_config.h   |  61 +++
 .../cpp/odbc/include/ignite/odbc/parser.h       |   3 -
 .../odbc/include/ignite/odbc/protocol_version.h | 168 +++++++
 .../include/ignite/odbc/system/odbc_constants.h |   4 -
 .../odbc/system/ui/dsn_configuration_window.h   | 136 ++++++
 .../ignite/odbc/system/ui/custom_window.h       | 189 ++++++++
 .../win/include/ignite/odbc/system/ui/window.h  | 201 ++++++++
 .../odbc/os/win/src/system/ui/custom_window.cpp | 184 ++++++++
 .../src/system/ui/dsn_configuration_window.cpp  | 212 +++++++++
 .../cpp/odbc/os/win/src/system/ui/window.cpp    | 192 ++++++++
 .../cpp/odbc/os/win/src/system_dsn.cpp          | 218 +++++++++
 .../platforms/cpp/odbc/project/vs/odbc.vcxproj  |  27 +-
 .../cpp/odbc/project/vs/odbc.vcxproj.filters    |  36 ++
 .../cpp/odbc/src/config/configuration.cpp       | 266 ++++++-----
 modules/platforms/cpp/odbc/src/connection.cpp   |  66 ++-
 .../odbc/src/diagnostic/diagnostic_record.cpp   |   8 +-
 .../diagnostic/diagnostic_record_storage.cpp    |   2 +-
 modules/platforms/cpp/odbc/src/dsn_config.cpp   | 111 +++++
 modules/platforms/cpp/odbc/src/entry_points.cpp |   8 -
 modules/platforms/cpp/odbc/src/odbc.cpp         |  83 +---
 .../platforms/cpp/odbc/src/protocol_version.cpp | 131 ++++++
 .../commands/cache/VisorCacheStopCommand.scala  |   5 +-
 55 files changed, 3435 insertions(+), 434 deletions(-)
----------------------------------------------------------------------



[32/49] ignite git commit: IGNITE-3852 IGFS: Support direct PROXY mode invocation in method: info. This closes #1040.

Posted by sb...@apache.org.
IGNITE-3852 IGFS: Support direct PROXY mode invocation in method: info. This closes #1040.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 216477e5a9badc09133a7fe1f545e048a23a8218
Parents: 88d027d
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Sep 7 17:30:48 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 17:30:48 2016 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/processors/igfs/IgfsImpl.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/216477e5/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 642352e..439e9ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -1526,7 +1526,14 @@ public final class IgfsImpl implements IgfsEx {
                 break;
 
             default:
-                assert false : "Unknown mode: " + mode;
+                assert mode == PROXY : "Unknown mode: " + mode;
+
+                IgfsFile status = secondaryFs.info(path);
+
+                if (status != null)
+                    return new IgfsFileImpl(status, data.groupBlockSize());
+                else
+                    return null;
         }
 
         if (info == null)


[36/49] ignite git commit: IGNITE-3855: IGFS: Support direct PROXY mode invocation in method: delete. This closes #1046.

Posted by sb...@apache.org.
IGNITE-3855: IGFS: Support direct PROXY mode invocation in method: delete. This closes #1046.


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

Branch: refs/heads/ignite-comm-opts1
Commit: b3bdca7ad9b394fba0f263990bd762ba04aef80b
Parents: c85b702
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Thu Sep 8 15:13:31 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 8 15:13:31 2016 +0300

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


http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bdca7a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 12d2830..fd32745 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -754,7 +754,10 @@ public final class IgfsImpl implements IgfsEx {
 
                 IgfsMode mode = resolveMode(path);
 
-                boolean dual = IgfsUtils.isDualMode(mode);;
+                if (mode == PROXY)
+                    return secondaryFs.delete(path, recursive);
+
+                boolean dual = IgfsUtils.isDualMode(mode);
 
                 if (dual)
                     await(path);


[03/49] ignite git commit: IGNITE-2208 - Queries with object arguments doesn't work wth BinaryMarshaller.

Posted by sb...@apache.org.
IGNITE-2208 - Queries with object arguments doesn't work wth BinaryMarshaller.


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

Branch: refs/heads/ignite-comm-opts1
Commit: ae7765329fd6f7d50d13183d13626f39c5682334
Parents: 12f5329
Author: dkarachentsev <dk...@gridgain.com>
Authored: Fri Sep 2 18:01:12 2016 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Fri Sep 2 18:01:12 2016 +0300

----------------------------------------------------------------------
 .../internal/binary/BinaryMarshaller.java       |   7 +
 .../processors/cache/IgniteCacheProxy.java      |  41 ++
 .../cache/query/GridCacheSqlQuery.java          |  11 +-
 .../GridCacheQueryTransformerSelfTest.java      |   9 +-
 .../query/h2/opt/GridH2ValueCacheObject.java    |   9 -
 ...niteBinaryObjectLocalQueryArgumentsTest.java |  28 ++
 ...aryObjectQueryArgumentsOffheapLocalTest.java |  28 ++
 ...teBinaryObjectQueryArgumentsOffheapTest.java |  30 ++
 .../IgniteBinaryObjectQueryArgumentsTest.java   | 469 ++++++++++++++++++-
 .../query/h2/sql/GridQueryParsingTest.java      |   4 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   9 +
 11 files changed, 610 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java
index 29a1fca..39015e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMarshaller.java
@@ -136,4 +136,11 @@ public class BinaryMarshaller extends AbstractMarshaller {
     @Override public void onUndeploy(ClassLoader ldr) {
         impl.context().onUndeploy(ldr);
     }
+
+    /**
+     * @return GridBinaryMarshaller instance.
+     */
+    public GridBinaryMarshaller binaryMarshaller() {
+        return impl;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 9b26c1d..8b2e605 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -63,6 +63,7 @@ import org.apache.ignite.internal.AsyncSupportAdapter;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.binary.BinaryUtils;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.query.CacheQuery;
 import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
@@ -688,6 +689,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
 
             validate(qry);
 
+            convertToBinary(qry);
+
             final CacheOperationContext opCtxCall = ctx.operationContextPerCall();
 
             if (qry instanceof ContinuousQuery)
@@ -764,6 +767,44 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
     }
 
     /**
+     * Convert query arguments to BinaryObjects if binary marshaller used.
+     *
+     * @param qry Query.
+     */
+    private void convertToBinary(final Query qry) {
+        if (ctx.binaryMarshaller()) {
+            if (qry instanceof SqlQuery) {
+                final SqlQuery sqlQry = (SqlQuery) qry;
+
+                convertToBinary(sqlQry.getArgs());
+            } else if (qry instanceof SpiQuery) {
+                final SpiQuery spiQry = (SpiQuery) qry;
+
+                convertToBinary(spiQry.getArgs());
+            } else if (qry instanceof SqlFieldsQuery) {
+                final SqlFieldsQuery fieldsQry = (SqlFieldsQuery) qry;
+
+                convertToBinary(fieldsQry.getArgs());
+            }
+        }
+    }
+
+    /**
+     * Converts query arguments to BinaryObjects if binary marshaller used.
+     *
+     * @param args Arguments.
+     */
+    private void convertToBinary(final Object[] args) {
+        if (args == null)
+            return;
+
+        for (int i = 0; i < args.length; i++) {
+            if (args[i] != null && !BinaryUtils.isBinaryType(args[i].getClass()))
+                args[i] = ctx.toCacheObject(args[i]);
+        }
+    }
+
+    /**
      * @return {@code true} If this is a replicated cache and we are on a data node.
      */
     private boolean isReplicatedDataNode() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index 0733827..bcb37c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
@@ -153,7 +154,13 @@ public class GridCacheSqlQuery implements Message {
 
         assert paramsBytes != null;
 
-        params = m.unmarshal(paramsBytes, U.resolveClassLoader(ctx.config()));
+        final ClassLoader ldr = U.resolveClassLoader(ctx.config());
+
+        if (m instanceof BinaryMarshaller)
+            // To avoid deserializing of enum types.
+            params = ((BinaryMarshaller)m).binaryMarshaller().unmarshal(paramsBytes, ldr);
+        else
+            params = m.unmarshal(paramsBytes, ldr);
     }
 
     /** {@inheritDoc} */
@@ -271,4 +278,4 @@ public class GridCacheSqlQuery implements Message {
 
         return cp;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java
index 6b13e05..e7e173b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java
@@ -66,9 +66,14 @@ public class GridCacheQueryTransformerSelfTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3);
 
-        Ignition.setClientMode(true);
+        try {
+            Ignition.setClientMode(true);
 
-        startGrid();
+            startGrid();
+        }
+        finally {
+            Ignition.setClientMode(false);
+        }
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
index 29f9675..fd0e6ed 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
@@ -21,8 +21,6 @@ import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Types;
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.internal.binary.BinaryEnumObjectImpl;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -146,13 +144,6 @@ public class GridH2ValueCacheObject extends Value {
             return c1.compareTo(o2);
         }
 
-        if (o1 instanceof BinaryEnumObjectImpl && o2 instanceof Enum) {
-            final BinaryEnumObjectImpl bo1 = (BinaryEnumObjectImpl)o1;
-
-            if (bo1.isTypeEquals(o2.getClass()))
-                return Integer.compare(bo1.enumOrdinal(), ((Enum)o2).ordinal());
-        }
-
         // Group by types.
         if (o1.getClass() != o2.getClass()) {
             if (o1Comparable != o2Comparable)

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectLocalQueryArgumentsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectLocalQueryArgumentsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectLocalQueryArgumentsTest.java
new file mode 100644
index 0000000..7e35e51
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectLocalQueryArgumentsTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectLocalQueryArgumentsTest extends IgniteBinaryObjectQueryArgumentsTest {
+    /** {@inheritDoc} */
+    @Override protected boolean isLocal() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsOffheapLocalTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsOffheapLocalTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsOffheapLocalTest.java
new file mode 100644
index 0000000..560d258
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsOffheapLocalTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectQueryArgumentsOffheapLocalTest extends IgniteBinaryObjectQueryArgumentsOffheapTest {
+    /** {@inheritDoc} */
+    @Override protected boolean isLocal() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsOffheapTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsOffheapTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsOffheapTest.java
new file mode 100644
index 0000000..d1428ae
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsOffheapTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+import org.apache.ignite.cache.CacheMemoryMode;
+
+/**
+ *
+ */
+public class IgniteBinaryObjectQueryArgumentsOffheapTest extends IgniteBinaryObjectQueryArgumentsTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMemoryMode memoryMode() {
+        return CacheMemoryMode.OFFHEAP_TIERED;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
index 5676ddd..8a0c5c8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
@@ -17,15 +17,27 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.util.Arrays;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
 import javax.cache.Cache;
-import org.apache.ignite.IgniteBinary;
+
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMemoryMode;
 import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -43,12 +55,64 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
     /** */
     private static final int NODES = 3;
 
+    /** */
+    public static final String PRIM_CACHE = "prim-cache";
+
+    /** */
+    public static final String STR_CACHE = "str-cache";
+
+    /** */
+    public static final String ENUM_CACHE = "enum-cache";
+
+    /** */
+    public static final String UUID_CACHE = "uuid-cache";
+
+    /** */
+    public static final String DATE_CACHE = "date-cache";
+
+    /** */
+    public static final String TIMESTAMP_CACHE = "timestamp-cache";
+
+    /** */
+    public static final String BIG_DECIMAL_CACHE = "decimal-cache";
+
+    /** */
+    public static final String OBJECT_CACHE = "obj-cache";
+
+    /** */
+    public static final String FIELD_CACHE = "field-cache";
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
+        cfg.setCacheConfiguration(getCacheConfigurations());
+
+        cfg.setMarshaller(null);
+
+        return cfg;
+    }
+
+    /**
+     * @return {@code True} If query is local.
+     */
+    protected boolean isLocal() {
+        return false;
+    }
+
+    /**
+     * @return Memory mode.
+     */
+    protected CacheMemoryMode memoryMode() {
+        return CacheMemoryMode.ONHEAP_TIERED;
+    }
+
+    /**
+     * @return Cache config.
+     */
+    protected CacheConfiguration getCacheConfiguration(final String cacheName) {
         CacheConfiguration ccfg = new CacheConfiguration();
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 
@@ -57,11 +121,64 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
         person.setValueType(Person.class.getName());
         person.addQueryField("name", String.class.getName(), null);
 
-        ccfg.setQueryEntities(Arrays.asList(person));
+        ccfg.setQueryEntities(Collections.singletonList(person));
 
-        cfg.setCacheConfiguration(ccfg);
+        ccfg.setMemoryMode(memoryMode());
 
-        cfg.setMarshaller(null);
+        ccfg.setName(cacheName);
+
+        return ccfg;
+    }
+
+    /**
+     * @return Cache configurations.
+     */
+    private CacheConfiguration[] getCacheConfigurations() {
+        final ArrayList<CacheConfiguration> ccfgs = new ArrayList<>();
+
+        ccfgs.add(getCacheConfiguration(OBJECT_CACHE));
+        ccfgs.addAll(getCacheConfigurations(STR_CACHE, String.class, Person.class));
+        ccfgs.addAll(getCacheConfigurations(PRIM_CACHE, Integer.class, Person.class));
+        ccfgs.addAll(getCacheConfigurations(ENUM_CACHE, EnumKey.class, Person.class));
+        ccfgs.addAll(getCacheConfigurations(UUID_CACHE, UUID.class, Person.class));
+        ccfgs.addAll(getCacheConfigurations(DATE_CACHE, Date.class, Person.class));
+        ccfgs.addAll(getCacheConfigurations(TIMESTAMP_CACHE, Timestamp.class, Person.class));
+        ccfgs.addAll(getCacheConfigurations(BIG_DECIMAL_CACHE, BigDecimal.class, Person.class));
+        ccfgs.add(getCacheConfiguration(FIELD_CACHE, Integer.class, SearchValue.class));
+
+        return ccfgs.toArray(new CacheConfiguration[ccfgs.size()]);
+    }
+
+    /**
+     *
+     * @param cacheName Cache name.
+     * @param key Key type.
+     * @param val Value type.
+     * @return Configurations.
+     */
+    private List<CacheConfiguration> getCacheConfigurations(final String cacheName, final Class<?> key, final Class<?> val) {
+        final List<CacheConfiguration> res = new ArrayList<>();
+
+        res.add(getCacheConfiguration(cacheName, key, val));
+        res.add(getCacheConfiguration(cacheName + "-val", val, key));
+
+        return res;
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param key Key type.
+     * @param val Value type
+     * @return Configuration.
+     */
+    @SuppressWarnings("unchecked")
+    private CacheConfiguration getCacheConfiguration(final String cacheName, final Class<?> key, final Class<?> val) {
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(cacheName);
+
+        cfg.setMemoryMode(memoryMode());
+        cfg.setIndexedTypes(key, val);
 
         return cfg;
     }
@@ -70,7 +187,9 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
     @Override protected void beforeTestsStarted() throws Exception {
         super.beforeTestsStarted();
 
-        startGridsMultiThreaded(NODES);
+        final int nodes = isLocal() ? 1 : NODES;
+
+        startGridsMultiThreaded(nodes);
     }
 
     /** {@inheritDoc} */
@@ -84,31 +203,210 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     public void testObjectArgument() throws Exception {
-        IgniteCache<TestKey, Person> cache = ignite(0).cache(null);
+        testKeyQuery(OBJECT_CACHE, new TestKey(1), new TestKey(2));
+    }
 
-        for (int i = 0; i < 100; i++)
-            cache.put(new TestKey(i), new Person("name-" + i));
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimitiveObjectArgument() throws Exception {
+        testKeyValQuery(PRIM_CACHE, 1, 2);
+    }
 
-        SqlQuery<TestKey, Person> qry = new SqlQuery<>(Person.class, "where _key=?");
+    /**
+     * @throws Exception If failed.
+     */
+    public void testStringObjectArgument() throws Exception {
+        testKeyValQuery(STR_CACHE, "str1", "str2");
+    }
 
-        IgniteBinary binary = ignite(0).binary();
+    /**
+     * @throws Exception If failed.
+     */
+    public void testEnumObjectArgument() throws Exception {
+       testKeyValQuery(ENUM_CACHE, EnumKey.KEY1, EnumKey.KEY2);
+    }
 
-        for (int i = 0; i < 100; i++) {
-            Object key = new TestKey(i);
+    /**
+     * @throws Exception If failed.
+     */
+    public void testUuidObjectArgument() throws Exception {
+        final UUID uuid1 = UUID.randomUUID();
+        UUID uuid2 = UUID.randomUUID();
 
-            if (i % 2 == 0)
-                key = binary.toBinary(key);
+        while (uuid1.equals(uuid2))
+            uuid2 = UUID.randomUUID();
 
-            qry.setArgs(key);
+        testKeyValQuery(UUID_CACHE, uuid1, uuid2);
+    }
 
-            List<Cache.Entry<TestKey, Person>> res = cache.query(qry).getAll();
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDateObjectArgument() throws Exception {
+        testKeyValQuery(DATE_CACHE, new Date(0), new Date(1));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTimestampArgument() throws Exception {
+        testKeyValQuery(TIMESTAMP_CACHE, new Timestamp(0), new Timestamp(1));
+    }
 
-            assertEquals(1, res.size());
 
-            Person p = res.get(0).getValue();
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBigDecimalArgument() throws Exception {
+        final ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
-            assertEquals("name-" + i, p.name);
+        final BigDecimal bd1 = new BigDecimal(rnd.nextDouble());
+        BigDecimal bd2 = new BigDecimal(rnd.nextDouble());
+
+        while (bd1.equals(bd2))
+            bd2 = new BigDecimal(rnd.nextDouble());
+
+        testKeyValQuery(BIG_DECIMAL_CACHE, bd1, bd2);
+    }
+
+    /**
+     * Test simple queries.
+     *
+     * @param cacheName Cache name.
+     * @param key1 Key 1.
+     * @param key2 Key 2.
+     * @param <T> Key type.
+     */
+    private <T> void testKeyValQuery(final String cacheName, final T key1, final T key2) {
+        testKeyQuery(cacheName, key1, key2);
+        testValQuery(cacheName + "-val", key1, key2);
+    }
+
+    /**
+     * Test simple query by key.
+     *
+     * @param cacheName Cache name.
+     * @param key1 Key 1.
+     * @param key2 Key 2.
+     * @param <T> Key type.
+     */
+    private <T> void testKeyQuery(final String cacheName, final T key1, final T key2) {
+        final IgniteCache<T, Person> cache = ignite(0).cache(cacheName);
+
+        final Person p1 = new Person("p1");
+        final Person p2 = new Person("p2");
+
+        cache.put(key1, p1);
+        cache.put(key2, p2);
+
+        final SqlQuery<T, Person> qry = new SqlQuery<>(Person.class, "where _key=?");
+
+        final SqlFieldsQuery fieldsQry = new SqlFieldsQuery("select * from Person where _key=?");
+
+        qry.setLocal(isLocal());
+        fieldsQry.setLocal(isLocal());
+
+        qry.setArgs(key1);
+        fieldsQry.setArgs(key1);
+
+        final List<Cache.Entry<T, Person>> res = cache.query(qry).getAll();
+        final List<List<?>> fieldsRes = cache.query(fieldsQry).getAll();
+
+        assertEquals(1, res.size());
+        assertEquals(1, fieldsRes.size());
+
+        assertEquals(p1, res.get(0).getValue());
+        assertEquals(key1, res.get(0).getKey());
+
+        assertTrue(fieldsRes.get(0).size() >= 2);
+        assertEquals(key1, fieldsRes.get(0).get(0));
+        assertEquals(p1, fieldsRes.get(0).get(1));
+    }
+
+    /**
+     * Test simple query by value.
+     *
+     * @param cacheName Cache name.
+     * @param val1 Value 1.
+     * @param val2 Value 2.
+     * @param <T> Value type.
+     */
+    private <T> void testValQuery(final String cacheName, final T val1, final T val2) {
+        final IgniteCache<Person, T> cache = ignite(0).cache(cacheName);
+
+        final Class<?> valType = val1.getClass();
+
+        final Person p1 = new Person("p1");
+        final Person p2 = new Person("p2");
+
+        cache.put(p1, val1);
+        cache.put(p2, val2);
+
+        final SqlQuery<Person, T> qry = new SqlQuery<>(valType, "where _val=?");
+
+        final SqlFieldsQuery fieldsQry = new SqlFieldsQuery("select * from " + valType.getSimpleName() + " where _val=?");
+
+        qry.setLocal(isLocal());
+        fieldsQry.setLocal(isLocal());
+
+        qry.setArgs(val1);
+        fieldsQry.setArgs(val1);
+
+        final List<Cache.Entry<Person, T>> res = cache.query(qry).getAll();
+        final List<List<?>> fieldsRes = cache.query(fieldsQry).getAll();
+
+        assertEquals(1, res.size());
+        assertEquals(1, fieldsRes.size());
+
+        assertEquals(p1, res.get(0).getKey());
+        assertEquals(val1, res.get(0).getValue());
+
+        assertTrue(fieldsRes.get(0).size() >= 2);
+        assertEquals(p1, fieldsRes.get(0).get(0));
+        assertEquals(val1, fieldsRes.get(0).get(1));
+    }
+
+    /**
+     * @throws Exception
+     */
+    public void testFieldSearch() throws Exception {
+        final IgniteCache<Integer, SearchValue> cache = ignite(0).cache(FIELD_CACHE);
+
+        final Map<Integer, SearchValue> map = new HashMap<>();
+
+        for (int i = 0; i < 10; i++) {
+            map.put(i,
+                new SearchValue(
+                    UUID.randomUUID(),
+                    String.valueOf(i),
+                    new BigDecimal(i * 0.1),
+                    i,
+                    new Date(i),
+                    new Timestamp(i),
+                    new Person(String.valueOf("name-" + i)),
+                    i % 2 == 0 ? EnumKey.KEY1 : EnumKey.KEY2)
+            );
         }
+
+        cache.putAll(map);
+
+        SqlQuery<Integer, SearchValue> qry = new SqlQuery<>(SearchValue.class,
+            "where uuid=? and str=? and decimal=? and integer=? and date=? and ts=? and person=? and enumKey=?");
+
+        final int k = ThreadLocalRandom.current().nextInt(10);
+
+        final SearchValue val = map.get(k);
+
+        qry.setLocal(isLocal());
+        qry.setArgs(val.uuid, val.str, val.decimal, val.integer, val.date, val.ts, val.person, val.enumKey);
+
+        final List<Cache.Entry<Integer, SearchValue>> res = cache.query(qry).getAll();
+
+        assertEquals(1, res.size());
+
+        assertEquals(val.integer, res.get(0).getKey());
+        assertEquals(val, res.get(0).getValue());
     }
 
     /**
@@ -124,6 +422,27 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
         public Person(String name) {
             this.name = name;
         }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final Person person = (Person) o;
+
+            return name != null ? name.equals(person.name) : person.name == null;
+
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return name != null ? name.hashCode() : 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Person.class, this);
+        }
     }
 
     /**
@@ -158,4 +477,114 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
             return id;
         }
     }
+
+    /**
+     *
+     */
+    private enum EnumKey {
+        /** */
+        KEY1,
+
+        /** */
+        KEY2
+    }
+
+    /**
+     *
+     */
+    private static class SearchValue {
+        /** */
+        @QuerySqlField
+        private UUID uuid;
+
+        /** */
+        @QuerySqlField
+        private String str;
+
+        /** */
+        @QuerySqlField
+        private BigDecimal decimal;
+
+        /** */
+        @QuerySqlField
+        private Integer integer;
+
+        /** */
+        @QuerySqlField
+        private Date date;
+
+        /** */
+        @QuerySqlField
+        private Timestamp ts;
+
+        /** */
+        @QuerySqlField
+        private Person person;
+
+        /** */
+        @QuerySqlField
+        private EnumKey enumKey;
+
+        /**
+         *
+         * @param uuid UUID.
+         * @param str String.
+         * @param decimal Decimal.
+         * @param integer Integer.
+         * @param date Date.
+         * @param ts Timestamp.
+         * @param person Person.
+         * @param enumKey Enum.
+         */
+        public SearchValue(
+            final UUID uuid,
+            final String str,
+            final BigDecimal decimal,
+            final Integer integer,
+            final Date date,
+            final Timestamp ts,
+            final Person person,
+            final EnumKey enumKey
+        ) {
+            this.uuid = uuid;
+            this.str = str;
+            this.decimal = decimal;
+            this.integer = integer;
+            this.date = date;
+            this.ts = ts;
+            this.person = person;
+            this.enumKey = enumKey;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final SearchValue that = (SearchValue) o;
+
+            if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) return false;
+            if (str != null ? !str.equals(that.str) : that.str != null) return false;
+            if (decimal != null ? !decimal.equals(that.decimal) : that.decimal != null) return false;
+            if (integer != null ? !integer.equals(that.integer) : that.integer != null) return false;
+            if (date != null ? !date.equals(that.date) : that.date != null) return false;
+            if (ts != null ? !ts.equals(that.ts) : that.ts != null) return false;
+            if (person != null ? !person.equals(that.person) : that.person != null) return false;
+            return enumKey == that.enumKey;
+
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int res = uuid != null ? uuid.hashCode() : 0;
+            res = 31 * res + (str != null ? str.hashCode() : 0);
+            res = 31 * res + (decimal != null ? decimal.hashCode() : 0);
+            res = 31 * res + (integer != null ? integer.hashCode() : 0);
+            res = 31 * res + (date != null ? date.hashCode() : 0);
+            res = 31 * res + (ts != null ? ts.hashCode() : 0);
+            res = 31 * res + (person != null ? person.hashCode() : 0);
+            res = 31 * res + (enumKey != null ? enumKey.hashCode() : 0);
+            return res;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index 1d54bbf..cf000e9 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -301,7 +301,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
     private static String normalizeSql(String sql) {
         return sql.toLowerCase()
             .replaceAll("/\\*(?:.|\r|\n)*?\\*/", " ")
-            .replaceAll("\\s*on\\s+1\\s*=\\s*1\\s*", " on true ")
+            .replaceAll("\\s*on\\s+1\\s*=\\s*1\\s*", " ")
             .replaceAll("\\s+", " ")
             .replaceAll("\\( +", "(")
             .replaceAll(" +\\)", ")")
@@ -366,4 +366,4 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
         @QuerySqlField(index = true)
         public String street = "Nevskiy";
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae776532/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 3652acd..e7f55a1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -24,6 +24,10 @@ import org.apache.ignite.internal.processors.cache.GridCacheQueryInternalKeysSel
 import org.apache.ignite.internal.processors.cache.GridCacheQuerySerializationSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectFieldsQuerySelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectLocalQueryArgumentsTest;
+import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectQueryArgumentsOffheapLocalTest;
+import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectQueryArgumentsOffheapTest;
+import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectQueryArgumentsTest;
 import org.apache.ignite.internal.processors.cache.IgniteBinaryWrappedObjectFieldsQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheDuplicateEntityConfigurationSelfTest;
@@ -118,6 +122,11 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheQueryNoRebalanceSelfTest.class);
         suite.addTestSuite(GridCacheQueryTransformerSelfTest.class);
 
+        suite.addTestSuite(IgniteBinaryObjectQueryArgumentsTest.class);
+        suite.addTestSuite(IgniteBinaryObjectQueryArgumentsOffheapTest.class);
+        suite.addTestSuite(IgniteBinaryObjectQueryArgumentsOffheapLocalTest.class);
+        suite.addTestSuite(IgniteBinaryObjectLocalQueryArgumentsTest.class);
+
         return suite;
     }
 }


[49/49] ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-comm-opts1

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-comm-opts1


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

Branch: refs/heads/ignite-comm-opts1
Commit: 58ba70ce42040beb93a464848d0c3e8c8fcaf2b2
Parents: 32dd9ec 04514fe
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 12 14:17:03 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 12 14:17:03 2016 +0300

----------------------------------------------------------------------
 .../ignite/configuration/OdbcConfiguration.java |  98 +++-
 .../local/LocalIgfsSecondaryFileSystem.java     |  15 +-
 .../apache/ignite/internal/GridLoggerProxy.java |   3 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  17 +-
 .../ignite/internal/binary/BinaryContext.java   |   3 +
 .../internal/binary/BinaryMarshaller.java       |  28 +-
 .../internal/binary/BinaryReaderExImpl.java     |  24 +
 .../internal/binary/BinaryReaderHandles.java    |   2 +-
 .../internal/binary/BinaryWriterExImpl.java     |  18 +
 .../binary/builder/BinaryObjectBuilderImpl.java |   2 +-
 .../client/GridClientConfiguration.java         |   1 -
 .../internal/cluster/ClusterGroupAdapter.java   |   2 +-
 .../cluster/ClusterNodeLocalMapImpl.java        |   3 +-
 .../processors/cache/GridCacheAdapter.java      |   2 +-
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../processors/cache/GridCacheProcessor.java    |   5 +-
 .../processors/cache/GridCacheTtlManager.java   |  24 +-
 .../processors/cache/IgniteCacheProxy.java      |  41 ++
 .../binary/CacheObjectBinaryProcessorImpl.java  |  40 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   2 +-
 .../cache/query/GridCacheSqlQuery.java          |  11 +-
 .../datastreamer/DataStreamerImpl.java          |  88 ++--
 .../processors/igfs/IgfsDataManager.java        |   2 +-
 .../internal/processors/igfs/IgfsImpl.java      | 216 +++++---
 .../local/LocalFileSystemSizeVisitor.java       |  60 +++
 .../processors/odbc/OdbcMessageParser.java      |  10 +-
 .../internal/processors/odbc/OdbcProcessor.java |  54 +-
 .../processors/odbc/OdbcRequestHandler.java     |  31 +-
 .../processors/odbc/escape/OdbcEscapeType.java  |  13 +-
 .../processors/odbc/escape/OdbcEscapeUtils.java |  58 ++-
 .../query/PlatformAbstractQueryCursor.java      |  11 +-
 .../cache/query/PlatformFieldsQueryCursor.java  |   6 +
 .../processors/task/GridTaskWorker.java         |   2 +-
 .../ignite/internal/util/IgniteUtils.java       |  60 ++-
 .../ignite/marshaller/AbstractMarshaller.java   |  41 +-
 .../AbstractNodeNameAwareMarshaller.java        | 142 ++++++
 .../ignite/marshaller/MarshallerUtils.java      |  58 +++
 .../ignite/marshaller/jdk/JdkMarshaller.java    |  40 +-
 .../optimized/OptimizedMarshaller.java          |  12 +-
 .../sharedfs/SharedFsCheckpointSpi.java         |   7 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  11 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  29 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  20 +-
 .../ignite/stream/socket/SocketStreamer.java    |  18 +-
 .../ignite/internal/ClusterGroupSelfTest.java   |   2 +-
 .../internal/GridEventStorageSelfTest.java      |  97 +++-
 .../binary/BinaryMarshallerSelfTest.java        |  38 ++
 .../BinaryObjectBuilderAdditionalSelfTest.java  |  14 +
 .../cache/GridCacheAbstractFullApiSelfTest.java |   2 +-
 .../cache/GridLocalIgniteSerializationTest.java | 378 ++++++++++++++
 .../IgniteCacheExpiryPolicyAbstractTest.java    |  14 +-
 .../GridCacheQueryTransformerSelfTest.java      |   9 +-
 .../igfs/IgfsAbstractBaseSelfTest.java          |   7 +-
 .../processors/igfs/IgfsAbstractSelfTest.java   |  31 +-
 ...SecondaryFileSystemDualAbstractSelfTest.java |  63 ++-
 .../processors/igfs/IgfsMaxSizeSelfTest.java    | 122 +++++
 .../processors/igfs/IgfsProcessorSelfTest.java  |  11 +-
 .../processors/igfs/IgfsProxySelfTest.java      |  32 ++
 .../processors/igfs/IgfsStreamsSelfTest.java    |   2 +-
 .../odbc/OdbcEscapeSequenceSelfTest.java        | 210 +++++++-
 .../odbc/OdbcProcessorValidationSelfTest.java   |  37 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |   2 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   2 +
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |   3 +
 .../query/h2/opt/GridH2ValueCacheObject.java    |   8 -
 ...niteBinaryObjectLocalQueryArgumentsTest.java |  28 ++
 ...aryObjectQueryArgumentsOffheapLocalTest.java |  28 ++
 ...teBinaryObjectQueryArgumentsOffheapTest.java |  30 ++
 .../IgniteBinaryObjectQueryArgumentsTest.java   | 472 +++++++++++++++++-
 .../query/h2/sql/GridQueryParsingTest.java      |   2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   9 +
 .../ignite/impl/binary/binary_reader_impl.h     |   2 +-
 .../common/include/ignite/common/concurrent.h   |   5 +-
 .../cpp/common/include/ignite/ignite_error.h    |  11 +-
 .../platforms/cpp/common/src/ignite_error.cpp   |   2 +-
 .../cpp/core-test/src/cache_query_test.cpp      | 300 ++++++++---
 modules/platforms/cpp/core/Makefile.am          |   1 +
 modules/platforms/cpp/core/include/Makefile.am  |   1 +
 .../include/ignite/cache/query/query_cursor.h   |   6 +-
 .../ignite/cache/query/query_fields_cursor.h    |   4 +-
 .../ignite/impl/cache/query/query_batch.h       | 148 ++++++
 .../impl/cache/query/query_fields_row_impl.h    |  30 +-
 .../ignite/impl/cache/query/query_impl.h        |  30 +-
 .../platforms/cpp/core/project/vs/core.vcxproj  |   2 +
 .../cpp/core/project/vs/core.vcxproj.filters    |   6 +
 .../core/src/impl/cache/query/query_batch.cpp   |  52 ++
 .../core/src/impl/cache/query/query_impl.cpp    | 180 ++++---
 modules/platforms/cpp/odbc-test/Makefile.am     |   2 +
 .../odbc-test/include/sql_test_suite_fixture.h  |   6 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   2 +
 .../project/vs/odbc-test.vcxproj.filters        |   6 +
 .../cpp/odbc-test/src/configuration_test.cpp    |  14 +-
 .../cpp/odbc-test/src/queries_test.cpp          |   1 +
 .../src/sql_date_time_functions_test.cpp        | 213 ++++++++
 .../cpp/odbc-test/src/sql_outer_join_test.cpp   | 498 +++++++++++++++++++
 .../odbc-test/src/sql_string_functions_test.cpp |  63 +++
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  25 +-
 .../include/ignite/odbc/config/configuration.h  |  52 +-
 .../cpp/odbc/include/ignite/odbc/result_page.h  |   3 -
 .../odbc/system/ui/dsn_configuration_window.h   |   8 +
 .../src/system/ui/dsn_configuration_window.cpp  |  23 +-
 .../cpp/odbc/os/win/src/system/ui/window.cpp    |   2 +-
 modules/platforms/cpp/odbc/src/column.cpp       |  14 +-
 .../cpp/odbc/src/config/configuration.cpp       |  30 +-
 .../cpp/odbc/src/config/connection_info.cpp     |  24 +-
 modules/platforms/cpp/odbc/src/dsn_config.cpp   |  14 +-
 .../platforms/cpp/odbc/src/query/data_query.cpp |   2 +-
 .../Impl/Cache/Query/FieldsQueryCursor.cs       |   3 +
 .../docker/compose/docker-compose.yml           |  14 +-
 109 files changed, 4162 insertions(+), 622 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/58ba70ce/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------


[25/49] ignite git commit: GridNearOptimisticTxPrepareFuture: fixed javadoc warning.

Posted by sb...@apache.org.
GridNearOptimisticTxPrepareFuture: fixed javadoc warning.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 385355a157993f4d78ced551bbaa168181748a7d
Parents: e23a94f
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 6 12:09:38 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 6 12:09:38 2016 +0300

----------------------------------------------------------------------
 .../cache/distributed/near/GridNearOptimisticTxPrepareFuture.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/385355a1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 5a300ff..e17a76c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -198,7 +198,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
     }
 
     /**
-     * @return Keys for which {@link MiniFuture} isn't completed.
+     * @return Keys for which MiniFuture isn't completed.
      */
     @SuppressWarnings("ForLoopReplaceableByForEach")
     public Set<IgniteTxKey> requestedKeys() {


[19/49] ignite git commit: IGNITE-3741: ODBC: Added character escape support to expression parser. This closes #1004.

Posted by sb...@apache.org.
IGNITE-3741: ODBC: Added character escape support to expression parser. This closes #1004.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 008cf64429f40635e396a71f2c0aaf184077ff2b
Parents: e353301
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Mon Sep 5 15:17:53 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 15:17:53 2016 +0300

----------------------------------------------------------------------
 .../processors/odbc/escape/OdbcEscapeType.java  |  9 ++-
 .../processors/odbc/escape/OdbcEscapeUtils.java | 53 ++++++------
 .../odbc/OdbcEscapeSequenceSelfTest.java        | 85 +++++++++++++++++++-
 3 files changed, 119 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/008cf644/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
index c7e3234..44d8361 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
@@ -42,8 +42,11 @@ public enum OdbcEscapeType {
     /** GUID. */
     GUID("guid", true, false),
 
-    /** LIKE clause. */
-    LIKE("\'", false, true);
+    /** LIKE escape character clause. */
+    ESCAPE_WO_TOKEN("\'", false, false),
+
+    /** LIKE escape character clause. */
+    ESCAPE("escape", true, false);
 
     /** Values in convenient order. */
     private static final OdbcEscapeType[] VALS = new OdbcEscapeType[] {
@@ -51,7 +54,7 @@ public enum OdbcEscapeType {
         DATE, TIMESTAMP, // Date and timestamp are relatively frequent as well; also TS must go before T.
         OUTER_JOIN,      // Joins are less frequent,
         CALL,            // Procedure calls are less frequent than joins.
-        LIKE, TIME, GUID // LIKE, TIME and GUID are even less frequent.
+        ESCAPE_WO_TOKEN, ESCAPE, TIME, GUID // LIKE, TIME and GUID are even less frequent.
     };
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/008cf644/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
index 88afc52..bbf19c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
@@ -76,12 +76,9 @@ public class OdbcEscapeUtils {
         while (curPos < text.length()) {
             char curChar = text.charAt(curPos);
 
-            if (curChar == '\'') {
-                if (!insideLiteral)
-                    insideLiteral = true;
-                else if (text.charAt(curPos - 1) != '\\')
-                    insideLiteral = false;
-            }
+            if (curChar == '\'')
+                /* Escaped quote in odbc is two successive singe quotes. They'll flip flag twice without side-effect. */
+                insideLiteral = !insideLiteral;
             else if (!insideLiteral) {
                 if (curChar == '{') {
                     if (openPos == -1) {
@@ -173,11 +170,7 @@ public class OdbcEscapeUtils {
 
             OdbcEscapeToken token = parseToken(text, startPos, len);
 
-            if (token.type().standard())
-                return parseStandardExpression(text, startPos, len, token);
-            else
-                throw new IgniteException("Unsupported escape sequence token [text=" +
-                    substring(text, startPos, len) + ", token=" + token.type().body() + ']');
+            return parseEscapeSequence(text, startPos, len, token);
         }
         else {
             // Nothing to escape, return original string.
@@ -209,20 +202,17 @@ public class OdbcEscapeUtils {
 
         for (OdbcEscapeType typ : OdbcEscapeType.sortedValues()) {
             if (text.startsWith(typ.body(), pos)) {
-                pos += typ.body().length();
+                if (typ.standard())
+                    pos += typ.body().length();
 
-                if (typ == OdbcEscapeType.LIKE)
-                    throw new IgniteException("LIKE escape sequence is not supported yet.");
-                else {
-                    empty = (startPos + len == pos + 1);
+                empty = (startPos + len == pos + 1);
 
-                    if (!empty && typ.standard()) {
-                        char charAfter = text.charAt(pos);
+                if (!empty && typ.standard()) {
+                    char charAfter = text.charAt(pos);
 
-                        if (!Character.isWhitespace(charAfter))
-                            throw new IgniteException("Unexpected escape sequence token: " +
-                                substring(text, startPos, len));
-                    }
+                    if (!Character.isWhitespace(charAfter))
+                        throw new IgniteException("Unexpected escape sequence token: " +
+                            substring(text, startPos, len));
                 }
 
                 curTyp = typ;
@@ -249,7 +239,7 @@ public class OdbcEscapeUtils {
      * @param token Token.
      * @return Result.
      */
-    private static String parseStandardExpression(String text, int startPos, int len, OdbcEscapeToken token) {
+    private static String parseEscapeSequence(String text, int startPos, int len, OdbcEscapeToken token) {
         assert validSubstring(text, startPos, len);
 
         // Get expression borders.
@@ -283,6 +273,11 @@ public class OdbcEscapeUtils {
 
                 return "CALL " + val;
             }
+
+            case ESCAPE:
+            case ESCAPE_WO_TOKEN:
+                return parseLikeEscCharacterExpression(text, startPos0, len0);
+
             default:
                 throw new IgniteException("Unsupported escape sequence token [text=" +
                     substring(text, startPos, len) + ", token=" + token.type().body() + ']');
@@ -302,6 +297,18 @@ public class OdbcEscapeUtils {
     }
 
     /**
+     * Parse LIKE escape character expression.
+     *
+     * @param text Text.
+     * @param startPos Start position.
+     * @param len Length.
+     * @return Parsed expression.
+     */
+    private static String parseLikeEscCharacterExpression(String text, int startPos, int len) {
+        return "ESCAPE " + substring(text, startPos, len).trim();
+    }
+
+    /**
      * Parse expression and validate against ODBC specification with regex pattern.
      *
      * @param text Text.

http://git-wip-us.apache.org/repos/asf/ignite/blob/008cf644/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
index 26221ea..5303c6e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
@@ -528,9 +528,10 @@ public class OdbcEscapeSequenceSelfTest extends GridCommonAbstractTest {
             "select '{' + {fn func()} + '}' from table;"
         );
 
+        // quoted two single quotes should be interpret as apostrophe
         check(
-            "select '{\\'{fn test()}\\'}' from table;",
-            "select '{\\'{fn test()}\\'}' from table;"
+            "select '{''{fn test()}''}' from table;",
+            "select '{''{fn test()}''}' from table;"
         );
 
         checkFail("'{fn test()}");
@@ -666,6 +667,86 @@ public class OdbcEscapeSequenceSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test escape sequence series.
+     */
+    public void testLikeEscapeSequence() throws Exception {
+        check(
+            "ESCAPE '\\'",
+            "{'\\'}"
+        );
+
+        check(
+            "ESCAPE '\\'",
+            "{escape '\\'}"
+        );
+
+        check(
+            "ESCAPE ''",
+            "{''}"
+        );
+
+        check(
+            "ESCAPE ''",
+            "{escape ''}"
+        );
+
+        check(
+            "select * from t where value LIKE '\\%AAA%' ESCAPE '\\'",
+            "select * from t where value LIKE '\\%AAA%' {'\\'}"
+        );
+
+        check(
+            "select * from t where value LIKE '\\%AAA%' ESCAPE '\\'",
+            "select * from t where value LIKE '\\%AAA%' {escape '\\'}"
+        );
+
+        check(
+            "select * from t where value LIKE '\\%AAA%' ESCAPE '\\' ORDER BY id;",
+            "select * from t where value LIKE '\\%AAA%' {'\\'} ORDER BY id;"
+        );
+
+        check(
+            "select * from t where value LIKE '\\%AAA%' ESCAPE '\\' ORDER BY id;",
+            "select * from t where value LIKE '\\%AAA%' {escape '\\'} ORDER BY id;"
+        );
+
+        check(
+            "select * from t where value LIKE '\\%AAA''s%' ESCAPE '\\'",
+            "select * from t where value LIKE '\\%AAA''s%' {escape '\\'}"
+        );
+    }
+
+    /**
+     * Test escape sequences with additional whitespace characters
+     */
+    public void testLikeEscapeSequenceWithWhitespaces() throws Exception {
+        check("ESCAPE '\\'", "{ '\\' }");
+        check("ESCAPE '\\'", "{ escape '\\'}");
+
+        check("ESCAPE '\\'", "{   '\\' }");
+        check("ESCAPE '\\'", "{   escape   '\\' }");
+
+        check("ESCAPE '\\'", "{ \n '\\' }");
+        check("ESCAPE '\\'", "{ \n escape\n'\\' }");
+    }
+
+    /**
+     * Test invalid escape sequence.
+     */
+    public void testLikeOnInvalidLikeEscapeSequence() {
+        checkFail("LIKE 'AAA's'");
+        checkFail("LIKE 'AAA\'s'");
+
+        checkFail("LIKE '\\%AAA%' {escape'\\' }");
+
+        checkFail("LIKE '\\%AAA%' {'\\' ORDER BY id");
+        checkFail("LIKE '\\%AAA%' {escape '\\' ORDER BY id;");
+
+        checkFail("LIKE '\\%AAA%' '\\'} ORDER BY id");
+        checkFail("LIKE '\\%AAA%' escape '\\'} ORDER BY id;");
+    }
+
+    /**
      * Check parsing logic.
      *
      * @param exp Expected result.


[42/49] ignite git commit: Merge remote-tracking branch 'upstream/ignite-1.6.8' into ignite-1.6.8

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


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

Branch: refs/heads/ignite-comm-opts1
Commit: 65c92faa0f36b3dc9b344d9c2d23bd15ded970e0
Parents: 59527c5 527a299
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 9 13:01:41 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 9 13:01:41 2016 +0300

----------------------------------------------------------------------
 .../processors/task/GridTaskWorker.java         |  2 +-
 .../internal/GridEventStorageSelfTest.java      | 97 +++++++++++++++++++-
 2 files changed, 97 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[40/49] ignite git commit: IGNITE-3846 Fixed wrong recording of JobEvent for @GridInternal task. Added test.

Posted by sb...@apache.org.
IGNITE-3846 Fixed wrong recording of JobEvent for @GridInternal task. Added test.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 527a2996fea51b81267d0fc96da0f4d6076ed436
Parents: 1cc502d
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Sep 9 16:51:15 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Sep 9 16:51:15 2016 +0700

----------------------------------------------------------------------
 .../processors/task/GridTaskWorker.java         |  2 +-
 .../internal/GridEventStorageSelfTest.java      | 97 +++++++++++++++++++-
 2 files changed, 97 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/527a2996/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
index 00ea29e..79d1a2c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
@@ -1500,7 +1500,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
      * @param msg Event message.
      */
     private void recordJobEvent(int evtType, IgniteUuid jobId, ClusterNode evtNode, String msg) {
-        if (ctx.event().isRecordable(evtType)) {
+        if (!internal && ctx.event().isRecordable(evtType)) {
             JobEvent evt = new JobEvent();
 
             evt.message(msg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/527a2996/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageSelfTest.java
index a3b9608..4f98b0c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageSelfTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -31,12 +32,17 @@ import org.apache.ignite.compute.ComputeJobAdapter;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.compute.ComputeTaskSplitAdapter;
 import org.apache.ignite.events.Event;
+import org.apache.ignite.events.JobEvent;
+import org.apache.ignite.events.TaskEvent;
+import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.testframework.junits.common.GridCommonTest;
 
 import static org.apache.ignite.events.EventType.EVTS_ALL_MINUS_METRIC_UPDATE;
+import static org.apache.ignite.events.EventType.EVTS_JOB_EXECUTION;
+import static org.apache.ignite.events.EventType.EVTS_TASK_EXECUTION;
 import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
 import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
 import static org.apache.ignite.events.EventType.EVT_TASK_STARTED;
@@ -193,6 +199,53 @@ public class GridEventStorageSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Checks that specified event is not task or job event.
+     *
+     * @param evt Event to check.
+     */
+    private void checkGridInternalEvent(Event evt) {
+        assertFalse("Found TASK event for task marked with @GridInternal [evtType=" + evt.type() + "]", evt instanceof TaskEvent);
+        assertFalse("Found JOB event for task marked with @GridInternal [evtType=" + evt.type() + "]", evt instanceof JobEvent);
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testGridInternalEvents() throws Exception {
+        IgnitePredicate<Event> lsnr = new IgnitePredicate<Event>() {
+            @Override public boolean apply(Event evt) {
+                checkGridInternalEvent(evt);
+
+                return true;
+            }
+        };
+
+        ignite1.events().localListen(lsnr, EVTS_TASK_EXECUTION);
+        ignite1.events().localListen(lsnr, EVTS_JOB_EXECUTION);
+        ignite2.events().localListen(lsnr, EVTS_TASK_EXECUTION);
+        ignite2.events().localListen(lsnr, EVTS_JOB_EXECUTION);
+
+        executeGridInternalTask(ignite1);
+
+        Collection<Event> evts1 = ignite1.events().localQuery(F.<Event>alwaysTrue());
+        Collection<Event> evts2 = ignite2.events().localQuery(F.<Event>alwaysTrue());
+
+        assert evts1 != null;
+        assert evts2 != null;
+
+        for (Event evt : evts1)
+            checkGridInternalEvent(evt);
+
+        for (Event evt : evts2)
+            checkGridInternalEvent(evt);
+
+        assert ignite1.events().stopLocalListen(lsnr, EVTS_TASK_EXECUTION);
+        assert ignite1.events().stopLocalListen(lsnr, EVTS_JOB_EXECUTION);
+        assert ignite2.events().stopLocalListen(lsnr, EVTS_TASK_EXECUTION);
+        assert ignite2.events().stopLocalListen(lsnr, EVTS_JOB_EXECUTION);
+    }
+
+    /**
      * Create events in grid.
      *
      * @param ignite Grid.
@@ -204,6 +257,15 @@ public class GridEventStorageSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Execute task marged with {@code GridInternal} annotation.
+     *
+     * @param ignite Grid.
+     */
+    private void executeGridInternalTask(Ignite ignite) {
+        ignite.compute().execute(GridInternalTestTask.class.getName(), null);
+    }
+
+    /**
      * Test task.
      */
     private static class GridEventTestTask extends ComputeTaskSplitAdapter<Object, Object> {
@@ -232,6 +294,39 @@ public class GridEventStorageSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test task marked with @GridInternal.
+     */
+    @GridInternal
+    private static class GridInternalTestTask extends ComputeTaskSplitAdapter<Object, Object> {
+        /** {@inheritDoc} */
+        @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
+            Collection<ComputeJob> jobs = new ArrayList<>(gridSize);
+
+            for (int i = 0; i < gridSize; i++)
+                jobs.add(new GridInternalTestJob());
+
+            return jobs;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Serializable reduce(List<ComputeJobResult> results) {
+            assert results != null;
+
+            return "GridInternalTestTask-result.";
+        }
+    }
+
+    /**
+     * Test job.
+     */
+    private static class GridInternalTestJob extends ComputeJobAdapter {
+        /** {@inheritDoc} */
+        @Override public String execute() {
+            return "GridInternalTestJob-result.";
+        }
+    }
+
+    /**
      * Test event listener.
      */
     private class TestEventListener implements IgnitePredicate<Event> {
@@ -274,4 +369,4 @@ public class GridEventStorageSelfTest extends GridCommonAbstractTest {
             return evt.type() == EVT_TASK_STARTED;
         }
     }
-}
\ No newline at end of file
+}


[09/49] ignite git commit: IGNITE-3801: ODBC: Added tests for OUTER JOIN. This closes #1027.

Posted by sb...@apache.org.
IGNITE-3801: ODBC: Added tests for OUTER JOIN. This closes #1027.


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

Branch: refs/heads/ignite-comm-opts1
Commit: d06eaa2344a753e08d1e3cb00e6b4ab83c6a9a01
Parents: c992213
Author: isapego <is...@gridgain.com>
Authored: Sun Sep 4 16:52:04 2016 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Sun Sep 4 16:52:04 2016 +0300

----------------------------------------------------------------------
 modules/platforms/cpp/odbc-test/Makefile.am     |   1 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   1 +
 .../project/vs/odbc-test.vcxproj.filters        |   3 +
 .../cpp/odbc-test/src/sql_outer_join_test.cpp   | 498 +++++++++++++++++++
 .../odbc-test/src/sql_test_suite_fixture.cpp    |   6 +-
 .../cpp/odbc/src/config/connection_info.cpp     |   4 +-
 6 files changed, 507 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d06eaa23/modules/platforms/cpp/odbc-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am
index 1ca85a7..c3dd86a 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -70,6 +70,7 @@ ignite_odbc_tests_SOURCES = \
     src/sql_operators_test.cpp \
     src/sql_value_expressions_test.cpp \
     src/sql_types_test.cpp \
+    src/sql_outer_join_test.cpp \
     ../odbc/src/cursor.cpp \
     ../odbc/src/config/connection_info.cpp \
     ../odbc/src/app/application_data_buffer.cpp \

http://git-wip-us.apache.org/repos/asf/ignite/blob/d06eaa23/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
index cb5735f..b85f1e6 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
@@ -170,6 +170,7 @@
     <ClCompile Include="..\..\src\parser_test.cpp" />
     <ClCompile Include="..\..\src\row_test.cpp" />
     <ClCompile Include="..\..\src\sql_aggregate_functions_test.cpp" />
+    <ClCompile Include="..\..\src\sql_outer_join_test.cpp" />
     <ClCompile Include="..\..\src\sql_test_suite_fixture.cpp" />
     <ClCompile Include="..\..\src\sql_numeric_functions_test.cpp" />
     <ClCompile Include="..\..\src\sql_operators_test.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/d06eaa23/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
index 270bdd6..ee5df76 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters
@@ -106,6 +106,9 @@
     <ClCompile Include="..\..\src\sql_value_expressions_test.cpp">
       <Filter>Code</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\sql_outer_join_test.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\test_type.h">

http://git-wip-us.apache.org/repos/asf/ignite/blob/d06eaa23/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
new file mode 100644
index 0000000..426041b
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
@@ -0,0 +1,498 @@
+/*
+ * 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.
+ */
+
+#ifndef _MSC_VER
+#   define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include "sql_test_suite_fixture.h"
+#include "test_utils.h"
+
+using namespace ignite;
+
+using namespace boost::unit_test;
+
+BOOST_FIXTURE_TEST_SUITE(SqlOuterJoinTestSuite, ignite::SqlTestSuiteFixture)
+
+// Checking that left outer joins are supported.
+// Corresponds to SQL_OJ_LEFT flag.
+BOOST_AUTO_TEST_CASE(TestOuterJoinLeft)
+{
+    TestType in1;
+    TestType in2;
+
+    in1.i32Field = 20;
+    in2.i32Field = 30;
+
+    in1.i16Field = 40;
+    in2.i16Field = 20;
+
+    testCache.Put(1, in1);
+    testCache.Put(2, in2);
+
+    SQLINTEGER columns[2];
+    SQLLEN columnsLen[2];
+
+    SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
+        "{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T1.i32Field = T2.i16Field}";
+
+    ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 20);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 20);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 30);
+
+    BOOST_CHECK_EQUAL(columnsLen[1], SQL_NULL_DATA);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
+// Checking that the column names in the ON clause of the outer join do not
+// have to be in the same order as their respective table names in the OUTER
+// JOIN clause. Corresponds to SQL_OJ_NOT_ORDERED flag. 
+BOOST_AUTO_TEST_CASE(TestOuterJoinOrdering)
+{
+    TestType in1;
+    TestType in2;
+
+    in1.i32Field = 20;
+    in2.i32Field = 30;
+
+    in1.i16Field = 40;
+    in2.i16Field = 20;
+
+    testCache.Put(1, in1);
+    testCache.Put(2, in2);
+
+    SQLINTEGER columns[2];
+    SQLLEN columnsLen[2];
+
+    SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
+        "{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field = T1.i32Field}";
+
+    ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 20);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 20);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 30);
+
+    BOOST_CHECK_EQUAL(columnsLen[1], SQL_NULL_DATA);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
+// Checking that the comparison operator in the ON clause can be any of the ODBC
+// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
+// Operator '<'.
+BOOST_AUTO_TEST_CASE(TestOuterJoinOpsLess)
+{
+    TestType in1;
+    TestType in2;
+
+    in1.i32Field = 20;
+    in2.i32Field = 30;
+
+    in1.i16Field = 40;
+    in2.i16Field = 20;
+
+    testCache.Put(1, in1);
+    testCache.Put(2, in2);
+
+    SQLINTEGER columns[2];
+    SQLLEN columnsLen[2];
+
+    SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
+        "{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field < T1.i32Field}";
+
+    ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 20);
+
+    BOOST_CHECK_EQUAL(columnsLen[1], SQL_NULL_DATA);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 30);
+
+    BOOST_CHECK_EQUAL(columnsLen[1], SQL_NULL_DATA);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
+// Checking that the comparison operator in the ON clause can be any of the ODBC
+// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
+// Operator '>'.
+BOOST_AUTO_TEST_CASE(TestOuterJoinOpsGreater)
+{
+    TestType in1;
+    TestType in2;
+
+    in1.i32Field = 20;
+    in2.i32Field = 30;
+
+    in1.i16Field = 40;
+    in2.i16Field = 20;
+
+    testCache.Put(1, in1);
+    testCache.Put(2, in2);
+
+    SQLINTEGER columns[2];
+    SQLLEN columnsLen[2];
+
+    SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
+        "{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field > T1.i32Field}";
+
+    ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 20);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 40);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 30);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 40);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
+// Checking that the comparison operator in the ON clause can be any of the ODBC
+// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
+// Operator '<='.
+BOOST_AUTO_TEST_CASE(TestOuterJoinOpsLessOrEqual)
+{
+    TestType in1;
+    TestType in2;
+
+    in1.i32Field = 20;
+    in2.i32Field = 30;
+
+    in1.i16Field = 40;
+    in2.i16Field = 20;
+
+    testCache.Put(1, in1);
+    testCache.Put(2, in2);
+
+    SQLINTEGER columns[2];
+    SQLLEN columnsLen[2];
+
+    SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
+        "{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field <= T1.i32Field}";
+
+    ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 20);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 20);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 30);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 20);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
+// Checking that the comparison operator in the ON clause can be any of the ODBC
+// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
+// Operator '>='.
+BOOST_AUTO_TEST_CASE(TestOuterJoinOpsGreaterOrEqual)
+{
+    TestType in1;
+    TestType in2;
+
+    in1.i32Field = 20;
+    in2.i32Field = 30;
+
+    in1.i16Field = 40;
+    in2.i16Field = 20;
+
+    testCache.Put(1, in1);
+    testCache.Put(2, in2);
+
+    SQLINTEGER columns[2];
+    SQLLEN columnsLen[2];
+
+    SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
+        "{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field >= T1.i32Field}";
+
+    ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 20);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 40);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 20);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 20);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 30);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 40);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
+// Checking that the comparison operator in the ON clause can be any of the ODBC
+// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
+// Operator '!='.
+BOOST_AUTO_TEST_CASE(TestOuterJoinOpsNotEqual)
+{
+    TestType in1;
+    TestType in2;
+
+    in1.i32Field = 20;
+    in2.i32Field = 30;
+
+    in1.i16Field = 40;
+    in2.i16Field = 20;
+
+    testCache.Put(1, in1);
+    testCache.Put(2, in2);
+
+    SQLINTEGER columns[2];
+    SQLLEN columnsLen[2];
+
+    SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
+        "{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field != T1.i32Field}";
+
+    ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 20);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 40);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 30);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 40);
+
+    ret = SQLFetch(stmt);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[0], 30);
+
+    BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
+    BOOST_CHECK_EQUAL(columns[1], 20);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
+BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/d06eaa23/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
index 69b4bfa..657b854 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
@@ -117,17 +117,17 @@ namespace ignite
         ret = SQLBindCol(stmt, 1, type, column, bufSize, resSize);
 
         if (!SQL_SUCCEEDED(ret))
-            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
+            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 
         ret = SQLExecDirect(stmt, reinterpret_cast<SQLCHAR*>(const_cast<char*>(request)), SQL_NTS);
 
         if (!SQL_SUCCEEDED(ret))
-            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
+            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 
         ret = SQLFetch(stmt);
 
         if (!SQL_SUCCEEDED(ret))
-            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt)) ;
+            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
 
         ret = SQLFetch(stmt);
         BOOST_CHECK(ret == SQL_NO_DATA) ;

http://git-wip-us.apache.org/repos/asf/ignite/blob/d06eaa23/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index 744a88e..ca8d1a0 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -298,9 +298,7 @@ namespace ignite
 #ifdef SQL_OJ_CAPABILITIES
                 // Bitmask enumerating the types of outer joins supported by the 
                 // driver and data source.
-                intParams[SQL_OJ_CAPABILITIES] = SQL_OJ_LEFT | SQL_OJ_RIGHT |
-                    SQL_OJ_FULL | SQL_OJ_NESTED | SQL_OJ_INNER |
-                    SQL_OJ_ALL_COMPARISON_OPS;
+                intParams[SQL_OJ_CAPABILITIES] = SQL_OJ_LEFT | SQL_OJ_NOT_ORDERED | SQL_OJ_ALL_COMPARISON_OPS;
 #endif // SQL_OJ_CAPABILITIES
 
 #ifdef SQL_POS_OPERATIONS


[04/49] ignite git commit: IGNITE-3827: Removed double marshalling of keys in DataStreamerImpl.addData(Map) method.

Posted by sb...@apache.org.
IGNITE-3827: Removed double marshalling of keys in DataStreamerImpl.addData(Map) method.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 7a84ab6a9163ca31fbcfcc6d7ff27e06bf9babef
Parents: fbbcaf4
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 2 18:05:16 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 2 18:05:16 2016 +0300

----------------------------------------------------------------------
 .../datastreamer/DataStreamerImpl.java          | 23 ++++++++------------
 1 file changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7a84ab6a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index e565cba..a3bae24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -87,7 +87,6 @@ import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl;
 import org.apache.ignite.internal.util.lang.GridPeerDeployAware;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
@@ -513,23 +512,19 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
 
             activeFuts.add(resFut);
 
-            Collection<KeyCacheObject> keys = null;
+            Collection<KeyCacheObject> keys =
+                new GridConcurrentHashSet<>(entries.size(), U.capacity(entries.size()), 1);
 
-            if (entries.size() > 1) {
-                keys = new GridConcurrentHashSet<>(entries.size(), U.capacity(entries.size()), 1);
+            Collection<DataStreamerEntry> entries0 = new ArrayList<>(entries.size());
 
-                for (Map.Entry<K, V> entry : entries)
-                    keys.add(cacheObjProc.toCacheKeyObject(cacheObjCtx, null, entry.getKey(), true));
-            }
+            for (Map.Entry<K, V> entry : entries) {
+                KeyCacheObject key = cacheObjProc.toCacheKeyObject(cacheObjCtx, null, entry.getKey(), true);
+                CacheObject val = cacheObjProc.toCacheObject(cacheObjCtx, entry.getValue(), true);
 
-            Collection<? extends DataStreamerEntry> entries0 = F.viewReadOnly(entries, new C1<Entry<K, V>, DataStreamerEntry>() {
-                @Override public DataStreamerEntry apply(Entry<K, V> e) {
-                    KeyCacheObject key = cacheObjProc.toCacheKeyObject(cacheObjCtx, null, e.getKey(), true);
-                    CacheObject val = cacheObjProc.toCacheObject(cacheObjCtx, e.getValue(), true);
+                keys.add(key);
 
-                    return new DataStreamerEntry(key, val);
-                }
-            });
+                entries0.add(new DataStreamerEntry(key, val));
+            }
 
             load0(entries0, resFut, keys, 0);
 


[08/49] ignite git commit: IGNITE-3760: ODBC: Added tests for supported SQL92 string functions. This closes #1006.

Posted by sb...@apache.org.
IGNITE-3760: ODBC: Added tests for supported SQL92 string functions. This closes #1006.


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

Branch: refs/heads/ignite-comm-opts1
Commit: c992213274ec5872ef7ce359efa51e26003424ad
Parents: e9c797f
Author: isapego <is...@gridgain.com>
Authored: Sun Sep 4 16:49:42 2016 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Sun Sep 4 16:49:42 2016 +0300

----------------------------------------------------------------------
 .../odbc-test/src/sql_string_functions_test.cpp | 63 ++++++++++++++++++++
 .../cpp/odbc/src/config/connection_info.cpp     |  4 +-
 2 files changed, 65 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c9922132/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
index d1ce194..c85f80c 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
@@ -288,4 +288,67 @@ BOOST_AUTO_TEST_CASE(TestStringFunctionUcase)
     CheckSingleResult<std::string>("SELECT {fn UCASE(strField)} FROM TestType", "HELLO WORLD!");
 }
 
+BOOST_AUTO_TEST_CASE(Test92StringFunctionLower)
+{
+    TestType in;
+    in.strField = "Hello World!";
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<std::string>("SELECT LOWER(strField) FROM TestType", "hello world!");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionUpper)
+{
+    TestType in;
+    in.strField = "Hello World!";
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<std::string>("SELECT UPPER(strField) FROM TestType", "HELLO WORLD!");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionSubstring)
+{
+    TestType in;
+    in.strField = "Hello Ignite!";
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<std::string>("SELECT SUBSTRING(strField, 7) FROM TestType", "Ignite!");
+    CheckSingleResult<std::string>("SELECT SUBSTRING(strField, 7, 6) FROM TestType", "Ignite");
+    CheckSingleResult<std::string>("SELECT SUBSTRING(strField FROM 7) FROM TestType", "Ignite!");
+    CheckSingleResult<std::string>("SELECT SUBSTRING(strField FROM 7 FOR 6) FROM TestType", "Ignite");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionTrimBoth)
+{
+    TestType in;
+    in.strField = "    Lorem ipsum  ";
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<std::string>("SELECT TRIM(BOTH FROM strField) FROM TestType", "Lorem ipsum");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionTrimLeading)
+{
+    TestType in;
+    in.strField = "    Lorem ipsum  ";
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<std::string>("SELECT TRIM(LEADING FROM strField) FROM TestType", "Lorem ipsum  ");
+}
+
+BOOST_AUTO_TEST_CASE(Test92StringFunctionTrimTrailing)
+{
+    TestType in;
+    in.strField = "    Lorem ipsum  ";
+
+    testCache.Put(1, in);
+
+    CheckSingleResult<std::string>("SELECT TRIM(TRAILING FROM strField) FROM TestType", "    Lorem ipsum");
+}
+
 BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/c9922132/modules/platforms/cpp/odbc/src/config/connection_info.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/connection_info.cpp b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
index cff48cf..744a88e 100644
--- a/modules/platforms/cpp/odbc/src/config/connection_info.cpp
+++ b/modules/platforms/cpp/odbc/src/config/connection_info.cpp
@@ -315,8 +315,8 @@ namespace ignite
 
 #ifdef SQL_SQL92_STRING_FUNCTIONS
                 // Bitmask enumerating the string scalar functions.
-                intParams[SQL_SQL92_STRING_FUNCTIONS] = SQL_SSF_CONVERT | SQL_SSF_LOWER | SQL_SSF_UPPER |
-                    SQL_SSF_SUBSTRING | SQL_SSF_TRANSLATE;
+                intParams[SQL_SQL92_STRING_FUNCTIONS] = SQL_SSF_LOWER | SQL_SSF_UPPER | SQL_SSF_SUBSTRING |
+                    SQL_SSF_TRIM_BOTH | SQL_SSF_TRIM_LEADING | SQL_SSF_TRIM_TRAILING;
 #endif // SQL_SQL92_STRING_FUNCTIONS
 
 #ifdef SQL_SQL92_DATETIME_FUNCTIONS


[44/49] ignite git commit: Merge branch 'ignite-1.6.8' into ignite-1.7.2

Posted by sb...@apache.org.
Merge branch 'ignite-1.6.8' into ignite-1.7.2


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

Branch: refs/heads/ignite-comm-opts1
Commit: 3b391849629d63c0925862fbf2b3ec2a2e429c24
Parents: 79745ee 65c92fa
Author: isapego <is...@gridgain.com>
Authored: Fri Sep 9 14:25:52 2016 +0300
Committer: isapego <is...@gridgain.com>
Committed: Fri Sep 9 14:25:52 2016 +0300

----------------------------------------------------------------------
 .../ignite/configuration/OdbcConfiguration.java |  98 +++-
 .../local/LocalIgfsSecondaryFileSystem.java     |  15 +-
 .../apache/ignite/internal/GridLoggerProxy.java |   3 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  17 +-
 .../ignite/internal/binary/BinaryContext.java   |   3 +
 .../internal/binary/BinaryMarshaller.java       |  28 +-
 .../internal/binary/BinaryReaderExImpl.java     |  24 +
 .../internal/binary/BinaryReaderHandles.java    |   2 +-
 .../internal/binary/BinaryWriterExImpl.java     |  18 +
 .../binary/builder/BinaryObjectBuilderImpl.java |   2 +-
 .../client/GridClientConfiguration.java         |   1 -
 .../internal/cluster/ClusterGroupAdapter.java   |   2 +-
 .../cluster/ClusterNodeLocalMapImpl.java        |   3 +-
 .../processors/cache/GridCacheAdapter.java      |   2 +-
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../processors/cache/GridCacheProcessor.java    |   5 +-
 .../processors/cache/GridCacheTtlManager.java   |  24 +-
 .../processors/cache/IgniteCacheProxy.java      |  41 ++
 .../binary/CacheObjectBinaryProcessorImpl.java  |  40 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   2 +-
 .../cache/query/GridCacheSqlQuery.java          |  11 +-
 .../datastreamer/DataStreamerImpl.java          |  23 +-
 .../processors/igfs/IgfsDataManager.java        |   2 +-
 .../internal/processors/igfs/IgfsImpl.java      | 216 +++++---
 .../local/LocalFileSystemSizeVisitor.java       |  60 +++
 .../processors/odbc/OdbcMessageParser.java      |  10 +-
 .../internal/processors/odbc/OdbcProcessor.java |  54 +-
 .../processors/odbc/OdbcRequestHandler.java     |  31 +-
 .../processors/odbc/escape/OdbcEscapeType.java  |  13 +-
 .../processors/odbc/escape/OdbcEscapeUtils.java |  58 ++-
 .../query/PlatformAbstractQueryCursor.java      |  11 +-
 .../cache/query/PlatformFieldsQueryCursor.java  |   6 +
 .../processors/task/GridTaskWorker.java         |   2 +-
 .../ignite/internal/util/IgniteUtils.java       |  60 ++-
 .../ignite/marshaller/AbstractMarshaller.java   |  41 +-
 .../AbstractNodeNameAwareMarshaller.java        | 142 ++++++
 .../ignite/marshaller/MarshallerUtils.java      |  58 +++
 .../ignite/marshaller/jdk/JdkMarshaller.java    |  40 +-
 .../optimized/OptimizedMarshaller.java          |  12 +-
 .../sharedfs/SharedFsCheckpointSpi.java         |   7 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  11 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  29 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  20 +-
 .../ignite/stream/socket/SocketStreamer.java    |  18 +-
 .../ignite/internal/ClusterGroupSelfTest.java   |   2 +-
 .../internal/GridEventStorageSelfTest.java      |  97 +++-
 .../binary/BinaryMarshallerSelfTest.java        |  38 ++
 .../BinaryObjectBuilderAdditionalSelfTest.java  |  14 +
 .../cache/GridCacheAbstractFullApiSelfTest.java |   2 +-
 .../cache/GridLocalIgniteSerializationTest.java | 378 ++++++++++++++
 .../IgniteCacheExpiryPolicyAbstractTest.java    |  14 +-
 .../GridCacheQueryTransformerSelfTest.java      |   9 +-
 .../igfs/IgfsAbstractBaseSelfTest.java          |   7 +-
 .../processors/igfs/IgfsAbstractSelfTest.java   |  31 +-
 ...SecondaryFileSystemDualAbstractSelfTest.java |  63 ++-
 .../processors/igfs/IgfsMaxSizeSelfTest.java    | 122 +++++
 .../processors/igfs/IgfsProcessorSelfTest.java  |  11 +-
 .../processors/igfs/IgfsProxySelfTest.java      |  32 ++
 .../processors/igfs/IgfsStreamsSelfTest.java    |   2 +-
 .../odbc/OdbcEscapeSequenceSelfTest.java        | 210 +++++++-
 .../odbc/OdbcProcessorValidationSelfTest.java   |  37 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |   2 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |   2 +
 .../ignite/testsuites/IgniteIgfsTestSuite.java  |   3 +
 .../query/h2/opt/GridH2ValueCacheObject.java    |   9 -
 ...niteBinaryObjectLocalQueryArgumentsTest.java |  28 ++
 ...aryObjectQueryArgumentsOffheapLocalTest.java |  28 ++
 ...teBinaryObjectQueryArgumentsOffheapTest.java |  30 ++
 .../IgniteBinaryObjectQueryArgumentsTest.java   | 472 +++++++++++++++++-
 .../query/h2/sql/GridQueryParsingTest.java      |   2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   9 +
 .../ignite/impl/binary/binary_reader_impl.h     |   2 +-
 .../common/include/ignite/common/concurrent.h   |   5 +-
 .../cpp/common/include/ignite/ignite_error.h    |  11 +-
 .../platforms/cpp/common/src/ignite_error.cpp   |   2 +-
 .../cpp/core-test/src/cache_query_test.cpp      | 300 ++++++++---
 modules/platforms/cpp/core/Makefile.am          |   1 +
 modules/platforms/cpp/core/include/Makefile.am  |   1 +
 .../include/ignite/cache/query/query_cursor.h   |   6 +-
 .../ignite/cache/query/query_fields_cursor.h    |   4 +-
 .../ignite/impl/cache/query/query_batch.h       | 148 ++++++
 .../impl/cache/query/query_fields_row_impl.h    |  30 +-
 .../ignite/impl/cache/query/query_impl.h        |  30 +-
 .../platforms/cpp/core/project/vs/core.vcxproj  |   2 +
 .../cpp/core/project/vs/core.vcxproj.filters    |   6 +
 .../core/src/impl/cache/query/query_batch.cpp   |  52 ++
 .../core/src/impl/cache/query/query_impl.cpp    | 180 ++++---
 modules/platforms/cpp/odbc-test/Makefile.am     |   2 +
 .../odbc-test/include/sql_test_suite_fixture.h  |   6 +
 .../cpp/odbc-test/project/vs/odbc-test.vcxproj  |   2 +
 .../project/vs/odbc-test.vcxproj.filters        |   6 +
 .../cpp/odbc-test/src/configuration_test.cpp    |  14 +-
 .../cpp/odbc-test/src/queries_test.cpp          |   1 +
 .../src/sql_date_time_functions_test.cpp        | 213 ++++++++
 .../cpp/odbc-test/src/sql_outer_join_test.cpp   | 498 +++++++++++++++++++
 .../odbc-test/src/sql_string_functions_test.cpp |  63 +++
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  25 +-
 .../include/ignite/odbc/config/configuration.h  |  52 +-
 .../cpp/odbc/include/ignite/odbc/result_page.h  |   3 -
 .../odbc/system/ui/dsn_configuration_window.h   |   8 +
 .../src/system/ui/dsn_configuration_window.cpp  |  23 +-
 .../cpp/odbc/os/win/src/system/ui/window.cpp    |   2 +-
 modules/platforms/cpp/odbc/src/column.cpp       |  14 +-
 .../cpp/odbc/src/config/configuration.cpp       |  30 +-
 .../cpp/odbc/src/config/connection_info.cpp     |  24 +-
 modules/platforms/cpp/odbc/src/dsn_config.cpp   |  14 +-
 .../platforms/cpp/odbc/src/query/data_query.cpp |   2 +-
 .../Impl/Cache/Query/FieldsQueryCursor.cs       |   3 +
 108 files changed, 4106 insertions(+), 600 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index 6b81ed1,bcb37c5..7feb091
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@@ -20,9 -20,9 +20,12 @@@ package org.apache.ignite.internal.proc
  import java.nio.ByteBuffer;
  import java.util.LinkedHashMap;
  import org.apache.ignite.IgniteCheckedException;
 +import org.apache.ignite.IgniteException;
++import org.apache.ignite.IgniteException;
  import org.apache.ignite.internal.GridDirectTransient;
  import org.apache.ignite.internal.GridKernalContext;
+ import org.apache.ignite.internal.binary.BinaryMarshaller;
++import org.apache.ignite.internal.binary.BinaryMarshaller;
  import org.apache.ignite.internal.util.tostring.GridToStringInclude;
  import org.apache.ignite.internal.util.typedef.F;
  import org.apache.ignite.internal.util.typedef.internal.A;
@@@ -153,12 -154,13 +156,18 @@@ public class GridCacheSqlQuery implemen
  
          assert paramsBytes != null;
  
 -        final ClassLoader ldr = U.resolveClassLoader(ctx.config());
 +        try {
-             params = m.unmarshal(paramsBytes, U.resolveClassLoader(ctx.config()));
++            final ClassLoader ldr = U.resolveClassLoader(ctx.config());
+ 
 -        if (m instanceof BinaryMarshaller)
 -            // To avoid deserializing of enum types.
 -            params = ((BinaryMarshaller)m).binaryMarshaller().unmarshal(paramsBytes, ldr);
 -        else
 -            params = m.unmarshal(paramsBytes, ldr);
++            if (m instanceof BinaryMarshaller)
++                // To avoid deserializing of enum types.
++                params = ((BinaryMarshaller)m).binaryMarshaller().unmarshal(paramsBytes, ldr);
++            else
++                params = m.unmarshal(paramsBytes, ldr);
 +        }
 +        catch (IgniteCheckedException e) {
 +            throw new IgniteException(e);
 +        }
      }
  
      /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcMessageParser.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/test/java/org/apache/ignite/internal/ClusterGroupSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 4198535,e7f55a1..b19fcee
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@@ -22,19 -22,15 +22,23 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexDisabledSelfTest;
  import org.apache.ignite.internal.processors.cache.GridCacheQueryInternalKeysSelfTest;
  import org.apache.ignite.internal.processors.cache.GridCacheQuerySerializationSelfTest;
 -import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
  import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectFieldsQuerySelfTest;
+ import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectLocalQueryArgumentsTest;
+ import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectQueryArgumentsOffheapLocalTest;
+ import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectQueryArgumentsOffheapTest;
+ import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectQueryArgumentsTest;
  import org.apache.ignite.internal.processors.cache.IgniteBinaryWrappedObjectFieldsQuerySelfTest;
  import org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheCrossCacheJoinRandomTest;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheDistributedJoinCollocatedAndNotTest;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheDistributedJoinCustomAffinityMapper;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheDistributedJoinPartitionedAndReplicatedTest;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheDistributedJoinQueryConditionsTest;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheDistributedJoinTest;
  import org.apache.ignite.internal.processors.cache.IgniteCacheDuplicateEntityConfigurationSelfTest;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheDistributedJoinNoIndexTest;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheJoinPartitionedAndReplicatedTest;
 +import org.apache.ignite.internal.processors.cache.IgniteCacheJoinQueryWithAffinityKeyTest;
  import org.apache.ignite.internal.processors.cache.IgniteCacheLargeResultSelfTest;
  import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapEvictQueryTest;
  import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapIndexScanTest;
@@@ -128,19 -121,12 +132,24 @@@ public class IgniteCacheQuerySelfTestSu
          suite.addTestSuite(IgniteCacheQueryH2IndexingLeakTest.class);
          suite.addTestSuite(IgniteCacheQueryNoRebalanceSelfTest.class);
          suite.addTestSuite(GridCacheQueryTransformerSelfTest.class);
 +        suite.addTestSuite(IgniteCachePrimitiveFieldsQuerySelfTest.class);
 +
 +        suite.addTestSuite(IgniteCacheJoinQueryWithAffinityKeyTest.class);
 +        suite.addTestSuite(IgniteCacheDistributedJoinCollocatedAndNotTest.class);
 +        suite.addTestSuite(IgniteCacheDistributedJoinPartitionedAndReplicatedTest.class);
 +        suite.addTestSuite(IgniteCacheDistributedJoinQueryConditionsTest.class);
 +        suite.addTestSuite(IgniteCacheDistributedJoinTest.class);
 +        suite.addTestSuite(IgniteCacheJoinPartitionedAndReplicatedTest.class);
 +        suite.addTestSuite(IgniteCacheDistributedJoinNoIndexTest.class);
 +        suite.addTestSuite(IgniteCrossCachesJoinsQueryTest.class);
 +        suite.addTestSuite(IgniteCacheCrossCacheJoinRandomTest.class);
 +        suite.addTestSuite(IgniteCacheDistributedJoinCustomAffinityMapper.class);
  
+         suite.addTestSuite(IgniteBinaryObjectQueryArgumentsTest.class);
+         suite.addTestSuite(IgniteBinaryObjectQueryArgumentsOffheapTest.class);
+         suite.addTestSuite(IgniteBinaryObjectQueryArgumentsOffheapLocalTest.class);
+         suite.addTestSuite(IgniteBinaryObjectLocalQueryArgumentsTest.class);
+ 
          return suite;
      }
  }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/platforms/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/core-test/src/cache_query_test.cpp
index e3fba02,b8cd612..9a5371b
--- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
@@@ -296,93 -212,6 +296,93 @@@ namespace ignit
      }
  }
  
- /**
-  * Test setup fixture.
-  */
- struct CacheQueryTestSuiteFixture
- {
-     Ignite StartNode(const char* name)
-     {
-         IgniteConfiguration cfg;
- 
-         cfg.jvmOpts.push_back("-Xdebug");
-         cfg.jvmOpts.push_back("-Xnoagent");
-         cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-         cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-         cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
- 
- #ifdef IGNITE_TESTS_32
-         cfg.jvmInitMem = 256;
-         cfg.jvmMaxMem = 768;
- #else
-         cfg.jvmInitMem = 1024;
-         cfg.jvmMaxMem = 4096;
- #endif
- 
-         cfg.springCfgPath.assign(getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH")).append("/cache-query.xml");
- 
-         IgniteError err;
- 
-         Ignite grid0 = Ignition::Start(cfg, name, &err);
- 
-         if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
-             BOOST_ERROR(err.GetText());
- 
-         return grid0;
-     }
- 
- 
-     /**
-      * Constructor.
-      */
-     CacheQueryTestSuiteFixture() : 
-         grid(StartNode("Node1"))
-     {
-         // No-op.
-     }
- 
-     /**
-      * Destructor.
-      */
-     ~CacheQueryTestSuiteFixture()
-     {
-         Ignition::StopAll(true);
-     }
- 
-     /** Person cache accessor. */
-     Cache<int, QueryPerson> GetPersonCache()
-     {
-         return grid.GetCache<int, QueryPerson>("QueryPerson");
-     }
- 
-     /** Relation cache accessor. */
-     Cache<int, QueryRelation> GetRelationCache()
-     {
-         return grid.GetCache<int, QueryRelation>("QueryRelation");
-     }
- 
-     /** Node started during the test. */
-     Ignite grid;
- };
++///**
++// * Test setup fixture.
++// */
++//struct CacheQueryTestSuiteFixture
++//{
++//    Ignite StartNode(const char* name)
++//    {
++//        IgniteConfiguration cfg;
++//
++//        cfg.jvmOpts.push_back("-Xdebug");
++//        cfg.jvmOpts.push_back("-Xnoagent");
++//        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
++//        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
++//        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
++//
++//#ifdef IGNITE_TESTS_32
++//        cfg.jvmInitMem = 256;
++//        cfg.jvmMaxMem = 768;
++//#else
++//        cfg.jvmInitMem = 1024;
++//        cfg.jvmMaxMem = 4096;
++//#endif
++//
++//        cfg.springCfgPath.assign(getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH")).append("/cache-query.xml");
++//
++//        IgniteError err;
++//
++//        Ignite grid0 = Ignition::Start(cfg, name, &err);
++//
++//        if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
++//            BOOST_ERROR(err.GetText());
++//
++//        return grid0;
++//    }
++//
++//
++//    /**
++//     * Constructor.
++//     */
++//    CacheQueryTestSuiteFixture() : 
++//        grid(StartNode("Node1"))
++//    {
++//        // No-op.
++//    }
++//
++//    /**
++//     * Destructor.
++//     */
++//    ~CacheQueryTestSuiteFixture()
++//    {
++//        Ignition::StopAll(true);
++//    }
++//
++//    /** Person cache accessor. */
++//    Cache<int, QueryPerson> GetPersonCache()
++//    {
++//        return grid.GetCache<int, QueryPerson>("QueryPerson");
++//    }
++//
++    ///** Relation cache accessor. */
++    //Cache<int, QueryRelation> GetRelationCache()
++    //{
++    //    return grid.GetCache<int, QueryRelation>("QueryRelation");
++    //}
++//
++//    /** Node started during the test. */
++//    Ignite grid;
++//};
 +
 +/**
 + * Count number of records returned by cursor.
 + *
 + * @param cur Cursor.
 + */
 +template<typename Cursor>
 +int CountRecords(Cursor& cur)
 +{
 +    int number = 0;
 +    while (cur.HasNext())
 +    {
 +        ++number;
 +        cur.GetNext();
 +    }
 +
 +    return number;
 +}
 +
  /**
   * Ensure that HasNext() fails.
   *
@@@ -654,6 -465,131 +654,137 @@@ void CheckMultipleGetAll(QueryCursor<in
      }
  }
  
+ /**
+  * Test setup fixture.
+  */
+ struct CacheQueryTestSuiteFixture
+ {
+     Ignite StartNode(const char* name)
+     {
+         IgniteConfiguration cfg;
+ 
+         cfg.jvmOpts.push_back("-Xdebug");
+         cfg.jvmOpts.push_back("-Xnoagent");
+         cfg.jvmOpts.push_back("-Djava.compiler=NONE");
+         cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
+         cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
+ 
+ #ifdef IGNITE_TESTS_32
+         cfg.jvmInitMem = 256;
+         cfg.jvmMaxMem = 768;
+ #else
+         cfg.jvmInitMem = 1024;
+         cfg.jvmMaxMem = 4096;
+ #endif
+ 
+         cfg.springCfgPath.assign(getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH")).append("/cache-query.xml");
+ 
+         IgniteError err;
+ 
+         Ignite grid0 = Ignition::Start(cfg, name, &err);
+ 
+         if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+             BOOST_ERROR(err.GetText());
+ 
+         return grid0;
+     }
+ 
+     void CheckFieldsQueryPages(int32_t pageSize, int32_t pagesNum, int32_t additionalNum)
+     {
+         // Test simple query.
+         Cache<int, QueryPerson> cache = GetPersonCache();
+ 
+         // Test query with two fields of different type.
+         SqlFieldsQuery qry("select name, age from QueryPerson");
+ 
+         QueryFieldsCursor cursor = cache.Query(qry);
+         CheckEmpty(cursor);
+ 
+         const int32_t entryCnt = pageSize * pagesNum + additionalNum; // Number of entries.
+ 
+         qry.SetPageSize(pageSize);
+ 
+         for (int i = 0; i < entryCnt; i++)
+         {
+             std::stringstream stream;
+ 
+             stream << "A" << i;
+ 
+             cache.Put(i, QueryPerson(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1970 + i),
+                 BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)));
+         }
+ 
+         cursor = cache.Query(qry);
+ 
+         IgniteError error;
+ 
+         for (int i = 0; i < entryCnt; i++)
+         {
+             std::stringstream stream;
+ 
+             stream << "A" << i;
+ 
+             std::string expected_name = stream.str();
+             int expected_age = i * 10;
+ 
+             BOOST_REQUIRE(cursor.HasNext(error));
+             BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+ 
+             QueryFieldsRow row = cursor.GetNext(error);
+             BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+ 
+             BOOST_REQUIRE(row.HasNext(error));
+             BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+ 
+             std::string name = row.GetNext<std::string>(error);
+             BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+ 
+             BOOST_REQUIRE(name == expected_name);
+ 
+             int age = row.GetNext<int>(error);
+             BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
+ 
+             BOOST_REQUIRE(age == expected_age);
+ 
+             BOOST_REQUIRE(!row.HasNext());
+         }
+ 
+         CheckEmpty(cursor);
+     }
+ 
+     /**
+      * Constructor.
+      */
+     CacheQueryTestSuiteFixture() : 
+         grid(StartNode("Node1"))
+     {
+         // No-op.
+     }
+ 
+     /**
+      * Destructor.
+      */
+     ~CacheQueryTestSuiteFixture()
+     {
+         Ignition::StopAll(true);
+     }
+ 
+     /** Person cache accessor. */
+     Cache<int, QueryPerson> GetPersonCache()
+     {
+         return grid.GetCache<int, QueryPerson>("cache");
+     }
+ 
++    /** Relation cache accessor. */
++    Cache<int, QueryRelation> GetRelationCache()
++    {
++        return grid.GetCache<int, QueryRelation>("QueryRelation");
++    }
++
+     /** Node started during the test. */
+     Ignite grid;
+ };
+ 
  BOOST_FIXTURE_TEST_SUITE(CacheQueryTestSuite, CacheQueryTestSuiteFixture)
  
  /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc-test/src/configuration_test.cpp
index 1851eae,bfdb220..3893ad9
--- a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
@@@ -37,8 -37,7 +37,9 @@@ namespac
      const uint16_t testServerPort = 4242;
      const std::string testCacheName = "TestCache";
      const std::string testDsn = "Ignite DSN";
+     const int32_t testPageSize = 4321;
 +    const bool testDistributedJoins = true;
 +    const bool testEnforceJoinOrder = true;
  
      const std::string testAddress = testServerHost + ':' + ignite::common::LexicalCast<std::string>(testServerPort);
  }
@@@ -96,16 -77,14 +97,18 @@@ void CheckConnectionConfig(const Config
      BOOST_CHECK_EQUAL(cfg.GetAddress(), testAddress);
      BOOST_CHECK_EQUAL(cfg.GetCache(), testCacheName);
      BOOST_CHECK_EQUAL(cfg.GetDsn(), std::string());
+     BOOST_CHECK_EQUAL(cfg.GetPageSize(), testPageSize);
 +    BOOST_CHECK_EQUAL(cfg.IsDistributedJoins(), testDistributedJoins);
 +    BOOST_CHECK_EQUAL(cfg.IsEnforceJoinOrder(), testEnforceJoinOrder);
  
      std::stringstream constructor;
  
      constructor << "address=" << testAddress << ';'
                  << "cache=" << testCacheName << ';'
 +                << "distributed_joins=" << (testDistributedJoins ? "true" : "false") << ';'
                  << "driver={" << testDriverName << "};"
-                 << "enforce_join_order=" << (testEnforceJoinOrder ? "true" : "false") << ';';
++                << "enforce_join_order=" << (testEnforceJoinOrder ? "true" : "false") << ';'
+                 << "page_size=" << testPageSize << ';';
  
      const std::string& expectedStr = constructor.str();
  
@@@ -120,8 -99,7 +123,9 @@@ void CheckDsnConfig(const Configuration
      BOOST_CHECK_EQUAL(cfg.GetAddress(), Configuration::DefaultValue::address);
      BOOST_CHECK_EQUAL(cfg.GetHost(), std::string());
      BOOST_CHECK_EQUAL(cfg.GetTcpPort(), Configuration::DefaultValue::port);
+     BOOST_CHECK_EQUAL(cfg.GetPageSize(), Configuration::DefaultValue::pageSize);
 +    BOOST_CHECK_EQUAL(cfg.IsDistributedJoins(), false);
 +    BOOST_CHECK_EQUAL(cfg.IsEnforceJoinOrder(), false);
  }
  
  BOOST_AUTO_TEST_SUITE(ConfigurationTestSuite)
@@@ -133,8 -111,7 +137,9 @@@ BOOST_AUTO_TEST_CASE(CheckTestValuesNot
      BOOST_CHECK_NE(testServerPort, Configuration::DefaultValue::port);
      BOOST_CHECK_NE(testCacheName, Configuration::DefaultValue::cache);
      BOOST_CHECK_NE(testDsn, Configuration::DefaultValue::dsn);
+     BOOST_CHECK_NE(testPageSize, Configuration::DefaultValue::pageSize);
 +    BOOST_CHECK_NE(testDistributedJoins, Configuration::DefaultValue::distributedJoins);
 +    BOOST_CHECK_NE(testEnforceJoinOrder, Configuration::DefaultValue::enforceJoinOrder);
  }
  
  BOOST_AUTO_TEST_CASE(TestConnectStringUppercase)
@@@ -146,8 -123,7 +151,9 @@@
      constructor << "DRIVER={" << testDriverName << "};"
                  << "ADDRESS=" << testAddress << ';'
                  << "CACHE=" << testCacheName << ';'
 +                << "DISTRIBUTED_JOINS=" << (testDistributedJoins ? "TRUE" : "FALSE") << ';'
-                 << "ENFORCE_JOIN_ORDER=" << (testEnforceJoinOrder ? "TRUE" : "FALSE");
++                << "ENFORCE_JOIN_ORDER=" << (testEnforceJoinOrder ? "TRUE" : "FALSE") << ';'
+                 << "PAGE_SIZE=" << testPageSize;
  
      const std::string& connectStr = constructor.str();
  
@@@ -164,9 -140,8 +170,10 @@@ BOOST_AUTO_TEST_CASE(TestConnectStringL
  
      constructor << "driver={" << testDriverName << "};"
                  << "address=" << testAddress << ';'
+                 << "page_size=" << testPageSize << ';'
 -                << "cache=" << testCacheName << ';';
 +                << "cache=" << testCacheName << ';'
 +                << "distributed_joins=" << (testDistributedJoins ? "true" : "false") << ';'
 +                << "enforce_join_order=" << (testEnforceJoinOrder ? "true" : "false");
  
      const std::string& connectStr = constructor.str();
  
@@@ -183,9 -158,8 +190,10 @@@ BOOST_AUTO_TEST_CASE(TestConnectStringZ
  
      constructor << "driver={" << testDriverName << "};"
                  << "address=" << testAddress << ';'
+                 << "page_size=" << testPageSize << ';'
 -                << "cache=" << testCacheName << ';';
 +                << "cache=" << testCacheName << ';'
 +                << "distributed_joins=" << (testDistributedJoins ? "true" : "false") << ';'
 +                << "enforce_join_order=" << (testEnforceJoinOrder ? "true" : "false");
  
      const std::string& connectStr = constructor.str();
  
@@@ -202,9 -176,8 +210,10 @@@ BOOST_AUTO_TEST_CASE(TestConnectStringM
  
      constructor << "Driver={" << testDriverName << "};"
                  << "Address=" << testAddress << ';'
+                 << "Page_Size=" << testPageSize << ';'
 -                << "Cache=" << testCacheName << ';';
 +                << "Cache=" << testCacheName << ';'
 +                << "Distributed_Joins=" << (testDistributedJoins ? "True" : "False") << ';'
 +                << "Enforce_Join_Order=" << (testEnforceJoinOrder ? "True" : "False");
  
      const std::string& connectStr = constructor.str();
  
@@@ -221,9 -194,8 +230,10 @@@ BOOST_AUTO_TEST_CASE(TestConnectStringW
  
      constructor << "DRIVER = {" << testDriverName << "} ;\n"
                  << " ADDRESS =" << testAddress << "; "
+                 << "   PAGE_SIZE= " << testPageSize << ';'
 -                << "CACHE = \n\r" << testCacheName << ';';
 +                << "CACHE = \n\r" << testCacheName << ';'
 +                << "   DISTRIBUTED_JOINS=" << (testDistributedJoins ? "TRUE" : "FALSE") << ';'
 +                << "ENFORCE_JOIN_ORDER=   " << (testEnforceJoinOrder ? "TRUE  " : "FALSE  ");
  
      const std::string& connectStr = constructor.str();
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
index 8e19a6e,b5f385e..05a9ec3
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/config/configuration.h
@@@ -62,14 -62,11 +62,17 @@@ namespace ignit
                      /** Connection attribute keyword for port attribute. */
                      static const std::string port;
  
 +                    /** Connection attribute keyword for distributed joins attribute. */
 +                    static const std::string distributedJoins;
 +
 +                    /** Connection attribute keyword for enforce join order attribute. */
 +                    static const std::string enforceJoinOrder;
 +
                      /** Connection attribute keyword for protocol version attribute. */
                      static const std::string protocolVersion;
+ 
+                     /** Connection attribute keyword for fetch results page size attribute. */
+                     static const std::string pageSize;
                  };
  
                  /** Default values for configuration. */
@@@ -96,11 -93,8 +99,14 @@@
                      /** Default value for port attribute. */
                      static const uint16_t port;
  
+                     /** Default value for fetch results page size attribute. */
+                     static const int32_t pageSize;
++
 +                    /** Default value for distributed joins attribute. */
 +                    static const bool distributedJoins;
 +
 +                    /** Default value for enforce join order attribute. */
 +                    static const bool enforceJoinOrder;
                  };
  
                  /**
@@@ -263,70 -263,53 +275,92 @@@
                  }
  
                  /**
 +                 * Check distributed joins flag.
 +                 *
 +                 * @return True if distributed joins are enabled.
 +                 */
 +                bool IsDistributedJoins() const
 +                {
 +                    return GetBoolValue(Key::distributedJoins, DefaultValue::distributedJoins);
 +                }
 +
 +                /**
 +                 * Set distributed joins.
 +                 *
 +                 * @param val Value to set.
 +                 */
 +                void SetDistributedJoins(bool val)
 +                {
 +                    SetBoolValue(Key::distributedJoins, val);
 +                }
 +
 +                /**
 +                 * Check enforce join order flag.
 +                 *
 +                 * @return True if enforcing of join order is enabled.
 +                 */
 +                bool IsEnforceJoinOrder() const
 +                {
 +                    return GetBoolValue(Key::enforceJoinOrder, DefaultValue::enforceJoinOrder);
 +                }
 +
 +                /**
 +                 * Set enforce joins.
 +                 *
 +                 * @param val Value to set.
 +                 */
 +                void SetEnforceJoinOrder(bool val)
 +                {
 +                    SetBoolValue(Key::enforceJoinOrder, val);
 +                }
 +
 +                /**
+                  * Get protocol version.
+                  *
+                  * @return Protocol version.
+                  */
+                 ProtocolVersion GetProtocolVersion() const;
+ 
+                 /**
+                  * Set protocol version.
+                  *
+                  * @param version Version to set.
+                  */
+                 void SetProtocolVersion(const std::string& version)
+                 {
+                     arguments[Key::protocolVersion] = version;
+                 }
+ 
+                 /**
 +                 * Get argument map.
 +                 *
 +                 * @return Argument map.
 +                 */
 +                const ArgumentMap& GetMap() const
 +                {
 +                    return arguments;
 +                }
 +
 +                /**
-                  * Get protocol version.
+                  * Get fetch results page size.
                   *
-                  * @return Protocol version.
+                  * @return Fetch results page size.
                   */
-                 ProtocolVersion GetProtocolVersion() const;
- 
+                 int32_t GetPageSize() const
+                 {
+                     return static_cast<int32_t>(GetIntValue(Key::pageSize, DefaultValue::pageSize));
+                 }
 -
                  /**
-                  * Set protocol version.
+                  * Set fetch results page size.
                   *
-                  * @param version Version to set.
+                  * @param size Fetch results page size.
                   */
-                 void SetProtocolVersion(const std::string& version);
+                 void SetPageSize(int32_t size)
+                 {
+                     arguments[Key::pageSize] = common::LexicalCast<std::string>(size);
+                 }
  
                  /**
 -                 * Get argument map.
 -                 *
 -                 * @return Argument map.
 -                 */
 -                const ArgumentMap& GetMap() const
 -                {
 -                    return arguments;
 -                }
 -
 -                /**
                   * Get string value from the config.
                   *
                   * @param key Configuration key.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
index d2cb569,f034a8b..32f3520
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/system/ui/dsn_configuration_window.h
@@@ -46,10 -46,8 +46,12 @@@ namespace ignit
                          ID_ADDRESS_LABEL,
                          ID_CACHE_EDIT,
                          ID_CACHE_LABEL,
+                         ID_PAGE_SIZE_EDIT,
+                         ID_PAGE_SIZE_LABEL,
 +                        ID_DISTRIBUTED_JOINS_CHECK_BOX,
 +                        ID_ENFORCE_JOIN_ORDER_CHECK_BOX,
 +                        ID_PROTOCOL_VERSION_LABEL,
 +                        ID_PROTOCOL_VERSION_COMBO_BOX,
                          ID_OK_BUTTON,
                          ID_CANCEL_BUTTON
                      };
@@@ -120,18 -118,12 +122,24 @@@
                      /** DSN cache edit field. */
                      std::auto_ptr<Window> cacheEdit;
  
+                     /** DSN fetch page size edit field label. */
+                     std::auto_ptr<Window> pageSizeLabel;
+ 
+                     /** DSN fetch page size edit field. */
+                     std::auto_ptr<Window> pageSizeEdit;
+ 
 +                    /** Distributed joins CheckBox. */
 +                    std::auto_ptr<Window> distributedJoinsCheckBox;
 +
 +                    /** Enforce join order CheckBox. */
 +                    std::auto_ptr<Window> enforceJoinOrderCheckBox;
 +
 +                    /** Protocol version edit field. */
 +                    std::auto_ptr<Window> protocolVersionLabel;
 +
 +                    /** Protocol verion ComboBox. */
 +                    std::auto_ptr<Window> protocolVersionComboBox;
 +
                      /** Ok button. */
                      std::auto_ptr<Window> okButton;
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
index 663333a,49f87d8..a758bd9
--- a/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system/ui/dsn_configuration_window.cpp
@@@ -30,7 -30,7 +30,7 @@@ namespace ignit
                  DsnConfigurationWindow::DsnConfigurationWindow(Window* parent, config::Configuration& config):
                      CustomWindow(parent, "IgniteConfigureDsn", "Configure Apache Ignite DSN"),
                      width(360),
-                     height(230),
 -                    height(200),
++                    height(270),
                      connectionSettingsGroupBox(),
                      nameLabel(),
                      nameEdit(),
@@@ -38,10 -38,8 +38,12 @@@
                      addressEdit(),
                      cacheLabel(),
                      cacheEdit(),
+                     pageSizeLabel(),
+                     pageSizeEdit(),
 +                    distributedJoinsCheckBox(),
 +                    enforceJoinOrderCheckBox(),
 +                    protocolVersionLabel(),
 +                    protocolVersionComboBox(),
                      okButton(),
                      cancelButton(),
                      config(config),
@@@ -117,40 -115,14 +119,50 @@@
  
                      rowPos += interval + rowSize;
  
+                     std::string tmp = common::LexicalCast<std::string>(config.GetPageSize());
+                     val = tmp.c_str();
+                     pageSizeLabel = CreateLabel(labelPosX, rowPos, labelSizeX,
+                         rowSize, "Page size:", ID_PAGE_SIZE_LABEL);
+ 
+                     pageSizeEdit = CreateEdit(editPosX, rowPos, editSizeX, 
+                         rowSize, val, ID_PAGE_SIZE_EDIT, ES_NUMBER);
+ 
++                    rowPos += interval + rowSize;
++
 +                    protocolVersionLabel = CreateLabel(labelPosX, rowPos, labelSizeX, rowSize,
 +                        "Protocol version:", ID_PROTOCOL_VERSION_LABEL);
 +                    protocolVersionComboBox = CreateComboBox(editPosX, rowPos, editSizeX, rowSize,
 +                        "Protocol version", ID_PROTOCOL_VERSION_COMBO_BOX);
 +
 +                    int id = 0;
 +
 +                    const ProtocolVersion::StringToVersionMap& versionMap = ProtocolVersion::GetMap();
 +
 +                    ProtocolVersion::StringToVersionMap::const_iterator it;
 +                    for (it = versionMap.begin(); it != versionMap.end(); ++it)
 +                    {
 +                        protocolVersionComboBox->AddString(it->first);
 +
 +                        if (it->second == config.GetProtocolVersion())
 +                            protocolVersionComboBox->SetSelection(id);
 +
 +                        ++id;
 +                    }
 +
 +                    rowPos += interval + rowSize;
 +
 +                    distributedJoinsCheckBox = CreateCheckBox(editPosX, rowPos, checkBoxSize, rowSize,
 +                        "Distributed Joins", ID_DISTRIBUTED_JOINS_CHECK_BOX, config.IsDistributedJoins());
 +
 +                    enforceJoinOrderCheckBox = CreateCheckBox(editPosX + checkBoxSize + interval, rowPos, checkBoxSize,
 +                        rowSize, "Enforce Join Order", ID_ENFORCE_JOIN_ORDER_CHECK_BOX, config.IsEnforceJoinOrder());
 +
 +                    if (!config.GetProtocolVersion().IsDistributedJoinsSupported())
 +                    {
 +                        distributedJoinsCheckBox->SetEnabled(false);
 +                        enforceJoinOrderCheckBox->SetEnabled(false);
 +                    }
 +
                      rowPos += interval * 2 + rowSize;
  
                      connectionSettingsGroupBox = CreateGroupBox(margin, sectionBegin, width - 2 * margin,
@@@ -265,29 -198,26 +277,37 @@@
                      std::string dsn;
                      std::string address;
                      std::string cache;
+                     std::string pageSizeStr;
 +                    std::string version;
 +
 +                    bool distributedJoins;
 +                    bool enforceJoinOrder;
  
                      nameEdit->GetText(dsn);
                      addressEdit->GetText(address);
                      cacheEdit->GetText(cache);
 +                    protocolVersionComboBox->GetText(version);
+                     pageSizeEdit->GetText(pageSizeStr);
+ 
+                     int32_t pageSize = common::LexicalCast<int32_t>(pageSizeStr);
+ 
+                     if (pageSize <= 0)
+                         pageSize = config.GetPageSize();
  
                      common::StripSurroundingWhitespaces(address);
                      common::StripSurroundingWhitespaces(dsn);
  
 +                    distributedJoins = distributedJoinsCheckBox->IsEnabled() && distributedJoinsCheckBox->IsChecked();
 +                    enforceJoinOrder = enforceJoinOrderCheckBox->IsEnabled() && enforceJoinOrderCheckBox->IsChecked();
 +
                      LOG_MSG("Retriving arguments:\n");
 -                    LOG_MSG("DSN:        %s\n", dsn.c_str());
 -                    LOG_MSG("Address:    %s\n", address.c_str());
 -                    LOG_MSG("Cache:      %s\n", cache.c_str());
 -                    LOG_MSG("Page size:  %d\n", pageSize);
 +                    LOG_MSG("DSN:                %s\n", dsn.c_str());
 +                    LOG_MSG("Address:            %s\n", address.c_str());
 +                    LOG_MSG("Cache:              %s\n", cache.c_str());
++                    LOG_MSG("Page size:          %d\n", pageSize);
 +                    LOG_MSG("Protocol version:   %s\n", version.c_str());
 +                    LOG_MSG("Distributed Joins:  %s\n", distributedJoins ? "true" : "false");
 +                    LOG_MSG("Enforce Join Order: %s\n", enforceJoinOrder ? "true" : "false");
  
                      if (dsn.empty())
                          throw IgniteError(IgniteError::IGNITE_ERR_GENERIC, "DSN name can not be empty.");
@@@ -295,9 -225,7 +315,10 @@@
                      cfg.SetDsn(dsn);
                      cfg.SetAddress(address);
                      cfg.SetCache(cache);
+                     cfg.SetPageSize(pageSize);
 +                    cfg.SetProtocolVersion(version);
 +                    cfg.SetDistributedJoins(distributedJoins);
 +                    cfg.SetEnforceJoinOrder(enforceJoinOrder);
                  }
              }
          }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/platforms/cpp/odbc/src/config/configuration.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/src/config/configuration.cpp
index dbe40bd,74ccaaf..f39e562
--- a/modules/platforms/cpp/odbc/src/config/configuration.cpp
+++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp
@@@ -38,24 -38,20 +38,25 @@@ namespace ignit
              const std::string Configuration::Key::address           = "address";
              const std::string Configuration::Key::server            = "server";
              const std::string Configuration::Key::port              = "port";
 +            const std::string Configuration::Key::distributedJoins  = "distributed_joins";
 +            const std::string Configuration::Key::enforceJoinOrder  = "enforce_join_order";
              const std::string Configuration::Key::protocolVersion   = "protocol_version";
+             const std::string Configuration::Key::pageSize          = "page_size";
  
-             const std::string Configuration::DefaultValue::dsn             = "Apache Ignite DSN";
-             const std::string Configuration::DefaultValue::driver          = "Apache Ignite";
-             const std::string Configuration::DefaultValue::cache           = "";
-             const std::string Configuration::DefaultValue::address         = "";
-             const std::string Configuration::DefaultValue::server          = "";
+             const std::string Configuration::DefaultValue::dsn      = "Apache Ignite DSN";
+             const std::string Configuration::DefaultValue::driver   = "Apache Ignite";
+             const std::string Configuration::DefaultValue::cache    = "";
+             const std::string Configuration::DefaultValue::address  = "";
+             const std::string Configuration::DefaultValue::server   = "";
  
-             const uint16_t Configuration::DefaultValue::port = 10800;
+             const uint16_t Configuration::DefaultValue::port    = 10800;
+             const int32_t Configuration::DefaultValue::pageSize = 1024;
  
 +            const bool Configuration::DefaultValue::distributedJoins = false;
 +            const bool Configuration::DefaultValue::enforceJoinOrder = false;
 +
              const ProtocolVersion& Configuration::DefaultValue::protocolVersion = ProtocolVersion::GetCurrent();
  
- 
              Configuration::Configuration() :
                  arguments()
              {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3b391849/modules/platforms/cpp/odbc/src/dsn_config.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc/src/dsn_config.cpp
index a304567,356bcaa..2edeab0
--- a/modules/platforms/cpp/odbc/src/dsn_config.cpp
+++ b/modules/platforms/cpp/odbc/src/dsn_config.cpp
@@@ -91,11 -91,13 +91,17 @@@ namespace ignit
          void ReadDsnConfiguration(const char* dsn, Configuration& config)
          {
              std::string address = ReadDsnString(dsn, Configuration::Key::address, config.GetAddress().c_str());
+ 
              std::string server = ReadDsnString(dsn, Configuration::Key::server, config.GetHost().c_str());
+ 
              uint16_t port = ReadDsnInt(dsn, Configuration::Key::port, config.GetTcpPort());
+ 
              std::string cache = ReadDsnString(dsn, Configuration::Key::cache, config.GetCache().c_str());
+ 
 +            bool distributedJoins = ReadDsnBool(dsn, Configuration::Key::distributedJoins, config.IsDistributedJoins());
++
 +            bool enforceJoinOrder = ReadDsnBool(dsn, Configuration::Key::enforceJoinOrder, config.IsEnforceJoinOrder());
++
              std::string version = ReadDsnString(dsn, Configuration::Key::protocolVersion,
                  config.GetProtocolVersion().ToString().c_str());
  
@@@ -105,11 -110,8 +114,10 @@@
              config.SetHost(server);
              config.SetTcpPort(port);
              config.SetCache(cache);
 +            config.SetDistributedJoins(distributedJoins);
 +            config.SetEnforceJoinOrder(enforceJoinOrder);
              config.SetProtocolVersion(version);
- 
-             LOG_MSG("%d\n", __LINE__);
+             config.SetPageSize(pageSize);
          }
      }
  }


[17/49] ignite git commit: IGNITE-3743: ODBC: Added procedure call escape sequence support. This closes #1008.

Posted by sb...@apache.org.
IGNITE-3743: ODBC: Added procedure call escape sequence support. This closes #1008.


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

Branch: refs/heads/ignite-comm-opts1
Commit: df8163f1ad3a390bb8d51b0eb2f378b5b3663025
Parents: 42963e6
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Mon Sep 5 14:15:59 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 14:15:59 2016 +0300

----------------------------------------------------------------------
 .../processors/odbc/escape/OdbcEscapeType.java  |   4 +
 .../processors/odbc/escape/OdbcEscapeUtils.java |   5 +
 .../odbc/OdbcEscapeSequenceSelfTest.java        | 125 +++++++++++++++++++
 3 files changed, 134 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/df8163f1/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
index 3bf0324..c7e3234 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeType.java
@@ -27,6 +27,9 @@ public enum OdbcEscapeType {
     /** Outer join. */
     OUTER_JOIN("oj", true, false),
 
+    /** Stored procedure call */
+    CALL("call", true, false),
+
     /** Date. */
     DATE("d", true, false),
 
@@ -47,6 +50,7 @@ public enum OdbcEscapeType {
         SCALAR_FUNCTION, // Assume that scalar functions are very frequent.
         DATE, TIMESTAMP, // Date and timestamp are relatively frequent as well; also TS must go before T.
         OUTER_JOIN,      // Joins are less frequent,
+        CALL,            // Procedure calls are less frequent than joins.
         LIKE, TIME, GUID // LIKE, TIME and GUID are even less frequent.
     };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/df8163f1/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
index 48d4296..88afc52 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/escape/OdbcEscapeUtils.java
@@ -278,6 +278,11 @@ public class OdbcEscapeUtils {
             case OUTER_JOIN:
                 return parseExpression(text, startPos0, len0);
 
+            case CALL: {
+                String val = parseExpression(text, startPos0, len0);
+
+                return "CALL " + val;
+            }
             default:
                 throw new IgniteException("Unsupported escape sequence token [text=" +
                     substring(text, startPos, len) + ", token=" + token.type().body() + ']');

http://git-wip-us.apache.org/repos/asf/ignite/blob/df8163f1/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
index 3fec7d3..26221ea 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/odbc/OdbcEscapeSequenceSelfTest.java
@@ -540,6 +540,131 @@ public class OdbcEscapeSequenceSelfTest extends GridCommonAbstractTest {
         checkFail("{fn func(arg')}");
     }
 
+
+    /**
+     * Test escape sequence series.
+     */
+    public void testSimpleCallProc() throws Exception {
+        check(
+            "CALL test()",
+            "{call test()}"
+        );
+
+        check(
+            "select CALL test()",
+            "select {call test()}"
+        );
+
+        check(
+            "select CALL test() from table;",
+            "select {call test()} from table;"
+        );
+
+        check(
+            "CALL func(field1) CALL func(field2)",
+            "{call func(field1)} {call func(field2)}"
+        );
+
+        check(
+            "select CALL func(field1), CALL func(field2)",
+            "select {call func(field1)}, {call func(field2)}"
+        );
+
+        check(
+            "select CALL func(field1), CALL func(field2) from table;",
+            "select {call func(field1)}, {call func(field2)} from table;"
+        );
+    }
+
+    /**
+     * Test simple nested escape sequences. Depth = 2.
+     */
+    public void testNestedCallProc() throws Exception {
+        check(
+            "CALL func1(field1, CALL func2(field2))",
+            "{call func1(field1, {call func2(field2)})}"
+        );
+
+        check(
+            "select CALL func1(field1, CALL func2(field2))",
+            "select {call func1(field1, {call func2(field2)})}"
+        );
+
+        check(
+            "select CALL func1(field1, CALL func2(field2), field3) from SomeTable;",
+            "select {call func1(field1, {call func2(field2)}, field3)} from SomeTable;"
+        );
+    }
+
+    /**
+     * Test nested escape sequences. Depth > 2.
+     */
+    public void testDeepNestedCallProc() {
+        check(
+            "CALL func1(CALL func2(CALL func3(field1)))",
+            "{call func1({call func2({call func3(field1)})})}"
+        );
+
+        check(
+            "CALL func1(CALL func2(CALL func3(CALL func4(field1))))",
+            "{call func1({call func2({call func3({call func4(field1)})})})}"
+        );
+
+        check(
+            "select CALL func1(field1, CALL func2(CALL func3(field2), field3))",
+            "select {call func1(field1, {call func2({call func3(field2)}, field3)})}"
+        );
+
+        check(
+            "select CALL func1(field1, CALL func2(CALL func3(field2), field3)) from SomeTable;",
+            "select {call func1(field1, {call func2({call func3(field2)}, field3)})} from SomeTable;"
+        );
+    }
+
+    /**
+     * Test series of nested escape sequences.
+     */
+    public void testNestedCallProcMixed() {
+        check(
+            "CALL func1(CALL func2(field1), CALL func3(field2))",
+            "{call func1({call func2(field1)}, {call func3(field2)})}"
+        );
+
+        check(
+            "select CALL func1(CALL func2(field1), CALL func3(field2)) from table;",
+            "select {call func1({call func2(field1)}, {call func3(field2)})} from table;"
+        );
+
+        check(
+            "CALL func1(CALL func2(CALL func3(field1))) CALL func1(CALL func2(field2))",
+            "{call func1({call func2({call func3(field1)})})} {call func1({call func2(field2)})}"
+        );
+    }
+
+    /**
+     * Test invalid escape sequence.
+     */
+    public void testFailedOnInvalidCallProcSequence() {
+        checkFail("{callfunc1()}");
+
+        checkFail("select {call func1(field1, {call func2(field2), field3)} from SomeTable;");
+
+        checkFail("select {call func1(field1, call func2(field2)}, field3)} from SomeTable;");
+    }
+
+    /**
+     * Test escape sequences with additional whitespace characters
+     */
+    public void testCallProcEscapeSequenceWithWhitespaces() throws Exception {
+        check("CALL func1()", "{ call func1()}");
+
+        check("CALL func1()", "{    call  func1()}");
+
+        check("CALL func1()", "{ \n call\nfunc1()}");
+
+        checkFail("{ \n func1()}");
+    }
+
     /**
      * Check parsing logic.
      *


[38/49] ignite git commit: IGNITE-3857: IGFS: Support direct PROXY mode invocation in methods: listPaths / listFiles. This closes #1048.

Posted by sb...@apache.org.
IGNITE-3857: IGFS: Support direct PROXY mode invocation in methods: listPaths / listFiles. This closes #1048.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 1cc502d64ca058d97b071f7db0ee18f3aac3dfd7
Parents: cc59502
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Thu Sep 8 15:17:26 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 8 15:17:26 2016 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/processors/igfs/IgfsImpl.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1cc502d6/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index a6d5b77..636b4a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -840,7 +840,7 @@ public final class IgfsImpl implements IgfsEx {
 
                 Collection<IgfsPath> files = new HashSet<>();
 
-                if (IgfsUtils.isDualMode(mode)) {
+                if (mode != PRIMARY) {
                     assert secondaryFs != null;
 
                     try {
@@ -848,7 +848,7 @@ public final class IgfsImpl implements IgfsEx {
 
                         files.addAll(children);
 
-                        if (!modeRslvr.hasPrimaryChild(path))
+                        if (mode == PROXY || !modeRslvr.hasPrimaryChild(path))
                             return files;
                     }
                     catch (Exception e) {
@@ -889,7 +889,7 @@ public final class IgfsImpl implements IgfsEx {
 
                 Collection<IgfsFile> files = new HashSet<>();
 
-                if (IgfsUtils.isDualMode(mode)) {
+                if (mode != PRIMARY) {
                     assert secondaryFs != null;
 
                     try {
@@ -901,7 +901,7 @@ public final class IgfsImpl implements IgfsEx {
                             files.add(impl);
                         }
 
-                        if (!modeRslvr.hasPrimaryChild(path))
+                        if (mode == PROXY || !modeRslvr.hasPrimaryChild(path))
                             return files;
                     }
                     catch (Exception e) {


[22/49] ignite git commit: IGNITE-2833: GridCacheTtlManager pending queue retention size optimization.

Posted by sb...@apache.org.
IGNITE-2833: GridCacheTtlManager pending queue retention size optimization.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 355082958b476009179254df9be20e225179cb7c
Parents: 2c397d2
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Mon Sep 5 18:06:27 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 18:06:27 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheTtlManager.java   | 24 ++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/35508295/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
index ae2895e..8ff0358 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache;
 
 import java.util.concurrent.atomic.AtomicLongFieldUpdater;
+
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -106,7 +107,8 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
 
                     break;
                 }
-            } else
+            }
+            else
                 break;
         }
     }
@@ -156,10 +158,11 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
                 if (log.isTraceEnabled())
                     log.trace("Trying to remove expired entry from cache: " + e);
 
-                GridCacheEntryEx entry = e.entry;
 
                 boolean touch = false;
 
+                GridCacheEntryEx entry = e.ctx.cache().entryEx(e.key);
+
                 while (true) {
                     try {
                         if (entry.onTtlExpired(obsoleteVer))
@@ -278,8 +281,11 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
         /** Entry expire time. */
         private final long expireTime;
 
-        /** Entry. */
-        private final GridCacheMapEntry entry;
+        /** Cache Object Context */
+        private final GridCacheContext ctx;
+
+        /** Cache Object Key */
+        private final CacheObject key;
 
         /**
          * @param entry Cache entry to create wrapper for.
@@ -289,7 +295,8 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
 
             assert expireTime != 0;
 
-            this.entry = entry;
+            this.ctx = entry.context();
+            this.key = entry.key();
         }
 
         /** {@inheritDoc} */
@@ -297,7 +304,7 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
             int res = Long.compare(expireTime, o.expireTime);
 
             if (res == 0)
-                res = compareKeys(entry.context(), entry.key(), o.entry.context(), o.entry.key());
+                res = compareKeys(ctx, key, o.ctx, o.key);
 
             return res;
         }
@@ -312,15 +319,14 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
 
             EntryWrapper that = (EntryWrapper)o;
 
-            return expireTime == that.expireTime &&
-                compareKeys(entry.context(), entry.key(), that.entry.context(), that.entry.key()) == 0;
+            return expireTime == that.expireTime && compareKeys(ctx, key, that.ctx, that.key) == 0;
         }
 
         /** {@inheritDoc} */
         @Override public int hashCode() {
             int res = (int)(expireTime ^ (expireTime >>> 32));
 
-            res = 31 * res + entry.key().hashCode();
+            res = 31 * res + key.hashCode();
 
             return res;
         }


[45/49] ignite git commit: Merge branch ignite-1.6.8 into ignite-1.7.2.

Posted by sb...@apache.org.
Merge branch ignite-1.6.8 into ignite-1.7.2.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 35d6a56c9b70af9c25b61f5be18a5d050b2a7922
Parents: 3b39184 6c3993d
Author: AKuznetsov <ak...@gridgain.com>
Authored: Sun Sep 11 22:16:02 2016 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Sun Sep 11 22:16:02 2016 +0700

----------------------------------------------------------------------
 .../datastreamer/DataStreamerImpl.java          | 69 +++++++++++++++-----
 1 file changed, 51 insertions(+), 18 deletions(-)
----------------------------------------------------------------------



[47/49] ignite git commit: Fixed test.

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


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

Branch: refs/heads/ignite-comm-opts1
Commit: 241b7933ddae77f8e39b167a025a1e442e629504
Parents: 843979d
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 12 10:44:56 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 12 10:44:56 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAbstractFullApiSelfTest.java         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/241b7933/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 5c86057..c0318c8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -298,7 +298,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         for (int i = 0; i < gridCount(); i++) {
             Boolean clientMode = grid(i).configuration().isClientMode();
 
-            if (clientMode)
+            if (clientMode != null && clientMode) // Can be null in multi jvm tests.
                 continue;
 
             grid(0).services(grid(0).cluster()).deployNodeSingleton(SERVICE_NAME1, new DummyServiceImpl());


[15/49] ignite git commit: IGNITE-3834: Fixed a problem with BinaryMarshaller handles resolution.

Posted by sb...@apache.org.
IGNITE-3834: Fixed a problem with BinaryMarshaller handles resolution.


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

Branch: refs/heads/ignite-comm-opts1
Commit: 40d4b6ac6a71ed541d20018cf7deb2fb9b9bbb9b
Parents: d65228e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Sep 5 11:35:26 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 5 11:35:26 2016 +0300

----------------------------------------------------------------------
 .../internal/binary/BinaryReaderHandles.java    |  2 +-
 .../binary/BinaryMarshallerSelfTest.java        | 38 ++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/40d4b6ac/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
index fddb8aa..881060f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandles.java
@@ -57,7 +57,7 @@ public class BinaryReaderHandles {
                 return null;
 
             case MODE_SINGLE:
-                return (T)data;
+                 return pos == singlePos ? (T)data : null;
 
             default:
                 assert mode == MODE_MULTIPLE;

http://git-wip-us.apache.org/repos/asf/ignite/blob/40d4b6ac/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
index f4c1bf7..b347ec0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
@@ -2896,6 +2896,21 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testSingleHandle() throws Exception {
+        SingleHandleA a = new SingleHandleA(new SingleHandleB());
+
+        BinaryObjectImpl bo = marshal(a, binaryMarshaller());
+
+        Map<String, BinaryObject> map = bo.field("map");
+
+        BinaryObject innerBo = map.get("key");
+
+        assertEquals(SingleHandleB.class, innerBo.deserialize().getClass());
+    }
+
+    /**
      *
      */
     private static interface SomeItf {
@@ -4847,4 +4862,27 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
             return value;
         }
     }
+
+    /**
+     */
+    private static class SingleHandleA {
+        /** */
+        private SingleHandleB b;
+
+        /** */
+        private Map<Object, SingleHandleB> map = new HashMap<>();
+
+        /**
+         * @param b B.
+         */
+        SingleHandleA(SingleHandleB b) {
+            this.b = b;
+
+            map.put("key", b);
+        }
+    }
+
+    /**
+     */
+    private static class SingleHandleB {}
 }