incubator-ignite git commit: #ignite-964: wip
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964 ce70877b1 -> 90a17a6b3 #ignite-964: wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/90a17a6b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/90a17a6b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/90a17a6b Branch: refs/heads/ignite-964 Commit: 90a17a6b39343cfc998cc056ad7611e7bfc1e4a4 Parents: ce70877 Author: ivasilinets Authored: Mon Jun 29 22:22:41 2015 +0300 Committer: ivasilinets Committed: Mon Jun 29 22:22:41 2015 +0300 -- modules/nodejs/src/test/js/test-query.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/90a17a6b/modules/nodejs/src/test/js/test-query.js -- diff --git a/modules/nodejs/src/test/js/test-query.js b/modules/nodejs/src/test/js/test-query.js index 9b9366c..502d391 100644 --- a/modules/nodejs/src/test/js/test-query.js +++ b/modules/nodejs/src/test/js/test-query.js @@ -79,7 +79,7 @@ testSqlFieldsQuery = function() { }); qry.on("page", function(res) { -console.log("PAGE : " + res); +console.log("PAGE : " + res); fullRes = fullRes.concat(res); });
incubator-ignite git commit: #ignite-964: wip
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964 90a17a6b3 -> 02b53870a #ignite-964: wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/02b53870 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/02b53870 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/02b53870 Branch: refs/heads/ignite-964 Commit: 02b53870a68fb27851e92bf4c4190e9370d55f6b Parents: 90a17a6 Author: ivasilinets Authored: Mon Jun 29 23:19:29 2015 +0300 Committer: ivasilinets Committed: Mon Jun 29 23:19:29 2015 +0300 -- .../handlers/query/QueryCommandHandler.java | 10 +- .../rest/request/RestSqlQueryRequest.java | 6 +- modules/nodejs/src/main/js/cache.js | 19 +- modules/nodejs/src/main/js/server.js| 3 - .../apache/ignite/internal/NodeJsSqlQuery.java | 165 - .../ignite/internal/NodeJsSqlQuerySelfTest.java | 180 +++ .../testsuites/IgniteNodeJsTestSuite.java | 2 +- modules/nodejs/src/test/js/test-query.js| 45 - .../http/jetty/GridJettyRestHandler.java| 3 +- 9 files changed, 248 insertions(+), 185 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/02b53870/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index b550a46..496243e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java @@ -118,11 +118,17 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { try { Query qry; -if (req.typeName() != null) +if (req.typeName() != null) { qry = new SqlQuery(req.typeName(), req.sqlQuery()); -else + +((SqlQuery)qry).setArgs(req.arguments()); +} +else { qry = new SqlFieldsQuery(req.sqlQuery()); +((SqlFieldsQuery)qry).setArgs(req.arguments()); +} + Iterator> cur = ctx.grid().cache(req.cacheName()).query(qry).iterator(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/02b53870/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java index 09b2fa3..830011a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java @@ -25,7 +25,7 @@ public class RestSqlQueryRequest extends GridRestRequest { private String sqlQry; /** Sql query arguments. */ -private Object args; +private Object[] args; /** Page size. */ private Integer pageSz; @@ -56,14 +56,14 @@ public class RestSqlQueryRequest extends GridRestRequest { /** * @param args Sql query arguments. */ -public void arguments(Object args) { +public void arguments(Object[] args) { this.args = args; } /** * @return Sql query arguments. */ -public Object arguments() { +public Object[] arguments() { return args; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/02b53870/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 991390a..fc988da 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -158,7 +158,7 @@ Cache.prototype.query = function(qry) { Server.pair("cacheName", this._cacheName), Server.pair("qryId", res.queryId), Server.pair("psz", qry.pageSize())], -onQueryExecute.bind(this, qry, res["queryId"])); +onQueryExecute.bi
incubator-ignite git commit: #ignite-964: post put all.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 [created] 2c1ecf283 #ignite-964: post put all. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2c1ecf28 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2c1ecf28 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2c1ecf28 Branch: refs/heads/ignite-964-1 Commit: 2c1ecf283773c992a8fdaec62de583abd56a340d Parents: 02b5387 Author: ivasilinets Authored: Tue Jun 30 00:36:13 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 00:36:13 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 ++ .../handlers/cache/GridCacheCommandHandler.java | 2 ++ modules/nodejs/src/main/js/cache.js | 13 modules/nodejs/src/main/js/server.js| 9 +- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 modules/nodejs/src/test/js/test-cache-api.js| 8 + .../http/jetty/GridJettyRestHandler.java| 34 7 files changed, 75 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c1ecf28/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 0afefb6..375a079 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -45,6 +45,9 @@ public enum GridRestCommand { /** Store several values in cache. */ CACHE_PUT_ALL("putall"), +/** Store several values in cache. */ +CACHE_PUT_ALL2("putall2"), + /** Remove value from cache. */ CACHE_REMOVE("rmv"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c1ecf28/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 1f24023..ef0391e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -58,6 +58,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_PUT, CACHE_ADD, CACHE_PUT_ALL, +CACHE_PUT_ALL2, CACHE_REMOVE, CACHE_REMOVE_ALL, CACHE_REPLACE, @@ -190,6 +191,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_PUT_ALL2: case CACHE_PUT_ALL: { Map map = req0.values(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c1ecf28/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index fc988da..9f72589 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -108,6 +108,19 @@ Cache.prototype.putAll = function(map, callback) { } /** + * Put keys to cache + * + * @this {Cache} + * @param {Object.} map collection of entries to put in the cache + * @param {noValue} callback Called on finish + */ +Cache.prototype.postPutAll = function(map, callback) { +var params = [this._cacheNameParam]; + +this._server.runCommand("putall2", params, callback, JSON.stringify(map)); +} + +/** * Callback for cache get * * @callback Cache~onGetAll http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c1ecf28/modules/nodejs/src/main/js/server.js -- diff --git a/modules/nodejs/src/main/js/server.js b/modules/nodejs/src/main/js/server.js index 81462a4..b3586e3 100644 --- a/modules/nodejs/src/main/js/server.js +++ b/modules/nodejs/src/main/js/server.js @@ -61,7 +61,7 @@ Server.prototype.host = function() { * @param params Parameters for command. * @param {onGet} Called on finish */ -Server.prototype.runComm
incubator-ignite git commit: #ignite-964: introduce command object in server.js
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 2c1ecf283 -> 874468768 #ignite-964: introduce command object in server.js Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/87446876 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/87446876 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/87446876 Branch: refs/heads/ignite-964-1 Commit: 8744687687f5994c1a881432a7c0600a6b7368c4 Parents: 2c1ecf2 Author: ivasilinets Authored: Tue Jun 30 02:02:44 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 02:02:44 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 100 - modules/nodejs/src/main/js/compute.js | 14 ++-- modules/nodejs/src/main/js/ignite.js | 7 +- modules/nodejs/src/main/js/server.js | 85 4 files changed, 98 insertions(+), 108 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/87446876/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 9f72589..1ece92d 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -16,6 +16,7 @@ */ var Server = require("./server").Server; +var Command = require("./server").Command; var SqlFieldsQuery = require("./sql-fields-query").SqlFieldsQuery var SqlQuery = require("./sql-query").SqlQuery @@ -30,7 +31,6 @@ var SqlQuery = require("./sql-query").SqlQuery function Cache(server, cacheName) { this._server = server; this._cacheName = cacheName; -this._cacheNameParam = Server.pair("cacheName", this._cacheName); } /** @@ -41,7 +41,7 @@ function Cache(server, cacheName) { * @param {onGet} callback Called on finish */ Cache.prototype.get = function(key, callback) { -this._server.runCommand("get", [this._cacheNameParam, Server.pair("key", key)], callback); +this._server.runCommand(this._createCommand("get").addParam("key", key), callback); }; /** @@ -53,7 +53,7 @@ Cache.prototype.get = function(key, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.put = function(key, value, callback) { -this._server.runCommand("put", [this._cacheNameParam, Server.pair("key", key), Server.pair("val", value)], +this._server.runCommand(this._createCommand("put").addParam("key", key).addParam("val", value), callback); } @@ -65,7 +65,7 @@ Cache.prototype.put = function(key, value, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.remove = function(key, callback) { -this._server.runCommand("rmv", [this._cacheNameParam, Server.pair("key", key)], callback); +this._server.runCommand(this._createCommand("rmv").addParam("key", key), callback); } /** @@ -76,11 +76,7 @@ Cache.prototype.remove = function(key, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.removeAll = function(keys, callback) { -var params = [this._cacheNameParam]; - -params = params.concat(Cache.concatParams("k", keys)); - -this._server.runCommand("rmvall", params, callback); +this._server.runCommand(this._createCommand("rmvall").addParams("k", keys), callback); } /** @@ -99,12 +95,7 @@ Cache.prototype.putAll = function(map, callback) { values.push(map[key]); } -var params = Cache.concatParams("k", keys); -params = params.concat(Cache.concatParams("v", values)); - -params.push(this._cacheNameParam); - -this._server.runCommand("putall", params, callback); +this._server.runCommand(this._createCommand("putall").addParams("k", keys).addParams("v", values), callback); } /** @@ -115,9 +106,7 @@ Cache.prototype.putAll = function(map, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.postPutAll = function(map, callback) { -var params = [this._cacheNameParam]; - -this._server.runCommand("putall2", params, callback, JSON.stringify(map)); + this._server.runCommand(this._createCommand("putall2").setPostData(JSON.stringify(map)), callback); } /** @@ -136,11 +125,7 @@ Cache.prototype.postPutAll = function(map, callback) { * @param {Cache~onGetAll} callback Called on finish */ Cache.prototype.getAll = function(keys, callback) { -var params = Cache.concatParams("k", keys); -
[1/5] incubator-ignite git commit: #ignite-964: remove error function for nodejs query.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 d218dfb1d -> 3f86e4b46 #ignite-964: remove error function for nodejs query. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/576c4350 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/576c4350 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/576c4350 Branch: refs/heads/ignite-964-1 Commit: 576c43501702f8c8de0103bc50f355ac35d3bee9 Parents: f260e9b Author: ivasilinets Authored: Tue Jun 30 13:46:57 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 13:46:57 2015 +0300 -- .../handlers/query/QueryCommandHandler.java | 8 +-- .../rest/request/RestSqlQueryRequest.java | 10 ++-- modules/nodejs/src/main/js/cache.js | 9 +--- modules/nodejs/src/main/js/sql-fields-query.js | 23 ++-- modules/nodejs/src/test/js/test-query.js| 55 +--- 5 files changed, 43 insertions(+), 62 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/576c4350/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index 496243e..a9f7b0f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java @@ -190,12 +190,12 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { /** {@inheritDoc} */ @Override public GridRestResponse call() throws Exception { try { -if (curs.contains(req.queryId())) +Iterator> cur = curs.get(req.queryId()); + +if (cur == null) return new GridRestResponse(GridRestResponse.STATUS_FAILED, "Cannot find query [qryId=" + req.queryId() + "]"); -Iterator> cur = curs.get(req.queryId()); - List> res = new ArrayList<>(); CacheQueryResult response = new CacheQueryResult(); @@ -215,6 +215,8 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { return new GridRestResponse(response); } catch (Exception e) { +curs.remove(req.queryId()); + return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/576c4350/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java index 830011a..5ba3a50 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java @@ -28,7 +28,7 @@ public class RestSqlQueryRequest extends GridRestRequest { private Object[] args; /** Page size. */ -private Integer pageSz; +private Integer pageSize; /** Cache name. */ private String cacheName; @@ -68,17 +68,17 @@ public class RestSqlQueryRequest extends GridRestRequest { } /** - * @param pageSz Page size. + * @param pageSize Page size. */ -public void pageSize(Integer pageSz) { -this.pageSz = pageSz; +public void pageSize(Integer pageSize) { +this.pageSize = pageSize; } /** * @return Page size. */ public int pageSize() { -return pageSz; +return pageSize; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/576c4350/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index fc988da..8f074e3 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -138,20 +138,15 @@ Cache.prototype.getAll = function(keys, callback) { Cache.prototype.query = function(qry) {
[5/5] incubator-ignite git commit: #ignite-964: wip
#ignite-964: wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3f86e4b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3f86e4b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3f86e4b4 Branch: refs/heads/ignite-964-1 Commit: 3f86e4b46dc445623b71bb90e37c9672ce41022f Parents: 0643798 Author: ivasilinets Authored: Tue Jun 30 15:30:56 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 15:30:56 2015 +0300 -- .../handlers/query/QueryCommandHandler.java | 23 ++--- modules/nodejs/src/main/js/cache.js | 9 +- modules/nodejs/src/main/js/server.js| 12 +-- .../ignite/internal/NodeJsSqlQuerySelfTest.java | 96 modules/nodejs/src/test/js/test-query.js| 24 +++-- .../http/jetty/GridJettyRestHandler.java| 23 - 6 files changed, 97 insertions(+), 90 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3f86e4b4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index a9f7b0f..a254115 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java @@ -45,7 +45,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private static final AtomicLong qryIdGen = new AtomicLong(); /** Current queries. */ -private final ConcurrentHashMap>> curs = +private final ConcurrentHashMap>> curs = new ConcurrentHashMap<>(); /** @@ -100,14 +100,14 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private RestSqlQueryRequest req; /** Queries cursors. */ -private ConcurrentHashMap>> curs; +private ConcurrentHashMap>> curs; /** * @param ctx Kernal context. * @param req Execute query request. */ public ExecuteQueryCallable(GridKernalContext ctx, RestSqlQueryRequest req, -ConcurrentHashMap>> curs) { +ConcurrentHashMap>> curs) { this.ctx = ctx; this.req = req; this.curs = curs; @@ -129,7 +129,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { ((SqlFieldsQuery)qry).setArgs(req.arguments()); } -Iterator> cur = +Iterator> cur = ctx.grid().cache(req.cacheName()).query(qry).iterator(); long qryId = qryIdGen.getAndIncrement(); @@ -140,8 +140,9 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { CacheQueryResult response = new CacheQueryResult(); -for (int i = 0; i < req.pageSize() && cur.hasNext(); ++i) +for (int i = 0; i < req.pageSize() && cur.hasNext(); ++i) { res.add(cur.next()); +} response.setItems(res); @@ -174,14 +175,14 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private RestSqlQueryRequest req; /** Queries cursors. */ -private ConcurrentHashMap>> curs; +private ConcurrentHashMap>> curs; /** * @param ctx Kernal context. * @param req Execute query request. */ public FetchQueryCallable(GridKernalContext ctx, RestSqlQueryRequest req, -ConcurrentHashMap>> curs) { +ConcurrentHashMap>> curs) { this.ctx = ctx; this.req = req; this.curs = curs; @@ -190,19 +191,19 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { /** {@inheritDoc} */ @Override public GridRestResponse call() throws Exception { try { -Iterator> cur = curs.get(req.queryId()); +Iterator> cur = curs.get(req.queryId()); if (cur == null) return new GridRestResponse(GridRestResponse.STATUS_FAILED, "Cannot find query [qryId=" + req.queryId() + "]"); -List> res = new ArrayList<>(); +L
[3/5] incubator-ignite git commit: #ignite-964: remove postPutAll
#ignite-964: remove postPutAll Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2bf2b69e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2bf2b69e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2bf2b69e Branch: refs/heads/ignite-964-1 Commit: 2bf2b69e4f18eacd79072c762a9d4a14bfca11ae Parents: 913a5d4 Author: ivasilinets Authored: Tue Jun 30 14:40:38 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 14:40:38 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 - .../handlers/cache/GridCacheCommandHandler.java | 2 - modules/nodejs/src/main/js/cache.js | 2 +- modules/nodejs/src/main/js/server.js| 10 +- .../http/jetty/GridJettyRestHandler.java| 108 +-- 5 files changed, 61 insertions(+), 64 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bf2b69e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 375a079..0afefb6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -45,9 +45,6 @@ public enum GridRestCommand { /** Store several values in cache. */ CACHE_PUT_ALL("putall"), -/** Store several values in cache. */ -CACHE_PUT_ALL2("putall2"), - /** Remove value from cache. */ CACHE_REMOVE("rmv"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bf2b69e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index ef0391e..1f24023 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -58,7 +58,6 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_PUT, CACHE_ADD, CACHE_PUT_ALL, -CACHE_PUT_ALL2, CACHE_REMOVE, CACHE_REMOVE_ALL, CACHE_REPLACE, @@ -191,7 +190,6 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } -case CACHE_PUT_ALL2: case CACHE_PUT_ALL: { Map map = req0.values(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bf2b69e/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 489..b19367c 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -106,7 +106,7 @@ Cache.prototype.putAll = function(map, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.postPutAll = function(map, callback) { - this._server.runCommand(this._createCommand("putall2").setPostData(JSON.stringify(map)), callback); + this._server.runCommand(this._createCommand("putall").setPostData(JSON.stringify(map)), callback); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bf2b69e/modules/nodejs/src/main/js/server.js -- diff --git a/modules/nodejs/src/main/js/server.js b/modules/nodejs/src/main/js/server.js index 2714ae5..3cb98c1 100644 --- a/modules/nodejs/src/main/js/server.js +++ b/modules/nodejs/src/main/js/server.js @@ -67,12 +67,18 @@ Server.prototype.runCommand = function(cmd, callback) { var http = require('http'); +var commHeaders = this._signature(); + +if (cmd._isPost()) { +commHeaders["JSONObject"] = "true"; +} + var options = { host: this._host, port: this._port, method : cmd._method(), path: "/ignite?" + requestQry, -headers: this._signature() +headers: commHeader
[4/5] incubator-ignite git commit: #ignite-964: remove postPutAll
#ignite-964: remove postPutAll Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0643798e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0643798e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0643798e Branch: refs/heads/ignite-964-1 Commit: 0643798e85545812677320fbde629dcfd75b5700 Parents: 2bf2b69 Author: ivasilinets Authored: Tue Jun 30 14:42:37 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 14:42:37 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 19 --- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 --- modules/nodejs/src/test/js/test-cache-api.js | 4 3 files changed, 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0643798e/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index b19367c..0e08c82 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -87,25 +87,6 @@ Cache.prototype.removeAll = function(keys, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.putAll = function(map, callback) { -var keys = Object.keys(map); - -var values = []; - -for (var key of keys) { -values.push(map[key]); -} - -this._server.runCommand(this._createCommand("putall").addParams("k", keys).addParams("v", values), callback); -} - -/** - * Put keys to cache - * - * @this {Cache} - * @param {Object.} map collection of entries to put in the cache - * @param {noValue} callback Called on finish - */ -Cache.prototype.postPutAll = function(map, callback) { this._server.runCommand(this._createCommand("putall").setPostData(JSON.stringify(map)), callback); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0643798e/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java -- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java index a6c6140..f17ca60 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java @@ -84,11 +84,4 @@ public class NodeJsCacheApiSelfTest extends NodeJsAbstractTest { public void testPutAllGetAll() throws Exception { runJsScript("testPutAllGetAll"); } - -/** - * @throws Exception If failed. - */ -public void testPostPutAllGetAll() throws Exception { -runJsScript("testPostPutAllGetAll"); -} } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0643798e/modules/nodejs/src/test/js/test-cache-api.js -- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 90ccbb6..fc29f22 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -35,10 +35,6 @@ testPutAllGetAll = function() { startTest("mycache", {trace: [putAll, getAll], entry: {"key1": "val1", "key2" : "val2"}}); } -testPostPutAllGetAll = function() { -startTest("mycache", {trace: [postPutAll, getAll], entry: {"key1": "val1", "key2" : "val2"}}); -} - testRemoveAll = function() { startTest("mycache", {trace: [putAll, getAll, removeAll, getNone], entry: {"key1": "val1", "key2" : "val2"}}); }
[2/5] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-964' into ignite-964-1
Merge remote-tracking branch 'remotes/origin/ignite-964' into ignite-964-1 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/913a5d46 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/913a5d46 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/913a5d46 Branch: refs/heads/ignite-964-1 Commit: 913a5d46693644557eb4697bb35862466014d70e Parents: d218dfb 576c435 Author: ivasilinets Authored: Tue Jun 30 14:26:07 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 14:26:07 2015 +0300 -- .../handlers/query/QueryCommandHandler.java | 8 +-- .../rest/request/RestSqlQueryRequest.java | 10 ++-- modules/nodejs/src/main/js/cache.js | 9 +--- modules/nodejs/src/main/js/sql-fields-query.js | 23 ++-- modules/nodejs/src/test/js/test-query.js| 55 +--- 5 files changed, 43 insertions(+), 62 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/913a5d46/modules/nodejs/src/main/js/cache.js -- diff --cc modules/nodejs/src/main/js/cache.js index 1ece92d,8f074e3..489 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@@ -149,12 -146,14 +144,12 @@@ Cache.prototype.query = function(qry) qry.page(res["items"]); if (res["last"]) { - qry.end(); + qry.end(null); } else { -this._server.runCommand("qryfetch", [ -Server.pair("cacheName", this._cacheName), -Server.pair("qryId", res.queryId), -Server.pair("psz", qry.pageSize())], -onQueryExecute.bind(this, qry)); +var command = this._createCommand("qryfetch"); +command.addParam("qryId", res.queryId).addParam("psz", qry.pageSize()); +this._server.runCommand(command, onQueryExecute.bind(this, qry)); } }
incubator-ignite git commit: #ignite-964: sql query works with arguments.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 3f86e4b46 -> 54be10600 #ignite-964: sql query works with arguments. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/54be1060 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/54be1060 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/54be1060 Branch: refs/heads/ignite-964-1 Commit: 54be1060053577dce1f689cb2aeec4210866b707 Parents: 3f86e4b Author: ivasilinets Authored: Tue Jun 30 16:00:11 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 16:00:11 2015 +0300 -- modules/nodejs/src/main/js/server.js| 2 +- .../ignite/internal/NodeJsSqlQuerySelfTest.java | 60 +++- modules/nodejs/src/test/js/test-query.js| 22 +++ .../http/jetty/GridJettyRestHandler.java| 2 - 4 files changed, 57 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/54be1060/modules/nodejs/src/main/js/server.js -- diff --git a/modules/nodejs/src/main/js/server.js b/modules/nodejs/src/main/js/server.js index e49ed83..021fffe 100644 --- a/modules/nodejs/src/main/js/server.js +++ b/modules/nodejs/src/main/js/server.js @@ -151,7 +151,7 @@ Server.prototype.checkConnection = function(callback) { */ Server.prototype._signature = function() { if (!this._secretKey) { -return ""; +return {}; } var loadTimeInMS = Date.now(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/54be1060/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java -- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java index 8d33668..a6891fb 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java @@ -18,12 +18,11 @@ package org.apache.ignite.internal; import org.apache.ignite.*; -import org.apache.ignite.cache.affinity.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.configuration.*; import java.io.*; -import java.util.*; /** * Node js sql query test. @@ -75,29 +74,40 @@ public class NodeJsSqlQuerySelfTest extends NodeJsAbstractTest { * Init cache. */ private void initCache() { -CacheConfiguration personCacheCfg = new CacheConfiguration<>("person"); -personCacheCfg.setIndexedTypes(UUID.class, Person.class); +CacheConfiguration personCacheCfg = new CacheConfiguration<>("person"); +personCacheCfg.setIndexedTypes(Integer.class, Person.class); -IgniteCache personCache = grid(0).getOrCreateCache(personCacheCfg); +IgniteCache personCache = grid(0).getOrCreateCache(personCacheCfg); + +personCache.clear(); Person p1 = new Person("John", "Doe", 2000); Person p2 = new Person("Jane", "Doe", 1000); Person p3 = new Person("John", "Smith", 1000); Person p4 = new Person("Jane", "Smith", 2000); -personCache.put(p4.getId(), p1); -personCache.put(p4.getId(), p2); -personCache.put(p4.getId(), p3); +personCache.put(p1.getId(), p1); +personCache.put(p2.getId(), p2); +personCache.put(p3.getId(), p3); personCache.put(p4.getId(), p4); + +SqlQuery qry = new SqlQuery(Person.class, "salary > ? and salary <= ?"); + +qry.setArgs(1000, 2000); + +assertEquals(2, personCache.query(qry).getAll().size()); } /** * Person class. */ public static class Person implements Serializable { +/** Person id. */ +private static int PERSON_ID = 0; + /** Person ID (indexed). */ @QuerySqlField(index = true) -private UUID id; +private Integer id; /** First name (not-indexed). */ @QuerySqlField @@ -116,44 +126,68 @@ public class NodeJsSqlQuerySelfTest extends NodeJsAbstractTest { * @param lastName Last name. * @param salary Salary. */ -Person( String firstName, String lastName, double salary) { -id = UUID.randomUUID(); +Person(String firstName, String lastName, double salary) { +id = PERSON_ID++; this.firstName = firstName
[1/3] incubator-ignite git commit: IGNITE-1062 Split in topology snapshot server and client nodes.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 54be10600 -> bea777f9d IGNITE-1062 Split in topology snapshot server and client nodes. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8006a843 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8006a843 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8006a843 Branch: refs/heads/ignite-964-1 Commit: 8006a84344118f39e9190643420512fbee06bc73 Parents: bade9f1 Author: nikolay_tikhonov Authored: Tue Jun 30 16:06:28 2015 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 30 16:06:28 2015 +0300 -- .../discovery/GridDiscoveryManager.java | 46 +++- .../IgniteTopologyPrintFormatSelfTest.java | 233 +++ .../testsuites/IgniteKernalSelfTestSuite.java | 1 + 3 files changed, 274 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8006a843/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java index 5e7600f..1d555e4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java @@ -98,6 +98,13 @@ public class GridDiscoveryManager extends GridManagerAdapter { } }; +/** Predicate filtering client nodes. */ +private static final IgnitePredicate clientFilter = new P1() { +@Override public boolean apply(ClusterNode n) { +return n.isClient(); +} +}; + /** Disco history entries comparator. */ private static final Comparator> histCmp = new Comparator>() { @@ -933,6 +940,10 @@ public class GridDiscoveryManager extends GridManagerAdapter { Collection rmtNodes = discoCache.remoteNodes(); +Collection serverNodes = discoCache.serverNodes(); + +Collection clientNodes = discoCache.clientNodes(); + ClusterNode locNode = discoCache.localNode(); Collection allNodes = discoCache.allNodes(); @@ -949,7 +960,7 @@ public class GridDiscoveryManager extends GridManagerAdapter { double heap = U.heapSize(allNodes, 2); if (log.isQuiet()) -U.quiet(false, topologySnapshotMessage(rmtNodes.size(), totalCpus, heap)); +U.quiet(false, topologySnapshotMessage(serverNodes.size(), clientNodes.size(), totalCpus, heap)); if (log.isDebugEnabled()) { String dbg = ""; @@ -959,7 +970,8 @@ public class GridDiscoveryManager extends GridManagerAdapter { ">>> " + PREFIX + "." + U.nl() + ">>> ++" + U.nl() + ">>> Grid name: " + (ctx.gridName() == null ? "default" : ctx.gridName()) + U.nl() + -">>> Number of nodes: " + (rmtNodes.size() + 1) + U.nl() + +">>> Number of server nodes: " + serverNodes.size() + U.nl() + +">>> Number of client nodes: " + clientNodes.size() + U.nl() + (discoOrdered ? ">>> Topology version: " + topVer + U.nl() : "") + ">>> Topology hash: 0x" + Long.toHexString(hash).toUpperCase() + U.nl(); @@ -992,19 +1004,21 @@ public class GridDiscoveryManager extends GridManagerAdapter { log.debug(dbg); } else if (log.isInfoEnabled()) -log.info(topologySnapshotMessage(rmtNodes.size(), totalCpus, heap)); +log.info(topologySnapshotMessage(serverNodes.size(), clientNodes.size(), totalCpus, heap)); } /** - * @param rmtNodesNum Remote nodes number. + * @param serverNodesNum Server nodes number. + * @param clientNodesNum Client nodes number. * @param totalCpus Total cpu number. * @param heap Heap size. * @return Topology snapshot message. */ -private String topologySnapshotMessage(int rmtNodesNum, int totalCpus, double heap) { +private String topologySnapshotMessage(int serverNodesNum, int clientNodesNum, int totalCpus, double heap) { return PREFIX + " [" + (discoOrdered ? "ver=" + topSnap.get().topVer.topologyVersion() + ", " : "") + -"nodes=" + (rmtNodesNum + 1) + +"server nodes=" + serverNodesNum + +", client nodes=" + clientNodesNum + ", CPUs=" + totalCpus + ", heap=" + heap + "GB" + ']'; @@ -2108,6 +2122,12 @
[3/3] incubator-ignite git commit: #ignite-964: add test put all objects.
#ignite-964: add test put all objects. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bea777f9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bea777f9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bea777f9 Branch: refs/heads/ignite-964-1 Commit: bea777f9d99b2e8a1e5cab8ab2c1215a70d15aff Parents: eb4f07b Author: ivasilinets Authored: Tue Jun 30 17:24:01 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 17:24:01 2015 +0300 -- .../processors/scripting/JSONCacheObject.java | 78 modules/nodejs/src/main/js/cache.js | 4 +- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 ++ modules/nodejs/src/test/js/test-cache-api.js| 16 ++-- modules/nodejs/src/test/js/test-utils.js| 15 5 files changed, 113 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bea777f9/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java new file mode 100644 index 000..46067d7 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java @@ -0,0 +1,78 @@ +/* + * 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.processors.scripting; + +import java.util.*; + +/** + * Json cache object. + */ +public class JSONCacheObject { +/** Fields map. */ +private Map fields = new HashMap<>(); + +/** + * @param key Field name. + * @param val Field value. + */ +public void addField(String key, Object val) { +fields.put(key, val); +} + +/** + * @param key Field name. + * @return Field value. + */ +public Object getField(String key) { +return fields.get(key); +} + +/** + * @return Fields key set. + */ +public Set keys() { +return fields.keySet(); +} + +/** {@inheritDoc} */ +@Override public int hashCode() { +//TODO: +return fields.hashCode(); +} + +/** {@inheritDoc} */ +@Override public boolean equals(Object obj) { +if (obj == null || !(obj instanceof JSONCacheObject)) +return false; + +JSONCacheObject obj0 = (JSONCacheObject) obj; + +if (fields.size() != obj0.fields.size()) +return false; + +for (String key : obj0.keys()) { +if (!fields.containsKey(key)) +return false; + +if (!obj0.getField(key).equals(getField(key))) +return false; +} + +return true; +} +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bea777f9/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 8ff6ee3..e0ed505 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -153,7 +153,6 @@ Cache.prototype._sqlFieldsQuery = function(qry, onQueryExecute) { } Cache.prototype._sqlQuery = function(qry, onQueryExecute) { - if (qry.returnType() == null) { qry.error("No type for sql query."); qry.end(); @@ -171,12 +170,15 @@ Cache.prototype._sqlQuery = function(qry, onQueryExecute) { Cache.prototype._createCommand = function(name) { var command = new Command(name); + return command.addParam("cacheName", this._cacheName); } Cache.prototype._createQueryCommand = function(name, qry) { var command = this._createCommand(name); + command.addParam("qry", qry.query()); + return command.addParam(&q
[2/3] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-964-1
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-964-1 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/eb4f07b2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/eb4f07b2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/eb4f07b2 Branch: refs/heads/ignite-964-1 Commit: eb4f07b2c81af0ad92a942bebb1c8fd14078d03a Parents: 54be106 8006a84 Author: ivasilinets Authored: Tue Jun 30 16:22:44 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 16:22:44 2015 +0300 -- .../discovery/GridDiscoveryManager.java | 46 +++- .../IgniteTopologyPrintFormatSelfTest.java | 233 +++ .../testsuites/IgniteKernalSelfTestSuite.java | 1 + 3 files changed, 274 insertions(+), 6 deletions(-) --
incubator-ignite git commit: #ignite-964: change test for object put all.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 bea777f9d -> ea50ebbaa #ignite-964: change test for object put all. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ea50ebba Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ea50ebba Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ea50ebba Branch: refs/heads/ignite-964-1 Commit: ea50ebbaa16544b1a791b2bef16bdb8e0dd75e0a Parents: bea777f Author: ivasilinets Authored: Tue Jun 30 17:47:53 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 17:47:53 2015 +0300 -- modules/nodejs/src/test/js/test-cache-api.js | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea50ebba/modules/nodejs/src/test/js/test-cache-api.js -- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 515f543..6e660b1 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -36,12 +36,18 @@ testPutAllGetAll = function() { } testPutAllObjectGetAll = function() { +var params = {} var key1 = {"name" : "Ann"}; var key2 = {"name" : "Paul"}; var val1 = {"age" : 12, "books" : ["1", "Book"]}; var val2 = {"age" : 13, "books" : ["1", "Book"]}; -startTest("mycache", {trace: [putAll, getAll], entry: {key1 : val1, key2 : val2}}); +params["k1"] = key1; +params["k2"] = key2; +params["val1"] = val1; +params["val2"] = val2; + +startTest("mycache", {trace: [putAll, getAll], entry: params}); } testRemoveAll = function() {
incubator-ignite git commit: #ignite-964: wip
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 ea50ebbaa -> 80bd452c9 #ignite-964: wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/80bd452c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/80bd452c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/80bd452c Branch: refs/heads/ignite-964-1 Commit: 80bd452c985d685169f7ca8bc4bd264e0f4d33ca Parents: ea50ebb Author: ivasilinets Authored: Tue Jun 30 18:53:10 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 18:53:10 2015 +0300 -- .../processors/scripting/JSONCacheObject.java | 78 - .../http/jetty/GridJettyRestHandler.java| 53 ++--- .../protocols/http/jetty/JSONCacheObject.java | 111 +++ 3 files changed, 149 insertions(+), 93 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/80bd452c/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java deleted file mode 100644 index 46067d7..000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.processors.scripting; - -import java.util.*; - -/** - * Json cache object. - */ -public class JSONCacheObject { -/** Fields map. */ -private Map fields = new HashMap<>(); - -/** - * @param key Field name. - * @param val Field value. - */ -public void addField(String key, Object val) { -fields.put(key, val); -} - -/** - * @param key Field name. - * @return Field value. - */ -public Object getField(String key) { -return fields.get(key); -} - -/** - * @return Fields key set. - */ -public Set keys() { -return fields.keySet(); -} - -/** {@inheritDoc} */ -@Override public int hashCode() { -//TODO: -return fields.hashCode(); -} - -/** {@inheritDoc} */ -@Override public boolean equals(Object obj) { -if (obj == null || !(obj instanceof JSONCacheObject)) -return false; - -JSONCacheObject obj0 = (JSONCacheObject) obj; - -if (fields.size() != obj0.fields.size()) -return false; - -for (String key : obj0.keys()) { -if (!fields.containsKey(key)) -return false; - -if (!obj0.getField(key).equals(getField(key))) -return false; -} - -return true; -} -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/80bd452c/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index 6327c88..f7b1db8 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -358,28 +358,28 @@ public class GridJettyRestHandler extends AbstractHandler { if (req.getHeader("JSONObject") != null) { if (cmd == CACHE_PUT_ALL) { -StringBuilder builder = new StringBuilder(); +
incubator-ignite git commit: #ignite-964: nodejs cache works with json objects and strings.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 80bd452c9 -> b963d0339 #ignite-964: nodejs cache works with json objects and strings. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b963d033 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b963d033 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b963d033 Branch: refs/heads/ignite-964-1 Commit: b963d033922fa712ddb11fd3542468af802ea91f Parents: 80bd452 Author: ivasilinets Authored: Wed Jul 1 01:14:44 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 01:14:44 2015 +0300 -- modules/nodejs/src/main/js/apache-ignite.js | 1 + modules/nodejs/src/main/js/cache.js | 71 +++-- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 ++ modules/nodejs/src/test/js/test-cache-api.js| 100 ++- modules/nodejs/src/test/js/test-utils.js| 11 +- .../http/jetty/GridJettyRestHandler.java| 91 ++--- .../protocols/http/jetty/JSONCacheObject.java | 8 ++ 7 files changed, 240 insertions(+), 49 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b963d033/modules/nodejs/src/main/js/apache-ignite.js -- diff --git a/modules/nodejs/src/main/js/apache-ignite.js b/modules/nodejs/src/main/js/apache-ignite.js index af86916..82aa5ca 100644 --- a/modules/nodejs/src/main/js/apache-ignite.js +++ b/modules/nodejs/src/main/js/apache-ignite.js @@ -17,6 +17,7 @@ module.exports = { Cache : require('./cache.js').Cache, +Entry : require('./cache.js').Entry, Ignition : require('./ignition.js').Ignition, Server : require('./server.js').Server, Ignite : require('./ignite.js').Ignite, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b963d033/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index e0ed505..3eaadb4 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -41,7 +41,9 @@ function Cache(server, cacheName) { * @param {onGet} callback Called on finish */ Cache.prototype.get = function(key, callback) { -this._server.runCommand(this._createCommand("get").addParam("key", key), callback); +this._server.runCommand(this._createCommand("get"). +setPostData(JSON.stringify({"key": key})), +callback); }; /** @@ -53,7 +55,8 @@ Cache.prototype.get = function(key, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.put = function(key, value, callback) { -this._server.runCommand(this._createCommand("put").addParam("key", key).addParam("val", value), +this._server.runCommand(this._createCommand("put"). +setPostData(JSON.stringify({"key": key, "val" : value})), callback); } @@ -65,7 +68,9 @@ Cache.prototype.put = function(key, value, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.remove = function(key, callback) { -this._server.runCommand(this._createCommand("rmv").addParam("key", key), callback); +this._server.runCommand(this._createCommand("rmv"). +setPostData(JSON.stringify({"key": key})), +callback); } /** @@ -76,18 +81,21 @@ Cache.prototype.remove = function(key, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.removeAll = function(keys, callback) { -this._server.runCommand(this._createCommand("rmvall").addParams("k", keys), callback); +this._server.runCommand(this._createCommand("rmvall"). +setPostData(JSON.stringify({"keys" : keys})), +callback); } /** * Put keys to cache * * @this {Cache} - * @param {Object.} map collection of entries to put in the cache + * @param {Entry[]} List of entries to put in the cache * @param {noValue} callback Called on finish */ -Cache.prototype.putAll = function(map, callback) { - this._server.runCommand(this._createCommand("putall").setPostData(JSON.stringify(map)), callback); +Cache.prototype.putAll = function(entries, callback) { +this._server.runCommand(this._createCommand("putall").setPostData( +JSON.stringify({"entries" : entries})), callback); } /** @@ -106,7 +114,25 @@ Cache.prototype.putAll = function(map, callback) { * @param {Cache~onGetAll} callback Called on fi
[03/23] incubator-ignite git commit: IGNITE-1046 Added license.
IGNITE-1046 Added license. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/86c5d207 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/86c5d207 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/86c5d207 Branch: refs/heads/ignite-964-1 Commit: 86c5d207094947aa9e53ea6da6314c125188ec8d Parents: f57aa92 Author: nikolay_tikhonov Authored: Fri Jun 26 13:09:59 2015 +0300 Committer: nikolay_tikhonov Committed: Fri Jun 26 13:09:59 2015 +0300 -- modules/docker/Dockerfile | 17 + modules/docker/build_users_libs.sh | 16 modules/docker/download_ignite.sh | 16 modules/docker/execute.sh | 16 modules/docker/run.sh | 16 5 files changed, 81 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c5d207/modules/docker/Dockerfile -- diff --git a/modules/docker/Dockerfile b/modules/docker/Dockerfile index 272..11e2e3d 100644 --- a/modules/docker/Dockerfile +++ b/modules/docker/Dockerfile @@ -1,3 +1,20 @@ +# +# 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. +# + # Start from a Debian image. FROM debian:8 http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c5d207/modules/docker/build_users_libs.sh -- diff --git a/modules/docker/build_users_libs.sh b/modules/docker/build_users_libs.sh index 24f4420..4d37187 100644 --- a/modules/docker/build_users_libs.sh +++ b/modules/docker/build_users_libs.sh @@ -1,4 +1,20 @@ #!/bin/bash +# +# 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. +# if [ -z $GIT_REPO ]; then echo Users git repo is not provided. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c5d207/modules/docker/download_ignite.sh -- diff --git a/modules/docker/download_ignite.sh b/modules/docker/download_ignite.sh index 6a8617f..9e2cb51 100644 --- a/modules/docker/download_ignite.sh +++ b/modules/docker/download_ignite.sh @@ -1,4 +1,20 @@ #!/bin/bash +# +# 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. +# function download { wget -O ignite.zip $1 http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c5d207/modules/docker/execute.sh -- diff --git a/modules/docker/execute.sh b/modules/docker/execute.sh ind
[17/23] incubator-ignite git commit: #ignite-964: IgniteJsEmitResult code style.
#ignite-964: IgniteJsEmitResult code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cec45347 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cec45347 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cec45347 Branch: refs/heads/ignite-964-1 Commit: cec45347bc6475c6b59f9128732b5c696ec20c47 Parents: 7e0a63b Author: ivasilinets Authored: Wed Jul 1 12:26:52 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:26:52 2015 +0300 -- .../processors/rest/handlers/scripting/IgniteJsEmitResult.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cec45347/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java index ecd6cba..b5ae106 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java @@ -37,9 +37,9 @@ public class IgniteJsEmitResult { List> res = emitResPerCall.get(); if (res == null) -res = new ArrayList(); +res = new ArrayList<>(); -res.add(new T3(f, args, node)); +res.add(new T3<>(f, args, node)); emitResPerCall.set(res); }
[08/23] incubator-ignite git commit: IGNITE-1062 Added tests.
IGNITE-1062 Added tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6ebcb6de Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6ebcb6de Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6ebcb6de Branch: refs/heads/ignite-964-1 Commit: 6ebcb6de192e1916e58226990eb9d9ec759da6ef Parents: 8006a84 Author: nikolay_tikhonov Authored: Tue Jun 30 16:51:15 2015 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 30 16:51:15 2015 +0300 -- .../discovery/GridDiscoveryManager.java | 26 + .../IgniteTopologyPrintFormatSelfTest.java | 60 +++- 2 files changed, 61 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ebcb6de/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java index 1d555e4..a8ce8ff 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java @@ -101,7 +101,7 @@ public class GridDiscoveryManager extends GridManagerAdapter { /** Predicate filtering client nodes. */ private static final IgnitePredicate clientFilter = new P1() { @Override public boolean apply(ClusterNode n) { -return n.isClient(); +return CU.clientNode(n); } }; @@ -940,9 +940,9 @@ public class GridDiscoveryManager extends GridManagerAdapter { Collection rmtNodes = discoCache.remoteNodes(); -Collection serverNodes = discoCache.serverNodes(); +Collection serverNodes = F.view(discoCache.allNodes(), F.not(clientFilter)); -Collection clientNodes = discoCache.clientNodes(); +Collection clientNodes = F.view(discoCache.allNodes(), clientFilter); ClusterNode locNode = discoCache.localNode(); @@ -2122,12 +2122,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { /** Remote nodes. */ private final List rmtNodes; -/** Client nodes. */ -private final List clientNodes; - -/** Server nodes. */ -private final List serverNodes; - /** All nodes. */ private final List allNodes; @@ -2216,10 +2210,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { all.addAll(rmtNodes); -clientNodes = Collections.unmodifiableList(new ArrayList<>(F.view(all, clientFilter))); - -serverNodes = Collections.unmodifiableList(new ArrayList<>(F.view(all, F.not(clientFilter; - Collections.sort(all, GridNodeOrderComparator.INSTANCE); allNodes = Collections.unmodifiableList(all); @@ -2370,16 +2360,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { return rmtNodes; } -/** @return Server nodes. */ -Collection serverNodes() { -return serverNodes; -} - -/** @return Client nodes. */ -Collection clientNodes() { -return clientNodes; -} - /** @return All nodes. */ Collection allNodes() { return allNodes; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ebcb6de/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java -- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java index efbc431..2a71f28 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java @@ -56,11 +56,16 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest { TcpDiscoverySpi disc = new TcpDiscoverySpi(); disc.setIpFinder(IP_FINDER); -cfg.setDiscoverySpi(disc); - if (gridName.endsWith("client")) cfg.setClientMode(true); +if (gridName.endsWith("client_force_server")) { +cfg.setClientMode(true); +disc.setForceServerMode(true); +} + +cfg.se
[01/23] incubator-ignite git commit: #IGNITE-1046 Added dockerfile and scripts for running container with ignite.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 b963d0339 -> 3807762a9 #IGNITE-1046 Added dockerfile and scripts for running container with ignite. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9de7d248 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9de7d248 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9de7d248 Branch: refs/heads/ignite-964-1 Commit: 9de7d248d9ed720179887547772a899beea48488 Parents: 1c66078 Author: nikolay_tikhonov Authored: Wed Jun 24 16:26:07 2015 +0300 Committer: nikolay_tikhonov Committed: Wed Jun 24 16:26:07 2015 +0300 -- modules/docker/Dockerfile | 38 + modules/docker/README.txt | 11 + modules/docker/build_users_libs.sh | 23 ++ modules/docker/download_ignite.sh | 33 ++ modules/docker/execute.sh | 42 + modules/docker/run.sh | 11 + 6 files changed, 158 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/Dockerfile -- diff --git a/modules/docker/Dockerfile b/modules/docker/Dockerfile new file mode 100644 index 000..272 --- /dev/null +++ b/modules/docker/Dockerfile @@ -0,0 +1,38 @@ +# Start from a Debian image. +FROM debian:8 + +# Install tools. +RUN apt-get update && apt-get install -y --fix-missing \ + wget \ + dstat \ + maven \ + git + +# Intasll Oracle JDK. +RUN mkdir /opt/jdk + +RUN wget --header "Cookie: oraclelicense=accept-securebackup-cookie" \ + http://download.oracle.com/otn-pub/java/jdk/7u76-b13/jdk-7u76-linux-x64.tar.gz + +RUN tar -zxf jdk-7u76-linux-x64.tar.gz -C /opt/jdk + +RUN rm jdk-7u76-linux-x64.tar.gz + +RUN update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.7.0_76/bin/java 100 + +RUN update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.7.0_76/bin/javac 100 + +# Sets java variables. +ENV JAVA_HOME /opt/jdk/jdk1.7.0_76/ + +# Create working directory +RUN mkdir /home/ignite_home + +WORKDIR /home/ignite_home + +# Copy sh files and set permission +ADD *.sh ./ + +RUN chmod +x *.sh + +CMD ./run.sh \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/README.txt -- diff --git a/modules/docker/README.txt b/modules/docker/README.txt new file mode 100644 index 000..0299d4c --- /dev/null +++ b/modules/docker/README.txt @@ -0,0 +1,11 @@ +Apache Ignite Docker module + + +Apache Ignite Docker module provides Dockerfile and bash scripts for building docker image. + +Build image +- + +cd to ./modules/docker + +sudo docker build . \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/build_users_libs.sh -- diff --git a/modules/docker/build_users_libs.sh b/modules/docker/build_users_libs.sh new file mode 100644 index 000..24f4420 --- /dev/null +++ b/modules/docker/build_users_libs.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ -z $GIT_REPO ]; then + echo Users git repo is not provided. + + exit 0 +fi + +git clone $GIT_REPO user-repo + +cd user-repo + +if [ ! -z $GIT_BRANCH ]; then + git checkout $GIT_BRANCH +fi + +if [ ! -z "$BUILD_CMD" ]; then + echo "Starting to execute build command: $BUILD_CMD" + + eval "$BUILD_CMD" +else + mvn clean package +fi \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/download_ignite.sh -- diff --git a/modules/docker/download_ignite.sh b/modules/docker/download_ignite.sh new file mode 100644 index 000..6a8617f --- /dev/null +++ b/modules/docker/download_ignite.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +function download { + wget -O ignite.zip $1 + + unzip ignite.zip -d ignite + + rm ignite.zip + + exit 0 +} + +if [ ! -z $IGNITE_URL ]; then + download $IGNITE_URL +fi + +if [ ! -z $IGNITE_VERSION ]; then + if [[ $IGNITE_VERSION =~ [0-9]*\.[0-9]*\.0 ]]; then +download http://apache-mirror.rbc.ru/pub/apache/incubator/ignite/${IGNITE_VERSION}/apache-ignite-fabric-${IGNITE_VERSION}-incubating-bin.zip + else +download http://www.gridgain.com/media/gridgain-community-fabric-${IGNITE_VERSION}.zip + fi +fi + +if [ -z $IGNITE_SOURCE ] || [ $IGNITE_SOURCE = "COMMUNITY" ]; then + download http://tiny.cc/updater/download_community.php +fi + +if [ $IGNITE_SOURCE = "APACHE" ]; then + d
[10/23] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-1064' into ignite-sprint-7
Merge remote-tracking branch 'remotes/origin/ignite-1064' into ignite-sprint-7 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e91bc484 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e91bc484 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e91bc484 Branch: refs/heads/ignite-964-1 Commit: e91bc484e224ce8a039ef5bba71aa7f093dce262 Parents: 28525ac 0ef74a1 Author: sboikov Authored: Tue Jun 30 17:31:22 2015 +0300 Committer: sboikov Committed: Tue Jun 30 17:31:22 2015 +0300 -- .../processors/clock/GridClockServer.java | 21 -- .../TcpDiscoveryMulticastIpFinder.java | 74 2 files changed, 76 insertions(+), 19 deletions(-) --
[15/23] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-964-1
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-964-1 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f9a738f3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f9a738f3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f9a738f3 Branch: refs/heads/ignite-964-1 Commit: f9a738f3e3aa4370a7302512bdd149a2984e6ae5 Parents: b963d03 c7e7487 Author: ivasilinets Authored: Wed Jul 1 12:08:12 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:08:12 2015 +0300 -- .../configuration/CacheConfiguration.java | 105 ++- .../configuration/NearCacheConfiguration.java | 10 +- .../managers/communication/GridIoManager.java | 49 + .../discovery/GridDiscoveryManager.java | 26 + .../processors/clock/GridClockServer.java | 21 +++- .../util/nio/GridNioMessageTracker.java | 23 +++- .../ignite/spi/discovery/tcp/ServerImpl.java| 2 +- .../TcpDiscoveryMulticastIpFinder.java | 74 ++--- .../IgniteTopologyPrintFormatSelfTest.java | 60 ++- modules/docker/Dockerfile | 55 ++ modules/docker/README.txt | 11 ++ modules/docker/build_users_libs.sh | 39 +++ modules/docker/download_ignite.sh | 49 + modules/docker/execute.sh | 62 +++ modules/docker/run.sh | 34 ++ 15 files changed, 497 insertions(+), 123 deletions(-) --
[23/23] incubator-ignite git commit: #ignite-964: nodejs code style.
#ignite-964: nodejs code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3807762a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3807762a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3807762a Branch: refs/heads/ignite-964-1 Commit: 3807762a9c7cb449e82357955b705927474c42ac Parents: 49f4f91 Author: ivasilinets Authored: Wed Jul 1 13:01:11 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 13:01:11 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 4 +- modules/nodejs/src/main/js/server.js| 57 +--- .../ignite/internal/NodeJsSqlQuerySelfTest.java | 2 +- modules/nodejs/src/test/js/test-compute.js | 3 -- 4 files changed, 42 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3807762a/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 3eaadb4..eef4039 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -180,8 +180,8 @@ Cache.prototype._sqlFieldsQuery = function(qry, onQueryExecute) { Cache.prototype._sqlQuery = function(qry, onQueryExecute) { if (qry.returnType() == null) { -qry.error("No type for sql query."); -qry.end(); +qry.end("No type for sql query."); + return; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3807762a/modules/nodejs/src/main/js/server.js -- diff --git a/modules/nodejs/src/main/js/server.js b/modules/nodejs/src/main/js/server.js index 021fffe..ee1a134 100644 --- a/modules/nodejs/src/main/js/server.js +++ b/modules/nodejs/src/main/js/server.js @@ -57,12 +57,10 @@ Server.prototype.host = function() { * Run http request * * @this {Server} - * @param {string} cmdName command name. - * @param params Parameters for command. + * @param {Command} cmd Command * @param {onGet} Called on finish */ Server.prototype.runCommand = function(cmd, callback) { - var requestQry = "cmd=" + cmd.name() + cmd.paramsString(); var http = require('http'); @@ -89,6 +87,7 @@ Server.prototype.runCommand = function(cmd, callback) { response.on('end', function () { console.log("fullResponseString:" + fullResponseString); + if (response.statusCode !== 200) { if (response.statusCode === 401) { callback.call(null, "Authentication failed. Status code 401."); @@ -181,52 +180,74 @@ Server._escape = function(f) { return qs.escape(f.toString()); } +/** + * @constructor + * @this{Command} + * @param{string} name Command name. + */ function Command(name) { this._name = name; this._params = []; } +/** + * @this {Command} + * @param {string} key Key + * @param {string} val Value + * @returns this + */ Command.prototype.addParam = function(key, value) { this._params.push({key: key, value: value}); return this; } -Command.prototype.addParams = function(prefix, params) { -for (var i = 1; i <= params.length; ++i) { -this.addParam(prefix + i, params[i - 1]); -} -return this; -} - +/** + * @this {Command} + * @param{JSONObject} postData Post data. + * @returns this + */ Command.prototype.setPostData = function(postData) { this._postData = postData; return this; } +/** + * @this {Command} + * @returns Post data. + */ Command.prototype.postData = function() { return this._postData; } -Command.prototype._method = function() { -return this._isPost()? "POST" : "GET"; -} - -Command.prototype._isPost = function() { -return !!this._postData; -} - +/** + * @this {Command} + * @returns Command name. + */ Command.prototype.name = function() { return this._name; } +/** + * @this {Command} + * @returns Http request string. + */ Command.prototype.paramsString = function() { var paramsString = ""; for (var p of this._params) { paramsString += "&" + Server._escape(p.key) + "=" + Server._escape(p.value); } + return paramsString; } +Command.prototype._method = function() { +return this._isPost()? "POST" : "GET"; +} + +Command.prototype._isPost = function() { +return !!this._postData; +} + exports.Server = Server; exports.Command = Command; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3807762a/modules/nodejs/src/test/java/org/apache/
[04/23] incubator-ignite git commit: IGNITE-1046 Added license.
IGNITE-1046 Added license. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4eef6d04 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4eef6d04 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4eef6d04 Branch: refs/heads/ignite-964-1 Commit: 4eef6d04c09a730188dbde33b9063965947a1683 Parents: 86c5d20 Author: nikolay_tikhonov Authored: Fri Jun 26 18:00:37 2015 +0300 Committer: nikolay_tikhonov Committed: Fri Jun 26 18:00:37 2015 +0300 -- modules/docker/run.sh | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4eef6d04/modules/docker/run.sh -- diff --git a/modules/docker/run.sh b/modules/docker/run.sh index e7feb8c..0f01c1c 100644 --- a/modules/docker/run.sh +++ b/modules/docker/run.sh @@ -16,13 +16,15 @@ # limitations under the License. # -IGNITE_VERSION="" - if [ -z $SKIP_BUILD_LIBS ]; then ./build_users_libs.sh - IGNITE_VERSION=$(mvn -f user-repo/pom.xml dependency:list | grep ':ignite-core:jar:.*:' | \ + PROJ_VER=$(mvn -f user-repo/pom.xml dependency:list | grep ':ignite-core:jar:.*:' | \ sed -rn 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') + + if [ ! -z $PROJ_VER ]; then +IGNITE_VERSION=$PROJ_VER + fi fi if [ -z $SKIP_DOWNLOAD ]; then
[22/23] incubator-ignite git commit: #ignite-964: GridJettyRestHandler code style.
#ignite-964: GridJettyRestHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/49f4f910 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/49f4f910 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/49f4f910 Branch: refs/heads/ignite-964-1 Commit: 49f4f91036c39118df71863371b6b3ef83fa42eb Parents: 990e5ec Author: ivasilinets Authored: Wed Jul 1 12:49:27 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:49:27 2015 +0300 -- .../http/jetty/GridJettyRestHandler.java | 19 ++- 1 file changed, 2 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/49f4f910/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index 11059f3..b5877b6 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -542,27 +542,12 @@ public class GridJettyRestHandler extends AbstractHandler { restReq0.sqlQuery((String)params.get("qry")); -StringBuilder builder = new StringBuilder(); +JSONObject o = parseRequest(req); -Scanner reader = null; +List args = (List)o.get("arg"); -try { -reader = new Scanner(req.getReader()); -} -catch (IOException e) { -throw new IgniteCheckedException(e); -} - -while (reader.hasNext()) -builder.append(reader.next() + "\n"); - -JSONObject o = JSONObject.fromObject(builder.toString()); - -List args = (List)o.get("arg"); restReq0.arguments(args.toArray()); - restReq0.typeName((String)params.get("type")); - restReq0.pageSize(Integer.parseInt((String) params.get("psz"))); restReq0.cacheName((String)params.get("cacheName"));
[02/23] incubator-ignite git commit: IGNITE-1046 Added default option libs.
IGNITE-1046 Added default option libs. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f57aa921 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f57aa921 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f57aa921 Branch: refs/heads/ignite-964-1 Commit: f57aa921e7ac7b583b0f31931890f1f9454f3b1a Parents: 9de7d24 Author: nikolay_tikhonov Authored: Fri Jun 26 13:06:45 2015 +0300 Committer: nikolay_tikhonov Committed: Fri Jun 26 13:06:45 2015 +0300 -- modules/docker/execute.sh | 4 modules/docker/run.sh | 11 --- 2 files changed, 12 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f57aa921/modules/docker/execute.sh -- diff --git a/modules/docker/execute.sh b/modules/docker/execute.sh index 22d..e0ed90c 100644 --- a/modules/docker/execute.sh +++ b/modules/docker/execute.sh @@ -8,6 +8,10 @@ if [ ! -z "$GIT_REPO" ]; then fi fi +if [ -z "$OPTION_LIBS" ]; then + OPTION_LIBS="ignite-log4j" +fi + if [ ! -z "$OPTION_LIBS" ]; then IFS=, LIBS_LIST=("$OPTION_LIBS") http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f57aa921/modules/docker/run.sh -- diff --git a/modules/docker/run.sh b/modules/docker/run.sh index 42fb29d..2e3110d 100644 --- a/modules/docker/run.sh +++ b/modules/docker/run.sh @@ -1,11 +1,16 @@ #!/bin/bash -if [ -z $SKIP_DOWNLOAD ]; then - ./download_ignite.sh -fi +IGNITE_VERSION="" if [ -z $SKIP_BUILD_LIBS ]; then ./build_users_libs.sh + + IGNITE_VERSION=$(mvn -f user-repo/pom.xml dependency:list | grep ':ignite-core:jar:.*:' | \ +sed -rn 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') +fi + +if [ -z $SKIP_DOWNLOAD ]; then + IGNITE_VERSION=$IGNITE_VERSION ./download_ignite.sh fi ./execute.sh \ No newline at end of file
[20/23] incubator-ignite git commit: #ignite-964: JSONCacheObject code style.
#ignite-964: JSONCacheObject code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bb412c42 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bb412c42 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bb412c42 Branch: refs/heads/ignite-964-1 Commit: bb412c4233c29a14fb96a58fb3cda2e0ea528388 Parents: d85dab7 Author: ivasilinets Authored: Wed Jul 1 12:36:54 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:36:54 2015 +0300 -- .../protocols/http/jetty/JSONCacheObject.java | 78 +++- 1 file changed, 45 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bb412c42/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java index 67f2430..7ea30b3 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java @@ -26,28 +26,62 @@ import java.util.*; */ public class JSONCacheObject { /** Fields map. */ -private Map fields = new HashMap<>(); +private final Map fields = new HashMap<>(); -public JSONCacheObject() { +/** + * Empty constructor. + */ +private JSONCacheObject() { +} +/** + * @param o JSON object. + */ +public JSONCacheObject(JSONObject o) { +for (Object key : o.keySet()) +addField(toSimpleObject(key), toSimpleObject(o.get(key))); } -public void setFields(Map fields) { -this.fields = fields; +/** + * @param key Field name. + * @param val Field value. + */ +public void addField(Object key, Object val) { +fields.put(key, val); } -public Map getFields() { -return fields; +/** + * @param key Field name. + * @return Field value. + */ +public Object getField(Object key) { +return fields.get(key); } -public JSONCacheObject(JSONObject o) { -for (Object key : o.keySet()) -addField(toSimpleObject(key), toSimpleObject(o.get(key))); +/** + * @return Fields key set. + */ +public Set keys() { +return fields.keySet(); +} + +/** + * @return Fields map. + */ +public Map getFields() { +return fields; } +/** + * Convert JSON object to JSONCacheObject + * + * @param o Object to convert. + * @return Converted object. + */ private Object toSimpleObject(Object o) { if (o instanceof JSONObject) { JSONObject o1 = (JSONObject)o; + JSONCacheObject res = new JSONCacheObject(); for (Object key : o1.keySet()) @@ -57,7 +91,9 @@ public class JSONCacheObject { } else if (o instanceof JSONArray) { JSONArray o1 = (JSONArray) o; + List val = new ArrayList<>(); + for (Object v : o1) val.add(toSimpleObject(v)); @@ -67,32 +103,8 @@ public class JSONCacheObject { return o; } -/** - * @param key Field name. - * @param val Field value. - */ -public void addField(Object key, Object val) { -fields.put(key, val); -} - -/** - * @param key Field name. - * @return Field value. - */ -public Object getField(Object key) { -return fields.get(key); -} - -/** - * @return Fields key set. - */ -public Set keys() { -return fields.keySet(); -} - /** {@inheritDoc} */ @Override public int hashCode() { -//TODO: return fields.hashCode(); }
[21/23] incubator-ignite git commit: #ignite-964: GridJettyRestHandler code style.
#ignite-964: GridJettyRestHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/990e5ece Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/990e5ece Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/990e5ece Branch: refs/heads/ignite-964-1 Commit: 990e5ecee7e78ce0c6f0e3f6a0c5b839f8eb5ff2 Parents: bb412c4 Author: ivasilinets Authored: Wed Jul 1 12:46:35 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:46:35 2015 +0300 -- .../http/jetty/GridJettyRestHandler.java| 95 +--- 1 file changed, 61 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/990e5ece/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index 55fe156..11059f3 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -315,11 +315,14 @@ public class GridJettyRestHandler extends AbstractHandler { } } +/** + * @param cmd Rest command. + * @param cmdRes Rest response. + */ private void createResponse(GridRestCommand cmd, GridRestResponse cmdRes) { if (cmd == CACHE_GET_ALL) { -if (cmdRes.getResponse() == null) { +if (cmdRes.getResponse() == null) return; -} Map o = (Map)cmdRes.getResponse(); @@ -332,37 +335,6 @@ public class GridJettyRestHandler extends AbstractHandler { } } -public static class RestEntry { -private Object key; -private Object value; -public RestEntry(Object key, Object value) { -if (key instanceof JSONCacheObject) -this.key = ((JSONCacheObject)key).getFields(); -else -this.key = key; - -if (value instanceof JSONCacheObject) -this.value = ((JSONCacheObject)value).getFields(); -else -this.value = value; -} -public Object getKey() { -return key; -} - -public void setKey(Object key) { -this.key = key; -} - -public Object getValue() { -return value; -} - -public void setValue(Object value) { -this.value = value; -} -} - /** * Creates REST request. * @@ -804,7 +776,7 @@ public class GridJettyRestHandler extends AbstractHandler { private JSONObject parseRequest(HttpServletRequest req) throws IgniteCheckedException{ StringBuilder builder = new StringBuilder(); -Scanner reader = null; +Scanner reader; try { reader = new Scanner(req.getReader()); @@ -818,4 +790,59 @@ public class GridJettyRestHandler extends AbstractHandler { return JSONObject.fromObject(builder.toString()); } + +/** + * Rest entry. + */ +public static class RestEntry { +/** Key. */ +private Object key; + +/** Value. */ +private Object value; + +/** + * @param key Key. + * @param val Value. + */ +public RestEntry(Object key, Object val) { +if (key instanceof JSONCacheObject) +this.key = ((JSONCacheObject)key).getFields(); +else +this.key = key; + +if (val instanceof JSONCacheObject) +this.value = ((JSONCacheObject)val).getFields(); +else +this.value = val; +} + +/** + * @return Key. + */ +public Object getKey() { +return key; +} + +/** + * @param key Key. + */ +public void setKey(Object key) { +this.key = key; +} + +/** + * @return Value. + */ +public Object getValue() { +return value; +} + +/** + * @param val Value. + */ +public void setValue(Object val) { +this.value = val; +} +} }
[16/23] incubator-ignite git commit: #ignite-964: QueryCommandHandler code style.
#ignite-964: QueryCommandHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7e0a63b6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7e0a63b6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7e0a63b6 Branch: refs/heads/ignite-964-1 Commit: 7e0a63b6408d079b146e7d5b9dc21efd766e803f Parents: f9a738f Author: ivasilinets Authored: Wed Jul 1 12:25:35 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:25:35 2015 +0300 -- .../handlers/query/QueryCommandHandler.java | 99 +--- 1 file changed, 43 insertions(+), 56 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e0a63b6/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index a254115..9432bb7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.processors.rest.request.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.typedef.internal.*; -import javax.cache.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -45,8 +44,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private static final AtomicLong qryIdGen = new AtomicLong(); /** Current queries. */ -private final ConcurrentHashMap>> curs = -new ConcurrentHashMap<>(); +private final ConcurrentHashMap curs = new ConcurrentHashMap<>(); /** * @param ctx Context. @@ -79,7 +77,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { assert req instanceof RestSqlQueryRequest : "Invalid type of query request."; return ctx.closure().callLocalSafe( -new FetchQueryCallable(ctx, (RestSqlQueryRequest)req, curs), false); +new FetchQueryCallable((RestSqlQueryRequest)req, curs), false); } } @@ -90,9 +88,6 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { * Execute query callable. */ private static class ExecuteQueryCallable implements Callable { -/** */ -private static final long serialVersionUID = 0L; - /** Kernal context. */ private GridKernalContext ctx; @@ -100,14 +95,15 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private RestSqlQueryRequest req; /** Queries cursors. */ -private ConcurrentHashMap>> curs; +private ConcurrentHashMap curs; /** * @param ctx Kernal context. * @param req Execute query request. + * @param curs Queries cursors. */ public ExecuteQueryCallable(GridKernalContext ctx, RestSqlQueryRequest req, -ConcurrentHashMap>> curs) { +ConcurrentHashMap curs) { this.ctx = ctx; this.req = req; this.curs = curs; @@ -129,31 +125,15 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { ((SqlFieldsQuery)qry).setArgs(req.arguments()); } -Iterator> cur = -ctx.grid().cache(req.cacheName()).query(qry).iterator(); +Iterator cur = ctx.grid().cache(req.cacheName()).query(qry).iterator(); long qryId = qryIdGen.getAndIncrement(); curs.put(qryId, cur); -List res = new ArrayList<>(); - -CacheQueryResult response = new CacheQueryResult(); - -for (int i = 0; i < req.pageSize() && cur.hasNext(); ++i) { -res.add(cur.next()); -} - -response.setItems(res); - -response.setLast(!cur.hasNext()); - -response.setQueryId(qryId); - -if (!cur.hasNext()) -curs.remove(qryId); +CacheQueryResult res = createQueryResult(curs, cur, req, qryId); -return new GridRestResponse(response); +return new GridRestResponse(res); }
[18/23] incubator-ignite git commit: #ignite-964: IgniteScriptingCommandHandler code style.
#ignite-964: IgniteScriptingCommandHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3bc20e8d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3bc20e8d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3bc20e8d Branch: refs/heads/ignite-964-1 Commit: 3bc20e8def3926f05950077cc40f61b1b2b641ac Parents: cec4534 Author: ivasilinets Authored: Wed Jul 1 12:28:16 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:28:16 2015 +0300 -- .../rest/handlers/scripting/IgniteScriptingCommandHandler.java | 6 -- 1 file changed, 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3bc20e8d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java index d7525a0..2d65016 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java @@ -260,9 +260,6 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter * Run script callable. */ private static class RunScriptCallable implements Callable { -/** */ -private static final long serialVersionUID = 0L; - /** Kernal context. */ private GridKernalContext ctx; @@ -294,9 +291,6 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter * Map reduce callable. */ private static class MapReduceCallable implements Callable { -/** */ -private static final long serialVersionUID = 0L; - /** Kernal context. */ private GridKernalContext ctx;
[19/23] incubator-ignite git commit: #ignite-964: GridVersionCommandHandler code style.
#ignite-964: GridVersionCommandHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d85dab7e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d85dab7e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d85dab7e Branch: refs/heads/ignite-964-1 Commit: d85dab7e830f9a7157755d6823080ab6a6dccc70 Parents: 3bc20e8 Author: ivasilinets Authored: Wed Jul 1 12:29:20 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:29:20 2015 +0300 -- .../processors/rest/GridRestProcessor.java | 2 +- .../version/GridVersionCommandHandler.java | 67 .../version/GridVersionNameCommandHandler.java | 67 3 files changed, 68 insertions(+), 68 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d85dab7e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 86bfafe..5a073a0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -290,7 +290,7 @@ public class GridRestProcessor extends GridProcessorAdapter { addHandler(new GridCacheCommandHandler(ctx)); addHandler(new GridTaskCommandHandler(ctx)); addHandler(new GridTopologyCommandHandler(ctx)); -addHandler(new GridVersionCommandHandler(ctx)); +addHandler(new GridVersionNameCommandHandler(ctx)); addHandler(new DataStructuresCommandHandler(ctx)); addHandler(new IgniteScriptingCommandHandler(ctx)); addHandler(new QueryCommandHandler(ctx)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d85dab7e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java deleted file mode 100644 index 9597ab3..000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.processors.rest.handlers.version; - -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.rest.*; -import org.apache.ignite.internal.processors.rest.handlers.*; -import org.apache.ignite.internal.processors.rest.request.*; -import org.apache.ignite.internal.util.future.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.util.*; - -import static org.apache.ignite.internal.IgniteVersionUtils.*; -import static org.apache.ignite.internal.processors.rest.GridRestCommand.*; - -/** - * Handler for {@link GridRestCommand#VERSION} command. - */ -public class GridVersionCommandHandler extends GridRestCommandHandlerAdapter { -/** Supported commands. */ -private static final Collection SUPPORTED_COMMANDS = U.sealList(VERSION, NAME); - -/** - * @param ctx Context. - */ -public GridVersionCommandHandler(GridKernalContext ctx) { -super(ctx); -} - -/** {@inheritDoc} */ -@Override public Collection supportedCommands() { -return SUPPORTED_COMMANDS; -} - -/** {@inheritDoc} */ -@Override public IgniteInternalFuture handleAsync(GridRestRequest req) { -
[13/23] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7
Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bccba308 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bccba308 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bccba308 Branch: refs/heads/ignite-964-1 Commit: bccba308a884ef527cf7f84f7f6dd57d55b1e51a Parents: aea804b e0c53b8 Author: nikolay_tikhonov Authored: Wed Jul 1 11:13:36 2015 +0300 Committer: nikolay_tikhonov Committed: Wed Jul 1 11:13:36 2015 +0300 -- .../main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --
[05/23] incubator-ignite git commit: IGNITE-1063 Added generic for chaining setters.
IGNITE-1063 Added generic for chaining setters. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ef7a35ce Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ef7a35ce Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ef7a35ce Branch: refs/heads/ignite-964-1 Commit: ef7a35ce9afb830c2e02b624eb3f3298f66e6129 Parents: bade9f1 Author: nikolay_tikhonov Authored: Tue Jun 30 12:31:13 2015 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 30 12:31:13 2015 +0300 -- .../configuration/CacheConfiguration.java | 105 ++- .../configuration/NearCacheConfiguration.java | 10 +- 2 files changed, 61 insertions(+), 54 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef7a35ce/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 7af4974..e2308f2 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -419,7 +419,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param name Cache name. May be null, but may not be empty string. * @return {@code this} for chaining. */ -public CacheConfiguration setName(String name) { +public CacheConfiguration setName(String name) { A.ensure(name == null || !name.isEmpty(), "Name cannot be null or empty."); this.name = name; @@ -444,7 +444,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param evictPlc Cache expiration policy. * @return {@code this} for chaining. */ -public CacheConfiguration setEvictionPolicy(@Nullable EvictionPolicy evictPlc) { +public CacheConfiguration setEvictionPolicy(@Nullable EvictionPolicy evictPlc) { this.evictPlc = evictPlc; return this; @@ -461,7 +461,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param nearCfg Near cache configuration. * @return {@code this} for chaining. */ -public CacheConfiguration setNearConfiguration(NearCacheConfiguration nearCfg) { +public CacheConfiguration setNearConfiguration(NearCacheConfiguration nearCfg) { this.nearCfg = nearCfg; return this; @@ -483,7 +483,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param writeSync Write synchronization mode. * @return {@code this} for chaining. */ -public CacheConfiguration setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync) { +public CacheConfiguration setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync) { this.writeSync = writeSync; return this; @@ -504,7 +504,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param nodeFilter Predicate specifying on which nodes the cache should be started. * @return {@code this} for chaining. */ -public CacheConfiguration setNodeFilter(IgnitePredicate nodeFilter) { +public CacheConfiguration setNodeFilter(IgnitePredicate nodeFilter) { this.nodeFilter = nodeFilter; return this; @@ -536,7 +536,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param evictSync {@code true} if synchronized, {@code false} if not. * @return {@code this} for chaining. */ -public CacheConfiguration setEvictSynchronized(boolean evictSync) { +public CacheConfiguration setEvictSynchronized(boolean evictSync) { this.evictSync = evictSync; return this; @@ -559,7 +559,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param evictKeyBufSize Eviction key buffer size. * @return {@code this} for chaining. */ -public CacheConfiguration setEvictSynchronizedKeyBufferSize(int evictKeyBufSize) { +public CacheConfiguration setEvictSynchronizedKeyBufferSize(int evictKeyBufSize) { this.evictKeyBufSize = evictKeyBufSize; return this; @@ -593,7 +593,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param evictSyncConcurrencyLvl Concurrency level for synchronized evictions. * @return {@code this} for chaining. */ -public CacheConfiguration setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl) { +public CacheConfiguration setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl) { t
[06/23] incubator-ignite git commit: # ignite-gg-1064 allow start if can not initialize multicast
# ignite-gg-1064 allow start if can not initialize multicast Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b5bc06ee Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b5bc06ee Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b5bc06ee Branch: refs/heads/ignite-964-1 Commit: b5bc06ee813471643c460aaa74ef4395ad79bd53 Parents: bade9f1 Author: sboikov Authored: Tue Jun 30 12:40:53 2015 +0300 Committer: sboikov Committed: Tue Jun 30 12:40:53 2015 +0300 -- .../TcpDiscoveryMulticastIpFinder.java | 74 1 file changed, 60 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5bc06ee/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java index 8e5a1fd..014d937 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java @@ -26,7 +26,6 @@ import org.apache.ignite.marshaller.*; import org.apache.ignite.marshaller.jdk.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; -import org.apache.ignite.spi.discovery.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.jetbrains.annotations.*; @@ -278,7 +277,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { addrSnds = new ArrayList<>(locAddrs.size()); -Collection reqItfs = new ArrayList<>(locAddrs.size()); // Interfaces used to send requests. +Set reqItfs = new HashSet<>(locAddrs.size()); // Interfaces used to send requests. for (String locAddr : locAddrs) { InetAddress addr; @@ -309,6 +308,8 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { } } +boolean mcastErr = false; + if (!clientMode) { if (addrSnds.isEmpty()) { try { @@ -317,13 +318,31 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { addrSnds.add(new AddressSender(mcastAddr, null, addrs)); } catch (IOException e) { -throw new IgniteSpiException("Failed to create multicast socket [mcastAddr=" + mcastAddr + -", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ']', e); +if (log.isDebugEnabled()) +log.debug("Failed to create multicast socket [mcastAddr=" + mcastAddr + +", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ", err=" + e + ']'); +} + +if (addrSnds.isEmpty()) { +try { +addrSnds.add(new AddressSender(mcastAddr, mcastAddr, addrs)); + +reqItfs.add(mcastAddr); +} +catch (IOException e) { +log.debug("Failed to create multicast socket [mcastAddr=" + mcastAddr + +", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ", locAddr=" + mcastAddr + +", err=" + e + ']'); +} } } -for (AddressSender addrSnd : addrSnds) -addrSnd.start(); +if (!addrSnds.isEmpty()) { +for (AddressSender addrSnd : addrSnds) +addrSnd.start(); +} +else +mcastErr = true; } else assert addrSnds.isEmpty() : addrSnds; @@ -358,10 +377,30 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { } } } -else -ret = requestAddresses(mcastAddr, F.first(reqItfs)); +else { +T2, Boolean> res = requestAddresses(mcastAddr, F.first(reqItfs)); + +ret = res.get1(); + +mcastErr |= res.get2(); +} + +if (ret.isEmpty()) { +if (mcastErr) { +if (getRegisteredAddresses().isEmpty()) { +InetSocketAddress addr = new InetSocketAddress("localhost", TcpDiscoverySpi.DFLT_PORT); + +
[14/23] incubator-ignite git commit: IGNITE-1068: Fixing ordered messages back pressure control.
IGNITE-1068: Fixing ordered messages back pressure control. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c7e74874 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c7e74874 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c7e74874 Branch: refs/heads/ignite-964-1 Commit: c7e7487458b72ba8b666fba7b9e24004d425719f Parents: bccba30 Author: vozerov-gridgain Authored: Wed Jul 1 11:50:08 2015 +0300 Committer: vozerov-gridgain Committed: Wed Jul 1 11:50:08 2015 +0300 -- .../managers/communication/GridIoManager.java | 49 +++- .../util/nio/GridNioMessageTracker.java | 23 +++-- 2 files changed, 48 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c7e74874/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index 4382731..d8dcc2c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -27,6 +27,7 @@ import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.managers.eventstorage.*; import org.apache.ignite.internal.processors.timeout.*; import org.apache.ignite.internal.util.*; +import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -718,7 +719,7 @@ public class GridIoManager extends GridManagerAdapter(); @@ -748,7 +749,7 @@ public class GridIoManager extends GridManagerAdapter> msgs = new ConcurrentLinkedDeque<>(); +private final Queue> msgs = new ConcurrentLinkedDeque<>(); /** */ private final AtomicBoolean reserved = new AtomicBoolean(); @@ -1873,6 +1865,7 @@ public class GridIoManager extends GridManagerAdapter t = msgs.poll(); t != null; t = msgs.poll()) -lsnr.onMessage(nodeId, t.get1().message()); +for (GridTuple3 t = msgs.poll(); t != null; t = msgs.poll()) { +try { +lsnr.onMessage( +nodeId, +t.get1().message()); +} +finally { +if (t.get3() != null) +t.get3().run(); +} +} } /** * @param msg Message to add. + * @param msgC Message closure (may be {@code null}). */ -void add(GridIoMessage msg) { -msgs.add(F.t(msg, U.currentTimeMillis())); +void add( +GridIoMessage msg, +@Nullable IgniteRunnable msgC +) { +msgs.add(F.t(msg, U.currentTimeMillis(), msgC)); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c7e74874/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java index 52b7fed..c9ed1a0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java @@ -56,9 +56,26 @@ public class GridNioMessageTracker implements IgniteRunnable { /** {@inheritDoc} */ @Override public void run() { -int cnt = msgCnt.decrementAndGet(); +// In case of ordered messages this may be called twice for 1 message. +// Example: message arrives, but listener has not been installed yet. +// Message set is created, but message does not get actually processed. +// If this is not called, connection may be paused which causes hang. +// It seems acceptable to have the following logic accounting the aforementioned. +int cnt = 0; -assert cnt >= 0 : "Invalid count: " + cnt; +for (;;) { +int cur = msgCnt.get(); + +if (cur == 0) +break; + +cnt = cur - 1; + +if (msgCnt.compareAndSet(cur, cnt)) +break; +} + +assert cnt >= 0 : "I
[09/23] incubator-ignite git commit: Merge branch 'ignite-sprint-7' into ignite-1063
Merge branch 'ignite-sprint-7' into ignite-1063 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/28525acb Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/28525acb Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/28525acb Branch: refs/heads/ignite-964-1 Commit: 28525acbe2e19f5605137dbb7e9b3824eab25987 Parents: ef7a35c 6ebcb6d Author: nikolay_tikhonov Authored: Tue Jun 30 16:56:15 2015 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 30 16:56:15 2015 +0300 -- .../discovery/GridDiscoveryManager.java | 26 +- .../IgniteTopologyPrintFormatSelfTest.java | 289 +++ .../testsuites/IgniteKernalSelfTestSuite.java | 1 + 3 files changed, 310 insertions(+), 6 deletions(-) --
[11/23] incubator-ignite git commit: # ignite-sprint-7 minor
# ignite-sprint-7 minor Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e0c53b81 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e0c53b81 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e0c53b81 Branch: refs/heads/ignite-964-1 Commit: e0c53b8171add7bfed0249c67a8e743443b7593f Parents: e91bc48 Author: sboikov Authored: Wed Jul 1 10:06:20 2015 +0300 Committer: sboikov Committed: Wed Jul 1 10:06:20 2015 +0300 -- .../main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e0c53b81/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java index fa3e564..720ce3a 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java @@ -2332,7 +2332,7 @@ class ServerImpl extends TcpDiscoveryImpl { LT.warn(log, null, "Local node has detected failed nodes and started cluster-wide procedure. " + "To speed up failure detection please see 'Failure Detection' section under javadoc" + -"for 'TcpDiscoverySpi'"); +" for 'TcpDiscoverySpi'"); } }
[12/23] incubator-ignite git commit: Merge branch 'ignite-sprint-7' into ignite-1046
Merge branch 'ignite-sprint-7' into ignite-1046 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aea804b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aea804b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aea804b4 Branch: refs/heads/ignite-964-1 Commit: aea804b41fd0a73a1eb4f8f68e28bf77d00de966 Parents: 4eef6d0 e91bc48 Author: nikolay_tikhonov Authored: Wed Jul 1 11:03:32 2015 +0300 Committer: nikolay_tikhonov Committed: Wed Jul 1 11:03:32 2015 +0300 -- .../ClientAbstractConnectivitySelfTest.java | 4 +- .../org/apache/ignite/cluster/ClusterGroup.java | 18 +- .../org/apache/ignite/cluster/ClusterNode.java | 2 + .../ignite/compute/ComputeTaskSplitAdapter.java | 2 +- .../configuration/CacheConfiguration.java | 105 +-- .../configuration/IgniteReflectionFactory.java | 81 +- .../configuration/NearCacheConfiguration.java | 10 +- .../ignite/internal/GridKernalContextImpl.java | 5 +- .../internal/cluster/ClusterGroupAdapter.java | 50 +- .../cluster/IgniteClusterAsyncImpl.java | 12 +- .../discovery/GridDiscoveryManager.java | 32 +- .../processors/cache/GridCacheContext.java | 2 +- .../cache/GridCacheDeploymentManager.java | 10 +- .../GridCachePartitionExchangeManager.java | 6 +- .../processors/cache/GridCacheProcessor.java| 62 +- .../distributed/dht/GridDhtLocalPartition.java | 3 +- .../distributed/dht/GridDhtLockFuture.java | 2 +- .../dht/atomic/GridDhtAtomicCache.java | 9 +- .../GridDhtPartitionsExchangeFuture.java| 46 +- .../processors/clock/GridClockServer.java | 21 +- .../datastructures/DataStructuresProcessor.java | 64 +- .../processors/hadoop/HadoopJobInfo.java| 4 +- .../hadoop/counter/HadoopCounterWriter.java | 5 +- .../processors/plugin/CachePluginManager.java | 10 +- .../processors/rest/GridRestProcessor.java | 4 +- .../handlers/task/GridTaskCommandHandler.java | 12 +- .../processors/task/GridTaskWorker.java | 4 +- .../internal/util/GridConfigurationFinder.java | 55 +- .../ignite/internal/util/IgniteUtils.java | 6 +- .../shmem/IpcSharedMemoryServerEndpoint.java| 10 +- .../apache/ignite/internal/visor/VisorJob.java | 2 + .../internal/visor/log/VisorLogSearchTask.java | 2 +- .../visor/node/VisorNodeDataCollectorJob.java | 4 + .../visor/query/VisorQueryCleanupTask.java | 14 + .../util/VisorClusterGroupEmptyException.java | 37 + .../ignite/spi/discovery/tcp/ClientImpl.java| 151 ++-- .../ignite/spi/discovery/tcp/ServerImpl.java| 103 ++- .../spi/discovery/tcp/TcpDiscoverySpi.java | 3 +- .../TcpDiscoveryMulticastIpFinder.java | 74 +- .../core/src/test/config/spark/spark-config.xml | 46 ++ .../internal/ClusterGroupAbstractTest.java | 777 ++ .../internal/ClusterGroupHostsSelfTest.java | 141 .../ignite/internal/ClusterGroupSelfTest.java | 251 ++ .../internal/GridDiscoveryEventSelfTest.java| 12 +- .../internal/GridProjectionAbstractTest.java| 784 --- .../ignite/internal/GridProjectionSelfTest.java | 251 -- .../apache/ignite/internal/GridSelfTest.java| 2 +- .../IgniteTopologyPrintFormatSelfTest.java | 289 +++ .../CacheReadThroughAtomicRestartSelfTest.java | 32 + ...heReadThroughLocalAtomicRestartSelfTest.java | 32 + .../CacheReadThroughLocalRestartSelfTest.java | 32 + ...dThroughReplicatedAtomicRestartSelfTest.java | 32 + ...cheReadThroughReplicatedRestartSelfTest.java | 32 + .../cache/CacheReadThroughRestartSelfTest.java | 133 .../cache/GridCacheAbstractSelfTest.java| 2 +- .../cache/GridCacheDaemonNodeStopSelfTest.java | 119 --- .../IgniteDaemonNodeMarshallerCacheTest.java| 192 + ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++ .../cache/IgniteDynamicCacheStartSelfTest.java | 37 + ...GridCacheQueueMultiNodeAbstractSelfTest.java | 4 +- .../GridCacheSetAbstractSelfTest.java | 22 +- .../IgniteDataStructureWithJobTest.java | 111 +++ .../distributed/IgniteCache150ClientsTest.java | 189 + ...teCacheClientNodePartitionsExchangeTest.java | 1 + .../distributed/IgniteCacheManyClientsTest.java | 1 + ...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 5 - ...achePartitionedMultiNodeFullApiSelfTest.java | 53 +- .../GridCacheReplicatedFailoverSelfTest.java| 5 + .../IgniteCacheTxStoreSessionTest.java | 4 + .../internal/util/IgniteUtilsSelfTest.java | 22 + .../tcp/TcpClientDiscoverySpiSelfTest.java | 265 ++- .../testframework/junits/GridAbstractTest.java | 2 +- .../ignite/testsuites/IgniteBasicTestSuite.java | 7 +- .../IgniteCacheDataStructuresSelfTestS
[07/23] incubator-ignite git commit: # ignite-gg-1064 use loopback address in clock server if failed to get local host
# ignite-gg-1064 use loopback address in clock server if failed to get local host Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0ef74a14 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0ef74a14 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0ef74a14 Branch: refs/heads/ignite-964-1 Commit: 0ef74a1449d503ae65a200e48da735b545e923da Parents: b5bc06e Author: sboikov Authored: Tue Jun 30 15:07:18 2015 +0300 Committer: sboikov Committed: Tue Jun 30 15:07:18 2015 +0300 -- .../processors/clock/GridClockServer.java | 21 +++- 1 file changed, 16 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0ef74a14/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java index e47d1fa..a835da8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java @@ -62,9 +62,20 @@ public class GridClockServer { int startPort = ctx.config().getTimeServerPortBase(); int endPort = startPort + ctx.config().getTimeServerPortRange() - 1; -InetAddress locHost = !F.isEmpty(ctx.config().getLocalHost()) ? -InetAddress.getByName(ctx.config().getLocalHost()) : -U.getLocalHost(); +InetAddress locHost; + +if (F.isEmpty(ctx.config().getLocalHost())) { +try { +locHost = U.getLocalHost(); +} +catch (IOException e) { +locHost = InetAddress.getLoopbackAddress(); + +U.warn(log, "Failed to get local host address, will use loopback address: " + locHost); +} +} +else +locHost = InetAddress.getByName(ctx.config().getLocalHost()); for (int p = startPort; p <= endPort; p++) { try { @@ -83,8 +94,8 @@ public class GridClockServer { } if (sock == null) -throw new IgniteCheckedException("Failed to bind time server socket within specified port range [locHost=" + -locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']'); +throw new IgniteCheckedException("Failed to bind time server socket within specified port range " + +"[locHost=" + locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']'); } catch (IOException e) { throw new IgniteCheckedException("Failed to start time server (failed to get local host address)", e);
incubator-ignite git commit: #ignite-964: nodejs code style.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 3807762a9 -> 45f16eaaa #ignite-964: nodejs code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/45f16eaa Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/45f16eaa Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/45f16eaa Branch: refs/heads/ignite-964-1 Commit: 45f16eaaab3de5b574725e187e29b33649ef0977 Parents: 3807762 Author: ivasilinets Authored: Wed Jul 1 13:07:47 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 13:07:47 2015 +0300 -- .../processors/rest/handlers/query/QueryCommandHandler.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45f16eaa/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index 9432bb7..ec9575c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java @@ -205,7 +205,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { res.setQueryId(qryId); if (!cur.hasNext()) -curs.remove(req.queryId()); +curs.remove(qryId); return res; }
incubator-ignite git commit: #ignite-964: nodejs code style.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 45f16eaaa -> ad11a4a12 #ignite-964: nodejs code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ad11a4a1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ad11a4a1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ad11a4a1 Branch: refs/heads/ignite-964-1 Commit: ad11a4a12b7a7159fbc7b36128ed65c817628e99 Parents: 45f16ea Author: ivasilinets Authored: Wed Jul 1 13:12:20 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 13:12:20 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad11a4a1/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index eef4039..c65f026 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -138,7 +138,7 @@ Cache.prototype.getAll = function(keys, callback) { /** * Execute sql query * - * @param {SqlQuery} qry Query + * @param {SqlQuery|SqlFieldsQuery} qry Query */ Cache.prototype.query = function(qry) { function onQueryExecute(qry, error, res) {
[19/39] incubator-ignite git commit: Merge branch 'ignite-sprint-7' into ignite-1063
Merge branch 'ignite-sprint-7' into ignite-1063 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/28525acb Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/28525acb Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/28525acb Branch: refs/heads/ignite-964 Commit: 28525acbe2e19f5605137dbb7e9b3824eab25987 Parents: ef7a35c 6ebcb6d Author: nikolay_tikhonov Authored: Tue Jun 30 16:56:15 2015 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 30 16:56:15 2015 +0300 -- .../discovery/GridDiscoveryManager.java | 26 +- .../IgniteTopologyPrintFormatSelfTest.java | 289 +++ .../testsuites/IgniteKernalSelfTestSuite.java | 1 + 3 files changed, 310 insertions(+), 6 deletions(-) --
[15/39] incubator-ignite git commit: #ignite-964: sql query works with arguments.
#ignite-964: sql query works with arguments. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/54be1060 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/54be1060 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/54be1060 Branch: refs/heads/ignite-964 Commit: 54be1060053577dce1f689cb2aeec4210866b707 Parents: 3f86e4b Author: ivasilinets Authored: Tue Jun 30 16:00:11 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 16:00:11 2015 +0300 -- modules/nodejs/src/main/js/server.js| 2 +- .../ignite/internal/NodeJsSqlQuerySelfTest.java | 60 +++- modules/nodejs/src/test/js/test-query.js| 22 +++ .../http/jetty/GridJettyRestHandler.java| 2 - 4 files changed, 57 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/54be1060/modules/nodejs/src/main/js/server.js -- diff --git a/modules/nodejs/src/main/js/server.js b/modules/nodejs/src/main/js/server.js index e49ed83..021fffe 100644 --- a/modules/nodejs/src/main/js/server.js +++ b/modules/nodejs/src/main/js/server.js @@ -151,7 +151,7 @@ Server.prototype.checkConnection = function(callback) { */ Server.prototype._signature = function() { if (!this._secretKey) { -return ""; +return {}; } var loadTimeInMS = Date.now(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/54be1060/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java -- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java index 8d33668..a6891fb 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java @@ -18,12 +18,11 @@ package org.apache.ignite.internal; import org.apache.ignite.*; -import org.apache.ignite.cache.affinity.*; +import org.apache.ignite.cache.query.*; import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.configuration.*; import java.io.*; -import java.util.*; /** * Node js sql query test. @@ -75,29 +74,40 @@ public class NodeJsSqlQuerySelfTest extends NodeJsAbstractTest { * Init cache. */ private void initCache() { -CacheConfiguration personCacheCfg = new CacheConfiguration<>("person"); -personCacheCfg.setIndexedTypes(UUID.class, Person.class); +CacheConfiguration personCacheCfg = new CacheConfiguration<>("person"); +personCacheCfg.setIndexedTypes(Integer.class, Person.class); -IgniteCache personCache = grid(0).getOrCreateCache(personCacheCfg); +IgniteCache personCache = grid(0).getOrCreateCache(personCacheCfg); + +personCache.clear(); Person p1 = new Person("John", "Doe", 2000); Person p2 = new Person("Jane", "Doe", 1000); Person p3 = new Person("John", "Smith", 1000); Person p4 = new Person("Jane", "Smith", 2000); -personCache.put(p4.getId(), p1); -personCache.put(p4.getId(), p2); -personCache.put(p4.getId(), p3); +personCache.put(p1.getId(), p1); +personCache.put(p2.getId(), p2); +personCache.put(p3.getId(), p3); personCache.put(p4.getId(), p4); + +SqlQuery qry = new SqlQuery(Person.class, "salary > ? and salary <= ?"); + +qry.setArgs(1000, 2000); + +assertEquals(2, personCache.query(qry).getAll().size()); } /** * Person class. */ public static class Person implements Serializable { +/** Person id. */ +private static int PERSON_ID = 0; + /** Person ID (indexed). */ @QuerySqlField(index = true) -private UUID id; +private Integer id; /** First name (not-indexed). */ @QuerySqlField @@ -116,44 +126,68 @@ public class NodeJsSqlQuerySelfTest extends NodeJsAbstractTest { * @param lastName Last name. * @param salary Salary. */ -Person( String firstName, String lastName, double salary) { -id = UUID.randomUUID(); +Person(String firstName, String lastName, double salary) { +id = PERSON_ID++; this.firstName = firstName; this.lastName = lastName; this.salary = salary; } +/
[04/39] incubator-ignite git commit: IGNITE-1046 Added license.
IGNITE-1046 Added license. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4eef6d04 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4eef6d04 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4eef6d04 Branch: refs/heads/ignite-964 Commit: 4eef6d04c09a730188dbde33b9063965947a1683 Parents: 86c5d20 Author: nikolay_tikhonov Authored: Fri Jun 26 18:00:37 2015 +0300 Committer: nikolay_tikhonov Committed: Fri Jun 26 18:00:37 2015 +0300 -- modules/docker/run.sh | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4eef6d04/modules/docker/run.sh -- diff --git a/modules/docker/run.sh b/modules/docker/run.sh index e7feb8c..0f01c1c 100644 --- a/modules/docker/run.sh +++ b/modules/docker/run.sh @@ -16,13 +16,15 @@ # limitations under the License. # -IGNITE_VERSION="" - if [ -z $SKIP_BUILD_LIBS ]; then ./build_users_libs.sh - IGNITE_VERSION=$(mvn -f user-repo/pom.xml dependency:list | grep ':ignite-core:jar:.*:' | \ + PROJ_VER=$(mvn -f user-repo/pom.xml dependency:list | grep ':ignite-core:jar:.*:' | \ sed -rn 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') + + if [ ! -z $PROJ_VER ]; then +IGNITE_VERSION=$PROJ_VER + fi fi if [ -z $SKIP_DOWNLOAD ]; then
[09/39] incubator-ignite git commit: # ignite-gg-1064 allow start if can not initialize multicast
# ignite-gg-1064 allow start if can not initialize multicast Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b5bc06ee Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b5bc06ee Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b5bc06ee Branch: refs/heads/ignite-964 Commit: b5bc06ee813471643c460aaa74ef4395ad79bd53 Parents: bade9f1 Author: sboikov Authored: Tue Jun 30 12:40:53 2015 +0300 Committer: sboikov Committed: Tue Jun 30 12:40:53 2015 +0300 -- .../TcpDiscoveryMulticastIpFinder.java | 74 1 file changed, 60 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5bc06ee/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java index 8e5a1fd..014d937 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java @@ -26,7 +26,6 @@ import org.apache.ignite.marshaller.*; import org.apache.ignite.marshaller.jdk.*; import org.apache.ignite.resources.*; import org.apache.ignite.spi.*; -import org.apache.ignite.spi.discovery.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.jetbrains.annotations.*; @@ -278,7 +277,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { addrSnds = new ArrayList<>(locAddrs.size()); -Collection reqItfs = new ArrayList<>(locAddrs.size()); // Interfaces used to send requests. +Set reqItfs = new HashSet<>(locAddrs.size()); // Interfaces used to send requests. for (String locAddr : locAddrs) { InetAddress addr; @@ -309,6 +308,8 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { } } +boolean mcastErr = false; + if (!clientMode) { if (addrSnds.isEmpty()) { try { @@ -317,13 +318,31 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { addrSnds.add(new AddressSender(mcastAddr, null, addrs)); } catch (IOException e) { -throw new IgniteSpiException("Failed to create multicast socket [mcastAddr=" + mcastAddr + -", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ']', e); +if (log.isDebugEnabled()) +log.debug("Failed to create multicast socket [mcastAddr=" + mcastAddr + +", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ", err=" + e + ']'); +} + +if (addrSnds.isEmpty()) { +try { +addrSnds.add(new AddressSender(mcastAddr, mcastAddr, addrs)); + +reqItfs.add(mcastAddr); +} +catch (IOException e) { +log.debug("Failed to create multicast socket [mcastAddr=" + mcastAddr + +", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ", locAddr=" + mcastAddr + +", err=" + e + ']'); +} } } -for (AddressSender addrSnd : addrSnds) -addrSnd.start(); +if (!addrSnds.isEmpty()) { +for (AddressSender addrSnd : addrSnds) +addrSnd.start(); +} +else +mcastErr = true; } else assert addrSnds.isEmpty() : addrSnds; @@ -358,10 +377,30 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder { } } } -else -ret = requestAddresses(mcastAddr, F.first(reqItfs)); +else { +T2, Boolean> res = requestAddresses(mcastAddr, F.first(reqItfs)); + +ret = res.get1(); + +mcastErr |= res.get2(); +} + +if (ret.isEmpty()) { +if (mcastErr) { +if (getRegisteredAddresses().isEmpty()) { +InetSocketAddress addr = new InetSocketAddress("localhost", TcpDiscoverySpi.DFLT_PORT); + +
[27/39] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7
Merge remote-tracking branch 'origin/ignite-sprint-7' into ignite-sprint-7 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bccba308 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bccba308 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bccba308 Branch: refs/heads/ignite-964 Commit: bccba308a884ef527cf7f84f7f6dd57d55b1e51a Parents: aea804b e0c53b8 Author: nikolay_tikhonov Authored: Wed Jul 1 11:13:36 2015 +0300 Committer: nikolay_tikhonov Committed: Wed Jul 1 11:13:36 2015 +0300 -- .../main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --
[21/39] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-1064' into ignite-sprint-7
Merge remote-tracking branch 'remotes/origin/ignite-1064' into ignite-sprint-7 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e91bc484 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e91bc484 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e91bc484 Branch: refs/heads/ignite-964 Commit: e91bc484e224ce8a039ef5bba71aa7f093dce262 Parents: 28525ac 0ef74a1 Author: sboikov Authored: Tue Jun 30 17:31:22 2015 +0300 Committer: sboikov Committed: Tue Jun 30 17:31:22 2015 +0300 -- .../processors/clock/GridClockServer.java | 21 -- .../TcpDiscoveryMulticastIpFinder.java | 74 2 files changed, 76 insertions(+), 19 deletions(-) --
[07/39] incubator-ignite git commit: Merge branch 'ignite-964' into ignite-964-1
Merge branch 'ignite-964' into ignite-964-1 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d218dfb1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d218dfb1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d218dfb1 Branch: refs/heads/ignite-964 Commit: d218dfb1d3e3f75a5b96cfb1c4aace9489f76731 Parents: 8744687 f260e9b Author: ivasilinets Authored: Tue Jun 30 11:05:00 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 11:05:00 2015 +0300 -- .../cache/GridCacheDeploymentManager.java | 10 ++-- .../shmem/IpcSharedMemoryServerEndpoint.java| 10 +++- .../core/src/test/config/spark/spark-config.xml | 46 ++ .../ignite/schema/model/PojoDescriptor.java | 2 + .../apache/ignite/schema/model/PojoField.java | 1 + .../parser/dialect/OracleMetadataDialect.java | 2 +- .../org/apache/ignite/spark/IgniteContext.scala | 50 ++-- .../org/apache/ignite/spark/IgniteRddSpec.scala | 18 +++ 8 files changed, 127 insertions(+), 12 deletions(-) --
[12/39] incubator-ignite git commit: #ignite-964: remove postPutAll
#ignite-964: remove postPutAll Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0643798e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0643798e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0643798e Branch: refs/heads/ignite-964 Commit: 0643798e85545812677320fbde629dcfd75b5700 Parents: 2bf2b69 Author: ivasilinets Authored: Tue Jun 30 14:42:37 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 14:42:37 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 19 --- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 --- modules/nodejs/src/test/js/test-cache-api.js | 4 3 files changed, 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0643798e/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index b19367c..0e08c82 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -87,25 +87,6 @@ Cache.prototype.removeAll = function(keys, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.putAll = function(map, callback) { -var keys = Object.keys(map); - -var values = []; - -for (var key of keys) { -values.push(map[key]); -} - -this._server.runCommand(this._createCommand("putall").addParams("k", keys).addParams("v", values), callback); -} - -/** - * Put keys to cache - * - * @this {Cache} - * @param {Object.} map collection of entries to put in the cache - * @param {noValue} callback Called on finish - */ -Cache.prototype.postPutAll = function(map, callback) { this._server.runCommand(this._createCommand("putall").setPostData(JSON.stringify(map)), callback); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0643798e/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java -- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java index a6c6140..f17ca60 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java @@ -84,11 +84,4 @@ public class NodeJsCacheApiSelfTest extends NodeJsAbstractTest { public void testPutAllGetAll() throws Exception { runJsScript("testPutAllGetAll"); } - -/** - * @throws Exception If failed. - */ -public void testPostPutAllGetAll() throws Exception { -runJsScript("testPostPutAllGetAll"); -} } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0643798e/modules/nodejs/src/test/js/test-cache-api.js -- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 90ccbb6..fc29f22 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -35,10 +35,6 @@ testPutAllGetAll = function() { startTest("mycache", {trace: [putAll, getAll], entry: {"key1": "val1", "key2" : "val2"}}); } -testPostPutAllGetAll = function() { -startTest("mycache", {trace: [postPutAll, getAll], entry: {"key1": "val1", "key2" : "val2"}}); -} - testRemoveAll = function() { startTest("mycache", {trace: [putAll, getAll, removeAll, getNone], entry: {"key1": "val1", "key2" : "val2"}}); }
[05/39] incubator-ignite git commit: #ignite-964: post put all.
#ignite-964: post put all. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2c1ecf28 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2c1ecf28 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2c1ecf28 Branch: refs/heads/ignite-964 Commit: 2c1ecf283773c992a8fdaec62de583abd56a340d Parents: 02b5387 Author: ivasilinets Authored: Tue Jun 30 00:36:13 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 00:36:13 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 ++ .../handlers/cache/GridCacheCommandHandler.java | 2 ++ modules/nodejs/src/main/js/cache.js | 13 modules/nodejs/src/main/js/server.js| 9 +- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 modules/nodejs/src/test/js/test-cache-api.js| 8 + .../http/jetty/GridJettyRestHandler.java| 34 7 files changed, 75 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c1ecf28/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 0afefb6..375a079 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -45,6 +45,9 @@ public enum GridRestCommand { /** Store several values in cache. */ CACHE_PUT_ALL("putall"), +/** Store several values in cache. */ +CACHE_PUT_ALL2("putall2"), + /** Remove value from cache. */ CACHE_REMOVE("rmv"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c1ecf28/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 1f24023..ef0391e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -58,6 +58,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_PUT, CACHE_ADD, CACHE_PUT_ALL, +CACHE_PUT_ALL2, CACHE_REMOVE, CACHE_REMOVE_ALL, CACHE_REPLACE, @@ -190,6 +191,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_PUT_ALL2: case CACHE_PUT_ALL: { Map map = req0.values(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c1ecf28/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index fc988da..9f72589 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -108,6 +108,19 @@ Cache.prototype.putAll = function(map, callback) { } /** + * Put keys to cache + * + * @this {Cache} + * @param {Object.} map collection of entries to put in the cache + * @param {noValue} callback Called on finish + */ +Cache.prototype.postPutAll = function(map, callback) { +var params = [this._cacheNameParam]; + +this._server.runCommand("putall2", params, callback, JSON.stringify(map)); +} + +/** * Callback for cache get * * @callback Cache~onGetAll http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c1ecf28/modules/nodejs/src/main/js/server.js -- diff --git a/modules/nodejs/src/main/js/server.js b/modules/nodejs/src/main/js/server.js index 81462a4..b3586e3 100644 --- a/modules/nodejs/src/main/js/server.js +++ b/modules/nodejs/src/main/js/server.js @@ -61,7 +61,7 @@ Server.prototype.host = function() { * @param params Parameters for command. * @param {onGet} Called on finish */ -Server.prototype.runCommand = function(cmdName, params, callback) { +Server.prototype.runCommand = function(cmdName, params, callback, postData)
[37/39] incubator-ignite git commit: #ignite-964: nodejs code style.
#ignite-964: nodejs code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3807762a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3807762a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3807762a Branch: refs/heads/ignite-964 Commit: 3807762a9c7cb449e82357955b705927474c42ac Parents: 49f4f91 Author: ivasilinets Authored: Wed Jul 1 13:01:11 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 13:01:11 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 4 +- modules/nodejs/src/main/js/server.js| 57 +--- .../ignite/internal/NodeJsSqlQuerySelfTest.java | 2 +- modules/nodejs/src/test/js/test-compute.js | 3 -- 4 files changed, 42 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3807762a/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 3eaadb4..eef4039 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -180,8 +180,8 @@ Cache.prototype._sqlFieldsQuery = function(qry, onQueryExecute) { Cache.prototype._sqlQuery = function(qry, onQueryExecute) { if (qry.returnType() == null) { -qry.error("No type for sql query."); -qry.end(); +qry.end("No type for sql query."); + return; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3807762a/modules/nodejs/src/main/js/server.js -- diff --git a/modules/nodejs/src/main/js/server.js b/modules/nodejs/src/main/js/server.js index 021fffe..ee1a134 100644 --- a/modules/nodejs/src/main/js/server.js +++ b/modules/nodejs/src/main/js/server.js @@ -57,12 +57,10 @@ Server.prototype.host = function() { * Run http request * * @this {Server} - * @param {string} cmdName command name. - * @param params Parameters for command. + * @param {Command} cmd Command * @param {onGet} Called on finish */ Server.prototype.runCommand = function(cmd, callback) { - var requestQry = "cmd=" + cmd.name() + cmd.paramsString(); var http = require('http'); @@ -89,6 +87,7 @@ Server.prototype.runCommand = function(cmd, callback) { response.on('end', function () { console.log("fullResponseString:" + fullResponseString); + if (response.statusCode !== 200) { if (response.statusCode === 401) { callback.call(null, "Authentication failed. Status code 401."); @@ -181,52 +180,74 @@ Server._escape = function(f) { return qs.escape(f.toString()); } +/** + * @constructor + * @this{Command} + * @param{string} name Command name. + */ function Command(name) { this._name = name; this._params = []; } +/** + * @this {Command} + * @param {string} key Key + * @param {string} val Value + * @returns this + */ Command.prototype.addParam = function(key, value) { this._params.push({key: key, value: value}); return this; } -Command.prototype.addParams = function(prefix, params) { -for (var i = 1; i <= params.length; ++i) { -this.addParam(prefix + i, params[i - 1]); -} -return this; -} - +/** + * @this {Command} + * @param{JSONObject} postData Post data. + * @returns this + */ Command.prototype.setPostData = function(postData) { this._postData = postData; return this; } +/** + * @this {Command} + * @returns Post data. + */ Command.prototype.postData = function() { return this._postData; } -Command.prototype._method = function() { -return this._isPost()? "POST" : "GET"; -} - -Command.prototype._isPost = function() { -return !!this._postData; -} - +/** + * @this {Command} + * @returns Command name. + */ Command.prototype.name = function() { return this._name; } +/** + * @this {Command} + * @returns Http request string. + */ Command.prototype.paramsString = function() { var paramsString = ""; for (var p of this._params) { paramsString += "&" + Server._escape(p.key) + "=" + Server._escape(p.value); } + return paramsString; } +Command.prototype._method = function() { +return this._isPost()? "POST" : "GET"; +} + +Command.prototype._isPost = function() { +return !!this._postData; +} + exports.Server = Server; exports.Command = Command; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3807762a/modules/nodejs/src/test/java/org/apache/
[35/39] incubator-ignite git commit: #ignite-964: GridJettyRestHandler code style.
#ignite-964: GridJettyRestHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/990e5ece Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/990e5ece Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/990e5ece Branch: refs/heads/ignite-964 Commit: 990e5ecee7e78ce0c6f0e3f6a0c5b839f8eb5ff2 Parents: bb412c4 Author: ivasilinets Authored: Wed Jul 1 12:46:35 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:46:35 2015 +0300 -- .../http/jetty/GridJettyRestHandler.java| 95 +--- 1 file changed, 61 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/990e5ece/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index 55fe156..11059f3 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -315,11 +315,14 @@ public class GridJettyRestHandler extends AbstractHandler { } } +/** + * @param cmd Rest command. + * @param cmdRes Rest response. + */ private void createResponse(GridRestCommand cmd, GridRestResponse cmdRes) { if (cmd == CACHE_GET_ALL) { -if (cmdRes.getResponse() == null) { +if (cmdRes.getResponse() == null) return; -} Map o = (Map)cmdRes.getResponse(); @@ -332,37 +335,6 @@ public class GridJettyRestHandler extends AbstractHandler { } } -public static class RestEntry { -private Object key; -private Object value; -public RestEntry(Object key, Object value) { -if (key instanceof JSONCacheObject) -this.key = ((JSONCacheObject)key).getFields(); -else -this.key = key; - -if (value instanceof JSONCacheObject) -this.value = ((JSONCacheObject)value).getFields(); -else -this.value = value; -} -public Object getKey() { -return key; -} - -public void setKey(Object key) { -this.key = key; -} - -public Object getValue() { -return value; -} - -public void setValue(Object value) { -this.value = value; -} -} - /** * Creates REST request. * @@ -804,7 +776,7 @@ public class GridJettyRestHandler extends AbstractHandler { private JSONObject parseRequest(HttpServletRequest req) throws IgniteCheckedException{ StringBuilder builder = new StringBuilder(); -Scanner reader = null; +Scanner reader; try { reader = new Scanner(req.getReader()); @@ -818,4 +790,59 @@ public class GridJettyRestHandler extends AbstractHandler { return JSONObject.fromObject(builder.toString()); } + +/** + * Rest entry. + */ +public static class RestEntry { +/** Key. */ +private Object key; + +/** Value. */ +private Object value; + +/** + * @param key Key. + * @param val Value. + */ +public RestEntry(Object key, Object val) { +if (key instanceof JSONCacheObject) +this.key = ((JSONCacheObject)key).getFields(); +else +this.key = key; + +if (val instanceof JSONCacheObject) +this.value = ((JSONCacheObject)val).getFields(); +else +this.value = val; +} + +/** + * @return Key. + */ +public Object getKey() { +return key; +} + +/** + * @param key Key. + */ +public void setKey(Object key) { +this.key = key; +} + +/** + * @return Value. + */ +public Object getValue() { +return value; +} + +/** + * @param val Value. + */ +public void setValue(Object val) { +this.value = val; +} +} }
[14/39] incubator-ignite git commit: #ignite-964: wip
#ignite-964: wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3f86e4b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3f86e4b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3f86e4b4 Branch: refs/heads/ignite-964 Commit: 3f86e4b46dc445623b71bb90e37c9672ce41022f Parents: 0643798 Author: ivasilinets Authored: Tue Jun 30 15:30:56 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 15:30:56 2015 +0300 -- .../handlers/query/QueryCommandHandler.java | 23 ++--- modules/nodejs/src/main/js/cache.js | 9 +- modules/nodejs/src/main/js/server.js| 12 +-- .../ignite/internal/NodeJsSqlQuerySelfTest.java | 96 modules/nodejs/src/test/js/test-query.js| 24 +++-- .../http/jetty/GridJettyRestHandler.java| 23 - 6 files changed, 97 insertions(+), 90 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3f86e4b4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index a9f7b0f..a254115 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java @@ -45,7 +45,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private static final AtomicLong qryIdGen = new AtomicLong(); /** Current queries. */ -private final ConcurrentHashMap>> curs = +private final ConcurrentHashMap>> curs = new ConcurrentHashMap<>(); /** @@ -100,14 +100,14 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private RestSqlQueryRequest req; /** Queries cursors. */ -private ConcurrentHashMap>> curs; +private ConcurrentHashMap>> curs; /** * @param ctx Kernal context. * @param req Execute query request. */ public ExecuteQueryCallable(GridKernalContext ctx, RestSqlQueryRequest req, -ConcurrentHashMap>> curs) { +ConcurrentHashMap>> curs) { this.ctx = ctx; this.req = req; this.curs = curs; @@ -129,7 +129,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { ((SqlFieldsQuery)qry).setArgs(req.arguments()); } -Iterator> cur = +Iterator> cur = ctx.grid().cache(req.cacheName()).query(qry).iterator(); long qryId = qryIdGen.getAndIncrement(); @@ -140,8 +140,9 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { CacheQueryResult response = new CacheQueryResult(); -for (int i = 0; i < req.pageSize() && cur.hasNext(); ++i) +for (int i = 0; i < req.pageSize() && cur.hasNext(); ++i) { res.add(cur.next()); +} response.setItems(res); @@ -174,14 +175,14 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private RestSqlQueryRequest req; /** Queries cursors. */ -private ConcurrentHashMap>> curs; +private ConcurrentHashMap>> curs; /** * @param ctx Kernal context. * @param req Execute query request. */ public FetchQueryCallable(GridKernalContext ctx, RestSqlQueryRequest req, -ConcurrentHashMap>> curs) { +ConcurrentHashMap>> curs) { this.ctx = ctx; this.req = req; this.curs = curs; @@ -190,19 +191,19 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { /** {@inheritDoc} */ @Override public GridRestResponse call() throws Exception { try { -Iterator> cur = curs.get(req.queryId()); +Iterator> cur = curs.get(req.queryId()); if (cur == null) return new GridRestResponse(GridRestResponse.STATUS_FAILED, "Cannot find query [qryId=" + req.queryId() + "]"); -List> res = new ArrayList<>(); +List
[01/39] incubator-ignite git commit: #IGNITE-1046 Added dockerfile and scripts for running container with ignite.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964 576c43501 -> ad11a4a12 #IGNITE-1046 Added dockerfile and scripts for running container with ignite. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9de7d248 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9de7d248 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9de7d248 Branch: refs/heads/ignite-964 Commit: 9de7d248d9ed720179887547772a899beea48488 Parents: 1c66078 Author: nikolay_tikhonov Authored: Wed Jun 24 16:26:07 2015 +0300 Committer: nikolay_tikhonov Committed: Wed Jun 24 16:26:07 2015 +0300 -- modules/docker/Dockerfile | 38 + modules/docker/README.txt | 11 + modules/docker/build_users_libs.sh | 23 ++ modules/docker/download_ignite.sh | 33 ++ modules/docker/execute.sh | 42 + modules/docker/run.sh | 11 + 6 files changed, 158 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/Dockerfile -- diff --git a/modules/docker/Dockerfile b/modules/docker/Dockerfile new file mode 100644 index 000..272 --- /dev/null +++ b/modules/docker/Dockerfile @@ -0,0 +1,38 @@ +# Start from a Debian image. +FROM debian:8 + +# Install tools. +RUN apt-get update && apt-get install -y --fix-missing \ + wget \ + dstat \ + maven \ + git + +# Intasll Oracle JDK. +RUN mkdir /opt/jdk + +RUN wget --header "Cookie: oraclelicense=accept-securebackup-cookie" \ + http://download.oracle.com/otn-pub/java/jdk/7u76-b13/jdk-7u76-linux-x64.tar.gz + +RUN tar -zxf jdk-7u76-linux-x64.tar.gz -C /opt/jdk + +RUN rm jdk-7u76-linux-x64.tar.gz + +RUN update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.7.0_76/bin/java 100 + +RUN update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.7.0_76/bin/javac 100 + +# Sets java variables. +ENV JAVA_HOME /opt/jdk/jdk1.7.0_76/ + +# Create working directory +RUN mkdir /home/ignite_home + +WORKDIR /home/ignite_home + +# Copy sh files and set permission +ADD *.sh ./ + +RUN chmod +x *.sh + +CMD ./run.sh \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/README.txt -- diff --git a/modules/docker/README.txt b/modules/docker/README.txt new file mode 100644 index 000..0299d4c --- /dev/null +++ b/modules/docker/README.txt @@ -0,0 +1,11 @@ +Apache Ignite Docker module + + +Apache Ignite Docker module provides Dockerfile and bash scripts for building docker image. + +Build image +- + +cd to ./modules/docker + +sudo docker build . \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/build_users_libs.sh -- diff --git a/modules/docker/build_users_libs.sh b/modules/docker/build_users_libs.sh new file mode 100644 index 000..24f4420 --- /dev/null +++ b/modules/docker/build_users_libs.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ -z $GIT_REPO ]; then + echo Users git repo is not provided. + + exit 0 +fi + +git clone $GIT_REPO user-repo + +cd user-repo + +if [ ! -z $GIT_BRANCH ]; then + git checkout $GIT_BRANCH +fi + +if [ ! -z "$BUILD_CMD" ]; then + echo "Starting to execute build command: $BUILD_CMD" + + eval "$BUILD_CMD" +else + mvn clean package +fi \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9de7d248/modules/docker/download_ignite.sh -- diff --git a/modules/docker/download_ignite.sh b/modules/docker/download_ignite.sh new file mode 100644 index 000..6a8617f --- /dev/null +++ b/modules/docker/download_ignite.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +function download { + wget -O ignite.zip $1 + + unzip ignite.zip -d ignite + + rm ignite.zip + + exit 0 +} + +if [ ! -z $IGNITE_URL ]; then + download $IGNITE_URL +fi + +if [ ! -z $IGNITE_VERSION ]; then + if [[ $IGNITE_VERSION =~ [0-9]*\.[0-9]*\.0 ]]; then +download http://apache-mirror.rbc.ru/pub/apache/incubator/ignite/${IGNITE_VERSION}/apache-ignite-fabric-${IGNITE_VERSION}-incubating-bin.zip + else +download http://www.gridgain.com/media/gridgain-community-fabric-${IGNITE_VERSION}.zip + fi +fi + +if [ -z $IGNITE_SOURCE ] || [ $IGNITE_SOURCE = "COMMUNITY" ]; then + download http://tiny.cc/updater/download_community.php +fi + +if [ $IGNITE_SOURCE = "APACHE" ]; then + downl
[13/39] incubator-ignite git commit: # ignite-gg-1064 use loopback address in clock server if failed to get local host
# ignite-gg-1064 use loopback address in clock server if failed to get local host Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0ef74a14 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0ef74a14 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0ef74a14 Branch: refs/heads/ignite-964 Commit: 0ef74a1449d503ae65a200e48da735b545e923da Parents: b5bc06e Author: sboikov Authored: Tue Jun 30 15:07:18 2015 +0300 Committer: sboikov Committed: Tue Jun 30 15:07:18 2015 +0300 -- .../processors/clock/GridClockServer.java | 21 +++- 1 file changed, 16 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0ef74a14/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java index e47d1fa..a835da8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java @@ -62,9 +62,20 @@ public class GridClockServer { int startPort = ctx.config().getTimeServerPortBase(); int endPort = startPort + ctx.config().getTimeServerPortRange() - 1; -InetAddress locHost = !F.isEmpty(ctx.config().getLocalHost()) ? -InetAddress.getByName(ctx.config().getLocalHost()) : -U.getLocalHost(); +InetAddress locHost; + +if (F.isEmpty(ctx.config().getLocalHost())) { +try { +locHost = U.getLocalHost(); +} +catch (IOException e) { +locHost = InetAddress.getLoopbackAddress(); + +U.warn(log, "Failed to get local host address, will use loopback address: " + locHost); +} +} +else +locHost = InetAddress.getByName(ctx.config().getLocalHost()); for (int p = startPort; p <= endPort; p++) { try { @@ -83,8 +94,8 @@ public class GridClockServer { } if (sock == null) -throw new IgniteCheckedException("Failed to bind time server socket within specified port range [locHost=" + -locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']'); +throw new IgniteCheckedException("Failed to bind time server socket within specified port range " + +"[locHost=" + locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']'); } catch (IOException e) { throw new IgniteCheckedException("Failed to start time server (failed to get local host address)", e);
[25/39] incubator-ignite git commit: # ignite-sprint-7 minor
# ignite-sprint-7 minor Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e0c53b81 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e0c53b81 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e0c53b81 Branch: refs/heads/ignite-964 Commit: e0c53b8171add7bfed0249c67a8e743443b7593f Parents: e91bc48 Author: sboikov Authored: Wed Jul 1 10:06:20 2015 +0300 Committer: sboikov Committed: Wed Jul 1 10:06:20 2015 +0300 -- .../main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e0c53b81/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java index fa3e564..720ce3a 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java @@ -2332,7 +2332,7 @@ class ServerImpl extends TcpDiscoveryImpl { LT.warn(log, null, "Local node has detected failed nodes and started cluster-wide procedure. " + "To speed up failure detection please see 'Failure Detection' section under javadoc" + -"for 'TcpDiscoverySpi'"); +" for 'TcpDiscoverySpi'"); } }
[03/39] incubator-ignite git commit: IGNITE-1046 Added license.
IGNITE-1046 Added license. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/86c5d207 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/86c5d207 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/86c5d207 Branch: refs/heads/ignite-964 Commit: 86c5d207094947aa9e53ea6da6314c125188ec8d Parents: f57aa92 Author: nikolay_tikhonov Authored: Fri Jun 26 13:09:59 2015 +0300 Committer: nikolay_tikhonov Committed: Fri Jun 26 13:09:59 2015 +0300 -- modules/docker/Dockerfile | 17 + modules/docker/build_users_libs.sh | 16 modules/docker/download_ignite.sh | 16 modules/docker/execute.sh | 16 modules/docker/run.sh | 16 5 files changed, 81 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c5d207/modules/docker/Dockerfile -- diff --git a/modules/docker/Dockerfile b/modules/docker/Dockerfile index 272..11e2e3d 100644 --- a/modules/docker/Dockerfile +++ b/modules/docker/Dockerfile @@ -1,3 +1,20 @@ +# +# 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. +# + # Start from a Debian image. FROM debian:8 http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c5d207/modules/docker/build_users_libs.sh -- diff --git a/modules/docker/build_users_libs.sh b/modules/docker/build_users_libs.sh index 24f4420..4d37187 100644 --- a/modules/docker/build_users_libs.sh +++ b/modules/docker/build_users_libs.sh @@ -1,4 +1,20 @@ #!/bin/bash +# +# 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. +# if [ -z $GIT_REPO ]; then echo Users git repo is not provided. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c5d207/modules/docker/download_ignite.sh -- diff --git a/modules/docker/download_ignite.sh b/modules/docker/download_ignite.sh index 6a8617f..9e2cb51 100644 --- a/modules/docker/download_ignite.sh +++ b/modules/docker/download_ignite.sh @@ -1,4 +1,20 @@ #!/bin/bash +# +# 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. +# function download { wget -O ignite.zip $1 http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86c5d207/modules/docker/execute.sh -- diff --git a/modules/docker/execute.sh b/modules/docker/execute.sh index
[24/39] incubator-ignite git commit: #ignite-964: nodejs cache works with json objects and strings.
#ignite-964: nodejs cache works with json objects and strings. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b963d033 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b963d033 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b963d033 Branch: refs/heads/ignite-964 Commit: b963d033922fa712ddb11fd3542468af802ea91f Parents: 80bd452 Author: ivasilinets Authored: Wed Jul 1 01:14:44 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 01:14:44 2015 +0300 -- modules/nodejs/src/main/js/apache-ignite.js | 1 + modules/nodejs/src/main/js/cache.js | 71 +++-- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 ++ modules/nodejs/src/test/js/test-cache-api.js| 100 ++- modules/nodejs/src/test/js/test-utils.js| 11 +- .../http/jetty/GridJettyRestHandler.java| 91 ++--- .../protocols/http/jetty/JSONCacheObject.java | 8 ++ 7 files changed, 240 insertions(+), 49 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b963d033/modules/nodejs/src/main/js/apache-ignite.js -- diff --git a/modules/nodejs/src/main/js/apache-ignite.js b/modules/nodejs/src/main/js/apache-ignite.js index af86916..82aa5ca 100644 --- a/modules/nodejs/src/main/js/apache-ignite.js +++ b/modules/nodejs/src/main/js/apache-ignite.js @@ -17,6 +17,7 @@ module.exports = { Cache : require('./cache.js').Cache, +Entry : require('./cache.js').Entry, Ignition : require('./ignition.js').Ignition, Server : require('./server.js').Server, Ignite : require('./ignite.js').Ignite, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b963d033/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index e0ed505..3eaadb4 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -41,7 +41,9 @@ function Cache(server, cacheName) { * @param {onGet} callback Called on finish */ Cache.prototype.get = function(key, callback) { -this._server.runCommand(this._createCommand("get").addParam("key", key), callback); +this._server.runCommand(this._createCommand("get"). +setPostData(JSON.stringify({"key": key})), +callback); }; /** @@ -53,7 +55,8 @@ Cache.prototype.get = function(key, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.put = function(key, value, callback) { -this._server.runCommand(this._createCommand("put").addParam("key", key).addParam("val", value), +this._server.runCommand(this._createCommand("put"). +setPostData(JSON.stringify({"key": key, "val" : value})), callback); } @@ -65,7 +68,9 @@ Cache.prototype.put = function(key, value, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.remove = function(key, callback) { -this._server.runCommand(this._createCommand("rmv").addParam("key", key), callback); +this._server.runCommand(this._createCommand("rmv"). +setPostData(JSON.stringify({"key": key})), +callback); } /** @@ -76,18 +81,21 @@ Cache.prototype.remove = function(key, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.removeAll = function(keys, callback) { -this._server.runCommand(this._createCommand("rmvall").addParams("k", keys), callback); +this._server.runCommand(this._createCommand("rmvall"). +setPostData(JSON.stringify({"keys" : keys})), +callback); } /** * Put keys to cache * * @this {Cache} - * @param {Object.} map collection of entries to put in the cache + * @param {Entry[]} List of entries to put in the cache * @param {noValue} callback Called on finish */ -Cache.prototype.putAll = function(map, callback) { - this._server.runCommand(this._createCommand("putall").setPostData(JSON.stringify(map)), callback); +Cache.prototype.putAll = function(entries, callback) { +this._server.runCommand(this._createCommand("putall").setPostData( +JSON.stringify({"entries" : entries})), callback); } /** @@ -106,7 +114,25 @@ Cache.prototype.putAll = function(map, callback) { * @param {Cache~onGetAll} callback Called on finish */ Cache.prototype.getAll = function(keys, callback) { -this._server.runCommand(this._
[22/39] incubator-ignite git commit: #ignite-964: change test for object put all.
#ignite-964: change test for object put all. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ea50ebba Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ea50ebba Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ea50ebba Branch: refs/heads/ignite-964 Commit: ea50ebbaa16544b1a791b2bef16bdb8e0dd75e0a Parents: bea777f Author: ivasilinets Authored: Tue Jun 30 17:47:53 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 17:47:53 2015 +0300 -- modules/nodejs/src/test/js/test-cache-api.js | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea50ebba/modules/nodejs/src/test/js/test-cache-api.js -- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 515f543..6e660b1 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -36,12 +36,18 @@ testPutAllGetAll = function() { } testPutAllObjectGetAll = function() { +var params = {} var key1 = {"name" : "Ann"}; var key2 = {"name" : "Paul"}; var val1 = {"age" : 12, "books" : ["1", "Book"]}; var val2 = {"age" : 13, "books" : ["1", "Book"]}; -startTest("mycache", {trace: [putAll, getAll], entry: {key1 : val1, key2 : val2}}); +params["k1"] = key1; +params["k2"] = key2; +params["val1"] = val1; +params["val2"] = val2; + +startTest("mycache", {trace: [putAll, getAll], entry: params}); } testRemoveAll = function() {
[30/39] incubator-ignite git commit: #ignite-964: QueryCommandHandler code style.
#ignite-964: QueryCommandHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7e0a63b6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7e0a63b6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7e0a63b6 Branch: refs/heads/ignite-964 Commit: 7e0a63b6408d079b146e7d5b9dc21efd766e803f Parents: f9a738f Author: ivasilinets Authored: Wed Jul 1 12:25:35 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:25:35 2015 +0300 -- .../handlers/query/QueryCommandHandler.java | 99 +--- 1 file changed, 43 insertions(+), 56 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e0a63b6/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index a254115..9432bb7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.processors.rest.request.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.typedef.internal.*; -import javax.cache.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -45,8 +44,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private static final AtomicLong qryIdGen = new AtomicLong(); /** Current queries. */ -private final ConcurrentHashMap>> curs = -new ConcurrentHashMap<>(); +private final ConcurrentHashMap curs = new ConcurrentHashMap<>(); /** * @param ctx Context. @@ -79,7 +77,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { assert req instanceof RestSqlQueryRequest : "Invalid type of query request."; return ctx.closure().callLocalSafe( -new FetchQueryCallable(ctx, (RestSqlQueryRequest)req, curs), false); +new FetchQueryCallable((RestSqlQueryRequest)req, curs), false); } } @@ -90,9 +88,6 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { * Execute query callable. */ private static class ExecuteQueryCallable implements Callable { -/** */ -private static final long serialVersionUID = 0L; - /** Kernal context. */ private GridKernalContext ctx; @@ -100,14 +95,15 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { private RestSqlQueryRequest req; /** Queries cursors. */ -private ConcurrentHashMap>> curs; +private ConcurrentHashMap curs; /** * @param ctx Kernal context. * @param req Execute query request. + * @param curs Queries cursors. */ public ExecuteQueryCallable(GridKernalContext ctx, RestSqlQueryRequest req, -ConcurrentHashMap>> curs) { +ConcurrentHashMap curs) { this.ctx = ctx; this.req = req; this.curs = curs; @@ -129,31 +125,15 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { ((SqlFieldsQuery)qry).setArgs(req.arguments()); } -Iterator> cur = -ctx.grid().cache(req.cacheName()).query(qry).iterator(); +Iterator cur = ctx.grid().cache(req.cacheName()).query(qry).iterator(); long qryId = qryIdGen.getAndIncrement(); curs.put(qryId, cur); -List res = new ArrayList<>(); - -CacheQueryResult response = new CacheQueryResult(); - -for (int i = 0; i < req.pageSize() && cur.hasNext(); ++i) { -res.add(cur.next()); -} - -response.setItems(res); - -response.setLast(!cur.hasNext()); - -response.setQueryId(qryId); - -if (!cur.hasNext()) -curs.remove(qryId); +CacheQueryResult res = createQueryResult(curs, cur, req, qryId); -return new GridRestResponse(response); +return new GridRestResponse(res); }
Git Push Summary
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 [deleted] ad11a4a12
[36/39] incubator-ignite git commit: #ignite-964: GridJettyRestHandler code style.
#ignite-964: GridJettyRestHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/49f4f910 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/49f4f910 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/49f4f910 Branch: refs/heads/ignite-964 Commit: 49f4f91036c39118df71863371b6b3ef83fa42eb Parents: 990e5ec Author: ivasilinets Authored: Wed Jul 1 12:49:27 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:49:27 2015 +0300 -- .../http/jetty/GridJettyRestHandler.java | 19 ++- 1 file changed, 2 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/49f4f910/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index 11059f3..b5877b6 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -542,27 +542,12 @@ public class GridJettyRestHandler extends AbstractHandler { restReq0.sqlQuery((String)params.get("qry")); -StringBuilder builder = new StringBuilder(); +JSONObject o = parseRequest(req); -Scanner reader = null; +List args = (List)o.get("arg"); -try { -reader = new Scanner(req.getReader()); -} -catch (IOException e) { -throw new IgniteCheckedException(e); -} - -while (reader.hasNext()) -builder.append(reader.next() + "\n"); - -JSONObject o = JSONObject.fromObject(builder.toString()); - -List args = (List)o.get("arg"); restReq0.arguments(args.toArray()); - restReq0.typeName((String)params.get("type")); - restReq0.pageSize(Integer.parseInt((String) params.get("psz"))); restReq0.cacheName((String)params.get("cacheName"));
[33/39] incubator-ignite git commit: #ignite-964: GridVersionCommandHandler code style.
#ignite-964: GridVersionCommandHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d85dab7e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d85dab7e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d85dab7e Branch: refs/heads/ignite-964 Commit: d85dab7e830f9a7157755d6823080ab6a6dccc70 Parents: 3bc20e8 Author: ivasilinets Authored: Wed Jul 1 12:29:20 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:29:20 2015 +0300 -- .../processors/rest/GridRestProcessor.java | 2 +- .../version/GridVersionCommandHandler.java | 67 .../version/GridVersionNameCommandHandler.java | 67 3 files changed, 68 insertions(+), 68 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d85dab7e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 86bfafe..5a073a0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -290,7 +290,7 @@ public class GridRestProcessor extends GridProcessorAdapter { addHandler(new GridCacheCommandHandler(ctx)); addHandler(new GridTaskCommandHandler(ctx)); addHandler(new GridTopologyCommandHandler(ctx)); -addHandler(new GridVersionCommandHandler(ctx)); +addHandler(new GridVersionNameCommandHandler(ctx)); addHandler(new DataStructuresCommandHandler(ctx)); addHandler(new IgniteScriptingCommandHandler(ctx)); addHandler(new QueryCommandHandler(ctx)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d85dab7e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java deleted file mode 100644 index 9597ab3..000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionCommandHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.processors.rest.handlers.version; - -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.rest.*; -import org.apache.ignite.internal.processors.rest.handlers.*; -import org.apache.ignite.internal.processors.rest.request.*; -import org.apache.ignite.internal.util.future.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.util.*; - -import static org.apache.ignite.internal.IgniteVersionUtils.*; -import static org.apache.ignite.internal.processors.rest.GridRestCommand.*; - -/** - * Handler for {@link GridRestCommand#VERSION} command. - */ -public class GridVersionCommandHandler extends GridRestCommandHandlerAdapter { -/** Supported commands. */ -private static final Collection SUPPORTED_COMMANDS = U.sealList(VERSION, NAME); - -/** - * @param ctx Context. - */ -public GridVersionCommandHandler(GridKernalContext ctx) { -super(ctx); -} - -/** {@inheritDoc} */ -@Override public Collection supportedCommands() { -return SUPPORTED_COMMANDS; -} - -/** {@inheritDoc} */ -@Override public IgniteInternalFuture handleAsync(GridRestRequest req) { -
[31/39] incubator-ignite git commit: #ignite-964: IgniteJsEmitResult code style.
#ignite-964: IgniteJsEmitResult code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cec45347 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cec45347 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cec45347 Branch: refs/heads/ignite-964 Commit: cec45347bc6475c6b59f9128732b5c696ec20c47 Parents: 7e0a63b Author: ivasilinets Authored: Wed Jul 1 12:26:52 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:26:52 2015 +0300 -- .../processors/rest/handlers/scripting/IgniteJsEmitResult.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cec45347/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java index ecd6cba..b5ae106 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteJsEmitResult.java @@ -37,9 +37,9 @@ public class IgniteJsEmitResult { List> res = emitResPerCall.get(); if (res == null) -res = new ArrayList(); +res = new ArrayList<>(); -res.add(new T3(f, args, node)); +res.add(new T3<>(f, args, node)); emitResPerCall.set(res); }
[17/39] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-964-1
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-964-1 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/eb4f07b2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/eb4f07b2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/eb4f07b2 Branch: refs/heads/ignite-964 Commit: eb4f07b2c81af0ad92a942bebb1c8fd14078d03a Parents: 54be106 8006a84 Author: ivasilinets Authored: Tue Jun 30 16:22:44 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 16:22:44 2015 +0300 -- .../discovery/GridDiscoveryManager.java | 46 +++- .../IgniteTopologyPrintFormatSelfTest.java | 233 +++ .../testsuites/IgniteKernalSelfTestSuite.java | 1 + 3 files changed, 274 insertions(+), 6 deletions(-) --
[26/39] incubator-ignite git commit: Merge branch 'ignite-sprint-7' into ignite-1046
Merge branch 'ignite-sprint-7' into ignite-1046 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aea804b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aea804b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aea804b4 Branch: refs/heads/ignite-964 Commit: aea804b41fd0a73a1eb4f8f68e28bf77d00de966 Parents: 4eef6d0 e91bc48 Author: nikolay_tikhonov Authored: Wed Jul 1 11:03:32 2015 +0300 Committer: nikolay_tikhonov Committed: Wed Jul 1 11:03:32 2015 +0300 -- .../ClientAbstractConnectivitySelfTest.java | 4 +- .../org/apache/ignite/cluster/ClusterGroup.java | 18 +- .../org/apache/ignite/cluster/ClusterNode.java | 2 + .../ignite/compute/ComputeTaskSplitAdapter.java | 2 +- .../configuration/CacheConfiguration.java | 105 +-- .../configuration/IgniteReflectionFactory.java | 81 +- .../configuration/NearCacheConfiguration.java | 10 +- .../ignite/internal/GridKernalContextImpl.java | 5 +- .../internal/cluster/ClusterGroupAdapter.java | 50 +- .../cluster/IgniteClusterAsyncImpl.java | 12 +- .../discovery/GridDiscoveryManager.java | 32 +- .../processors/cache/GridCacheContext.java | 2 +- .../cache/GridCacheDeploymentManager.java | 10 +- .../GridCachePartitionExchangeManager.java | 6 +- .../processors/cache/GridCacheProcessor.java| 62 +- .../distributed/dht/GridDhtLocalPartition.java | 3 +- .../distributed/dht/GridDhtLockFuture.java | 2 +- .../dht/atomic/GridDhtAtomicCache.java | 9 +- .../GridDhtPartitionsExchangeFuture.java| 46 +- .../processors/clock/GridClockServer.java | 21 +- .../datastructures/DataStructuresProcessor.java | 64 +- .../processors/hadoop/HadoopJobInfo.java| 4 +- .../hadoop/counter/HadoopCounterWriter.java | 5 +- .../processors/plugin/CachePluginManager.java | 10 +- .../processors/rest/GridRestProcessor.java | 4 +- .../handlers/task/GridTaskCommandHandler.java | 12 +- .../processors/task/GridTaskWorker.java | 4 +- .../internal/util/GridConfigurationFinder.java | 55 +- .../ignite/internal/util/IgniteUtils.java | 6 +- .../shmem/IpcSharedMemoryServerEndpoint.java| 10 +- .../apache/ignite/internal/visor/VisorJob.java | 2 + .../internal/visor/log/VisorLogSearchTask.java | 2 +- .../visor/node/VisorNodeDataCollectorJob.java | 4 + .../visor/query/VisorQueryCleanupTask.java | 14 + .../util/VisorClusterGroupEmptyException.java | 37 + .../ignite/spi/discovery/tcp/ClientImpl.java| 151 ++-- .../ignite/spi/discovery/tcp/ServerImpl.java| 103 ++- .../spi/discovery/tcp/TcpDiscoverySpi.java | 3 +- .../TcpDiscoveryMulticastIpFinder.java | 74 +- .../core/src/test/config/spark/spark-config.xml | 46 ++ .../internal/ClusterGroupAbstractTest.java | 777 ++ .../internal/ClusterGroupHostsSelfTest.java | 141 .../ignite/internal/ClusterGroupSelfTest.java | 251 ++ .../internal/GridDiscoveryEventSelfTest.java| 12 +- .../internal/GridProjectionAbstractTest.java| 784 --- .../ignite/internal/GridProjectionSelfTest.java | 251 -- .../apache/ignite/internal/GridSelfTest.java| 2 +- .../IgniteTopologyPrintFormatSelfTest.java | 289 +++ .../CacheReadThroughAtomicRestartSelfTest.java | 32 + ...heReadThroughLocalAtomicRestartSelfTest.java | 32 + .../CacheReadThroughLocalRestartSelfTest.java | 32 + ...dThroughReplicatedAtomicRestartSelfTest.java | 32 + ...cheReadThroughReplicatedRestartSelfTest.java | 32 + .../cache/CacheReadThroughRestartSelfTest.java | 133 .../cache/GridCacheAbstractSelfTest.java| 2 +- .../cache/GridCacheDaemonNodeStopSelfTest.java | 119 --- .../IgniteDaemonNodeMarshallerCacheTest.java| 192 + ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++ .../cache/IgniteDynamicCacheStartSelfTest.java | 37 + ...GridCacheQueueMultiNodeAbstractSelfTest.java | 4 +- .../GridCacheSetAbstractSelfTest.java | 22 +- .../IgniteDataStructureWithJobTest.java | 111 +++ .../distributed/IgniteCache150ClientsTest.java | 189 + ...teCacheClientNodePartitionsExchangeTest.java | 1 + .../distributed/IgniteCacheManyClientsTest.java | 1 + ...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 5 - ...achePartitionedMultiNodeFullApiSelfTest.java | 53 +- .../GridCacheReplicatedFailoverSelfTest.java| 5 + .../IgniteCacheTxStoreSessionTest.java | 4 + .../internal/util/IgniteUtilsSelfTest.java | 22 + .../tcp/TcpClientDiscoverySpiSelfTest.java | 265 ++- .../testframework/junits/GridAbstractTest.java | 2 +- .../ignite/testsuites/IgniteBasicTestSuite.java | 7 +- .../IgniteCacheDataStructuresSelfTestSui
[11/39] incubator-ignite git commit: #ignite-964: remove postPutAll
#ignite-964: remove postPutAll Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2bf2b69e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2bf2b69e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2bf2b69e Branch: refs/heads/ignite-964 Commit: 2bf2b69e4f18eacd79072c762a9d4a14bfca11ae Parents: 913a5d4 Author: ivasilinets Authored: Tue Jun 30 14:40:38 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 14:40:38 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 - .../handlers/cache/GridCacheCommandHandler.java | 2 - modules/nodejs/src/main/js/cache.js | 2 +- modules/nodejs/src/main/js/server.js| 10 +- .../http/jetty/GridJettyRestHandler.java| 108 +-- 5 files changed, 61 insertions(+), 64 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bf2b69e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 375a079..0afefb6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -45,9 +45,6 @@ public enum GridRestCommand { /** Store several values in cache. */ CACHE_PUT_ALL("putall"), -/** Store several values in cache. */ -CACHE_PUT_ALL2("putall2"), - /** Remove value from cache. */ CACHE_REMOVE("rmv"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bf2b69e/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index ef0391e..1f24023 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -58,7 +58,6 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_PUT, CACHE_ADD, CACHE_PUT_ALL, -CACHE_PUT_ALL2, CACHE_REMOVE, CACHE_REMOVE_ALL, CACHE_REPLACE, @@ -191,7 +190,6 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } -case CACHE_PUT_ALL2: case CACHE_PUT_ALL: { Map map = req0.values(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bf2b69e/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 489..b19367c 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -106,7 +106,7 @@ Cache.prototype.putAll = function(map, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.postPutAll = function(map, callback) { - this._server.runCommand(this._createCommand("putall2").setPostData(JSON.stringify(map)), callback); + this._server.runCommand(this._createCommand("putall").setPostData(JSON.stringify(map)), callback); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2bf2b69e/modules/nodejs/src/main/js/server.js -- diff --git a/modules/nodejs/src/main/js/server.js b/modules/nodejs/src/main/js/server.js index 2714ae5..3cb98c1 100644 --- a/modules/nodejs/src/main/js/server.js +++ b/modules/nodejs/src/main/js/server.js @@ -67,12 +67,18 @@ Server.prototype.runCommand = function(cmd, callback) { var http = require('http'); +var commHeaders = this._signature(); + +if (cmd._isPost()) { +commHeaders["JSONObject"] = "true"; +} + var options = { host: this._host, port: this._port, method : cmd._method(), path: "/ignite?" + requestQry, -headers: this._signature() +headers: commHeader
[18/39] incubator-ignite git commit: IGNITE-1062 Added tests.
IGNITE-1062 Added tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6ebcb6de Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6ebcb6de Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6ebcb6de Branch: refs/heads/ignite-964 Commit: 6ebcb6de192e1916e58226990eb9d9ec759da6ef Parents: 8006a84 Author: nikolay_tikhonov Authored: Tue Jun 30 16:51:15 2015 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 30 16:51:15 2015 +0300 -- .../discovery/GridDiscoveryManager.java | 26 + .../IgniteTopologyPrintFormatSelfTest.java | 60 +++- 2 files changed, 61 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ebcb6de/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java index 1d555e4..a8ce8ff 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java @@ -101,7 +101,7 @@ public class GridDiscoveryManager extends GridManagerAdapter { /** Predicate filtering client nodes. */ private static final IgnitePredicate clientFilter = new P1() { @Override public boolean apply(ClusterNode n) { -return n.isClient(); +return CU.clientNode(n); } }; @@ -940,9 +940,9 @@ public class GridDiscoveryManager extends GridManagerAdapter { Collection rmtNodes = discoCache.remoteNodes(); -Collection serverNodes = discoCache.serverNodes(); +Collection serverNodes = F.view(discoCache.allNodes(), F.not(clientFilter)); -Collection clientNodes = discoCache.clientNodes(); +Collection clientNodes = F.view(discoCache.allNodes(), clientFilter); ClusterNode locNode = discoCache.localNode(); @@ -2122,12 +2122,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { /** Remote nodes. */ private final List rmtNodes; -/** Client nodes. */ -private final List clientNodes; - -/** Server nodes. */ -private final List serverNodes; - /** All nodes. */ private final List allNodes; @@ -2216,10 +2210,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { all.addAll(rmtNodes); -clientNodes = Collections.unmodifiableList(new ArrayList<>(F.view(all, clientFilter))); - -serverNodes = Collections.unmodifiableList(new ArrayList<>(F.view(all, F.not(clientFilter; - Collections.sort(all, GridNodeOrderComparator.INSTANCE); allNodes = Collections.unmodifiableList(all); @@ -2370,16 +2360,6 @@ public class GridDiscoveryManager extends GridManagerAdapter { return rmtNodes; } -/** @return Server nodes. */ -Collection serverNodes() { -return serverNodes; -} - -/** @return Client nodes. */ -Collection clientNodes() { -return clientNodes; -} - /** @return All nodes. */ Collection allNodes() { return allNodes; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ebcb6de/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java -- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java index efbc431..2a71f28 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java @@ -56,11 +56,16 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest { TcpDiscoverySpi disc = new TcpDiscoverySpi(); disc.setIpFinder(IP_FINDER); -cfg.setDiscoverySpi(disc); - if (gridName.endsWith("client")) cfg.setClientMode(true); +if (gridName.endsWith("client_force_server")) { +cfg.setClientMode(true); +disc.setForceServerMode(true); +} + +cfg.setD
[06/39] incubator-ignite git commit: #ignite-964: introduce command object in server.js
#ignite-964: introduce command object in server.js Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/87446876 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/87446876 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/87446876 Branch: refs/heads/ignite-964 Commit: 8744687687f5994c1a881432a7c0600a6b7368c4 Parents: 2c1ecf2 Author: ivasilinets Authored: Tue Jun 30 02:02:44 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 02:02:44 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 100 - modules/nodejs/src/main/js/compute.js | 14 ++-- modules/nodejs/src/main/js/ignite.js | 7 +- modules/nodejs/src/main/js/server.js | 85 4 files changed, 98 insertions(+), 108 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/87446876/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 9f72589..1ece92d 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -16,6 +16,7 @@ */ var Server = require("./server").Server; +var Command = require("./server").Command; var SqlFieldsQuery = require("./sql-fields-query").SqlFieldsQuery var SqlQuery = require("./sql-query").SqlQuery @@ -30,7 +31,6 @@ var SqlQuery = require("./sql-query").SqlQuery function Cache(server, cacheName) { this._server = server; this._cacheName = cacheName; -this._cacheNameParam = Server.pair("cacheName", this._cacheName); } /** @@ -41,7 +41,7 @@ function Cache(server, cacheName) { * @param {onGet} callback Called on finish */ Cache.prototype.get = function(key, callback) { -this._server.runCommand("get", [this._cacheNameParam, Server.pair("key", key)], callback); +this._server.runCommand(this._createCommand("get").addParam("key", key), callback); }; /** @@ -53,7 +53,7 @@ Cache.prototype.get = function(key, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.put = function(key, value, callback) { -this._server.runCommand("put", [this._cacheNameParam, Server.pair("key", key), Server.pair("val", value)], +this._server.runCommand(this._createCommand("put").addParam("key", key).addParam("val", value), callback); } @@ -65,7 +65,7 @@ Cache.prototype.put = function(key, value, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.remove = function(key, callback) { -this._server.runCommand("rmv", [this._cacheNameParam, Server.pair("key", key)], callback); +this._server.runCommand(this._createCommand("rmv").addParam("key", key), callback); } /** @@ -76,11 +76,7 @@ Cache.prototype.remove = function(key, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.removeAll = function(keys, callback) { -var params = [this._cacheNameParam]; - -params = params.concat(Cache.concatParams("k", keys)); - -this._server.runCommand("rmvall", params, callback); +this._server.runCommand(this._createCommand("rmvall").addParams("k", keys), callback); } /** @@ -99,12 +95,7 @@ Cache.prototype.putAll = function(map, callback) { values.push(map[key]); } -var params = Cache.concatParams("k", keys); -params = params.concat(Cache.concatParams("v", values)); - -params.push(this._cacheNameParam); - -this._server.runCommand("putall", params, callback); +this._server.runCommand(this._createCommand("putall").addParams("k", keys).addParams("v", values), callback); } /** @@ -115,9 +106,7 @@ Cache.prototype.putAll = function(map, callback) { * @param {noValue} callback Called on finish */ Cache.prototype.postPutAll = function(map, callback) { -var params = [this._cacheNameParam]; - -this._server.runCommand("putall2", params, callback, JSON.stringify(map)); + this._server.runCommand(this._createCommand("putall2").setPostData(JSON.stringify(map)), callback); } /** @@ -136,11 +125,7 @@ Cache.prototype.postPutAll = function(map, callback) { * @param {Cache~onGetAll} callback Called on finish */ Cache.prototype.getAll = function(keys, callback) { -var params = Cache.concatParams("k", keys); - -params.push(this._cacheNameParam); - -this._server.runCommand("getall", pa
[08/39] incubator-ignite git commit: IGNITE-1063 Added generic for chaining setters.
IGNITE-1063 Added generic for chaining setters. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ef7a35ce Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ef7a35ce Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ef7a35ce Branch: refs/heads/ignite-964 Commit: ef7a35ce9afb830c2e02b624eb3f3298f66e6129 Parents: bade9f1 Author: nikolay_tikhonov Authored: Tue Jun 30 12:31:13 2015 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 30 12:31:13 2015 +0300 -- .../configuration/CacheConfiguration.java | 105 ++- .../configuration/NearCacheConfiguration.java | 10 +- 2 files changed, 61 insertions(+), 54 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef7a35ce/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 7af4974..e2308f2 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -419,7 +419,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param name Cache name. May be null, but may not be empty string. * @return {@code this} for chaining. */ -public CacheConfiguration setName(String name) { +public CacheConfiguration setName(String name) { A.ensure(name == null || !name.isEmpty(), "Name cannot be null or empty."); this.name = name; @@ -444,7 +444,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param evictPlc Cache expiration policy. * @return {@code this} for chaining. */ -public CacheConfiguration setEvictionPolicy(@Nullable EvictionPolicy evictPlc) { +public CacheConfiguration setEvictionPolicy(@Nullable EvictionPolicy evictPlc) { this.evictPlc = evictPlc; return this; @@ -461,7 +461,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param nearCfg Near cache configuration. * @return {@code this} for chaining. */ -public CacheConfiguration setNearConfiguration(NearCacheConfiguration nearCfg) { +public CacheConfiguration setNearConfiguration(NearCacheConfiguration nearCfg) { this.nearCfg = nearCfg; return this; @@ -483,7 +483,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param writeSync Write synchronization mode. * @return {@code this} for chaining. */ -public CacheConfiguration setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync) { +public CacheConfiguration setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync) { this.writeSync = writeSync; return this; @@ -504,7 +504,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param nodeFilter Predicate specifying on which nodes the cache should be started. * @return {@code this} for chaining. */ -public CacheConfiguration setNodeFilter(IgnitePredicate nodeFilter) { +public CacheConfiguration setNodeFilter(IgnitePredicate nodeFilter) { this.nodeFilter = nodeFilter; return this; @@ -536,7 +536,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param evictSync {@code true} if synchronized, {@code false} if not. * @return {@code this} for chaining. */ -public CacheConfiguration setEvictSynchronized(boolean evictSync) { +public CacheConfiguration setEvictSynchronized(boolean evictSync) { this.evictSync = evictSync; return this; @@ -559,7 +559,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param evictKeyBufSize Eviction key buffer size. * @return {@code this} for chaining. */ -public CacheConfiguration setEvictSynchronizedKeyBufferSize(int evictKeyBufSize) { +public CacheConfiguration setEvictSynchronizedKeyBufferSize(int evictKeyBufSize) { this.evictKeyBufSize = evictKeyBufSize; return this; @@ -593,7 +593,7 @@ public class CacheConfiguration extends MutableConfiguration { * @param evictSyncConcurrencyLvl Concurrency level for synchronized evictions. * @return {@code this} for chaining. */ -public CacheConfiguration setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl) { +public CacheConfiguration setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl) { thi
[38/39] incubator-ignite git commit: #ignite-964: nodejs code style.
#ignite-964: nodejs code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/45f16eaa Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/45f16eaa Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/45f16eaa Branch: refs/heads/ignite-964 Commit: 45f16eaaab3de5b574725e187e29b33649ef0977 Parents: 3807762 Author: ivasilinets Authored: Wed Jul 1 13:07:47 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 13:07:47 2015 +0300 -- .../processors/rest/handlers/query/QueryCommandHandler.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45f16eaa/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java index 9432bb7..ec9575c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java @@ -205,7 +205,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter { res.setQueryId(qryId); if (!cur.hasNext()) -curs.remove(req.queryId()); +curs.remove(qryId); return res; }
[32/39] incubator-ignite git commit: #ignite-964: IgniteScriptingCommandHandler code style.
#ignite-964: IgniteScriptingCommandHandler code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3bc20e8d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3bc20e8d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3bc20e8d Branch: refs/heads/ignite-964 Commit: 3bc20e8def3926f05950077cc40f61b1b2b641ac Parents: cec4534 Author: ivasilinets Authored: Wed Jul 1 12:28:16 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:28:16 2015 +0300 -- .../rest/handlers/scripting/IgniteScriptingCommandHandler.java | 6 -- 1 file changed, 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3bc20e8d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java index d7525a0..2d65016 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java @@ -260,9 +260,6 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter * Run script callable. */ private static class RunScriptCallable implements Callable { -/** */ -private static final long serialVersionUID = 0L; - /** Kernal context. */ private GridKernalContext ctx; @@ -294,9 +291,6 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter * Map reduce callable. */ private static class MapReduceCallable implements Callable { -/** */ -private static final long serialVersionUID = 0L; - /** Kernal context. */ private GridKernalContext ctx;
[10/39] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-964' into ignite-964-1
Merge remote-tracking branch 'remotes/origin/ignite-964' into ignite-964-1 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/913a5d46 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/913a5d46 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/913a5d46 Branch: refs/heads/ignite-964 Commit: 913a5d46693644557eb4697bb35862466014d70e Parents: d218dfb 576c435 Author: ivasilinets Authored: Tue Jun 30 14:26:07 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 14:26:07 2015 +0300 -- .../handlers/query/QueryCommandHandler.java | 8 +-- .../rest/request/RestSqlQueryRequest.java | 10 ++-- modules/nodejs/src/main/js/cache.js | 9 +--- modules/nodejs/src/main/js/sql-fields-query.js | 23 ++-- modules/nodejs/src/test/js/test-query.js| 55 +--- 5 files changed, 43 insertions(+), 62 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/913a5d46/modules/nodejs/src/main/js/cache.js -- diff --cc modules/nodejs/src/main/js/cache.js index 1ece92d,8f074e3..489 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@@ -149,12 -146,14 +144,12 @@@ Cache.prototype.query = function(qry) qry.page(res["items"]); if (res["last"]) { - qry.end(); + qry.end(null); } else { -this._server.runCommand("qryfetch", [ -Server.pair("cacheName", this._cacheName), -Server.pair("qryId", res.queryId), -Server.pair("psz", qry.pageSize())], -onQueryExecute.bind(this, qry)); +var command = this._createCommand("qryfetch"); +command.addParam("qryId", res.queryId).addParam("psz", qry.pageSize()); +this._server.runCommand(command, onQueryExecute.bind(this, qry)); } }
[39/39] incubator-ignite git commit: #ignite-964: nodejs code style.
#ignite-964: nodejs code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ad11a4a1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ad11a4a1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ad11a4a1 Branch: refs/heads/ignite-964 Commit: ad11a4a12b7a7159fbc7b36128ed65c817628e99 Parents: 45f16ea Author: ivasilinets Authored: Wed Jul 1 13:12:20 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 13:12:20 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad11a4a1/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index eef4039..c65f026 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -138,7 +138,7 @@ Cache.prototype.getAll = function(keys, callback) { /** * Execute sql query * - * @param {SqlQuery} qry Query + * @param {SqlQuery|SqlFieldsQuery} qry Query */ Cache.prototype.query = function(qry) { function onQueryExecute(qry, error, res) {
[29/39] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-964-1
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-964-1 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f9a738f3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f9a738f3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f9a738f3 Branch: refs/heads/ignite-964 Commit: f9a738f3e3aa4370a7302512bdd149a2984e6ae5 Parents: b963d03 c7e7487 Author: ivasilinets Authored: Wed Jul 1 12:08:12 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:08:12 2015 +0300 -- .../configuration/CacheConfiguration.java | 105 ++- .../configuration/NearCacheConfiguration.java | 10 +- .../managers/communication/GridIoManager.java | 49 + .../discovery/GridDiscoveryManager.java | 26 + .../processors/clock/GridClockServer.java | 21 +++- .../util/nio/GridNioMessageTracker.java | 23 +++- .../ignite/spi/discovery/tcp/ServerImpl.java| 2 +- .../TcpDiscoveryMulticastIpFinder.java | 74 ++--- .../IgniteTopologyPrintFormatSelfTest.java | 60 ++- modules/docker/Dockerfile | 55 ++ modules/docker/README.txt | 11 ++ modules/docker/build_users_libs.sh | 39 +++ modules/docker/download_ignite.sh | 49 + modules/docker/execute.sh | 62 +++ modules/docker/run.sh | 34 ++ 15 files changed, 497 insertions(+), 123 deletions(-) --
[20/39] incubator-ignite git commit: #ignite-964: add test put all objects.
#ignite-964: add test put all objects. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bea777f9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bea777f9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bea777f9 Branch: refs/heads/ignite-964 Commit: bea777f9d99b2e8a1e5cab8ab2c1215a70d15aff Parents: eb4f07b Author: ivasilinets Authored: Tue Jun 30 17:24:01 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 17:24:01 2015 +0300 -- .../processors/scripting/JSONCacheObject.java | 78 modules/nodejs/src/main/js/cache.js | 4 +- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 ++ modules/nodejs/src/test/js/test-cache-api.js| 16 ++-- modules/nodejs/src/test/js/test-utils.js| 15 5 files changed, 113 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bea777f9/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java new file mode 100644 index 000..46067d7 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java @@ -0,0 +1,78 @@ +/* + * 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.processors.scripting; + +import java.util.*; + +/** + * Json cache object. + */ +public class JSONCacheObject { +/** Fields map. */ +private Map fields = new HashMap<>(); + +/** + * @param key Field name. + * @param val Field value. + */ +public void addField(String key, Object val) { +fields.put(key, val); +} + +/** + * @param key Field name. + * @return Field value. + */ +public Object getField(String key) { +return fields.get(key); +} + +/** + * @return Fields key set. + */ +public Set keys() { +return fields.keySet(); +} + +/** {@inheritDoc} */ +@Override public int hashCode() { +//TODO: +return fields.hashCode(); +} + +/** {@inheritDoc} */ +@Override public boolean equals(Object obj) { +if (obj == null || !(obj instanceof JSONCacheObject)) +return false; + +JSONCacheObject obj0 = (JSONCacheObject) obj; + +if (fields.size() != obj0.fields.size()) +return false; + +for (String key : obj0.keys()) { +if (!fields.containsKey(key)) +return false; + +if (!obj0.getField(key).equals(getField(key))) +return false; +} + +return true; +} +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bea777f9/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 8ff6ee3..e0ed505 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -153,7 +153,6 @@ Cache.prototype._sqlFieldsQuery = function(qry, onQueryExecute) { } Cache.prototype._sqlQuery = function(qry, onQueryExecute) { - if (qry.returnType() == null) { qry.error("No type for sql query."); qry.end(); @@ -171,12 +170,15 @@ Cache.prototype._sqlQuery = function(qry, onQueryExecute) { Cache.prototype._createCommand = function(name) { var command = new Command(name); + return command.addParam("cacheName", this._cacheName); } Cache.prototype._createQueryCommand = function(name, qry) { var command = this._createCommand(name); + command.addParam("qry", qry.query()); + return command.addParam("ps
[28/39] incubator-ignite git commit: IGNITE-1068: Fixing ordered messages back pressure control.
IGNITE-1068: Fixing ordered messages back pressure control. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c7e74874 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c7e74874 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c7e74874 Branch: refs/heads/ignite-964 Commit: c7e7487458b72ba8b666fba7b9e24004d425719f Parents: bccba30 Author: vozerov-gridgain Authored: Wed Jul 1 11:50:08 2015 +0300 Committer: vozerov-gridgain Committed: Wed Jul 1 11:50:08 2015 +0300 -- .../managers/communication/GridIoManager.java | 49 +++- .../util/nio/GridNioMessageTracker.java | 23 +++-- 2 files changed, 48 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c7e74874/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java index 4382731..d8dcc2c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java @@ -27,6 +27,7 @@ import org.apache.ignite.internal.managers.deployment.*; import org.apache.ignite.internal.managers.eventstorage.*; import org.apache.ignite.internal.processors.timeout.*; import org.apache.ignite.internal.util.*; +import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -718,7 +719,7 @@ public class GridIoManager extends GridManagerAdapter(); @@ -748,7 +749,7 @@ public class GridIoManager extends GridManagerAdapter> msgs = new ConcurrentLinkedDeque<>(); +private final Queue> msgs = new ConcurrentLinkedDeque<>(); /** */ private final AtomicBoolean reserved = new AtomicBoolean(); @@ -1873,6 +1865,7 @@ public class GridIoManager extends GridManagerAdapter t = msgs.poll(); t != null; t = msgs.poll()) -lsnr.onMessage(nodeId, t.get1().message()); +for (GridTuple3 t = msgs.poll(); t != null; t = msgs.poll()) { +try { +lsnr.onMessage( +nodeId, +t.get1().message()); +} +finally { +if (t.get3() != null) +t.get3().run(); +} +} } /** * @param msg Message to add. + * @param msgC Message closure (may be {@code null}). */ -void add(GridIoMessage msg) { -msgs.add(F.t(msg, U.currentTimeMillis())); +void add( +GridIoMessage msg, +@Nullable IgniteRunnable msgC +) { +msgs.add(F.t(msg, U.currentTimeMillis(), msgC)); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c7e74874/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java index 52b7fed..c9ed1a0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioMessageTracker.java @@ -56,9 +56,26 @@ public class GridNioMessageTracker implements IgniteRunnable { /** {@inheritDoc} */ @Override public void run() { -int cnt = msgCnt.decrementAndGet(); +// In case of ordered messages this may be called twice for 1 message. +// Example: message arrives, but listener has not been installed yet. +// Message set is created, but message does not get actually processed. +// If this is not called, connection may be paused which causes hang. +// It seems acceptable to have the following logic accounting the aforementioned. +int cnt = 0; -assert cnt >= 0 : "Invalid count: " + cnt; +for (;;) { +int cur = msgCnt.get(); + +if (cur == 0) +break; + +cnt = cur - 1; + +if (msgCnt.compareAndSet(cur, cnt)) +break; +} + +assert cnt >= 0 : "Inv
[34/39] incubator-ignite git commit: #ignite-964: JSONCacheObject code style.
#ignite-964: JSONCacheObject code style. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bb412c42 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bb412c42 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bb412c42 Branch: refs/heads/ignite-964 Commit: bb412c4233c29a14fb96a58fb3cda2e0ea528388 Parents: d85dab7 Author: ivasilinets Authored: Wed Jul 1 12:36:54 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 12:36:54 2015 +0300 -- .../protocols/http/jetty/JSONCacheObject.java | 78 +++- 1 file changed, 45 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bb412c42/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java index 67f2430..7ea30b3 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/JSONCacheObject.java @@ -26,28 +26,62 @@ import java.util.*; */ public class JSONCacheObject { /** Fields map. */ -private Map fields = new HashMap<>(); +private final Map fields = new HashMap<>(); -public JSONCacheObject() { +/** + * Empty constructor. + */ +private JSONCacheObject() { +} +/** + * @param o JSON object. + */ +public JSONCacheObject(JSONObject o) { +for (Object key : o.keySet()) +addField(toSimpleObject(key), toSimpleObject(o.get(key))); } -public void setFields(Map fields) { -this.fields = fields; +/** + * @param key Field name. + * @param val Field value. + */ +public void addField(Object key, Object val) { +fields.put(key, val); } -public Map getFields() { -return fields; +/** + * @param key Field name. + * @return Field value. + */ +public Object getField(Object key) { +return fields.get(key); } -public JSONCacheObject(JSONObject o) { -for (Object key : o.keySet()) -addField(toSimpleObject(key), toSimpleObject(o.get(key))); +/** + * @return Fields key set. + */ +public Set keys() { +return fields.keySet(); +} + +/** + * @return Fields map. + */ +public Map getFields() { +return fields; } +/** + * Convert JSON object to JSONCacheObject + * + * @param o Object to convert. + * @return Converted object. + */ private Object toSimpleObject(Object o) { if (o instanceof JSONObject) { JSONObject o1 = (JSONObject)o; + JSONCacheObject res = new JSONCacheObject(); for (Object key : o1.keySet()) @@ -57,7 +91,9 @@ public class JSONCacheObject { } else if (o instanceof JSONArray) { JSONArray o1 = (JSONArray) o; + List val = new ArrayList<>(); + for (Object v : o1) val.add(toSimpleObject(v)); @@ -67,32 +103,8 @@ public class JSONCacheObject { return o; } -/** - * @param key Field name. - * @param val Field value. - */ -public void addField(Object key, Object val) { -fields.put(key, val); -} - -/** - * @param key Field name. - * @return Field value. - */ -public Object getField(Object key) { -return fields.get(key); -} - -/** - * @return Fields key set. - */ -public Set keys() { -return fields.keySet(); -} - /** {@inheritDoc} */ @Override public int hashCode() { -//TODO: return fields.hashCode(); }
[02/39] incubator-ignite git commit: IGNITE-1046 Added default option libs.
IGNITE-1046 Added default option libs. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f57aa921 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f57aa921 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f57aa921 Branch: refs/heads/ignite-964 Commit: f57aa921e7ac7b583b0f31931890f1f9454f3b1a Parents: 9de7d24 Author: nikolay_tikhonov Authored: Fri Jun 26 13:06:45 2015 +0300 Committer: nikolay_tikhonov Committed: Fri Jun 26 13:06:45 2015 +0300 -- modules/docker/execute.sh | 4 modules/docker/run.sh | 11 --- 2 files changed, 12 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f57aa921/modules/docker/execute.sh -- diff --git a/modules/docker/execute.sh b/modules/docker/execute.sh index 22d..e0ed90c 100644 --- a/modules/docker/execute.sh +++ b/modules/docker/execute.sh @@ -8,6 +8,10 @@ if [ ! -z "$GIT_REPO" ]; then fi fi +if [ -z "$OPTION_LIBS" ]; then + OPTION_LIBS="ignite-log4j" +fi + if [ ! -z "$OPTION_LIBS" ]; then IFS=, LIBS_LIST=("$OPTION_LIBS") http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f57aa921/modules/docker/run.sh -- diff --git a/modules/docker/run.sh b/modules/docker/run.sh index 42fb29d..2e3110d 100644 --- a/modules/docker/run.sh +++ b/modules/docker/run.sh @@ -1,11 +1,16 @@ #!/bin/bash -if [ -z $SKIP_DOWNLOAD ]; then - ./download_ignite.sh -fi +IGNITE_VERSION="" if [ -z $SKIP_BUILD_LIBS ]; then ./build_users_libs.sh + + IGNITE_VERSION=$(mvn -f user-repo/pom.xml dependency:list | grep ':ignite-core:jar:.*:' | \ +sed -rn 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/p') +fi + +if [ -z $SKIP_DOWNLOAD ]; then + IGNITE_VERSION=$IGNITE_VERSION ./download_ignite.sh fi ./execute.sh \ No newline at end of file
[23/39] incubator-ignite git commit: #ignite-964: wip
#ignite-964: wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/80bd452c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/80bd452c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/80bd452c Branch: refs/heads/ignite-964 Commit: 80bd452c985d685169f7ca8bc4bd264e0f4d33ca Parents: ea50ebb Author: ivasilinets Authored: Tue Jun 30 18:53:10 2015 +0300 Committer: ivasilinets Committed: Tue Jun 30 18:53:10 2015 +0300 -- .../processors/scripting/JSONCacheObject.java | 78 - .../http/jetty/GridJettyRestHandler.java| 53 ++--- .../protocols/http/jetty/JSONCacheObject.java | 111 +++ 3 files changed, 149 insertions(+), 93 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/80bd452c/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java deleted file mode 100644 index 46067d7..000 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/JSONCacheObject.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.processors.scripting; - -import java.util.*; - -/** - * Json cache object. - */ -public class JSONCacheObject { -/** Fields map. */ -private Map fields = new HashMap<>(); - -/** - * @param key Field name. - * @param val Field value. - */ -public void addField(String key, Object val) { -fields.put(key, val); -} - -/** - * @param key Field name. - * @return Field value. - */ -public Object getField(String key) { -return fields.get(key); -} - -/** - * @return Fields key set. - */ -public Set keys() { -return fields.keySet(); -} - -/** {@inheritDoc} */ -@Override public int hashCode() { -//TODO: -return fields.hashCode(); -} - -/** {@inheritDoc} */ -@Override public boolean equals(Object obj) { -if (obj == null || !(obj instanceof JSONCacheObject)) -return false; - -JSONCacheObject obj0 = (JSONCacheObject) obj; - -if (fields.size() != obj0.fields.size()) -return false; - -for (String key : obj0.keys()) { -if (!fields.containsKey(key)) -return false; - -if (!obj0.getField(key).equals(getField(key))) -return false; -} - -return true; -} -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/80bd452c/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index 6327c88..f7b1db8 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -358,28 +358,28 @@ public class GridJettyRestHandler extends AbstractHandler { if (req.getHeader("JSONObject") != null) { if (cmd == CACHE_PUT_ALL) { -StringBuilder builder = new StringBuilder(); +JSONObject o =parseRequest(req); -Scanner reader = null
[16/39] incubator-ignite git commit: IGNITE-1062 Split in topology snapshot server and client nodes.
IGNITE-1062 Split in topology snapshot server and client nodes. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8006a843 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8006a843 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8006a843 Branch: refs/heads/ignite-964 Commit: 8006a84344118f39e9190643420512fbee06bc73 Parents: bade9f1 Author: nikolay_tikhonov Authored: Tue Jun 30 16:06:28 2015 +0300 Committer: nikolay_tikhonov Committed: Tue Jun 30 16:06:28 2015 +0300 -- .../discovery/GridDiscoveryManager.java | 46 +++- .../IgniteTopologyPrintFormatSelfTest.java | 233 +++ .../testsuites/IgniteKernalSelfTestSuite.java | 1 + 3 files changed, 274 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8006a843/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java index 5e7600f..1d555e4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java @@ -98,6 +98,13 @@ public class GridDiscoveryManager extends GridManagerAdapter { } }; +/** Predicate filtering client nodes. */ +private static final IgnitePredicate clientFilter = new P1() { +@Override public boolean apply(ClusterNode n) { +return n.isClient(); +} +}; + /** Disco history entries comparator. */ private static final Comparator> histCmp = new Comparator>() { @@ -933,6 +940,10 @@ public class GridDiscoveryManager extends GridManagerAdapter { Collection rmtNodes = discoCache.remoteNodes(); +Collection serverNodes = discoCache.serverNodes(); + +Collection clientNodes = discoCache.clientNodes(); + ClusterNode locNode = discoCache.localNode(); Collection allNodes = discoCache.allNodes(); @@ -949,7 +960,7 @@ public class GridDiscoveryManager extends GridManagerAdapter { double heap = U.heapSize(allNodes, 2); if (log.isQuiet()) -U.quiet(false, topologySnapshotMessage(rmtNodes.size(), totalCpus, heap)); +U.quiet(false, topologySnapshotMessage(serverNodes.size(), clientNodes.size(), totalCpus, heap)); if (log.isDebugEnabled()) { String dbg = ""; @@ -959,7 +970,8 @@ public class GridDiscoveryManager extends GridManagerAdapter { ">>> " + PREFIX + "." + U.nl() + ">>> ++" + U.nl() + ">>> Grid name: " + (ctx.gridName() == null ? "default" : ctx.gridName()) + U.nl() + -">>> Number of nodes: " + (rmtNodes.size() + 1) + U.nl() + +">>> Number of server nodes: " + serverNodes.size() + U.nl() + +">>> Number of client nodes: " + clientNodes.size() + U.nl() + (discoOrdered ? ">>> Topology version: " + topVer + U.nl() : "") + ">>> Topology hash: 0x" + Long.toHexString(hash).toUpperCase() + U.nl(); @@ -992,19 +1004,21 @@ public class GridDiscoveryManager extends GridManagerAdapter { log.debug(dbg); } else if (log.isInfoEnabled()) -log.info(topologySnapshotMessage(rmtNodes.size(), totalCpus, heap)); +log.info(topologySnapshotMessage(serverNodes.size(), clientNodes.size(), totalCpus, heap)); } /** - * @param rmtNodesNum Remote nodes number. + * @param serverNodesNum Server nodes number. + * @param clientNodesNum Client nodes number. * @param totalCpus Total cpu number. * @param heap Heap size. * @return Topology snapshot message. */ -private String topologySnapshotMessage(int rmtNodesNum, int totalCpus, double heap) { +private String topologySnapshotMessage(int serverNodesNum, int clientNodesNum, int totalCpus, double heap) { return PREFIX + " [" + (discoOrdered ? "ver=" + topSnap.get().topVer.topologyVersion() + ", " : "") + -"nodes=" + (rmtNodesNum + 1) + +"server nodes=" + serverNodesNum + +", client nodes=" + clientNodesNum + ", CPUs=" + totalCpus + ", heap=" + heap + "GB" + ']'; @@ -2108,6 +2122,12 @@ public class GridDiscoveryManager extends GridManagerAdapter { /** Remote nodes. */
[2/8] incubator-ignite git commit: #ignite-964: add contains keys method for nodejs cache.
#ignite-964: add contains keys method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1ba51fcd Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1ba51fcd Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1ba51fcd Branch: refs/heads/ignite-964 Commit: 1ba51fcdcc24876dbb734fe7f8c3e8ce791889bc Parents: 7bed77b Author: ivasilinets Authored: Wed Jul 1 15:00:00 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 15:00:00 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 + .../processors/rest/GridRestProcessor.java | 2 + .../handlers/cache/GridCacheCommandHandler.java | 76 +++- modules/nodejs/src/main/js/cache.js | 12 .../ignite/internal/NodeJsCacheApiSelfTest.java | 14 modules/nodejs/src/test/js/test-cache-api.js| 57 +++ .../http/jetty/GridJettyRestHandler.java| 3 +- 7 files changed, 147 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ba51fcd/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 48d5bcf..a6563c9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -36,6 +36,9 @@ public enum GridRestCommand { /** Contains cached value. */ CACHE_CONTAINS_KEY("containskey"), +/** Contains cached values. */ +CACHE_CONTAINS_KEYS("containskeys"), + /** Get several cached values. */ CACHE_GET_ALL("getall"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ba51fcd/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 220f2d1..f688d3a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -388,6 +388,7 @@ public class GridRestProcessor extends GridProcessorAdapter { if (interceptor != null && res.getResponse() != null) { switch (req.command()) { +case CACHE_CONTAINS_KEYS: case CACHE_CONTAINS_KEY: case CACHE_GET: case CACHE_GET_ALL: @@ -533,6 +534,7 @@ public class GridRestProcessor extends GridProcessorAdapter { switch (req.command()) { case CACHE_GET: case CACHE_CONTAINS_KEY: +case CACHE_CONTAINS_KEYS: case CACHE_GET_ALL: perm = SecurityPermission.CACHE_READ; name = ((GridRestCacheRequest)req).cacheName(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ba51fcd/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index a4dc466..6a966ee 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -53,6 +53,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.*; public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { /** Supported commands. */ private static final Collection SUPPORTED_COMMANDS = U.sealList( +CACHE_CONTAINS_KEYS, CACHE_CONTAINS_KEY, CACHE_GET, CACHE_GET_ALL, @@ -139,9 +140,16 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { IgniteInternalFuture fut; switch (cmd) { +case CACHE_CONTAINS_KEYS: { +fut = executeCommand(req.destinationId(),
[8/8] incubator-ignite git commit: #ignite-964: fix get operations.
#ignite-964: fix get operations. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/830f397d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/830f397d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/830f397d Branch: refs/heads/ignite-964 Commit: 830f397d06d3addbbf0363d942e69013bf65897b Parents: 61f88e8 Author: ivasilinets Authored: Wed Jul 1 16:08:58 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 16:08:58 2015 +0300 -- .../apache/ignite/internal/NodeJsCacheApiSelfTest.java | 7 +++ modules/nodejs/src/test/js/test-cache-api.js| 10 +- .../rest/protocols/http/jetty/GridJettyRestHandler.java | 12 +--- 3 files changed, 25 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/830f397d/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java -- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java index dcb0db5..596c964 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java @@ -53,6 +53,13 @@ public class NodeJsCacheApiSelfTest extends NodeJsAbstractTest { /** * @throws Exception If failed. */ +public void testPutGetObject() throws Exception { +runJsScript("testPutGetObject"); +} + +/** + * @throws Exception If failed. + */ public void testIncorrectCache() throws Exception { runJsScript("testIncorrectCacheName"); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/830f397d/modules/nodejs/src/test/js/test-cache-api.js -- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 3e397bc..77b1684 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -26,6 +26,13 @@ testPutGet = function() { startTest("mycache", {trace: [put, getExist], entry: ["key" , "6"]}); } +testPutGetObject = function() { +var key = {"name" : "Paul"}; +var val = {"age" : 12, "books" : ["1", "Book"]}; + +startTest("mycache", {trace: [put, getExist], entry: [key , val]}); +} + testPutContains = function() { startTest("mycache", {trace: [put, containsKey], entry: ["key" , "6"]}); } @@ -249,7 +256,8 @@ function notContainsKeys(cache, entries, next) { function getExist(cache, entry, next) { function onGet(error, value) { assert(!error); -assert(value === entry[1], "Get incorrect value on get [exp=" + entry[1] + ", val=" + value + "]"); +assert(TestUtils.compareObject(entry[1], value), "Get incorrect value on get [exp=" + +JSON.stringify(entry[1]) + ", val=" + JSON.stringify(value) + "]"); next(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/830f397d/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java -- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index cacbf19..be44916 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -320,10 +320,10 @@ public class GridJettyRestHandler extends AbstractHandler { * @param cmdRes Rest response. */ private void createResponse(GridRestCommand cmd, GridRestResponse cmdRes) { -if (cmd == CACHE_GET_ALL) { -if (cmdRes.getResponse() == null) -return; +if (cmdRes.getResponse() == null) +return; +if (cmd == CACHE_GET_ALL) { Map o = (Map)cmdRes.getResponse(); List res = new ArrayList<>(); @@ -332,6 +332,12 @@ public class GridJettyRestHandler extends AbstractHandler {
[3/8] incubator-ignite git commit: #ignite-964: add getAndPut method for nodejs cache.
#ignite-964: add getAndPut method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/943d2dbc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/943d2dbc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/943d2dbc Branch: refs/heads/ignite-964 Commit: 943d2dbce9b01572f434582fef4cf6efd058f0d7 Parents: 1ba51fc Author: ivasilinets Authored: Wed Jul 1 15:17:46 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 15:17:46 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 + .../processors/rest/GridRestProcessor.java | 1 + .../handlers/cache/GridCacheCommandHandler.java | 40 modules/nodejs/src/main/js/cache.js | 15 - .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 ++ modules/nodejs/src/test/js/test-cache-api.js| 69 +--- .../http/jetty/GridJettyRestHandler.java| 3 +- 7 files changed, 98 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/943d2dbc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index a6563c9..2d9a159 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -42,6 +42,9 @@ public enum GridRestCommand { /** Get several cached values. */ CACHE_GET_ALL("getall"), +/** Store value in cache and return previous value. */ +CACHE_GET_AND_PUT("getandput"), + /** Store value in cache. */ CACHE_PUT("put"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/943d2dbc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index f688d3a..ee9bfce 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -548,6 +548,7 @@ public class GridRestProcessor extends GridProcessorAdapter { case CACHE_CAS: case CACHE_APPEND: case CACHE_PREPEND: +case CACHE_GET_AND_PUT: perm = SecurityPermission.CACHE_PUT; name = ((GridRestCacheRequest)req).cacheName(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/943d2dbc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 6a966ee..5d7f24a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -56,6 +56,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_CONTAINS_KEYS, CACHE_CONTAINS_KEY, CACHE_GET, +CACHE_GET_AND_PUT, CACHE_GET_ALL, CACHE_PUT, CACHE_ADD, @@ -73,6 +74,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { private static final EnumSet KEY_REQUIRED_REQUESTS = EnumSet.of( CACHE_CONTAINS_KEY, CACHE_GET, +CACHE_GET_AND_PUT, CACHE_PUT, CACHE_ADD, CACHE_REMOVE, @@ -161,6 +163,18 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_GET_AND_PUT: { +final Object val = req0.value(); + +if (val == null) +throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val")); + +fut = executeCommand(req.destinationId(), re
[4/8] incubator-ignite git commit: #ignite-964: add CACHE_GET_AND_PUT_IF_ABSENT method for nodejs cache.
#ignite-964: add CACHE_GET_AND_PUT_IF_ABSENT method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/16ff838d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/16ff838d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/16ff838d Branch: refs/heads/ignite-964 Commit: 16ff838df8f019d81c41ea2eb884bc849a2aa4d4 Parents: 943d2db Author: ivasilinets Authored: Wed Jul 1 15:39:49 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 15:39:49 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 ++ .../processors/rest/GridRestProcessor.java | 1 + .../handlers/cache/GridCacheCommandHandler.java | 37 ++-- modules/nodejs/src/main/js/cache.js | 15 +++- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 modules/nodejs/src/test/js/test-cache-api.js| 25 + .../http/jetty/GridJettyRestHandler.java| 4 ++- 7 files changed, 82 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16ff838d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 2d9a159..5a11faf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -45,6 +45,9 @@ public enum GridRestCommand { /** Store value in cache and return previous value. */ CACHE_GET_AND_PUT("getandput"), +/** Store value in cache and return previous value. */ +CACHE_GET_AND_PUT_IF_ABSENT("getandputifabsent"), + /** Store value in cache. */ CACHE_PUT("put"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16ff838d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index ee9bfce..14811f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -549,6 +549,7 @@ public class GridRestProcessor extends GridProcessorAdapter { case CACHE_APPEND: case CACHE_PREPEND: case CACHE_GET_AND_PUT: +case CACHE_GET_AND_PUT_IF_ABSENT: perm = SecurityPermission.CACHE_PUT; name = ((GridRestCacheRequest)req).cacheName(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16ff838d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 5d7f24a..798d151 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -57,6 +57,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_CONTAINS_KEY, CACHE_GET, CACHE_GET_AND_PUT, +CACHE_GET_AND_PUT_IF_ABSENT, CACHE_GET_ALL, CACHE_PUT, CACHE_ADD, @@ -75,6 +76,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_CONTAINS_KEY, CACHE_GET, CACHE_GET_AND_PUT, +CACHE_GET_AND_PUT_IF_ABSENT, CACHE_PUT, CACHE_ADD, CACHE_REMOVE, @@ -175,6 +177,18 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_GET_AND_PUT_IF_ABSENT: { +final Object val = req0.value(); + +if (val == null) +throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("
[7/8] incubator-ignite git commit: #ignite-964: add CACHE_REMOVE_VALUE method for nodejs cache.
#ignite-964: add CACHE_REMOVE_VALUE method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/61f88e8f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/61f88e8f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/61f88e8f Branch: refs/heads/ignite-964 Commit: 61f88e8fd8c50aba12c2b884287e28efef2f76f5 Parents: d44d7f2 Author: ivasilinets Authored: Wed Jul 1 16:00:47 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 16:00:47 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 + .../processors/rest/GridRestProcessor.java | 1 + .../handlers/cache/GridCacheCommandHandler.java | 78 modules/nodejs/src/main/js/cache.js | 16 +++- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 ++ modules/nodejs/src/test/js/test-cache-api.js| 19 - .../http/jetty/GridJettyRestHandler.java| 3 +- 7 files changed, 92 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/61f88e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index b8f05bf..86237b8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -64,6 +64,9 @@ public enum GridRestCommand { CACHE_REMOVE("rmv"), /** Remove value from cache. */ +CACHE_REMOVE_VALUE("rmvvalue"), + +/** Remove value from cache. */ CACHE_GET_AND_REMOVE("getandrmv"), /** Remove several values from cache. */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/61f88e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index b524e92..a19fde7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -559,6 +559,7 @@ public class GridRestProcessor extends GridProcessorAdapter { case CACHE_REMOVE: case CACHE_REMOVE_ALL: case CACHE_GET_AND_REMOVE: +case CACHE_REMOVE_VALUE: perm = SecurityPermission.CACHE_REMOVE; name = ((GridRestCacheRequest)req).cacheName(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/61f88e8f/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index b5b59fc..6db6c23 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -64,6 +64,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_ADD, CACHE_PUT_ALL, CACHE_REMOVE, +CACHE_REMOVE_VALUE, CACHE_GET_AND_REMOVE, CACHE_REMOVE_ALL, CACHE_REPLACE, @@ -83,6 +84,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_PUT, CACHE_ADD, CACHE_REMOVE, +CACHE_REMOVE_VALUE, CACHE_GET_AND_REMOVE, CACHE_REPLACE, ATOMIC_INCREMENT, @@ -170,38 +172,22 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { } case CACHE_GET_AND_PUT: { -final Object val = req0.value(); - -if (val == null) -throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val")); - fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skip
[1/8] incubator-ignite git commit: #ignite-964: add contains key method for nodejs cache.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964 ad11a4a12 -> 830f397d0 #ignite-964: add contains key method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7bed77b3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7bed77b3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7bed77b3 Branch: refs/heads/ignite-964 Commit: 7bed77b375580b62f4bc5b98b32a595716868cad Parents: ad11a4a Author: ivasilinets Authored: Wed Jul 1 13:47:56 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 13:47:56 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 ++ .../processors/rest/GridRestProcessor.java | 2 ++ .../handlers/cache/GridCacheCommandHandler.java | 30 modules/nodejs/src/main/js/cache.js | 30 ++-- .../ignite/internal/NodeJsCacheApiSelfTest.java | 14 + modules/nodejs/src/test/js/test-cache-api.js| 30 .../http/jetty/GridJettyRestHandler.java| 4 ++- 7 files changed, 103 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7bed77b3/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 0afefb6..48d5bcf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -33,6 +33,9 @@ public enum GridRestCommand { /** Get cached value. */ CACHE_GET("get"), +/** Contains cached value. */ +CACHE_CONTAINS_KEY("containskey"), + /** Get several cached values. */ CACHE_GET_ALL("getall"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7bed77b3/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 5a073a0..220f2d1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -388,6 +388,7 @@ public class GridRestProcessor extends GridProcessorAdapter { if (interceptor != null && res.getResponse() != null) { switch (req.command()) { +case CACHE_CONTAINS_KEY: case CACHE_GET: case CACHE_GET_ALL: case CACHE_PUT: @@ -531,6 +532,7 @@ public class GridRestProcessor extends GridProcessorAdapter { switch (req.command()) { case CACHE_GET: +case CACHE_CONTAINS_KEY: case CACHE_GET_ALL: perm = SecurityPermission.CACHE_READ; name = ((GridRestCacheRequest)req).cacheName(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7bed77b3/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 1f24023..a4dc466 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -53,6 +53,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.*; public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { /** Supported commands. */ private static final Collection SUPPORTED_COMMANDS = U.sealList( +CACHE_CONTAINS_KEY, CACHE_GET, CACHE_GET_ALL, CACHE_PUT, @@ -69,6 +70,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { /** Requests with required parameter {@code key}. */ private static final EnumSet KEY_REQUIRED_REQUESTS = EnumSet.of( +
[5/8] incubator-ignite git commit: #ignite-964: add CACHE_GET_AND_REMOVE method for nodejs cache.
#ignite-964: add CACHE_GET_AND_REMOVE method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d7faab39 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d7faab39 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d7faab39 Branch: refs/heads/ignite-964 Commit: d7faab397726a472e7ff0a61e13dd3e937ee656f Parents: 16ff838 Author: ivasilinets Authored: Wed Jul 1 15:46:32 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 15:46:32 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 ++ .../processors/rest/GridRestProcessor.java | 1 + .../handlers/cache/GridCacheCommandHandler.java | 29 +++- modules/nodejs/src/main/js/cache.js | 13 + .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 + modules/nodejs/src/test/js/test-cache-api.js| 15 ++ .../http/jetty/GridJettyRestHandler.java| 3 +- 7 files changed, 69 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7faab39/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 5a11faf..4ded850 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -60,6 +60,9 @@ public enum GridRestCommand { /** Remove value from cache. */ CACHE_REMOVE("rmv"), +/** Remove value from cache. */ +CACHE_GET_AND_REMOVE("getandrmv"), + /** Remove several values from cache. */ CACHE_REMOVE_ALL("rmvall"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7faab39/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 14811f3..e477547 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -557,6 +557,7 @@ public class GridRestProcessor extends GridProcessorAdapter { case CACHE_REMOVE: case CACHE_REMOVE_ALL: +case CACHE_GET_AND_REMOVE: perm = SecurityPermission.CACHE_REMOVE; name = ((GridRestCacheRequest)req).cacheName(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d7faab39/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 798d151..ef14582 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -63,6 +63,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_ADD, CACHE_PUT_ALL, CACHE_REMOVE, +CACHE_GET_AND_REMOVE, CACHE_REMOVE_ALL, CACHE_REPLACE, CACHE_CAS, @@ -80,6 +81,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_PUT, CACHE_ADD, CACHE_REMOVE, +CACHE_GET_AND_REMOVE, CACHE_REPLACE, ATOMIC_INCREMENT, ATOMIC_DECREMENT, @@ -250,6 +252,13 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_GET_AND_REMOVE: { +fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key, +new GetAndRemoveCommand(key)); + +break; +} + case CACHE_REMOVE_ALL: { Map map = req0.values(); @@ -911,7 +920,7 @@ public
[6/8] incubator-ignite git commit: #ignite-964: add CACHE_PUT_IF_ABSENT method for nodejs cache.
#ignite-964: add CACHE_PUT_IF_ABSENT method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d44d7f20 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d44d7f20 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d44d7f20 Branch: refs/heads/ignite-964 Commit: d44d7f209e46d7dcf6b35b179016dfbfaf435993 Parents: d7faab3 Author: ivasilinets Authored: Wed Jul 1 15:52:29 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 15:52:29 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 ++ .../processors/rest/GridRestProcessor.java | 1 + .../handlers/cache/GridCacheCommandHandler.java | 34 modules/nodejs/src/main/js/cache.js | 14 .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 modules/nodejs/src/test/js/test-cache-api.js| 15 + .../http/jetty/GridJettyRestHandler.java| 4 ++- 7 files changed, 77 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d44d7f20/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 4ded850..b8f05bf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -51,6 +51,9 @@ public enum GridRestCommand { /** Store value in cache. */ CACHE_PUT("put"), +/** Store value in cache. */ +CACHE_PUT_IF_ABSENT("putifabsent"), + /** Store value in cache if it doesn't exist. */ CACHE_ADD("add"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d44d7f20/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index e477547..b524e92 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -550,6 +550,7 @@ public class GridRestProcessor extends GridProcessorAdapter { case CACHE_PREPEND: case CACHE_GET_AND_PUT: case CACHE_GET_AND_PUT_IF_ABSENT: +case CACHE_PUT_IF_ABSENT: perm = SecurityPermission.CACHE_PUT; name = ((GridRestCacheRequest)req).cacheName(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d44d7f20/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index ef14582..b5b59fc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -58,6 +58,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_GET, CACHE_GET_AND_PUT, CACHE_GET_AND_PUT_IF_ABSENT, +CACHE_PUT_IF_ABSENT, CACHE_GET_ALL, CACHE_PUT, CACHE_ADD, @@ -78,6 +79,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_GET, CACHE_GET_AND_PUT, CACHE_GET_AND_PUT_IF_ABSENT, +CACHE_PUT_IF_ABSENT, CACHE_PUT, CACHE_ADD, CACHE_REMOVE, @@ -191,6 +193,19 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_PUT_IF_ABSENT: { + +final Object val = req0.value(); + +if (val == null) +throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val")); + +fut = executeCommand(req.destinati
incubator-ignite git commit: #ignite-964: aff removeAllFromCache method for nodejs cache.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964 830f397d0 -> 5a8982fee #ignite-964: aff removeAllFromCache method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5a8982fe Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5a8982fe Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5a8982fe Branch: refs/heads/ignite-964 Commit: 5a8982fee9dce01e5495a1e257735c292ceeec96 Parents: 830f397 Author: ivasilinets Authored: Wed Jul 1 16:16:40 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 16:16:40 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 11 +++ .../apache/ignite/internal/NodeJsCacheApiSelfTest.java | 7 +++ modules/nodejs/src/test/js/test-cache-api.js | 8 3 files changed, 26 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a8982fe/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 57f1f79..c96b709 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -128,6 +128,17 @@ Cache.prototype.removeAll = function(keys, callback) { } /** + * Remove all cache keys + * + * @this {Cache} + * @param {noValue} callback Called on finish + */ +Cache.prototype.removeAllFromCache = function(callback) { +this._server.runCommand(this._createCommand("rmvall"), +callback); +} + +/** * Put keys to cache * * @this {Cache} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a8982fe/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java -- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java index 596c964..47e4f09 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java @@ -168,4 +168,11 @@ public class NodeJsCacheApiSelfTest extends NodeJsAbstractTest { public void testRemoveValue() throws Exception { runJsScript("testRemoveValue"); } + +/** + * @throws Exception If failed. + */ +public void testRemoveAllFromCache() throws Exception { +runJsScript("testRemoveAllFromCache"); +} } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a8982fe/modules/nodejs/src/test/js/test-cache-api.js -- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 77b1684..4766c9c 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -152,6 +152,14 @@ testGetAndRemove = function() { startTest("mycache", {trace: [put, getAndRemove, getNone], entry: ["key", "6"]}); } +testRemoveAllFromCache = function() { +function removeAllFromCache(cache, entry, next) { +cache.removeAllFromCache(next); +} + +startTest("mycache", {trace: [put, removeAllFromCache, getNone], entry: ["key", "6"]}); +} + function objectEntries() { entries = [];
[1/4] incubator-ignite git commit: #ignite-964: aff replace method for nodejs cache.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964 5a8982fee -> a7bb9ee4a #ignite-964: aff replace method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2496ac3c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2496ac3c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2496ac3c Branch: refs/heads/ignite-964 Commit: 2496ac3c9548a96ebb1bbd655fea969ef4bab93c Parents: 5a8982f Author: ivasilinets Authored: Wed Jul 1 16:41:22 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 16:41:22 2015 +0300 -- modules/nodejs/src/main/js/cache.js | 26 + .../ignite/internal/NodeJsCacheApiSelfTest.java | 21 +++ modules/nodejs/src/test/js/test-cache-api.js| 59 .../http/jetty/GridJettyRestHandler.java| 2 +- 4 files changed, 107 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2496ac3c/modules/nodejs/src/main/js/cache.js -- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index c96b709..bb48dfd 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -217,6 +217,32 @@ Cache.prototype.getAndPut = function(key, val, callback) { } /** + * replace cache value + * + * @this {Cache} + * @param {string} key Key + * @param {string} value Value + * @param {onGet} callback Called on finish + */ +Cache.prototype.replace = function(key, val, callback) { +this._server.runCommand(this._createCommand("rep"). +setPostData(JSON.stringify({"key" : key, "val" : val})), callback); +} + +/** + * Get and put cache value + * + * @this {Cache} + * @param {string} key Key + * @param {string} value Value + * @param {onGet} callback Called on finish + */ +Cache.prototype.getAndReplace = function(key, val, callback) { +this._server.runCommand(this._createCommand("getandreplace"). +setPostData(JSON.stringify({"key" : key, "val" : val})), callback); +} + +/** * Stores given key-value pair in cache only if cache had no previous mapping for it. * * @this {Cache} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2496ac3c/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java -- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java index 47e4f09..d5bf7ae 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java @@ -175,4 +175,25 @@ public class NodeJsCacheApiSelfTest extends NodeJsAbstractTest { public void testRemoveAllFromCache() throws Exception { runJsScript("testRemoveAllFromCache"); } + +/** + * @throws Exception If failed. + */ +public void testReplace() throws Exception { +runJsScript("testReplace"); +} + +/** + * @throws Exception If failed. + */ +public void testIncorrectReplaceObject() throws Exception { +runJsScript("testIncorrectReplaceObject"); +} + +/** + * @throws Exception If failed. + */ +public void testReplaceObject() throws Exception { +runJsScript("testReplaceObject"); +} } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2496ac3c/modules/nodejs/src/test/js/test-cache-api.js -- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 4766c9c..cca7e10 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -160,6 +160,65 @@ testRemoveAllFromCache = function() { startTest("mycache", {trace: [put, removeAllFromCache, getNone], entry: ["key", "6"]}); } +testReplace = function() { +function replace(cache, entry, next) { +cache.replace(entry[0], "7", onReplace.bind(null, cache)); + +function onReplace(cache, err, res) { +assert(err === null, "Get error on get and put [err=" + err + "]"); +assert(res === true, "Incorrect result for replace [expected=true, val" + res + "]"); + +cache.get(entry[0], function(err, res) { +assert(!err); +
[3/4] incubator-ignite git commit: #ignite-964: add CACHE_REPLACE_VALUE for nodejs cache.
#ignite-964: add CACHE_REPLACE_VALUE for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/13e78dac Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/13e78dac Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/13e78dac Branch: refs/heads/ignite-964 Commit: 13e78dacab1eb3eb9e4c49d0d51c6142c2f7834a Parents: cb366d4 Author: ivasilinets Authored: Wed Jul 1 16:56:13 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 16:56:13 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 ++ .../processors/rest/GridRestProcessor.java | 1 + .../handlers/cache/GridCacheCommandHandler.java | 33 modules/nodejs/src/main/js/cache.js | 18 +-- .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 + modules/nodejs/src/test/js/test-cache-api.js| 18 +++ .../http/jetty/GridJettyRestHandler.java| 4 ++- 7 files changed, 81 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/13e78dac/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 3887b4e..90d7dc2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -76,6 +76,9 @@ public enum GridRestCommand { CACHE_REPLACE("rep"), /** Replace cache value only if there is currently a mapping for it. */ +CACHE_REPLACE_VALUE("repval"), + +/** Replace cache value only if there is currently a mapping for it. */ CACHE_GET_AND_REPLACE("getandreplace"), /** Compare and set. */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/13e78dac/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 3eca643..c3c9871 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -552,6 +552,7 @@ public class GridRestProcessor extends GridProcessorAdapter { case CACHE_GET_AND_REPLACE: case CACHE_GET_AND_PUT_IF_ABSENT: case CACHE_PUT_IF_ABSENT: +case CACHE_REPLACE_VALUE: perm = SecurityPermission.CACHE_PUT; name = ((GridRestCacheRequest)req).cacheName(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/13e78dac/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 5631d87..87a87e3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -66,6 +66,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_PUT_ALL, CACHE_REMOVE, CACHE_REMOVE_VALUE, +CACHE_REPLACE_VALUE, CACHE_GET_AND_REMOVE, CACHE_REMOVE_ALL, CACHE_REPLACE, @@ -87,6 +88,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_ADD, CACHE_REMOVE, CACHE_REMOVE_VALUE, +CACHE_REPLACE_VALUE, CACHE_GET_AND_REMOVE, CACHE_REPLACE, ATOMIC_INCREMENT, @@ -259,6 +261,13 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_REPLACE_VALUE: { +fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key, +new ReplaceValueCommand(key
incubator-ignite git commit: #ignite-964: add SIZE for nodejs cache.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964 a7bb9ee4a -> 43d8cd3c6 #ignite-964: add SIZE for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/43d8cd3c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/43d8cd3c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/43d8cd3c Branch: refs/heads/ignite-964 Commit: 43d8cd3c686b5a15fb9da0f9bdedeaa23f5fdfb2 Parents: a7bb9ee Author: ivasilinets Authored: Wed Jul 1 17:08:54 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 17:08:54 2015 +0300 -- modules/nodejs/src/test/js/test-cache-api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43d8cd3c/modules/nodejs/src/test/js/test-cache-api.js -- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 3d3dad8..c3a2f9e 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -269,7 +269,7 @@ testSize = function() { cache.size(onSize.bind(null, 0, next, cache)); } - function size1(cache, entry, next) { +function size1(cache, entry, next) { cache.size(onSize.bind(null, 1, next, cache)); }
[2/4] incubator-ignite git commit: #ignite-964: add CACHE_GET_AND_REPLACE for nodejs cache.
#ignite-964: add CACHE_GET_AND_REPLACE for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cb366d43 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cb366d43 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cb366d43 Branch: refs/heads/ignite-964 Commit: cb366d43cb1a1be7cc21240d44875f3ca48b786c Parents: 2496ac3 Author: ivasilinets Authored: Wed Jul 1 16:46:08 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 16:46:08 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 +++ .../processors/rest/GridRestProcessor.java | 1 + .../handlers/cache/GridCacheCommandHandler.java | 28 .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 + modules/nodejs/src/test/js/test-cache-api.js| 18 + .../http/jetty/GridJettyRestHandler.java| 7 +++-- 6 files changed, 62 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb366d43/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 86237b8..3887b4e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -75,6 +75,9 @@ public enum GridRestCommand { /** Replace cache value only if there is currently a mapping for it. */ CACHE_REPLACE("rep"), +/** Replace cache value only if there is currently a mapping for it. */ +CACHE_GET_AND_REPLACE("getandreplace"), + /** Compare and set. */ CACHE_CAS("cas"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb366d43/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index a19fde7..3eca643 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -549,6 +549,7 @@ public class GridRestProcessor extends GridProcessorAdapter { case CACHE_APPEND: case CACHE_PREPEND: case CACHE_GET_AND_PUT: +case CACHE_GET_AND_REPLACE: case CACHE_GET_AND_PUT_IF_ABSENT: case CACHE_PUT_IF_ABSENT: perm = SecurityPermission.CACHE_PUT; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb366d43/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 6db6c23..5631d87 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -57,6 +57,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_CONTAINS_KEY, CACHE_GET, CACHE_GET_AND_PUT, +CACHE_GET_AND_REPLACE, CACHE_GET_AND_PUT_IF_ABSENT, CACHE_PUT_IF_ABSENT, CACHE_GET_ALL, @@ -79,6 +80,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_CONTAINS_KEY, CACHE_GET, CACHE_GET_AND_PUT, +CACHE_GET_AND_REPLACE, CACHE_GET_AND_PUT_IF_ABSENT, CACHE_PUT_IF_ABSENT, CACHE_PUT, @@ -178,6 +180,13 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_GET_AND_REPLACE: { +fut = executeCommand(req.destinationId(), req.clientId(), cacheName, skipStore, key, +new GetAndReplaceCommand(key, getValue(req0))); + +break; +
[4/4] incubator-ignite git commit: #ignite-964: add SIZE for nodejs cache.
#ignite-964: add SIZE for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a7bb9ee4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a7bb9ee4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a7bb9ee4 Branch: refs/heads/ignite-964 Commit: a7bb9ee4a875b5ca6c928a47282e7104498ee8e2 Parents: 13e78da Author: ivasilinets Authored: Wed Jul 1 17:08:41 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 17:08:41 2015 +0300 -- .../processors/rest/GridRestCommand.java| 3 ++ .../processors/rest/GridRestProcessor.java | 1 + .../handlers/cache/GridCacheCommandHandler.java | 20 +++- modules/nodejs/src/main/js/cache.js | 8 + .../ignite/internal/NodeJsCacheApiSelfTest.java | 7 modules/nodejs/src/test/js/test-cache-api.js| 34 +--- .../http/jetty/GridJettyRestHandler.java| 1 + 7 files changed, 68 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a7bb9ee4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index 90d7dc2..81fb7f5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -93,6 +93,9 @@ public enum GridRestCommand { /** Cache metrics. */ CACHE_METRICS("cache"), +/** Cache size. */ +CACHE_SIZE("cachesize"), + /** Increment. */ ATOMIC_INCREMENT("incr"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a7bb9ee4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index c3c9871..c8cb25a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -575,6 +575,7 @@ public class GridRestProcessor extends GridProcessorAdapter { break; case CACHE_METRICS: +case CACHE_SIZE: case TOPOLOGY: case NODE: case VERSION: http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a7bb9ee4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 87a87e3..26140f3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -73,7 +73,8 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_CAS, CACHE_APPEND, CACHE_PREPEND, -CACHE_METRICS +CACHE_METRICS, +CACHE_SIZE ); /** Requests with required parameter {@code key}. */ @@ -329,6 +330,12 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { break; } +case CACHE_SIZE: { +fut = executeCommand(req.destinationId(), req.clientId(), cacheName, key, new SizeCommand()); + +break; +} + default: throw new IllegalArgumentException("Invalid command for cache handler: " + req); } @@ -1304,4 +1311,15 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { ); } } + +/** */ +private static class SizeCommand extends CacheCommand { +/** */ +private static final long serialVersionUID = 0L; + +/** {@inheritDoc} */ +@Override public IgniteInternalFuture applyx(IgniteInternalCache c, Grid
incubator-ignite git commit: #ignite-964: compute should be able to work with cache.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 [created] fb65fa1ef #ignite-964: compute should be able to work with cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fb65fa1e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fb65fa1e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fb65fa1e Branch: refs/heads/ignite-964-1 Commit: fb65fa1efbc219239ce58deb39cb65551f2a2b8c Parents: 43d8cd3 Author: ivasilinets Authored: Wed Jul 1 19:38:03 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 19:38:03 2015 +0300 -- .../ignite/internal/NodeJsComputeSelfTest.java | 14 +++ modules/nodejs/src/test/js/test-compute.js | 97 +++- 2 files changed, 110 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fb65fa1e/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java -- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java index 3a00231..a9ff998 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java @@ -83,6 +83,20 @@ public class NodeJsComputeSelfTest extends NodeJsAbstractTest { /** * @throws Exception If failed. */ +public void testComputeCacheSizeExecute() throws Exception { +runJsScript("testComputeCacheSizeExecute"); +} + +/** + * @throws Exception If failed. + */ +public void testComputeCacheExecute() throws Exception { +runJsScript("testComputeCacheExecute"); +} + +/** + * @throws Exception If failed. + */ public void testRestartGrid() throws Exception { final AtomicInteger id = new AtomicInteger(2); IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Callable() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fb65fa1e/modules/nodejs/src/test/js/test-compute.js -- diff --git a/modules/nodejs/src/test/js/test-compute.js b/modules/nodejs/src/test/js/test-compute.js index 943ab02..b7ac463 100644 --- a/modules/nodejs/src/test/js/test-compute.js +++ b/modules/nodejs/src/test/js/test-compute.js @@ -17,6 +17,9 @@ var TestUtils = require("./test-utils").TestUtils; +var Ignite = require(TestUtils.scriptPath()); +var Entry = Ignite.Entry; + var assert = require("assert"); testComputeRunScript = function() { @@ -31,6 +34,14 @@ testComputeAllNodeExecute = function() { TestUtils.startIgniteNode(computeAllNodeExecute); } +testComputeCacheSizeExecute = function() { +TestUtils.startIgniteNode(computeCacheSizeExecute); +} + +testComputeCacheExecute = function() { +TestUtils.startIgniteNode(computeCacheExecute); +} + function onStart(onPut, error, ignite) { var cache = ignite.cache("mycache"); @@ -80,7 +91,7 @@ function computeExecute(error, ignite) { var sum = 0; for (var i = 0; i < results.length; ++i) { -sum += parseInt(results[i], 10); +sum += JSON.parse(results[i]); } return sum; @@ -119,6 +130,90 @@ function computeAllNodeExecute(error, ignite) { ignite.compute().execute(map, reduce, "", callback); } +function computeCacheExecute(error, ignite) { +var map = function(nodes, args) { +for (var i = 0; i < nodes.length; i++) { +var f = function (args1) { +println("!!!arg" + args1 + " JSON" + JSON.stringify(args1)); +var o = ignite.cache("mycache").get(args1[0]); +println("!!!o" + o + " JSON" + JSON.stringify(o)); +return o; +}; + +emit(f, args, nodes[i]); +} +}; + +var reduce = function(results) { +println("!!results=" + results); +var exp = {"age" : 12, "books" : ["1", "Book"]}; + +for (var i = 0; i < results.length; i++) { +var val = JSON.parse(results[i]); + +println("Incorrect value [exp=" + JSON.stringify(exp) + ", val=" + JSON.stringify(val) + "]"); +} + +return sum; +}; + +var callback = function(err, res) { +assert(err == null, "Get error on compute task
incubator-ignite git commit: #ignite-964: wip
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 fb65fa1ef -> 584adbc1a #ignite-964: wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/584adbc1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/584adbc1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/584adbc1 Branch: refs/heads/ignite-964-1 Commit: 584adbc1a21692c801889b88a8d34a8cb531756b Parents: fb65fa1 Author: ivasilinets Authored: Wed Jul 1 23:48:33 2015 +0300 Committer: ivasilinets Committed: Wed Jul 1 23:48:33 2015 +0300 -- .../scripting/IgniteScriptProcessor.java| 3 +- modules/nodejs/src/main/js/compute.js | 8 +++--- modules/nodejs/src/test/js/test-compute.js | 29 ++-- .../http/jetty/GridJettyRestHandler.java| 9 -- 4 files changed, 34 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/584adbc1/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java index e82da91..247421f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java @@ -57,7 +57,7 @@ public class IgniteScriptProcessor extends GridProcessorAdapter { String createJSFunction = "function __createJSFunction(mapFunc) {" + "return eval('(function() { return ' + mapFunc.trim() + '})()'); }"; -String internalCall = "function __internalCall(funcSource, arg1, arg2) { " + +String internalCall = "function __internalCall(funcSource, arg1, arg2) { " + "var func = __createJSFunction(funcSource); " + "return func.apply(null, [arg1, arg2]); }"; @@ -127,6 +127,7 @@ public class IgniteScriptProcessor extends GridProcessorAdapter { public Object invokeFunction(String src, Object arg, Object arg2) throws IgniteCheckedException { try { Invocable invocable = (Invocable) jsEngine; + return invocable.invokeFunction("__internalCall", src, arg, arg2); } catch (ScriptException e) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/584adbc1/modules/nodejs/src/main/js/compute.js -- diff --git a/modules/nodejs/src/main/js/compute.js b/modules/nodejs/src/main/js/compute.js index 830ba85..7f56e1c 100644 --- a/modules/nodejs/src/main/js/compute.js +++ b/modules/nodejs/src/main/js/compute.js @@ -34,7 +34,8 @@ function Compute(server) { * @param {onGet} callback Callback */ Compute.prototype.runScript = function(runnable, args, callback) { -this._server.runCommand(new Command("runscript").addParam("func", runnable).addParam("arg", args), callback); +this._server.runCommand(new Command("runscript").addParam("func", runnable). +setPostData(JSON.stringify({"arg" : args})), callback); } /** @@ -47,9 +48,8 @@ Compute.prototype.runScript = function(runnable, args, callback) { Compute.prototype.execute = function(map, reduce, arg, callback) { var command = new Command("excmapreduce"); -command.addParam("map", map); -command.addParam("reduce", reduce); -command.addParam("arg", arg); +command.addParam("map", map).addParam("reduce", reduce); +command.setPostData(JSON.stringify({"arg" : arg})); this._server.runCommand(command, callback); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/584adbc1/modules/nodejs/src/test/js/test-compute.js -- diff --git a/modules/nodejs/src/test/js/test-compute.js b/modules/nodejs/src/test/js/test-compute.js index b7ac463..9fd813b 100644 --- a/modules/nodejs/src/test/js/test-compute.js +++ b/modules/nodejs/src/test/js/test-compute.js @@ -91,7 +91,7 @@ function computeExecute(error, ignite) { var sum = 0; for (var i = 0; i < results.length; ++i) { -sum += JSON.parse(results[i]); +sum += results[i].intValue(); } return sum; @@ -134,9 +134,15 @@ function computeCacheExecute
incubator-ignite git commit: #ignite-964: wip
Repository: incubator-ignite Updated Branches: refs/heads/ignite-964-1 584adbc1a -> 1572a3a0a #ignite-964: wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1572a3a0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1572a3a0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1572a3a0 Branch: refs/heads/ignite-964-1 Commit: 1572a3a0a3529b0dd55879f33e4afba96ddce6ce Parents: 584adbc Author: ivasilinets Authored: Thu Jul 2 00:53:40 2015 +0300 Committer: ivasilinets Committed: Thu Jul 2 00:53:40 2015 +0300 -- .../IgniteScriptingCommandHandler.java | 3 +- .../scripting/IgniteScriptProcessor.java| 31 modules/nodejs/src/test/js/test-compute.js | 21 + .../http/jetty/GridJettyRestHandler.java| 2 +- 4 files changed, 49 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1572a3a0/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java index 2d65016..68908f4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.rest.handlers.scripting; +import net.sf.json.*; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.compute.*; @@ -174,7 +175,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter data[i] = results.get(i).getData(); } -return ctx.scripting().invokeFunction(reduceFunc, data); +return ctx.scripting().invokeJSFunction(reduceFunc, JSONSerializer.toJSON(data), null); } catch (IgniteCheckedException e) { throw U.convertException(e); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1572a3a0/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java index 247421f..6248695 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptProcessor.java @@ -61,8 +61,14 @@ public class IgniteScriptProcessor extends GridProcessorAdapter { "var func = __createJSFunction(funcSource); " + "return func.apply(null, [arg1, arg2]); }"; +String internalJSCall = "function __internalJSCall(funcSource, arg1, arg2) { " + +"var func = __createJSFunction(funcSource); " + +"println('INIT arg=' + arg1);"+ +"return func.apply(null, [JSON.parse(arg1), arg2]); }"; + addEngineFunction(createJSFunction); addEngineFunction(internalCall); +addEngineFunction(internalJSCall); } /** @@ -137,4 +143,29 @@ public class IgniteScriptProcessor extends GridProcessorAdapter { throw new IgniteCheckedException("Cannot find function [func=__internalCall]."); } } + +/** + * @param src Script src. + * @param arg Argument. + * @return Result of the function. + * @throws IgniteCheckedException If script failed. + */ +public Object invokeJSFunction(String src, Object arg, Object arg2) throws IgniteCheckedException { +try { +Invocable invocable = (Invocable) jsEngine; +if (arg != null && arg2 != null) +return invocable.invokeFunction("__internalJSCall", src, arg.toString(), arg2.toString()); +if (arg != null && arg2 == null) +return invocable.invokeFunction("__internalJSCall", src, arg.toString(), arg2); + +return invocable.invokeFunction("__intern
incubator-ignite git commit: #ignite-sberb-34: debug info.
Repository: incubator-ignite Updated Branches: refs/heads/ignite-sberb-34 [created] 9b7b96635 #ignite-sberb-34: debug info. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9b7b9663 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9b7b9663 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9b7b9663 Branch: refs/heads/ignite-sberb-34 Commit: 9b7b966350c37cb27037c9ec7c3e35f6ce8c4958 Parents: da6ff64 Author: ivasilinets Authored: Thu Jul 2 13:31:20 2015 +0300 Committer: ivasilinets Committed: Thu Jul 2 13:31:20 2015 +0300 -- .../main/java/org/apache/ignite/internal/util/IgniteUtils.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9b7b9663/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index f457d6c..96af8aa 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -8048,9 +8048,13 @@ public abstract class IgniteUtils { public static String consistentId(Collection addrs, int port) { assert !F.isEmpty(addrs); +List sortAddrs = new ArrayList(addrs); + +Collections.sort(sortAddrs); + StringBuilder sb = new StringBuilder(); -for (String addr : addrs) +for (String addr : sortAddrs) sb.append(addr).append(','); sb.delete(sb.length() - 1, sb.length());
[2/2] incubator-ignite git commit: #ignite-sberb-34: debug info.
#ignite-sberb-34: debug info. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/648e2a87 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/648e2a87 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/648e2a87 Branch: refs/heads/sberb-34 Commit: 648e2a87d362e4a50fc58f8460747a5c9422fb57 Parents: fb6e8f9 Author: ivasilinets Authored: Thu Jul 2 13:31:20 2015 +0300 Committer: ivasilinets Committed: Thu Jul 2 14:22:47 2015 +0300 -- .../main/java/org/apache/ignite/internal/util/IgniteUtils.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/648e2a87/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java -- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 6623e85..03779af 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -8048,9 +8048,13 @@ public abstract class IgniteUtils { public static String consistentId(Collection addrs, int port) { assert !F.isEmpty(addrs); +List sortAddrs = new ArrayList(addrs); + +Collections.sort(sortAddrs); + StringBuilder sb = new StringBuilder(); -for (String addr : addrs) +for (String addr : sortAddrs) sb.append(addr).append(','); sb.delete(sb.length() - 1, sb.length());