ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [16/16] ignite git commit: IGNITE-4436 WIP.
Date Mon, 30 Jan 2017 11:01:14 GMT
IGNITE-4436 WIP.


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

Branch: refs/heads/ignite-4436-2
Commit: 2416432e7c818e68c3aea5b2edc3dee43fd6c892
Parents: 33b95ac
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Mon Jan 30 18:01:41 2017 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Mon Jan 30 18:01:41 2017 +0700

----------------------------------------------------------------------
 .../processors/query/GridQueryIndexing.java     |  2 +-
 .../processors/query/GridQueryProcessor.java    |  2 +-
 .../query/VisorCollectCurrentQueriesTask.java   |  2 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  2 +-
 .../cache/GridCacheCrossCacheQuerySelfTest.java | 64 +++++++++++++++++++-
 .../h2/GridIndexingSpiAbstractSelfTest.java     | 11 +++-
 6 files changed, 76 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2416432e/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index 397f1aa..e368063 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -246,7 +246,7 @@ public interface GridQueryIndexing {
      * @param duration Duration to check.
      * @return Collection of long running queries.
      */
-    public Collection<GridQuery> longRunningQueries(long duration);
+    public Collection<GridQuery> runningQueries(long duration);
 
     /**
      * Cancel specified queries.

http://git-wip-us.apache.org/repos/asf/ignite/blob/2416432e/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 7744649..fa7f517 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -953,7 +953,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         Collection<String> res = new ArrayList<>();
 
         if (moduleEnabled()) {
-            idx.longRunningQueries(duration);
+            idx.runningQueries(duration);
 
             res.add("Query");
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2416432e/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectCurrentQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectCurrentQueriesTask.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectCurrentQueriesTask.java
index c77de15..52ed50e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectCurrentQueriesTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectCurrentQueriesTask.java
@@ -74,7 +74,7 @@ public class VisorCollectCurrentQueriesTask extends VisorMultiNodeTask<Long,
Map
 
         /** {@inheritDoc} */
         @Override protected Collection<VisorQuery> run(@Nullable Long duration) throws
IgniteException {
-            Collection<GridQuery> queries = ignite.context().query().indexing().longRunningQueries(duration);
+            Collection<GridQuery> queries = ignite.context().query().indexing().runningQueries(duration);
 
             Collection<VisorQuery> res = new ArrayList<>(queries.size());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2416432e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index cb1d49c..9d635e3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -3149,7 +3149,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<GridQuery> longRunningQueries(long duration) {
+    @Override public Collection<GridQuery> runningQueries(long duration) {
         return rdcQryExec.longRunningQueries(duration);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2416432e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
index 1f10593..4da31ab 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashSet;
@@ -29,11 +30,16 @@ import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.query.GridQuery;
+import org.apache.ignite.internal.processors.query.GridQueryIndexing;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -54,6 +60,26 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest
{
     /** */
     private Ignite ignite;
 
+    /***/
+    public static class TestSQLFunctions {
+        /**
+         * @param x Time to sleep.
+         * @return Return specified argument.
+         */
+        @QuerySqlFunction
+        public static long sleep(long x) {
+            if (x >= 0)
+                try {
+                    Thread.sleep(x);
+                }
+                catch (InterruptedException ignored) {
+                    // No-op.
+                }
+
+            return x;
+        }
+    }
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration c = super.getConfiguration(gridName);
@@ -113,6 +139,8 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest
{
         else
             throw new IllegalStateException("mode: " + mode);
 
+        cc.setSqlFunctionClasses(TestSQLFunctions.class);
+
         return cc;
     }
 
@@ -218,6 +246,40 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest
{
     }
 
     /**
+     * Test collecting info about running.
+     *
+     * @throws Exception If failed.
+     */
+    public void testRunningQueries() throws Exception {
+        IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+            @Override public void run() {
+                try {
+                    SqlFieldsQuery qry = new SqlFieldsQuery("select productId, sleep(3000)
from FactPurchase limit 1");
+
+                    ignite.cache("partitioned").query(qry).getAll();
+                }
+                catch (Throwable e) {
+                    e.printStackTrace();
+                }
+            }
+        }, 1);
+
+        Thread.sleep(100);
+
+        GridQueryIndexing idx = ((IgniteKernal)ignite).context().query().indexing();
+
+        Collection<GridQuery> queries = idx.runningQueries(50);
+
+        assertEquals(1, queries.size());
+
+        fut.get();
+
+        queries = idx.runningQueries(50);
+
+        assertEquals(0, queries.size());
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testApiQueries() throws Exception {
@@ -477,4 +539,4 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest
{
             return storeId;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/2416432e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 512001f..fcec4b5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -106,6 +106,9 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
         spi.registerCache(null, cacheCfg("B"));
     }
 
+    /**
+     * @param name Name.
+     */
     private CacheConfiguration cacheCfg(String name) {
         CacheConfiguration<?,?> cfg = new CacheConfiguration<>();
 
@@ -114,6 +117,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
         return cfg;
     }
 
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         idx.stop();
 
@@ -182,6 +186,9 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
         return idx;
     }
 
+    /**
+     * @return {@code true} if OFF-HEAP mode should be tested.
+     */
     protected boolean offheap() {
         return false;
     }
@@ -236,7 +243,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
 
             fail("Enumerations of aliases in select block must be prohibited");
         }
-        catch (IgniteCheckedException e) {
+        catch (IgniteCheckedException ignored) {
             // all fine
         }
 
@@ -713,4 +720,4 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
             throw new UnsupportedOperationException();
         }
     }
-}
\ No newline at end of file
+}


Mime
View raw message