You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/10/26 06:32:19 UTC
ignite git commit: IGNITE-1769 Close the current query on server-side
when user start new one
Repository: ignite
Updated Branches:
refs/heads/ignite-843-rc1 952dcd9fe -> 336d8a1e3
IGNITE-1769 Close the current query on server-side when user start new one
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/336d8a1e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/336d8a1e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/336d8a1e
Branch: refs/heads/ignite-843-rc1
Commit: 336d8a1e30c4e2ff5d663aef576d8c53f303f5d0
Parents: 952dcd9
Author: Andrey <an...@gridgain.com>
Authored: Mon Oct 26 12:32:24 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Oct 26 12:32:24 2015 +0700
----------------------------------------------------------------------
.../src/main/js/controllers/sql-controller.js | 34 ++++++++++++++++----
.../src/main/js/routes/agent.js | 17 ++++++++++
2 files changed, 45 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/336d8a1e/modules/control-center-web/src/main/js/controllers/sql-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/sql-controller.js b/modules/control-center-web/src/main/js/controllers/sql-controller.js
index de4ef51..8dd0664 100644
--- a/modules/control-center-web/src/main/js/controllers/sql-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/sql-controller.js
@@ -538,6 +538,11 @@ consoleModule.controller('sqlController',
return retainedCols;
}
+ var _tryCloseQueryResult = function (queryId) {
+ if (queryId)
+ $http.post('/agent/query/close', { queryId: queryId });
+ };
+
var _processQueryResult = function (paragraph, refreshMode) {
return function (res) {
if (res.meta && !refreshMode) {
@@ -626,6 +631,8 @@ consoleModule.controller('sqlController',
};
var _executeRefresh = function (paragraph) {
+ _tryCloseQueryResult(paragraph.queryId);
+
$http.post('/agent/query', paragraph.queryArgs)
.success(_processQueryResult(paragraph, true))
.error(function (errMsg) {
@@ -645,6 +652,10 @@ consoleModule.controller('sqlController',
paragraph.prevQuery = paragraph.queryArgs ? paragraph.queryArgs.query : paragraph.query;
+ _showLoading(paragraph, true);
+
+ _tryCloseQueryResult(paragraph.queryId);
+
paragraph.queryArgs = {
type: "QUERY",
query: paragraph.query,
@@ -652,8 +663,6 @@ consoleModule.controller('sqlController',
cacheName: paragraph.cacheName
};
- _showLoading(paragraph, true);
-
$http.post('/agent/query', paragraph.queryArgs)
.success(function (res) {
_processQueryResult(paragraph)(res);
@@ -676,10 +685,17 @@ consoleModule.controller('sqlController',
_cancelRefresh(paragraph);
- paragraph.queryArgs = { type: "EXPLAIN", query: 'EXPLAIN ' + paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cacheName };
-
_showLoading(paragraph, true);
+ _tryCloseQueryResult(paragraph.queryId);
+
+ paragraph.queryArgs = {
+ type: "EXPLAIN",
+ query: 'EXPLAIN ' + paragraph.query,
+ pageSize: paragraph.pageSize,
+ cacheName: paragraph.cacheName
+ };
+
$http.post('/agent/query', paragraph.queryArgs)
.success(_processQueryResult(paragraph))
.error(function (errMsg) {
@@ -696,10 +712,16 @@ consoleModule.controller('sqlController',
_cancelRefresh(paragraph);
- paragraph.queryArgs = { type: "SCAN", pageSize: paragraph.pageSize, cacheName: paragraph.cacheName };
-
_showLoading(paragraph, true);
+ _tryCloseQueryResult(paragraph.queryId);
+
+ paragraph.queryArgs = {
+ type: "SCAN",
+ pageSize: paragraph.pageSize,
+ cacheName: paragraph.cacheName
+ };
+
$http.post('/agent/scan', paragraph.queryArgs)
.success(_processQueryResult(paragraph))
.error(function (errMsg) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/336d8a1e/modules/control-center-web/src/main/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/agent.js b/modules/control-center-web/src/main/js/routes/agent.js
index 6becd7a..786c867 100644
--- a/modules/control-center-web/src/main/js/routes/agent.js
+++ b/modules/control-center-web/src/main/js/routes/agent.js
@@ -185,6 +185,23 @@ router.post('/query/fetch', function (req, res) {
}
});
+/* Close query cursor by id. */
+router.post('/query/close', function (req, res) {
+ var client = _client(req, res);
+
+ if (client) {
+ var cache = client.ignite().cache(req.body.cacheName);
+
+ var cmd = cache._createCommand('qrycls').addParam('qryId', req.body.queryId);
+
+ cache.__createPromise(cmd).then(function () {
+ res.sendStatus(200);
+ }, function (err) {
+ res.status(500).send(err);
+ });
+ }
+});
+
/* Get metadata for cache. */
router.post('/cache/metadata', function (req, res) {
var client = _client(req, res);