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

[1/6] ignite git commit: ignite-1.5 Fixed javadoc.

Repository: ignite
Updated Branches:
  refs/heads/ignite-2099 22322fa0d -> 84006b957


ignite-1.5 Fixed javadoc.


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

Branch: refs/heads/ignite-2099
Commit: 049f5bebd50e1350a7bf80886da7dbda46cf3ab6
Parents: 6791c50
Author: sboikov <sb...@gridgain.com>
Authored: Wed Dec 9 18:17:12 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Dec 9 18:17:12 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/thread/IgniteThread.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/049f5beb/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java b/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
index 974fa94..a9f1fbb 100644
--- a/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
+++ b/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
@@ -88,7 +88,11 @@ public class IgniteThread extends Thread {
         this.gridName = gridName;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Gets name of the grid this thread belongs to.
+     *
+     * @return Name of the grid this thread belongs to.
+     */
     public String getGridName() {
         return gridName;
     }


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

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


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

Branch: refs/heads/ignite-2099
Commit: e2316ff9160ef8e54f8edeed47d02a0976edcac8
Parents: 637b79a 049f5be
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Dec 9 18:19:18 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Dec 9 18:19:18 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/thread/IgniteThread.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[5/6] ignite git commit: IGNITE-2093 Implemented scan for near cache.

Posted by vo...@apache.org.
IGNITE-2093 Implemented scan for near cache.


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

Branch: refs/heads/ignite-2099
Commit: 1a3c78400d0b804c5d9046604f3f114786af7003
Parents: b541daf
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Dec 10 12:55:57 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 10 12:55:57 2015 +0700

----------------------------------------------------------------------
 .../ignite/internal/visor/cache/VisorCache.java | 13 ++++
 .../internal/visor/query/VisorQueryJob.java     | 76 +++++++++++++++++---
 .../internal/visor/query/VisorQueryUtils.java   |  5 +-
 3 files changed, 84 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1a3c7840/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index 1bbcf2f..6def8c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -108,6 +108,9 @@ public class VisorCache implements Serializable {
     /** Cache partitions states. */
     private GridDhtPartitionMap2 partitionsMap;
 
+    /** Flag indicating that cache has near cache. */
+    private boolean near;
+
     /**
      * @param ignite Grid.
      * @param cacheName Cache name.
@@ -140,6 +143,8 @@ public class VisorCache implements Serializable {
 
         CacheConfiguration cfg = ca.configuration();
 
+        near = ca.context().isNear();
+
         mode = cfg.getCacheMode();
 
         boolean partitioned = (mode == CacheMode.PARTITIONED || mode == CacheMode.REPLICATED)
@@ -275,6 +280,7 @@ public class VisorCache implements Serializable {
         c.primaryPartitions = Collections.emptyList();
         c.backupPartitions = Collections.emptyList();
         c.metrics = metrics;
+        c.near = near;
 
         return c;
     }
@@ -405,6 +411,13 @@ public class VisorCache implements Serializable {
         return partitionsMap;
     }
 
+    /**
+     * @return {@code true} if cache has near cache.
+     */
+    public boolean near() {
+        return near;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(VisorCache.class, this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a3c7840/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
index 40c5cc3..50e5a06 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
@@ -20,11 +20,14 @@ package org.apache.ignite.internal.visor.query;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentMap;
 import javax.cache.Cache;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
@@ -39,6 +42,7 @@ import org.apache.ignite.lang.IgniteBiTuple;
 import static org.apache.ignite.internal.visor.query.VisorQueryUtils.RMV_DELAY;
 import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_COL_NAMES;
 import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_QRY_NAME;
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_NEAR_CACHE;
 import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SQL_QRY_NAME;
 import static org.apache.ignite.internal.visor.query.VisorQueryUtils.fetchScanQueryRows;
 import static org.apache.ignite.internal.visor.query.VisorQueryUtils.fetchSqlQueryRows;
@@ -70,26 +74,49 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
         return cacheProcessor.jcache(cacheName);
     }
 
+    /**
+     * Execute scan query.
+     *
+     * @param c Cache to scan.
+     * @param arg Job argument with query parameters.
+     * @return Query cursor.
+     */
+    private QueryCursor<Cache.Entry<Object, Object>> scan(IgniteCache<Object, Object> c, VisorQueryArg arg) {
+        ScanQuery<Object, Object> qry = new ScanQuery<>(null);
+        qry.setPageSize(arg.pageSize());
+        qry.setLocal(arg.local());
+
+        return c.query(qry);
+    }
+
+    /**
+     * Scan near cache.
+     *
+     * @param c Cache to scan near entries.
+     * @return Cache entries iterator wrapped with query cursor.
+     */
+    private QueryCursor<Cache.Entry<Object, Object>> near(IgniteCache<Object, Object> c) {
+        return new VisorNearCacheCursor<>(c.localEntries(CachePeekMode.NEAR).iterator());
+    }
+
     /** {@inheritDoc} */
     @Override protected IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx> run(VisorQueryArg arg) {
         try {
             UUID nid = ignite.localNode().id();
 
+            boolean near = SCAN_NEAR_CACHE.equalsIgnoreCase(arg.queryTxt());
+
             boolean scan = arg.queryTxt() == null;
 
-            String qryId = (scan ? SCAN_QRY_NAME : SQL_QRY_NAME) + "-" +
-                UUID.randomUUID();
+            // Generate query ID to store query cursor in node local storage.
+            String qryId = ((scan || near) ? SCAN_QRY_NAME : SQL_QRY_NAME) + "-" + UUID.randomUUID();
 
             IgniteCache<Object, Object> c = cache(arg.cacheName());
 
-            if (scan) {
-                ScanQuery<Object, Object> qry = new ScanQuery<>(null);
-                qry.setPageSize(arg.pageSize());
-                qry.setLocal(arg.local());
-
+            if (near || scan) {
                 long start = U.currentTimeMillis();
 
-                VisorQueryCursor<Cache.Entry<Object, Object>> cur = new VisorQueryCursor<>(c.query(qry));
+                VisorQueryCursor<Cache.Entry<Object, Object>> cur = new VisorQueryCursor<>(near ? near(c) : scan(c, arg));
 
                 List<Object[]> rows = fetchScanQueryRows(cur, arg.pageSize());
 
@@ -184,4 +211,35 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
     @Override public String toString() {
         return S.toString(VisorQueryJob.class, this);
     }
-}
\ No newline at end of file
+
+    /**
+     * Wrapper for cache iterator to behave like {@link QueryCursor}.
+     */
+    private static class VisorNearCacheCursor<T> implements QueryCursor<T> {
+        private final Iterator<T> it;
+
+        private VisorNearCacheCursor(Iterator<T> it) {
+            this.it = it;
+        }
+
+        /** {@inheritDoc} */
+        @Override public List<T> getAll() {
+            List<T> all = new ArrayList<>();
+
+            while(it.hasNext())
+                all.add(it.next());
+
+            return all;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void close() {
+            // Nothing to close.
+        }
+
+        /** {@inheritDoc} */
+        @Override public Iterator<T> iterator() {
+            return it;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1a3c7840/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
index e89093f..64d2b95 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
@@ -40,6 +40,9 @@ public class VisorQueryUtils {
     /** Prefix for node local key for SCAN queries. */
     public static final String SCAN_QRY_NAME = "VISOR_SCAN_QUERY";
 
+    /** Prefix for node local key for SCAN near queries. */
+    public static final String SCAN_NEAR_CACHE = "VISOR_SCAN_NEAR_CACHE";
+
     /** Columns for SCAN queries. */
     public static final Collection<VisorQueryField> SCAN_COL_NAMES = Arrays.asList(
         new VisorQueryField(null, null, "Key Class", ""), new VisorQueryField(null, null, "Key", ""),
@@ -195,4 +198,4 @@ public class VisorQueryUtils {
 
         return rows;
     }
-}
\ No newline at end of file
+}


[4/6] ignite git commit: ignite-1.5 Minor fix in generated javadoc.

Posted by vo...@apache.org.
ignite-1.5 Minor fix in generated javadoc.


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

Branch: refs/heads/ignite-2099
Commit: b541daf0bc9193dc0aa78b27efa610b26e49bec7
Parents: e2316ff
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Dec 10 10:13:39 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 10 10:13:39 2015 +0700

----------------------------------------------------------------------
 .../ignite/schema/generator/CodeGenerator.java  | 30 +++++++++++---------
 1 file changed, 17 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b541daf0/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
index 92167e5..0e52acc 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
@@ -584,8 +584,8 @@ public class CodeGenerator {
         Collection<String> src = new ArrayList<>(256);
 
         header(src, pkg, "java.sql.*;java.util.*;" +
-                "org.apache.ignite.cache.*;org.apache.ignite.cache.store.jdbc.*;" +
-                "org.apache.ignite.configuration.*",
+            "org.apache.ignite.cache.*;org.apache.ignite.cache.store.jdbc.*;" +
+            "org.apache.ignite.configuration.*",
             "CacheConfig", "CacheConfig");
 
         // Generate methods for each type in order to avoid compiler error "java: code too large".
@@ -594,10 +594,11 @@ public class CodeGenerator {
             String valClsName = pojo.valueClassName();
 
             add1(src, "/**");
-            add1(src, "* Create JDBC type for " + tbl + ".");
-            add1(src, "*");
-            add1(src, "* @param cacheName Cache name.");
-            add1(src, "*/");
+            add1(src, " * Create JDBC type for " + tbl + ".");
+            add1(src, " *");
+            add1(src, " * @param cacheName Cache name.");
+            add1(src, " * @return Configured JDBC type.");
+            add1(src, " */");
             add1(src, "private static JdbcType jdbcType" + valClsName + "(String cacheName) {");
 
             add2(src, "JdbcType jdbcType = new JdbcType();");
@@ -632,8 +633,10 @@ public class CodeGenerator {
             add0(src, "");
 
             add1(src, "/**");
-            add1(src, "* Create SQL Query descriptor for " + tbl + ".");
-            add1(src, "*/");
+            add1(src, " * Create SQL Query descriptor for " + tbl + ".");
+            add1(src, " *");
+            add1(src, " * @return Configured query entity.");
+            add1(src, " */");
             add1(src, "private static QueryEntity queryEntity" + valClsName + "() {");
 
             // Query entity.
@@ -711,11 +714,12 @@ public class CodeGenerator {
         }
 
         add1(src, "/**");
-        add1(src, "* Configure cache.");
-        add1(src, "*");
-        add1(src, "* @param cacheName Cache name.");
-        add1(src, "* @param storeFactory Cache store factory.");
-        add1(src, "*/");
+        add1(src, " * Configure cache.");
+        add1(src, " *");
+        add1(src, " * @param cacheName Cache name.");
+        add1(src, " * @param storeFactory Cache store factory.");
+        add1(src, " * @return Cache configuration.");
+        add1(src, " */");
         add1(src, "public static <K, V> CacheConfiguration<K, V> cache(String cacheName," +
             " CacheJdbcPojoStoreFactory<K, V> storeFactory) {");
         add2(src, "if (storeFactory == null)");


[6/6] ignite git commit: Merge branch 'ignite-1.5' into ignite-2099

Posted by vo...@apache.org.
Merge branch 'ignite-1.5' into ignite-2099


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

Branch: refs/heads/ignite-2099
Commit: 84006b9570ef19bf8ebda20a3008b22a34564d22
Parents: 22322fa 1a3c784
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Dec 10 09:47:49 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Dec 10 09:47:49 2015 +0300

----------------------------------------------------------------------
 .../portable/PortableClassDescriptor.java       |  2 +-
 .../ignite/internal/visor/cache/VisorCache.java | 13 ++++
 .../internal/visor/query/VisorQueryJob.java     | 76 +++++++++++++++++---
 .../internal/visor/query/VisorQueryUtils.java   |  5 +-
 .../org/apache/ignite/thread/IgniteThread.java  |  6 +-
 .../ignite/schema/generator/CodeGenerator.java  | 30 ++++----
 6 files changed, 107 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/84006b95/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
----------------------------------------------------------------------


[2/6] ignite git commit: 2064 Hotfix.

Posted by vo...@apache.org.
2064 Hotfix.


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

Branch: refs/heads/ignite-2099
Commit: 637b79ad8902da082178e3e9cb63d80beb382a63
Parents: 6791c50
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Dec 9 18:18:52 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Dec 9 18:18:52 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/portable/PortableClassDescriptor.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/637b79ad/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
index ed65e63..50c8bb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
@@ -795,7 +795,7 @@ public class PortableClassDescriptor {
      * @return {@code true} if to use, {@code false} otherwise.
      */
     private boolean initUseOptimizedMarshallerFlag() {
-        for (Class c = cls; !c.equals(Object.class); c = c.getSuperclass()) {
+        for (Class c = cls; c != null && !c.equals(Object.class); c = c.getSuperclass()) {
             try {
                 Method writeObj = c.getDeclaredMethod("writeObject", ObjectOutputStream.class);
                 Method readObj = c.getDeclaredMethod("readObject", ObjectInputStream.class);