You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/08/03 11:05:21 UTC

[1/3] ignite git commit: Visor: scan cache with filter.

Repository: ignite
Updated Branches:
  refs/heads/master 043c3a23b -> c421614d7


Visor: scan cache with filter.


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

Branch: refs/heads/master
Commit: ae23dab0af8caaccd3db1dca8e435b57b8844a31
Parents: 4f27a47
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Aug 3 17:10:03 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Aug 3 17:10:03 2016 +0700

----------------------------------------------------------------------
 .../internal/visor/query/VisorQueryJob.java     | 38 +++++++++---
 .../query/VisorQueryScanSubstringFilter.java    | 63 ++++++++++++++++++++
 .../internal/visor/query/VisorQueryUtils.java   |  6 ++
 3 files changed, 99 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ae23dab0/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 0f2f82e..153c564 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
@@ -37,9 +37,12 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.util.VisorExceptionWrapper;
+import org.apache.ignite.lang.IgniteBiPredicate;
 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_CACHE_WITH_FILTER;
+import static org.apache.ignite.internal.visor.query.VisorQueryUtils.SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE;
 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;
@@ -81,8 +84,9 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
      * @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);
+    private QueryCursor<Cache.Entry<Object, Object>> scan(IgniteCache<Object, Object> c, VisorQueryArg arg,
+        IgniteBiPredicate<Object, Object> filter) {
+        ScanQuery<Object, Object> qry = new ScanQuery<>(filter);
         qry.setPageSize(arg.pageSize());
         qry.setLocal(arg.local());
 
@@ -100,23 +104,41 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
     }
 
     /** {@inheritDoc} */
