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 2015/05/13 14:43:36 UTC

[27/27] incubator-ignite git commit: ignite-745 Query metrics do not updated for SQL queries

ignite-745 Query metrics do not updated for SQL queries


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

Branch: refs/heads/ignite-745
Commit: 9943b77e43e880a5e5287441e3e665cf16f1a681
Parents: 7b15752
Author: agura <ag...@gridgain.com>
Authored: Wed May 13 15:42:30 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Wed May 13 15:42:30 2015 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    | 54 +++++++++-----------
 1 file changed, 24 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9943b77e/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 e552293..b1cc2ed 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
@@ -609,21 +609,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                     final GridCloseableIterator<IgniteBiTuple<K, V>> i = idx.query(space, sqlQry, F.asList(params),
                         typeDesc, idx.backupFilter());
 
-                    if (ctx.event().isRecordable(EVT_CACHE_QUERY_EXECUTED)) {
-                        ctx.event().record(new CacheQueryExecutedEvent<>(
-                            ctx.discovery().localNode(),
-                            "SQL query executed.",
-                            EVT_CACHE_QUERY_EXECUTED,
-                            CacheQueryType.SQL.name(),
-                            null,
-                            null,
-                            sqlQry,
-                            null,
-                            null,
-                            params,
-                            null,
-                            null));
-                    }
+                    sendQueryExecutedEvent(sqlQry, params);
 
                     return new ClIter<Cache.Entry<K, V>>() {
                         @Override public void close() throws Exception {
@@ -656,6 +642,28 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @param sqlQry Sql query.
+     * @param params Params.
+     */
+    private void sendQueryExecutedEvent(String sqlQry, Object[] params) {
+        if (ctx.event().isRecordable(EVT_CACHE_QUERY_EXECUTED)) {
+            ctx.event().record(new CacheQueryExecutedEvent<>(
+                ctx.discovery().localNode(),
+                "SQL query executed.",
+                EVT_CACHE_QUERY_EXECUTED,
+                CacheQueryType.SQL.name(),
+                null,
+                null,
+                sqlQry,
+                null,
+                null,
+                params,
+                null,
+                null));
+        }
+    }
+
+    /**
      * @return Message factory for {@link GridIoManager}.
      */
     public MessageFactory messageFactory() {
@@ -687,21 +695,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
                     GridQueryFieldsResult res = idx.queryFields(space, sql, F.asList(args), idx.backupFilter());
 
-                    if (ctx.event().isRecordable(EVT_CACHE_QUERY_EXECUTED)) {
-                        ctx.event().record(new CacheQueryExecutedEvent<>(
-                            ctx.discovery().localNode(),
-                            "SQL query executed.",
-                            EVT_CACHE_QUERY_EXECUTED,
-                            CacheQueryType.SQL.name(),
-                            null,
-                            null,
-                            sql,
-                            null,
-                            null,
-                            args,
-                            null,
-                            null));
-                    }
+                    sendQueryExecutedEvent(sql, args);
 
                     QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>(
                         new GridQueryCacheObjectsIterator(res.iterator(), cctx, cctx.keepPortable()));