-    @Override protected IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx> run(VisorQueryArg arg) {
+    @Override protected IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx> run(final VisorQueryArg arg) {
         try {
             UUID nid = ignite.localNode().id();
 
-            boolean near = SCAN_NEAR_CACHE.equalsIgnoreCase(arg.queryTxt());
+            String qryTxt = arg.queryTxt();
 
-            boolean scan = arg.queryTxt() == null;
+            boolean scan = qryTxt == null;
+
+            boolean scanWithFilter = qryTxt != null && qryTxt.startsWith(SCAN_CACHE_WITH_FILTER);
+
+            boolean near = qryTxt != null && qryTxt.startsWith(SCAN_NEAR_CACHE);
+
+            boolean scanAny = scan || scanWithFilter || near;
 
             // Generate query ID to store query cursor in node local storage.
-            String qryId = ((scan || near) ? SCAN_QRY_NAME : SQL_QRY_NAME) + "-" + UUID.randomUUID();
+            String qryId = (scanAny ? SCAN_QRY_NAME : SQL_QRY_NAME) + "-" + UUID.randomUUID();
 
             IgniteCache<Object, Object> c = cache(arg.cacheName());
 
-            if (near || scan) {
+            if (scanAny) {
                 long start = U.currentTimeMillis();
 
-                VisorQueryCursor<Cache.Entry<Object, Object>> cur = new VisorQueryCursor<>(near ? near(c) : scan(c, arg));
+                IgniteBiPredicate<Object, Object> filter = null;
+
+                if (scanWithFilter) {
+                    boolean caseSensitive = qryTxt.startsWith(SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE);
+
+                    String ptrn = caseSensitive
+                        ? qryTxt.substring(SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE.length())
+                        : qryTxt.substring(SCAN_CACHE_WITH_FILTER.length());
+
+                    filter = new VisorQueryScanSubstringFilter(caseSensitive, ptrn);
+                }
+
+                VisorQueryCursor<Cache.Entry<Object, Object>> cur = new VisorQueryCursor<>(near ? near(c) : scan(c, arg, filter));
 
                 List<Object[]> rows = fetchScanQueryRows(cur, arg.pageSize());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae23dab0/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
new file mode 100644
index 0000000..43eb6dd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryScanSubstringFilter.java
@@ -0,0 +1,63 @@
+/*
+ * 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.visor.query;
+
+import org.apache.ignite.lang.IgniteBiPredicate;
+
+/**
+ * Filter scan results by specified substring in string presentation of key or value.
+ */
+public class VisorQueryScanSubstringFilter implements IgniteBiPredicate<Object, Object> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Case sensitive flag. */
+    private final boolean caseSensitive;
+
+    /** String to search in string presentation of key or value. */
+    private final String ptrn;
+
+    /**
+     * Create filter instance.
+     *
+     * @param caseSensitive Case sensitive flag.
+     * @param ptrn String to search in string presentation of key or value.
+     */
+    public VisorQueryScanSubstringFilter(boolean caseSensitive, String ptrn) {
+        this.caseSensitive = caseSensitive;
+
+        this.ptrn = caseSensitive ? ptrn : ptrn.toUpperCase();
+    }
+
+    /**
+     * Check that key or value contains specified string.
+     *
+     * @param key Key object.
+     * @param val Value object.
+     * @return {@code true} when string presentation of key or value contain specified string.
+     */
+    @Override public boolean apply(Object key, Object val) {
+        String k = key.toString();
+        String v = val.toString();
+
+        if (caseSensitive)
+            return k.contains(ptrn) || v.contains(ptrn);
+
+        return k.toUpperCase().contains(ptrn) || v.toUpperCase().contains(ptrn);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ae23dab0/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 64d2b95..0b8cf83 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
@@ -43,6 +43,12 @@ public class VisorQueryUtils {
     /** Prefix for node local key for SCAN near queries. */
     public static final String SCAN_NEAR_CACHE = "VISOR_SCAN_NEAR_CACHE";
 
+    /** Prefix for node local key for SCAN near queries. */
+    public static final String SCAN_CACHE_WITH_FILTER = "VISOR_SCAN_CACHE_WITH_FILTER";
+
+    /** Prefix for node local key for SCAN near queries. */
+    public static final String SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE = "VISOR_SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE";
+
     /** 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", ""),


[2/3] ignite git commit: Merge branch 'ignite-1.6.4' to 'ignite-1.7.1'

Posted by ak...@apache.org.
Merge branch 'ignite-1.6.4' to 'ignite-1.7.1'


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

Branch: refs/heads/master
Commit: e6d6286d5bd680c1b11e91cf3ad31416d2ca59bd
Parents: d65f794 ae23dab
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Aug 3 17:56:16 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Aug 3 17:56:42 2016 +0700

----------------------------------------------------------------------
 .../internal/visor/query/VisorQueryJob.java     | 38 +++++++++---
 .../query/VisorQueryScanSubstringFilter.java    | 63 ++++++++++++++++++++
 .../internal/visor/query/VisorQueryUtils.java   |  6 ++
 .../resources/META-INF/classnames.properties    | 20 +++++--
 4 files changed, 113 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e6d6286d/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/e6d6286d/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --cc modules/core/src/main/resources/META-INF/classnames.properties
index 57762c7,57762c7..ade21ce
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@@ -18,6 -18,6 +18,7 @@@
  org.apache.ignite.IgniteAuthenticationException
  org.apache.ignite.IgniteCheckedException
  org.apache.ignite.IgniteClientDisconnectedException
++org.apache.ignite.IgniteDataStreamerTimeoutException
  org.apache.ignite.IgniteDeploymentException
  org.apache.ignite.IgniteException
  org.apache.ignite.IgniteIllegalStateException
@@@ -88,6 -88,6 +89,8 @@@ org.apache.ignite.cache.store.jdbc.Jdbc
  org.apache.ignite.cache.store.jdbc.JdbcTypeDefaultHasher
  org.apache.ignite.cache.store.jdbc.JdbcTypeField
  org.apache.ignite.cache.store.jdbc.JdbcTypeHasher
++org.apache.ignite.cache.store.jdbc.JdbcTypesDefaultTransformer
++org.apache.ignite.cache.store.jdbc.JdbcTypesTransformer
  org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect
  org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect$1
  org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect$2
@@@ -389,11 -389,11 +392,12 @@@ org.apache.ignite.internal.processors.c
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$64
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$65
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$66
--org.apache.ignite.internal.processors.cache.GridCacheAdapter$68
++org.apache.ignite.internal.processors.cache.GridCacheAdapter$67
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$69
--org.apache.ignite.internal.processors.cache.GridCacheAdapter$69$1
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$70
++org.apache.ignite.internal.processors.cache.GridCacheAdapter$70$1
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$71
++org.apache.ignite.internal.processors.cache.GridCacheAdapter$72
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$9
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1$1
@@@ -409,6 -409,6 +413,8 @@@ org.apache.ignite.internal.processors.c
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJobV2
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallable
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallableV2
++org.apache.ignite.internal.processors.cache.GridCacheAdapter$PartitionSizeLongJob
++org.apache.ignite.internal.processors.cache.GridCacheAdapter$PartitionSizeLongTask
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeJob
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeLongJob
  org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeLongTask
@@@ -841,6 -841,6 +847,8 @@@ org.apache.ignite.internal.processors.c
  org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$MetadataJob$3
  org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$OffheapIteratorClosure
  org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$PeekValueExpiryAwareIterator
++org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$RequestFutureMap
++org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$RequestFutureMap$1
  org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsAdapter
  org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsKey
  org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest
@@@ -948,7 -948,7 +956,6 @@@ org.apache.ignite.internal.processors.c
  org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl$UserKeyCacheObjectImpl
  org.apache.ignite.internal.processors.clock.GridClockDeltaSnapshotMessage
  org.apache.ignite.internal.processors.clock.GridClockDeltaVersion
--org.apache.ignite.internal.processors.closure.GridClosurePolicy
  org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1
  org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1MLA
  org.apache.ignite.internal.processors.closure.GridClosureProcessor$C1MLAV2
@@@ -1180,6 -1180,6 +1187,7 @@@ org.apache.ignite.internal.processors.p
  org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessorImpl
  org.apache.ignite.internal.processors.platform.cache.PlatformCachePartialUpdateException
  org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinity$1
++org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction
  org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQuery
  org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryFilter
  org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryImpl
@@@ -1231,9 -1231,9 +1239,6 @@@ org.apache.ignite.internal.processors.q
  org.apache.ignite.internal.processors.query.GridQueryProcessor$4
  org.apache.ignite.internal.processors.query.GridQueryProcessor$5
  org.apache.ignite.internal.processors.query.GridQueryProcessor$6
--org.apache.ignite.internal.processors.query.GridQueryProcessor$7
--org.apache.ignite.internal.processors.query.GridQueryProcessor$8
--org.apache.ignite.internal.processors.query.GridQueryProcessor$9
  org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
  org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
  org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
@@@ -1749,6 -1749,6 +1754,7 @@@ org.apache.ignite.internal.visor.node.V
  org.apache.ignite.internal.visor.node.VisorSpisConfiguration
  org.apache.ignite.internal.visor.node.VisorTransactionConfiguration
  org.apache.ignite.internal.visor.query.VisorQueryArg
++org.apache.ignite.internal.visor.query.VisorQueryArgV2
  org.apache.ignite.internal.visor.query.VisorQueryCleanupTask
  org.apache.ignite.internal.visor.query.VisorQueryCleanupTask$VisorQueryCleanupJob
  org.apache.ignite.internal.visor.query.VisorQueryField
@@@ -1757,6 -1757,6 +1763,7 @@@ org.apache.ignite.internal.visor.query.
  org.apache.ignite.internal.visor.query.VisorQueryNextPageTask$VisorQueryNextPageJob
  org.apache.ignite.internal.visor.query.VisorQueryResult
  org.apache.ignite.internal.visor.query.VisorQueryResultEx
++org.apache.ignite.internal.visor.query.VisorQueryScanSubstringFilter
  org.apache.ignite.internal.visor.query.VisorQueryTask
  org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException
  org.apache.ignite.internal.visor.util.VisorEventMapper
@@@ -1783,6 -1783,6 +1790,7 @@@ org.apache.ignite.lifecycle.LifecycleEv
  org.apache.ignite.marshaller.jdk.JdkMarshallerDummySerializable
  org.apache.ignite.marshaller.optimized.OptimizedFieldType
  org.apache.ignite.messaging.MessagingListenActor
++org.apache.ignite.platform.dotnet.PlatformDotNetAffinityFunction
  org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory
  org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactoryNative
  org.apache.ignite.plugin.CachePluginConfiguration


[3/3] ignite git commit: Merge branch 'ignite-1.7.1' to master

Posted by ak...@apache.org.
Merge branch 'ignite-1.7.1' to master


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

Branch: refs/heads/master
Commit: c421614d713424148abce5b5634039b0a4039f45
Parents: 043c3a2 e6d6286
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Aug 3 18:02:13 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Aug 3 18:02:13 2016 +0700

----------------------------------------------------------------------
 .../internal/visor/query/VisorQueryJob.java     | 38 +++++++++---
 .../query/VisorQueryScanSubstringFilter.java    | 63 ++++++++++++++++++++
 .../internal/visor/query/VisorQueryUtils.java   |  6 ++
 .../resources/META-INF/classnames.properties    | 20 +++++--
 4 files changed, 113 insertions(+), 14 deletions(-)
----------------------------------------------------------------------