You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by yz...@apache.org on 2017/02/16 17:36:02 UTC
[01/50] [abbrv] ignite git commit: Minor fixes in tests.
Repository: ignite
Updated Branches:
refs/heads/ignite-comm-balance-master c57d72eea -> fb5ef696b
Minor fixes in tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2305e383
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2305e383
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2305e383
Branch: refs/heads/ignite-comm-balance-master
Commit: 2305e38345d8a7ca812d265d00eaca5bb7d6adb1
Parents: 2eb24ca
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Wed Jan 18 14:57:53 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Wed Jan 18 14:57:53 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheAbstractQuerySelfTest.java | 4 ++--
...IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java | 3 ++-
...teCacheQueryStopOnCancelOrTimeoutDistributedJoinSelfTest.java | 3 ++-
3 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2305e383/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index c5a241e..9f56877 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -642,7 +642,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
return null;
}
- }, IgniteException.class, null);
+ }, CacheException.class, null);
}
/**
@@ -688,7 +688,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
return null;
}
- }, IgniteException.class, null);
+ }, CacheException.class, null);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/2305e383/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
index 80c4a08..50fb034 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.cache.query.QueryCancelledException;
+import org.apache.ignite.internal.processors.GridProcessor;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -244,7 +245,7 @@ public class IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest extends Gr
IgniteEx grid = grid(i);
// Validate everything was cleaned up.
- ConcurrentMap<UUID, ?> map = U.field(((IgniteH2Indexing)U.field(U.field(
+ ConcurrentMap<UUID, ?> map = U.field(((IgniteH2Indexing)U.field((GridProcessor)U.field(
grid.context(), "qryProc"), "idx")).mapQueryExecutor(), "qryRess");
String msg = "Map executor state is not cleared";
http://git-wip-us.apache.org/repos/asf/ignite/blob/2305e383/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryStopOnCancelOrTimeoutDistributedJoinSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryStopOnCancelOrTimeoutDistributedJoinSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryStopOnCancelOrTimeoutDistributedJoinSelfTest.java
index 4baaf8f..3263b41 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryStopOnCancelOrTimeoutDistributedJoinSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryStopOnCancelOrTimeoutDistributedJoinSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.GridProcessor;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -122,7 +123,7 @@ public class IgniteCacheQueryStopOnCancelOrTimeoutDistributedJoinSelfTest extend
IgniteEx grid = grid(i);
// Validate everything was cleaned up.
- ConcurrentMap<UUID, ?> map = U.field(((IgniteH2Indexing) U.field(U.field(
+ ConcurrentMap<UUID, ?> map = U.field(((IgniteH2Indexing)U.field((GridProcessor)U.field(
grid.context(), "qryProc"), "idx")).mapQueryExecutor(), "qryRess");
String msg = "Map executor state is not cleared";
[20/50] [abbrv] ignite git commit: New benchmark for putting values
with primitive fields only.
Posted by yz...@apache.org.
New benchmark for putting values with primitive fields only.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1c3ddaf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1c3ddaf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1c3ddaf
Branch: refs/heads/ignite-comm-balance-master
Commit: e1c3ddaf6238545ade73cd5e0627584e16e8ddf1
Parents: 4a62232
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Thu Feb 9 16:40:50 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Feb 9 17:50:35 2017 +0300
----------------------------------------------------------------------
.../cache/IgnitePutValue8Benchmark.java | 42 ++++++++++++++++++++
1 file changed, 42 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1c3ddaf/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutValue8Benchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutValue8Benchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutValue8Benchmark.java
new file mode 100644
index 0000000..6a3d492
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutValue8Benchmark.java
@@ -0,0 +1,42 @@
+/*
+ * 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.yardstick.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.yardstick.cache.model.Person8;
+
+import java.util.Map;
+
+/**
+ * Ignite benchmark that performs put operations for entity with primitive fields.
+ */
+public class IgnitePutValue8Benchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new Person8(key));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic");
+ }
+}
[13/50] [abbrv] ignite git commit: IGNITE-4619 .NET: TransactionScope
example
Posted by yz...@apache.org.
IGNITE-4619 .NET: TransactionScope example
This closes #1492
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e6cc8cda
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e6cc8cda
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e6cc8cda
Branch: refs/heads/ignite-comm-balance-master
Commit: e6cc8cdab85c96d7a2088d3a5267f3f42039601b
Parents: 26ee9c2
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Feb 8 13:15:08 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Feb 8 13:15:08 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Examples.csproj | 1 +
.../Datagrid/TransactionExample.cs | 75 +++++++++++++++-----
2 files changed, 59 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6cc8cda/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
index ebf9e92..c3ea378 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
@@ -49,6 +49,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
+ <Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
<Compile Include="Compute\ClosureExample.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6cc8cda/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs
index f90cf96..83d08ff 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs
@@ -18,7 +18,9 @@
namespace Apache.Ignite.Examples.Datagrid
{
using System;
+ using System.Transactions;
using Apache.Ignite.Core;
+ using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Transactions;
using Apache.Ignite.ExamplesDll.Binary;
@@ -59,18 +61,9 @@ namespace Apache.Ignite.Examples.Datagrid
AtomicityMode = CacheAtomicityMode.Transactional
});
- // Clean up caches on all nodes before run.
- cache.Clear();
+ InitAccounts(cache);
- // Initialize.
- cache.Put(1, new Account(1, 100));
- cache.Put(2, new Account(2, 200));
-
- Console.WriteLine();
- Console.WriteLine(">>> Accounts before transfer: ");
- Console.WriteLine(">>> " + cache.Get(1));
- Console.WriteLine(">>> " + cache.Get(2));
- Console.WriteLine();
+ Console.WriteLine("\n>>> Transferring with Ignite transaction API...");
// Transfer money between accounts in a single transaction.
using (var tx = cache.Ignite.GetTransactions().TxStart(TransactionConcurrency.Pessimistic,
@@ -88,18 +81,66 @@ namespace Apache.Ignite.Examples.Datagrid
tx.Commit();
}
- Console.WriteLine(">>> Transfer finished.");
+ DisplayAccounts(cache);
- Console.WriteLine();
- Console.WriteLine(">>> Accounts after transfer: ");
- Console.WriteLine(">>> " + cache.Get(1));
- Console.WriteLine(">>> " + cache.Get(2));
- Console.WriteLine();
+ InitAccounts(cache);
+
+ Console.WriteLine("\n>>> Transferring with TransactionScope API...");
+
+ // Do the same transaction with TransactionScope API.
+ using (var ts = new TransactionScope())
+ {
+ Account acc1 = cache.Get(1);
+ Account acc2 = cache.Get(2);
+
+ acc1.Balance += 100;
+ acc2.Balance -= 100;
+
+ cache.Put(1, acc1);
+ cache.Put(2, acc2);
+
+ ts.Complete();
+ }
+
+ DisplayAccounts(cache);
}
Console.WriteLine();
Console.WriteLine(">>> Example finished, press any key to exit ...");
Console.ReadKey();
}
+
+ /// <summary>
+ /// Displays accounts.
+ /// </summary>
+ private static void DisplayAccounts(ICache<int, Account> cache)
+ {
+ Console.WriteLine(">>> Transfer finished.");
+
+ Console.WriteLine();
+ Console.WriteLine(">>> Accounts after transfer: ");
+ Console.WriteLine(">>> " + cache.Get(1));
+ Console.WriteLine(">>> " + cache.Get(2));
+ Console.WriteLine();
+ }
+
+ /// <summary>
+ /// Initializes account balance.
+ /// </summary>
+ private static void InitAccounts(ICache<int, Account> cache)
+ {
+ // Clean up caches on all nodes before run.
+ cache.Clear();
+
+ // Initialize.
+ cache.Put(1, new Account(1, 100));
+ cache.Put(2, new Account(2, 200));
+
+ Console.WriteLine();
+ Console.WriteLine(">>> Accounts before transfer: ");
+ Console.WriteLine(">>> " + cache.Get(1));
+ Console.WriteLine(">>> " + cache.Get(2));
+ Console.WriteLine();
+ }
}
}
[45/50] [abbrv] ignite git commit: IGNITE-4159: fixing logging
Posted by yz...@apache.org.
IGNITE-4159: fixing logging
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/06908d29
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/06908d29
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/06908d29
Branch: refs/heads/ignite-comm-balance-master
Commit: 06908d29e0f2687fc31885f7fae5e436801a2c11
Parents: ee832e4
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Feb 15 20:37:26 2017 -0800
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Feb 15 20:37:26 2017 -0800
----------------------------------------------------------------------
.../ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/06908d29/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
index f312195..53b6df6 100644
--- a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
+++ b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
@@ -137,7 +137,8 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
Collection<InetSocketAddress> addrs = new ArrayList<>();
try {
- log.debug("Getting Apache Ignite endpoints from: " + url);
+ if (log.isDebugEnabled())
+ log.debug("Getting Apache Ignite endpoints from: " + url);
HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
@@ -159,7 +160,8 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
for (Address address : subset.addresses) {
addrs.add(new InetSocketAddress(address.ip, 0));
- log.debug("Added an address to the list: " + address.ip);
+ if (log.isDebugEnabled())
+ log.debug("Added an address to the list: " + address.ip);
}
}
}
[34/50] [abbrv] ignite git commit: Pinned dependencies versions
Posted by yz...@apache.org.
Pinned dependencies versions
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0bdcfb02
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0bdcfb02
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0bdcfb02
Branch: refs/heads/ignite-comm-balance-master
Commit: 0bdcfb022b6755b082d7f0240934c83a07f0bf50
Parents: 37c0a22
Author: Andrey Novikov <an...@gridgain.com>
Authored: Tue Feb 14 11:16:23 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Tue Feb 14 11:16:23 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/package.json | 182 ++++++++++++-------------
1 file changed, 91 insertions(+), 91 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0bdcfb02/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index 651f496..0fde6d4 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -29,100 +29,100 @@
"win32"
],
"dependencies": {
- "angular": "~1.5.9",
- "angular-acl": "~0.1.7",
- "angular-animate": "~1.5.9",
- "angular-aria": "~1.5.9",
- "angular-cookies": "~1.5.9",
- "angular-drag-and-drop-lists": "~1.4.0",
- "angular-gridster": "~0.13.3",
- "angular-motion": "~0.4.4",
- "angular-nvd3": "~1.0.9",
- "angular-retina": "~0.3.13",
- "angular-sanitize": "~1.5.9",
- "angular-smart-table": "~2.1.8",
- "angular-socket-io": "~0.7.0",
- "angular-strap": "~2.3.8",
- "angular-touch": "~1.5.9",
- "angular-translate": "~2.13.1",
- "angular-tree-control": "~0.2.26",
- "angular-ui-grid": "~4.0.0",
- "angular-ui-router": "~0.3.1",
- "bootstrap-sass": "~3.3.6",
- "brace": "~0.8.0",
- "es6-promise": "~3.3.1",
- "file-saver": "~1.3.2",
- "font-awesome": "~4.7.0",
- "glob": "~7.1.1",
- "jquery": "~3.1.1",
- "jszip": "~3.1.3",
- "lodash": "~4.17.2",
+ "angular": "1.5.11",
+ "angular-acl": "0.1.7",
+ "angular-animate": "1.5.11",
+ "angular-aria": "1.5.11",
+ "angular-cookies": "1.5.11",
+ "angular-drag-and-drop-lists": "1.4.0",
+ "angular-gridster": "0.13.4",
+ "angular-motion": "0.4.4",
+ "angular-nvd3": "1.0.9",
+ "angular-retina": "0.4.0",
+ "angular-sanitize": "1.5.11",
+ "angular-smart-table": "2.1.8",
+ "angular-socket-io": "0.7.0",
+ "angular-strap": "2.3.12",
+ "angular-touch": "1.5.11",
+ "angular-translate": "2.14.0",
+ "angular-tree-control": "0.2.28",
+ "angular-ui-grid": "4.0.2",
+ "angular-ui-router": "0.4.2",
+ "bootstrap-sass": "3.3.7",
+ "brace": "0.8.0",
+ "es6-promise": "3.3.1",
+ "file-saver": "1.3.3",
+ "font-awesome": "4.7.0",
+ "glob": "7.1.1",
+ "jquery": "3.1.1",
+ "jszip": "3.1.3",
+ "lodash": "4.17.4",
"nvd3": "1.8.4",
- "raleway-webfont": "~3.0.1",
- "roboto-font": "~0.1.0",
- "socket.io-client": "~1.7.2",
- "ui-router-metatags": "~1.0.3"
+ "raleway-webfont": "3.0.1",
+ "roboto-font": "0.1.0",
+ "socket.io-client": "1.7.2",
+ "ui-router-metatags": "1.0.3"
},
"devDependencies": {
- "assets-webpack-plugin": "~3.5.0",
- "autoprefixer-core": "~6.0.1",
- "babel-core": "~6.20.0",
- "babel-eslint": "~7.0.0",
- "babel-loader": "~6.2.4",
- "babel-plugin-add-module-exports": "~0.2.1",
- "babel-plugin-transform-builtin-extend": "~1.1.0",
- "babel-plugin-transform-runtime": "~6.15.0",
- "babel-polyfill": "~6.20.0",
- "babel-preset-angular": "~6.0.15",
- "babel-preset-es2015": "~6.18.0",
- "babel-runtime": "~6.20.0",
- "chai": "~3.5.0",
- "cross-env": "~1.0.7",
- "css-loader": "~0.23.0",
- "eslint": "~3.12.2",
- "eslint-friendly-formatter": "~2.0.5",
- "eslint-loader": "~1.6.1",
- "expose-loader": "~0.7.1",
- "extract-text-webpack-plugin": "~1.0.1",
- "file-loader": "~0.9.0",
- "gulp": "~3.9.1",
- "gulp-eslint": "~3.0.0",
- "gulp-inject": "~4.1.0",
- "gulp-jade": "~1.1.0",
- "gulp-ll": "~1.0.4",
- "gulp-rimraf": "~0.2.0",
- "gulp-sequence": "~0.4.1",
- "gulp-util": "~3.0.7",
- "html-loader": "~0.4.3",
- "html-webpack-plugin": "~2.24.1",
- "jade": "~1.11.0",
+ "assets-webpack-plugin": "3.5.1",
+ "autoprefixer-core": "6.0.1",
+ "babel-core": "6.23.1",
+ "babel-eslint": "7.1.1",
+ "babel-loader": "6.2.10",
+ "babel-plugin-add-module-exports": "0.2.1",
+ "babel-plugin-transform-builtin-extend": "1.1.2",
+ "babel-plugin-transform-runtime": "6.23.0",
+ "babel-polyfill": "6.23.0",
+ "babel-preset-angular": "6.0.15",
+ "babel-preset-es2015": "6.22.0",
+ "babel-runtime": "6.22.0",
+ "chai": "3.5.0",
+ "cross-env": "1.0.8",
+ "css-loader": "0.26.1",
+ "eslint": "3.12.2",
+ "eslint-friendly-formatter": "2.0.7",
+ "eslint-loader": "1.6.1",
+ "expose-loader": "0.7.1",
+ "extract-text-webpack-plugin": "1.0.1",
+ "file-loader": "0.9.0",
+ "gulp": "3.9.1",
+ "gulp-eslint": "3.0.1",
+ "gulp-inject": "4.1.0",
+ "gulp-jade": "1.1.0",
+ "gulp-ll": "1.0.4",
+ "gulp-rimraf": "0.2.1",
+ "gulp-sequence": "0.4.6",
+ "gulp-util": "3.0.8",
+ "html-loader": "0.4.4",
+ "html-webpack-plugin": "2.24.1",
+ "jade": "1.11.0",
"jade-html-loader": "git://github.com/courcelan/jade-html-loader",
- "jasmine-core": "~2.5.2",
- "json-loader": "~0.5.4",
- "karma": "~0.13.22",
- "karma-babel-preprocessor": "~6.0.1",
- "karma-jasmine": "~1.1.0",
- "karma-mocha": "~1.3.0",
- "karma-mocha-reporter": "~2.2.0",
- "karma-phantomjs-launcher": "~1.0.0",
- "karma-teamcity-reporter": "~1.0.0",
- "karma-webpack": "~1.8.0",
- "mocha": "~2.5.3",
- "mocha-teamcity-reporter": "~1.1.1",
- "morgan": "~1.7.0",
- "ngtemplate-loader": "~1.3.1",
- "node-sass": "~3.13.1",
- "phantomjs-prebuilt": "~2.1.7",
- "postcss-loader": "~0.9.1",
- "progress-bar-webpack-plugin": "~1.9.0",
- "require-dir": "~0.3.0",
- "resolve-url-loader": "~1.6.1",
- "sass-loader": "~3.1.1",
- "style-loader": "~0.13.1",
- "url": "~0.11.0",
- "url-loader": "~0.5.6",
- "webpack": "~1.14.0",
- "webpack-dev-server": "~1.16.2",
- "worker-loader": "~0.7.1"
+ "jasmine-core": "2.5.2",
+ "json-loader": "0.5.4",
+ "karma": "0.13.22",
+ "karma-babel-preprocessor": "6.0.1",
+ "karma-jasmine": "1.1.0",
+ "karma-mocha": "1.3.0",
+ "karma-mocha-reporter": "2.2.2",
+ "karma-phantomjs-launcher": "1.0.2",
+ "karma-teamcity-reporter": "1.0.0",
+ "karma-webpack": "1.8.1",
+ "mocha": "2.5.3",
+ "mocha-teamcity-reporter": "1.1.1",
+ "morgan": "1.7.0",
+ "ngtemplate-loader": "1.3.1",
+ "node-sass": "3.13.1",
+ "phantomjs-prebuilt": "2.1.14",
+ "postcss-loader": "0.9.1",
+ "progress-bar-webpack-plugin": "1.9.3",
+ "require-dir": "0.3.1",
+ "resolve-url-loader": "1.6.1",
+ "sass-loader": "3.2.2",
+ "style-loader": "0.13.1",
+ "url": "0.11.0",
+ "url-loader": "0.5.7",
+ "webpack": "1.14.0",
+ "webpack-dev-server": "1.16.3",
+ "worker-loader": "0.7.1"
}
}
[11/50] [abbrv] ignite git commit: IGNITE-4472 Added user activities
in Web Console.
Posted by yz...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/Demo/Demo.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/Demo/Demo.module.js b/modules/web-console/frontend/app/modules/Demo/Demo.module.js
deleted file mode 100644
index a3700ca..0000000
--- a/modules/web-console/frontend/app/modules/Demo/Demo.module.js
+++ /dev/null
@@ -1,166 +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.
- */
-
-import angular from 'angular';
-
-import DEMO_INFO from 'app/data/demo-info.json';
-
-angular
-.module('ignite-console.demo', [
- 'ignite-console.socket'
-])
-.config(['$stateProvider', ($stateProvider) => {
- $stateProvider
- .state('demo', {
- abstract: true,
- template: '<ui-view></ui-view>'
- })
- .state('demo.resume', {
- url: '/demo',
- controller: ['$state', ($state) => {
- $state.go('base.configuration.clusters');
- }],
- metaTags: {
- }
- })
- .state('demo.reset', {
- url: '/demo/reset',
- controller: ['$state', '$http', 'IgniteMessages', ($state, $http, Messages) => {
- $http.post('/api/v1/demo/reset')
- .then(() => $state.go('base.configuration.clusters'))
- .catch((res) => {
- $state.go('base.configuration.clusters');
-
- Messages.showError(res);
- });
- }],
- metaTags: {}
- });
-}])
-.provider('Demo', ['$stateProvider', '$httpProvider', 'igniteSocketFactoryProvider', function($state, $http, socketFactory) {
- if (/(\/demo.*)/ig.test(location.pathname))
- sessionStorage.setItem('IgniteDemoMode', 'true');
-
- const enabled = sessionStorage.getItem('IgniteDemoMode') === 'true';
-
- if (enabled) {
- socketFactory.set({query: 'IgniteDemoMode=true'});
-
- $http.interceptors.push('demoInterceptor');
- }
-
- this.$get = ['$rootScope', ($root) => {
- $root.IgniteDemoMode = enabled;
-
- return {enabled};
- }];
-}])
-.factory('demoInterceptor', ['Demo', (Demo) => {
- const isApiRequest = (url) => /\/api\/v1/ig.test(url);
-
- return {
- request(cfg) {
- if (Demo.enabled && isApiRequest(cfg.url))
- cfg.headers.IgniteDemoMode = true;
-
- return cfg;
- }
- };
-}])
-.controller('demoController', ['$scope', '$state', '$window', 'IgniteConfirm', ($scope, $state, $window, Confirm) => {
- const _openTab = (stateName) => $window.open($state.href(stateName), '_blank');
-
- $scope.startDemo = () => {
- if (!$scope.user.demoCreated)
- return _openTab('demo.reset');
-
- Confirm.confirm('Would you like to continue with previous demo session?', true, false)
- .then((resume) => {
- if (resume)
- return _openTab('demo.resume');
-
- _openTab('demo.reset');
- });
- };
-
- $scope.closeDemo = () => {
- $window.close();
- };
-}])
-.provider('igniteDemoInfo', [function() {
- const items = DEMO_INFO;
-
- this.update = (data) => items[0] = data;
-
- this.$get = [() => {
- return items;
- }];
-}])
-.service('DemoInfo', ['$rootScope', '$modal', '$state', '$q', 'igniteDemoInfo', 'IgniteAgentMonitor', ($rootScope, $modal, $state, $q, igniteDemoInfo, agentMonitor) => {
- const scope = $rootScope.$new();
-
- let closePromise = null;
-
- function _fillPage() {
- const model = igniteDemoInfo;
-
- scope.title = model[0].title;
- scope.message = model[0].message.join(' ');
- }
-
- const dialog = $modal({
- templateUrl: '/templates/demo-info.html',
- scope,
- placement: 'center',
- show: false,
- backdrop: 'static'
- });
-
- scope.close = () => {
- dialog.hide();
-
- closePromise && closePromise.resolve();
- };
-
- scope.downloadAgent = () => {
- const lnk = document.createElement('a');
-
- lnk.setAttribute('href', '/api/v1/agent/download/zip');
- lnk.setAttribute('target', '_self');
- lnk.setAttribute('download', null);
- lnk.style.display = 'none';
-
- document.body.appendChild(lnk);
-
- lnk.click();
-
- document.body.removeChild(lnk);
- };
-
- return {
- show: () => {
- closePromise = $q.defer();
-
- _fillPage();
-
- return dialog.$promise
- .then(dialog.show)
- .then(() => Promise.race([agentMonitor.awaitAgent(), closePromise.promise]))
- .then(() => scope.hasAgents = true);
- }
- };
-}]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/demo/Demo.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/demo/Demo.module.js b/modules/web-console/frontend/app/modules/demo/Demo.module.js
new file mode 100644
index 0000000..bd759df
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/demo/Demo.module.js
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import DEMO_INFO from 'app/data/demo-info.json';
+
+angular
+.module('ignite-console.demo', [
+ 'ignite-console.socket'
+])
+.config(['$stateProvider', 'AclRouteProvider', ($stateProvider, AclRoute) => {
+ $stateProvider
+ .state('demo', {
+ abstract: true,
+ url: '/demo',
+ template: '<ui-view></ui-view>'
+ })
+ .state('demo.resume', {
+ url: '/resume',
+ onEnter: AclRoute.checkAccess('demo'),
+ controller: ['$state', ($state) => {
+ $state.go('base.configuration.clusters');
+ }],
+ metaTags: {
+ title: 'Demo resume'
+ }
+ })
+ .state('demo.reset', {
+ url: '/reset',
+ onEnter: AclRoute.checkAccess('demo'),
+ controller: ['$state', '$http', 'IgniteMessages', ($state, $http, Messages) => {
+ $http.post('/api/v1/demo/reset')
+ .then(() => $state.go('base.configuration.clusters'))
+ .catch((res) => {
+ $state.go('base.configuration.clusters');
+
+ Messages.showError(res);
+ });
+ }],
+ metaTags: {
+ title: 'Demo reset'
+ }
+ });
+}])
+.provider('Demo', ['$stateProvider', '$httpProvider', 'igniteSocketFactoryProvider', function($state, $http, socketFactory) {
+ if (/(\/demo.*)/ig.test(location.pathname))
+ sessionStorage.setItem('IgniteDemoMode', 'true');
+
+ const enabled = sessionStorage.getItem('IgniteDemoMode') === 'true';
+
+ if (enabled) {
+ socketFactory.set({query: 'IgniteDemoMode=true'});
+
+ $http.interceptors.push('demoInterceptor');
+ }
+
+ this.$get = ['$rootScope', ($root) => {
+ $root.IgniteDemoMode = enabled;
+
+ return {enabled};
+ }];
+}])
+.factory('demoInterceptor', ['Demo', (Demo) => {
+ const isApiRequest = (url) => /\/api\/v1/ig.test(url);
+
+ return {
+ request(cfg) {
+ if (Demo.enabled && isApiRequest(cfg.url))
+ cfg.headers.IgniteDemoMode = true;
+
+ return cfg;
+ }
+ };
+}])
+.controller('demoController', ['$scope', '$state', '$window', 'IgniteConfirm', ($scope, $state, $window, Confirm) => {
+ const _openTab = (stateName) => $window.open($state.href(stateName), '_blank');
+
+ $scope.startDemo = () => {
+ if (!$scope.user.demoCreated)
+ return _openTab('demo.reset');
+
+ Confirm.confirm('Would you like to continue with previous demo session?', true, false)
+ .then((resume) => {
+ if (resume)
+ return _openTab('demo.resume');
+
+ _openTab('demo.reset');
+ });
+ };
+
+ $scope.closeDemo = () => {
+ $window.close();
+ };
+}])
+.provider('igniteDemoInfo', [function() {
+ const items = DEMO_INFO;
+
+ this.update = (data) => items[0] = data;
+
+ this.$get = [() => {
+ return items;
+ }];
+}])
+.service('DemoInfo', ['$rootScope', '$modal', '$state', '$q', 'igniteDemoInfo', 'IgniteAgentMonitor', ($rootScope, $modal, $state, $q, igniteDemoInfo, agentMonitor) => {
+ const scope = $rootScope.$new();
+
+ let closePromise = null;
+
+ function _fillPage() {
+ const model = igniteDemoInfo;
+
+ scope.title = model[0].title;
+ scope.message = model[0].message.join(' ');
+ }
+
+ const dialog = $modal({
+ templateUrl: '/templates/demo-info.html',
+ scope,
+ placement: 'center',
+ show: false,
+ backdrop: 'static'
+ });
+
+ scope.close = () => {
+ dialog.hide();
+
+ closePromise && closePromise.resolve();
+ };
+
+ scope.downloadAgent = () => {
+ const lnk = document.createElement('a');
+
+ lnk.setAttribute('href', '/api/v1/agent/download/zip');
+ lnk.setAttribute('target', '_self');
+ lnk.setAttribute('download', null);
+ lnk.style.display = 'none';
+
+ document.body.appendChild(lnk);
+
+ lnk.click();
+
+ document.body.removeChild(lnk);
+ };
+
+ return {
+ show: () => {
+ closePromise = $q.defer();
+
+ _fillPage();
+
+ return dialog.$promise
+ .then(dialog.show)
+ .then(() => Promise.race([agentMonitor.awaitAgent(), closePromise.promise]))
+ .then(() => scope.hasAgents = true);
+ }
+ };
+}]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index 0d0b171..4e972ef 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -186,8 +186,8 @@ class Paragraph {
}
// Controller for SQL notebook screen.
-export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteAgentMonitor', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion',
- function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMonitor, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version) {
+export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteAgentMonitor', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion', 'IgniteActivitiesData',
+ function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMonitor, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData) {
let stopTopology = null;
const _tryStopRefresh = function(paragraph) {
@@ -965,6 +965,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
$scope.addQuery = function() {
const sz = $scope.notebook.paragraphs.length;
+ ActivitiesData.post({ action: '/queries/add/query' });
+
const paragraph = new Paragraph($animate, $timeout, {
name: 'Query' + (sz === 0 ? '' : sz),
query: '',
@@ -991,6 +993,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
$scope.addScan = function() {
const sz = $scope.notebook.paragraphs.length;
+ ActivitiesData.post({ action: '/queries/add/scan' });
+
const paragraph = new Paragraph($animate, $timeout, {
name: 'Scan' + (sz === 0 ? '' : sz),
query: '',
@@ -1379,6 +1383,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
const qry = args.maxPages ? addLimit(args.query, args.pageSize * args.maxPages) : paragraph.query;
+ ActivitiesData.post({ action: '/queries/execute' });
+
return agentMonitor.query(nid, args.cacheName, qry, nonCollocatedJoins, local, args.pageSize);
})
.then((res) => {
@@ -1430,6 +1436,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
pageSize: paragraph.pageSize
};
+ ActivitiesData.post({ action: '/queries/explain' });
+
return agentMonitor.query(nid, args.cacheName, args.query, false, false, args.pageSize);
})
.then(_processQueryResult.bind(this, paragraph, true))
@@ -1466,6 +1474,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
localNid: local ? nid : null
};
+ ActivitiesData.post({ action: '/queries/scan' });
+
return agentMonitor.query(nid, args.cacheName, query, false, local, args.pageSize);
})
.then((res) => _processQueryResult(paragraph, true, res))
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/sql/sql.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.module.js b/modules/web-console/frontend/app/modules/sql/sql.module.js
index a1ffde9..5875961 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.module.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.module.js
@@ -30,7 +30,7 @@ angular.module('ignite-console.sql', [
// set up the states
$stateProvider
.state('base.sql', {
- url: '/sql',
+ url: '/queries',
abstract: true,
template: '<ui-view></ui-view>'
})
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/states/admin.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/admin.state.js b/modules/web-console/frontend/app/modules/states/admin.state.js
index c3151e1..35c6fbb 100644
--- a/modules/web-console/frontend/app/modules/states/admin.state.js
+++ b/modules/web-console/frontend/app/modules/states/admin.state.js
@@ -29,7 +29,7 @@ angular
templateUrl: '/settings/admin.html',
onEnter: AclRoute.checkAccess('admin_page'),
metaTags: {
- title: 'List of registered users'
+ title: 'Admin panel'
}
});
}]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
index cfc6df9..16d2fae 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
+++ b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.controller.js
@@ -21,8 +21,8 @@ import saver from 'file-saver';
const escapeFileName = (name) => name.replace(/[\\\/*\"\[\],\.:;|=<>?]/g, '-').replace(/ /g, '_');
export default [
- '$rootScope', '$scope', '$http', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteLoading', '$filter', 'IgniteConfigurationResource', 'JavaTypes', 'IgniteVersion', 'IgniteConfigurationGenerator', 'SpringTransformer', 'JavaTransformer', 'IgniteDockerGenerator', 'IgniteMavenGenerator', 'IgnitePropertiesGenerator', 'IgniteReadmeGenerator', 'IgniteFormUtils', 'IgniteSummaryZipper',
- function($root, $scope, $http, LegacyUtils, Messages, Loading, $filter, Resource, JavaTypes, Version, generator, spring, java, docker, pom, propsGenerator, readme, FormUtils, SummaryZipper) {
+ '$rootScope', '$scope', '$http', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteLoading', '$filter', 'IgniteConfigurationResource', 'JavaTypes', 'IgniteVersion', 'IgniteConfigurationGenerator', 'SpringTransformer', 'JavaTransformer', 'IgniteDockerGenerator', 'IgniteMavenGenerator', 'IgnitePropertiesGenerator', 'IgniteReadmeGenerator', 'IgniteFormUtils', 'IgniteSummaryZipper', 'IgniteActivitiesData',
+ function($root, $scope, $http, LegacyUtils, Messages, Loading, $filter, Resource, JavaTypes, Version, generator, spring, java, docker, pom, propsGenerator, readme, FormUtils, SummaryZipper, ActivitiesData) {
const ctrl = this;
$scope.ui = {
@@ -304,6 +304,8 @@ export default [
$scope.isPrepareDownloading = true;
+ ActivitiesData.post({ action: '/configuration/download' });
+
return new SummaryZipper({ cluster, data: ctrl.data || {}, IgniteDemoMode: $root.IgniteDemoMode })
.then((data) => {
saver.saveAs(data, escapeFileName(cluster.name) + '-project.zip');
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/user/AclRoute.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/AclRoute.provider.js b/modules/web-console/frontend/app/modules/user/AclRoute.provider.js
index 40abea5..4225bc4 100644
--- a/modules/web-console/frontend/app/modules/user/AclRoute.provider.js
+++ b/modules/web-console/frontend/app/modules/user/AclRoute.provider.js
@@ -17,31 +17,36 @@
export default [() => {
class AclRoute {
- static checkAccess = (permissions, failState) => {
+ static checkAccess(permissions, failState) {
failState = failState || '403';
- return ['$state', 'AclService', 'User', ($state, AclService, User) => {
- User.read()
- .then(() => {
- if (AclService.can(permissions))
- return;
+ return ['$q', '$state', 'AclService', 'User', 'IgniteActivitiesData', function($q, $state, AclService, User, Activities) {
+ const action = this.name ? $state.href(this.name) : null;
- return $state.go(failState);
- })
+ return User.read()
.catch(() => {
User.clean();
if ($state.current.name !== 'signin')
$state.go('signin');
+
+ return $q.reject('Failed to detect user');
+ })
+ .then(() => {
+ if (AclService.can(permissions))
+ return Activities.post({ action });
+
+ $state.go(failState);
+
+ return $q.reject('User are not authorized');
});
}];
}
- }
- return {
- checkAccess: AclRoute.checkAccess,
- $get: () => {
+ static $get() {
return AclRoute;
}
- };
+ }
+
+ return AclRoute;
}];
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/user/Auth.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/Auth.service.js b/modules/web-console/frontend/app/modules/user/Auth.service.js
index e0f905d..95ff4c3 100644
--- a/modules/web-console/frontend/app/modules/user/Auth.service.js
+++ b/modules/web-console/frontend/app/modules/user/Auth.service.js
@@ -21,7 +21,7 @@ export default ['Auth', ['$http', '$rootScope', '$state', '$window', 'IgniteErro
forgotPassword(userInfo) {
$http.post('/api/v1/password/forgot', userInfo)
.then(() => $state.go('password.send'))
- .cacth(({data}) => ErrorPopover.show('forgot_email', Messages.errorMessage(null, data)));
+ .catch(({data}) => ErrorPopover.show('forgot_email', Messages.errorMessage(null, data)));
},
auth(action, userInfo) {
$http.post('/api/v1/' + action, userInfo)
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/user/permissions.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/permissions.js b/modules/web-console/frontend/app/modules/user/permissions.js
index e13509c..b6f7c3a 100644
--- a/modules/web-console/frontend/app/modules/user/permissions.js
+++ b/modules/web-console/frontend/app/modules/user/permissions.js
@@ -16,7 +16,7 @@
*/
const guest = ['login'];
-const becomed = ['profile', 'configuration', 'query'];
+const becomed = ['profile', 'configuration', 'query', 'demo'];
const user = becomed.concat(['logout']);
const admin = user.concat(['admin_page']);
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/modules/user/user.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/user.module.js b/modules/web-console/frontend/app/modules/user/user.module.js
index 11798d0..b86a62e 100644
--- a/modules/web-console/frontend/app/modules/user/user.module.js
+++ b/modules/web-console/frontend/app/modules/user/user.module.js
@@ -22,10 +22,10 @@ import Auth from './Auth.service';
import User from './User.service';
import AclRouteProvider from './AclRoute.provider';
-angular
-.module('ignite-console.user', [
+angular.module('ignite-console.user', [
'mm.acl',
- 'ignite-console.config'
+ 'ignite-console.config',
+ 'ignite-console.core'
])
.factory('sessionRecoverer', ['$injector', '$q', ($injector, $q) => {
return {
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/vendor.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/vendor.js b/modules/web-console/frontend/app/vendor.js
index a9e8844..3bbb322 100644
--- a/modules/web-console/frontend/app/vendor.js
+++ b/modules/web-console/frontend/app/vendor.js
@@ -25,6 +25,7 @@ import 'angular-strap/dist/angular-strap.tpl';
import 'angular-socket-io';
import 'angular-retina';
import 'angular-ui-router';
+import 'angular-translate';
import 'ui-router-metatags/dist/ui-router-metatags';
import 'angular-smart-table';
import 'angular-ui-grid/ui-grid';
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/controllers/admin-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/admin-controller.js b/modules/web-console/frontend/controllers/admin-controller.js
deleted file mode 100644
index cf7fd71..0000000
--- a/modules/web-console/frontend/controllers/admin-controller.js
+++ /dev/null
@@ -1,234 +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.
- */
-
-const ICON_SORT = '<span ui-grid-one-bind-id-grid="col.uid + \'-sortdir-text\'" ui-grid-visible="col.sort.direction" aria-label="Sort Descending"><i ng-class="{ \'ui-grid-icon-up-dir\': col.sort.direction == asc, \'ui-grid-icon-down-dir\': col.sort.direction == desc, \'ui-grid-icon-blank\': !col.sort.direction }" title="" aria-hidden="true"></i></span>';
-
-const CLUSTER_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-sitemap'></i>${ICON_SORT}</div>`;
-const MODEL_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-object-group'></i>${ICON_SORT}</div>`;
-const CACHE_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-database'></i>${ICON_SORT}</div>`;
-const IGFS_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-folder-o'></i>${ICON_SORT}</div>`;
-
-const ACTIONS_TEMPLATE = `
-<div class='text-center ui-grid-cell-actions'>
- <a class='btn btn-default dropdown-toggle' bs-dropdown='' ng-show='row.entity._id != $root.user._id' data-placement='bottom-right' data-container='.panel'>
- <i class='fa fa-gear'></i>
- <span class='caret'></span>
- </a>
- <ul class='dropdown-menu' role='menu'>
- <li>
- <a ng-click='grid.api.becomeUser(row.entity)'>Become this user</a>
- </li>
- <li>
- <a ng-click='grid.api.toggleAdmin(row.entity)' ng-if='row.entity.admin && row.entity._id !== $root.user._id'>Revoke admin</a>
- <a ng-click='grid.api.toggleAdmin(row.entity)' ng-if='!row.entity.admin && row.entity._id !== $root.user._id'>Grant admin</a>
- </li>
- <li>
- <a ng-click='grid.api.removeUser(row.entity)'>Remove user</a>
- </li>
-</div>`;
-
-const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a ng-href="mailto:{{ COL_FIELD }}">{{ COL_FIELD }}</a></div>';
-
-// Controller for Admin screen.
-export default ['adminController', [
- '$rootScope', '$scope', '$http', '$q', '$state', '$filter', 'uiGridConstants', 'IgniteMessages', 'IgniteConfirm', 'User', 'IgniteNotebookData', 'IgniteCountries',
- ($rootScope, $scope, $http, $q, $state, $filter, uiGridConstants, Messages, Confirm, User, Notebook, Countries) => {
- $scope.users = null;
-
- const companySelectOptions = [];
- const countrySelectOptions = [];
-
- const COLUMNS_DEFS = [
- {displayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'test', minWidth: 80, width: 80, enableFiltering: false, enableSorting: false},
- {displayName: 'User', field: 'userName', minWidth: 65, enableFiltering: true, filter: { placeholder: 'Filter by name...' }},
- {displayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by email...' }},
- {displayName: 'Company', field: 'company', minWidth: 160, filter: {
- selectOptions: companySelectOptions, type: uiGridConstants.filter.SELECT, condition: uiGridConstants.filter.EXACT }
- },
- {displayName: 'Country', field: 'countryCode', minWidth: 80, filter: {
- selectOptions: countrySelectOptions, type: uiGridConstants.filter.SELECT, condition: uiGridConstants.filter.EXACT }
- },
- {displayName: 'Last login', field: 'lastLogin', cellFilter: 'date:"medium"', minWidth: 175, width: 175, enableFiltering: false, sort: { direction: 'desc', priority: 0 }},
- {displayName: 'Clusters count', headerCellTemplate: CLUSTER_HEADER_TEMPLATE, field: '_clusters', type: 'number', headerTooltip: 'Clusters count', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'Models count', headerCellTemplate: MODEL_HEADER_TEMPLATE, field: '_models', type: 'number', headerTooltip: 'Models count', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'Caches count', headerCellTemplate: CACHE_HEADER_TEMPLATE, field: '_caches', type: 'number', headerTooltip: 'Caches count', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'IGFS count', headerCellTemplate: IGFS_HEADER_TEMPLATE, field: '_igfs', type: 'number', headerTooltip: 'IGFS count', minWidth: 50, width: 50, enableFiltering: false}
- ];
-
- const ctrl = $scope.ctrl = {};
-
- const becomeUser = function(user) {
- $http.get('/api/v1/admin/become', { params: {viewedUserId: user._id}})
- .then(() => User.load())
- .then(() => $state.go('base.configuration.clusters'))
- .then(() => Notebook.load())
- .catch(Messages.showError);
- };
-
- const removeUser = (user) => {
- Confirm.confirm(`Are you sure you want to remove user: "${user.userName}"?`)
- .then(() => {
- $http.post('/api/v1/admin/remove', {userId: user._id})
- .then(() => {
- const i = _.findIndex($scope.users, (u) => u._id === user._id);
-
- if (i >= 0)
- $scope.users.splice(i, 1);
-
- Messages.showInfo(`User has been removed: "${user.userName}"`);
- })
- .catch(({data, status}) => {
- if (status === 503)
- Messages.showInfo(data);
- else
- Messages.showError('Failed to remove user: ', data);
- });
- });
- };
-
- const toggleAdmin = (user) => {
- if (user.adminChanging)
- return;
-
- user.adminChanging = true;
-
- $http.post('/api/v1/admin/save', {userId: user._id, adminFlag: !user.admin})
- .then(() => {
- user.admin = !user.admin;
-
- Messages.showInfo(`Admin right was successfully toggled for user: "${user.userName}"`);
- })
- .catch((res) => {
- Messages.showError('Failed to toggle admin right for user: ', res);
- })
- .finally(() => user.adminChanging = false);
- };
-
-
- ctrl.gridOptions = {
- data: [],
- columnVirtualizationThreshold: 30,
- columnDefs: COLUMNS_DEFS,
- categories: [
- {name: 'Actions', visible: true, selectable: true},
- {name: 'User', visible: true, selectable: true},
- {name: 'Email', visible: true, selectable: true},
- {name: 'Company', visible: true, selectable: true},
- {name: 'Country', visible: true, selectable: true},
- {name: 'Last login', visible: true, selectable: true},
-
- {name: 'Clusters count', visible: true, selectable: true},
- {name: 'Models count', visible: true, selectable: true},
- {name: 'Caches count', visible: true, selectable: true},
- {name: 'IGFS count', visible: true, selectable: true}
- ],
- enableFiltering: true,
- enableRowSelection: false,
- enableRowHeaderSelection: false,
- enableColumnMenus: false,
- multiSelect: false,
- modifierKeysToMultiSelect: true,
- noUnselect: true,
- flatEntityAccess: true,
- fastWatch: true,
- onRegisterApi: (api) => {
- ctrl.gridApi = api;
-
- api.becomeUser = becomeUser;
- api.removeUser = removeUser;
- api.toggleAdmin = toggleAdmin;
- }
- };
-
- /**
- * Set grid height.
- *
- * @param {Number} rows Rows count.
- * @private
- */
- const adjustHeight = (rows) => {
- const height = Math.min(rows, 20) * 30 + 75;
-
- // Remove header height.
- ctrl.gridApi.grid.element.css('height', height + 'px');
-
- ctrl.gridApi.core.handleWindowResize();
- };
-
- const usersToFilterOptions = (column) => {
- return _.sortBy(
- _.map(
- _.groupBy($scope.users, (usr) => {
- const fld = usr[column];
-
- return _.isNil(fld) ? fld : fld.toUpperCase();
- }),
- (arr, value) => ({label: `${_.head(arr)[column] || 'Not set'} (${arr.length})`, value})
- ),
- 'value');
- };
-
- const _reloadUsers = () => {
- $http.post('/api/v1/admin/list')
- .then(({ data }) => {
- $scope.users = data;
-
- companySelectOptions.length = 0;
- countrySelectOptions.length = 0;
-
- _.forEach($scope.users, (user) => {
- user.userName = user.firstName + ' ' + user.lastName;
- user.countryCode = Countries.getByName(user.country).code;
-
- user._clusters = user.counters.clusters;
- user._models = user.counters.models;
- user._caches = user.counters.caches;
- user._igfs = user.counters.igfs;
- });
-
- companySelectOptions.push(...usersToFilterOptions('company'));
- countrySelectOptions.push(...usersToFilterOptions('countryCode'));
-
- $scope.ctrl.gridOptions.data = data;
-
- adjustHeight(data.length);
- })
- .catch(Messages.showError);
- };
-
- _reloadUsers();
-
- const _enableColumns = (categories, visible) => {
- _.forEach(categories, (cat) => {
- cat.visible = visible;
-
- _.forEach(ctrl.gridOptions.columnDefs, (col) => {
- if (col.displayName === cat.name)
- col.visible = visible;
- });
- });
-
- ctrl.gridApi.grid.refresh();
- };
-
- const _selectableColumns = () => _.filter(ctrl.gridOptions.categories, (cat) => cat.selectable);
-
- ctrl.toggleColumns = (category, visible) => _enableColumns([category], visible);
- ctrl.selectAllColumns = () => _enableColumns(_selectableColumns(), true);
- ctrl.clearAllColumns = () => _enableColumns(_selectableColumns(), false);
- }
-]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index 303110e..bfffe92 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -17,8 +17,8 @@
// Controller for Domain model screen.
export default ['domainsController', [
- '$rootScope', '$scope', '$http', '$state', '$filter', '$timeout', '$modal', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteFocus', 'IgniteConfirm', 'IgniteConfirmBatch', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteAgentMonitor', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils', 'JavaTypes', 'SqlTypes',
- function($root, $scope, $http, $state, $filter, $timeout, $modal, LegacyUtils, Messages, Focus, Confirm, ConfirmBatch, Clone, Loading, ModelNormalizer, UnsavedChangesGuard, IgniteAgentMonitor, LegacyTable, Resource, ErrorPopover, FormUtils, JavaTypes, SqlTypes) {
+ '$rootScope', '$scope', '$http', '$state', '$filter', '$timeout', '$modal', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteFocus', 'IgniteConfirm', 'IgniteConfirmBatch', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteAgentMonitor', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils', 'JavaTypes', 'SqlTypes', 'IgniteActivitiesData',
+ function($root, $scope, $http, $state, $filter, $timeout, $modal, LegacyUtils, Messages, Focus, Confirm, ConfirmBatch, Clone, Loading, ModelNormalizer, UnsavedChangesGuard, IgniteAgentMonitor, LegacyTable, Resource, ErrorPopover, FormUtils, JavaTypes, SqlTypes, ActivitiesData) {
UnsavedChangesGuard.install($scope);
const emptyDomain = {empty: true};
@@ -460,6 +460,14 @@ export default ['domainsController', [
$scope.importDomain.loadingOptions = LOADING_JDBC_DRIVERS;
IgniteAgentMonitor.startWatch({text: 'Back to Domain models', goal: 'import domain model from database'})
+ .then(() => {
+ ActivitiesData.post({
+ group: 'configuration',
+ action: 'configuration/import/model'
+ });
+
+ return true;
+ })
.then(importDomainModal.$promise)
.then(importDomainModal.show)
.then(() => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index fd50d5b..ff52ba4 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -44,6 +44,7 @@
"angular-socket-io": "~0.7.0",
"angular-strap": "~2.3.8",
"angular-touch": "~1.5.9",
+ "angular-translate": "~2.13.1",
"angular-tree-control": "~0.2.26",
"angular-ui-grid": "~3.2.9",
"angular-ui-router": "~0.3.1",
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss b/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss
index bfa6c6c..47555a7 100644
--- a/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss
+++ b/modules/web-console/frontend/public/stylesheets/_font-awesome-custom.scss
@@ -69,3 +69,31 @@ $fa-font-path: '~font-awesome/fonts';
cursor: default;
}
+
+.icon-user {
+ @extend .fa;
+ @extend .fa-user-o;
+
+ cursor: default;
+}
+
+.icon-admin {
+ @extend .fa;
+ @extend .fa-user-secret;
+
+ cursor: default;
+}
+
+.icon-datepicker-left {
+ @extend .fa;
+ @extend .fa-chevron-left;
+
+ margin: 0;
+}
+
+.icon-datepicker-right {
+ @extend .fa;
+ @extend .fa-chevron-right;
+
+ margin: 0;
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 4318fc2..67cfed1 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -2302,12 +2302,13 @@ html,body,.splash-screen {
cursor: default;
i {
+ margin-top: 2px;
margin-right: 10px;
}
label {
cursor: default;
- line-height: 24px;
+ line-height: 28px;
}
sub {
@@ -2326,4 +2327,40 @@ html,body,.splash-screen {
.ui-grid-filter-select {
width: calc(100% - 10px);
}
+
+ .ui-grid-cell-contents > i {
+ line-height: $line-height-base;
+ }
+
+ .ui-grid-row:nth-child(odd):hover .ui-grid-cell {
+ background: $ignite-row-hover;
+ }
+
+ .ui-grid-row:nth-child(even):hover .ui-grid-cell {
+ background: $ignite-row-hover;
+ }
}
+
+.datepicker.dropdown-menu {
+ width: 250px;
+ height: 270px;
+
+ button {
+ outline: none;
+ border: 0;
+ }
+
+ tbody {
+ height: 180px;
+ }
+
+ tbody button {
+ padding: 6px;
+ }
+
+ &.datepicker-mode-1, &.datepicker-mode-2 {
+ tbody button {
+ height: 65px;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/public/stylesheets/variables.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/variables.scss b/modules/web-console/frontend/public/stylesheets/variables.scss
index 8500eac..e30bbdd 100644
--- a/modules/web-console/frontend/public/stylesheets/variables.scss
+++ b/modules/web-console/frontend/public/stylesheets/variables.scss
@@ -26,3 +26,4 @@ $ignite-border-bottom-color: $brand-primary;
$ignite-background-color: #fff;
$ignite-header-color: #555;
$ignite-invalid-color: $brand-primary;
+$ignite-row-hover: #c9dde1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/views/settings/admin.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/settings/admin.jade b/modules/web-console/frontend/views/settings/admin.jade
index c985826..a09fda9 100644
--- a/modules/web-console/frontend/views/settings/admin.jade
+++ b/modules/web-console/frontend/views/settings/admin.jade
@@ -14,38 +14,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-mixin grid-settings()
- i.fa.fa-bars(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
- ul.select.dropdown-menu(role='menu')
- li(ng-repeat='item in ctrl.gridOptions.categories|filter:{selectable:true}')
- a(ng-click='ctrl.toggleColumns(item, !item.visible)')
- i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
- i.fa.fa-square-o.pull-left(ng-if='!item.visible')
- span {{::item.name}}
- li.divider
- li
- a(ng-click='ctrl.selectAllColumns()') Select all
- li
- a(ng-click='ctrl.clearAllColumns()') Clear all
- li.divider
- li
- a(ng-click='$hide()') Close
-
-.admin-page.row(ng-controller='adminController')
+.admin-page.row
.docs-content.greedy
.docs-header
- h1 List of registered users
+ h1 Admin panel
hr
.docs-body
.row
.col-xs-12
- .panel.panel-default
- .panel-heading.ui-grid-settings
- +grid-settings
- label Total users:
- strong {{ users.length }}
- label Showing users:
- strong {{ ctrl.gridApi.grid.getVisibleRows().length }}
- sub(ng-show='users.length === ctrl.gridApi.grid.getVisibleRows().length') all
- .panel-collapse
- .grid(ui-grid='ctrl.gridOptions' ui-grid-resize-columns ui-grid-selection ui-grid-pinning)
+ ignite-list-of-registered-users(data-options='ctrl.data')
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/views/sql/sql.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.jade b/modules/web-console/frontend/views/sql/sql.jade
index 03015e8..61d5b30 100644
--- a/modules/web-console/frontend/views/sql/sql.jade
+++ b/modules/web-console/frontend/views/sql/sql.jade
@@ -15,7 +15,7 @@
limitations under the License.
include /app/helpers/jade/mixins.jade
-include /app/directives/ui-grid-settings/ui-grid-settings.jade
+include /app/components/ui-grid-settings/ui-grid-settings.jade
mixin btn-toolbar(btn, click, tip, focusId)
i.btn.btn-default.fa(class=btn ng-click=click bs-tooltip='' data-title=tip ignite-on-click-focus=focusId data-trigger='hover' data-placement='bottom')
@@ -195,7 +195,7 @@ mixin paragraph-scan
+table-result-body
.footer.clearfix()
.pull-left
- | Showing results for scan of #[b{{ paragraph.queryArgs.cacheName | defaultName }}]
+ | Showing results for scan of #[b {{ paragraph.queryArgs.cacheName | defaultName }}]
span(ng-if='paragraph.queryArgs.filter') with filter: #[b {{ paragraph.queryArgs.filter }}]
span(ng-if='paragraph.queryArgs.localNid') on node: #[b {{ paragraph.queryArgs.localNid | limitTo:8 }}]
[42/50] [abbrv] ignite git commit: IGNITE-4678 Node version in range.
Posted by yz...@apache.org.
IGNITE-4678 Node version in range.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2cfd55dc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2cfd55dc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2cfd55dc
Branch: refs/heads/ignite-comm-balance-master
Commit: 2cfd55dcff04cd81ac81e8ed68a34e7ad9ebb883
Parents: 571586c
Author: Andrey Novikov <an...@gridgain.com>
Authored: Wed Feb 15 16:08:57 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Wed Feb 15 16:08:57 2017 +0700
----------------------------------------------------------------------
.../modules/configuration/Version.service.js | 30 +++++++++++++++++---
.../frontend/test/unit/Version.test.js | 26 ++++++++++++++++-
.../demo/service/DemoCachesLoadService.java | 2 +-
.../service/DemoRandomCacheLoadService.java | 2 +-
4 files changed, 53 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cfd55dc/modules/web-console/frontend/app/modules/configuration/Version.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/Version.service.js b/modules/web-console/frontend/app/modules/configuration/Version.service.js
index 746b1ed..3fc7199 100644
--- a/modules/web-console/frontend/app/modules/configuration/Version.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/Version.service.js
@@ -77,12 +77,34 @@ export default class IgniteVersion {
}
/**
+ * Check if node version in range
+ * @param {String} nodeVer Node version.
+ * @param {Array.<String>} ranges Version ranges to compare with.
+ * @returns {Boolean} `True` if node version is equal or greater than specified range.
+ */
+ includes(nodeVer, ...ranges) {
+ return !!_.find(ranges, ([after, before]) =>
+ this.compare(nodeVer, after) >= 0 && (_.isNil(before) || this.compare(nodeVer, before) < 0)
+ );
+ }
+
+ /**
* Check if node version is newer or same
- * @param {String} nodeVer
- * @param {String} sinceVer
- * @returns {Boolean}
+ * @param {String} nodeVer Node version.
+ * @param {String} sinceVer Version to compare with.
+ * @returns {Boolean} `True` if node version is equal or greater than specified version.
*/
since(nodeVer, sinceVer) {
- return this.compare(nodeVer, sinceVer) >= 0;
+ return this.includes(nodeVer, [sinceVer]);
+ }
+
+ /**
+ * Check whether node version before than specified version.
+ * @param {String} nodeVer Node version.
+ * @param {String} sinceVer Version to compare with.
+ * @return {Boolean} `True` if node version before than specified version.
+ */
+ before(nodeVer, sinceVer) {
+ return !this.since(nodeVer, sinceVer);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cfd55dc/modules/web-console/frontend/test/unit/Version.test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/test/unit/Version.test.js b/modules/web-console/frontend/test/unit/Version.test.js
index 2d75ab5..72685ea 100644
--- a/modules/web-console/frontend/test/unit/Version.test.js
+++ b/modules/web-console/frontend/test/unit/Version.test.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import VersionService from '../../app/modules/configuration/Version.service.js';
+import VersionService from '../../app/modules/configuration/Version.service';
const INSTANCE = new VersionService();
@@ -53,6 +53,7 @@ suite('VersionServiceTestsSuite', () => {
});
test('Check since call', () => {
+ assert.equal(INSTANCE.since('1.5.0', '1.5.0'), true);
assert.equal(INSTANCE.since('1.6.0', '1.5.0'), true);
});
@@ -60,6 +61,29 @@ suite('VersionServiceTestsSuite', () => {
assert.equal(INSTANCE.since('1.3.0', '1.5.0'), false);
});
+ test('Check before call', () => {
+ assert.equal(INSTANCE.before('1.5.0', '1.5.0'), false);
+ assert.equal(INSTANCE.before('1.5.0', '1.6.0'), true);
+ });
+
+ test('Check wrong before call', () => {
+ assert.equal(INSTANCE.before('1.5.0', '1.3.0'), false);
+ });
+
+ test('Check includes call', () => {
+ assert.equal(INSTANCE.includes('1.5.4', ['1.5.5', '1.6.0'], ['1.6.2']), false);
+ assert.equal(INSTANCE.includes('1.5.5', ['1.5.5', '1.6.0'], ['1.6.2']), true);
+ assert.equal(INSTANCE.includes('1.5.11', ['1.5.5', '1.6.0'], ['1.6.2']), true);
+ assert.equal(INSTANCE.includes('1.6.0', ['1.5.5', '1.6.0'], ['1.6.2']), false);
+ assert.equal(INSTANCE.includes('1.6.1', ['1.5.5', '1.6.0'], ['1.6.2']), false);
+ assert.equal(INSTANCE.includes('1.6.2', ['1.5.5', '1.6.0'], ['1.6.2']), true);
+ assert.equal(INSTANCE.includes('1.6.3', ['1.5.5', '1.6.0'], ['1.6.2']), true);
+ });
+
+ test('Check wrong before call', () => {
+ assert.equal(INSTANCE.before('1.5.0', '1.3.0'), false);
+ });
+
test('Parse 1.7.0-SNAPSHOT', () => {
const version = INSTANCE.parse('1.7.0-SNAPSHOT');
assert.equal(version.major, 1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cfd55dc/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
index 9117646..fbfa2ae 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
@@ -114,7 +114,7 @@ public class DemoCachesLoadService implements Service {
/** {@inheritDoc} */
@Override public void cancel(ServiceContext ctx) {
if (cachePool != null)
- cachePool.shutdown();
+ cachePool.shutdownNow();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cfd55dc/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
index 57b26a2..c704dbe 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
@@ -62,7 +62,7 @@ public class DemoRandomCacheLoadService implements Service {
/** {@inheritDoc} */
@Override public void cancel(ServiceContext ctx) {
if (cachePool != null)
- cachePool.shutdown();
+ cachePool.shutdownNow();
}
/** {@inheritDoc} */
[03/50] [abbrv] ignite git commit: ignite-4499 Drop node from
topology in case when connection creation is impossible
Posted by yz...@apache.org.
ignite-4499 Drop node from topology in case when connection creation is impossible
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f9aaf035
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f9aaf035
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f9aaf035
Branch: refs/heads/ignite-comm-balance-master
Commit: f9aaf0353cea54afefea4caac74b1583eb17969b
Parents: ecf4b8b
Author: agura <agura>
Authored: Wed Jan 18 18:04:45 2017 +0300
Committer: agura <agura>
Committed: Wed Jan 18 18:04:45 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../communication/tcp/TcpCommunicationSpi.java | 16 +
.../ignite/spi/discovery/tcp/ClientImpl.java | 88 ++++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 61 ++--
.../messages/TcpDiscoveryAbstractMessage.java | 21 ++
.../tcp/TcpCommunicationSpiDropNodesTest.java | 322 +++++++++++++++++++
.../TcpCommunicationSpiFaultyClientTest.java | 270 ++++++++++++++++
.../ignite/testframework/GridTestNode.java | 1 +
.../testframework/junits/GridAbstractTest.java | 2 +
.../IgniteSpiCommunicationSelfTestSuite.java | 5 +
.../cache/IgniteCacheAbstractQuerySelfTest.java | 8 +-
11 files changed, 758 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 0da0f49..d77b2fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -65,6 +65,9 @@ public final class IgniteSystemProperties {
*/
public static final String IGNITE_NO_DISCO_ORDER = "IGNITE_NO_DISCO_ORDER";
+ /** Defines reconnect delay in milliseconds for client node that was failed forcible. */
+ public static final String IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY = "IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY";
+
/**
* If this system property is set to {@code false} - no checks for new versions will
* be performed by Ignite. By default, Ignite periodically checks for the new
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 1fe437c..94b7efe 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -94,6 +94,7 @@ import org.apache.ignite.internal.util.nio.ssl.GridSslMeta;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -2550,6 +2551,21 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
"operating system firewall is disabled on local and remote hosts) " +
"[addrs=" + addrs + ']');
+ if (getSpiContext().node(node.id()) != null && (CU.clientNode(node) || !CU.clientNode(getLocalNode())) &&
+ X.hasCause(errs, ConnectException.class, SocketTimeoutException.class, HandshakeTimeoutException.class,
+ IgniteSpiOperationTimeoutException.class)) {
+ LT.warn(log, "TcpCommunicationSpi failed to establish connection to node, node will be dropped from " +
+ "cluster [" +
+ "rmtNode=" + node +
+ ", err=" + errs +
+ ", connectErrs=" + Arrays.toString(errs.getSuppressed()) + ']');
+
+ getSpiContext().failNode(node.id(), "TcpCommunicationSpi failed to establish connection to node [" +
+ "rmtNode=" + node +
+ ", errs=" + errs +
+ ", connectErrs=" + Arrays.toString(errs.getSuppressed()) + ']');
+ }
+
throw errs;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 9a1261c..35f0908 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -50,6 +50,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
@@ -100,6 +101,7 @@ import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY;
import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_DISCONNECTED;
import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_RECONNECTED;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
@@ -166,6 +168,9 @@ class ClientImpl extends TcpDiscoveryImpl {
/** */
protected MessageWorker msgWorker;
+ /** Force fail message for local node. */
+ private TcpDiscoveryNodeFailedMessage forceFailMsg;
+
/** */
@GridToStringExclude
private int joinCnt;
@@ -450,6 +455,8 @@ class ClientImpl extends TcpDiscoveryImpl {
msg.warning(warning);
+ msg.force(true);
+
msgWorker.addMessage(msg);
}
}
@@ -1396,6 +1403,14 @@ class ClientImpl extends TcpDiscoveryImpl {
else
leaveLatch.countDown();
}
+ else if (msg instanceof TcpDiscoveryNodeFailedMessage &&
+ ((TcpDiscoveryNodeFailedMessage)msg).failedNodeId().equals(locNode.id())) {
+ TcpDiscoveryNodeFailedMessage msg0 = (TcpDiscoveryNodeFailedMessage)msg;
+
+ assert msg0.force() : msg0;
+
+ forceFailMsg = msg0;
+ }
else if (msg instanceof SocketClosedMessage) {
if (((SocketClosedMessage)msg).sock == currSock) {
currSock = null;
@@ -1412,25 +1427,45 @@ class ClientImpl extends TcpDiscoveryImpl {
}
}
else {
- if (log.isDebugEnabled())
- log.debug("Connection closed, will try to restore connection.");
+ if (forceFailMsg != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Connection closed, local node received force fail message, " +
+ "will not try to restore connection");
+ }
+
+ queue.addFirst(SPI_RECONNECT_FAILED);
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Connection closed, will try to restore connection.");
- assert reconnector == null;
+ assert reconnector == null;
- final Reconnector reconnector = new Reconnector(join);
- this.reconnector = reconnector;
- reconnector.start();
+ final Reconnector reconnector = new Reconnector(join);
+ this.reconnector = reconnector;
+ reconnector.start();
+ }
}
}
}
else if (msg == SPI_RECONNECT_FAILED) {
- reconnector.cancel();
- reconnector.join();
+ if (reconnector != null) {
+ reconnector.cancel();
+ reconnector.join();
- reconnector = null;
+ reconnector = null;
+ }
+ else
+ assert forceFailMsg != null;
if (spi.isClientReconnectDisabled()) {
if (state != SEGMENTED && state != STOPPED) {
+ if (forceFailMsg != null) {
+ U.quietAndWarn(log, "Local node was dropped from cluster due to network problems " +
+ "[nodeInitiatedFail=" + forceFailMsg.creatorNodeId() +
+ ", msg=" + forceFailMsg.warning() + ']');
+ }
+
if (log.isDebugEnabled()) {
log.debug("Failed to restore closed connection, reconnect disabled, " +
"local node segmented [networkTimeout=" + spi.netTimeout + ']');
@@ -1445,7 +1480,9 @@ class ClientImpl extends TcpDiscoveryImpl {
if (state == STARTING || state == CONNECTED) {
if (log.isDebugEnabled()) {
log.debug("Failed to restore closed connection, will try to reconnect " +
- "[networkTimeout=" + spi.netTimeout + ", joinTimeout=" + spi.joinTimeout + ']');
+ "[networkTimeout=" + spi.netTimeout +
+ ", joinTimeout=" + spi.joinTimeout +
+ ", failMsg=" + forceFailMsg + ']');
}
state = DISCONNECTED;
@@ -1468,7 +1505,36 @@ class ClientImpl extends TcpDiscoveryImpl {
UUID newId = UUID.randomUUID();
- if (log.isInfoEnabled()) {
+ if (forceFailMsg != null) {
+ long delay = IgniteSystemProperties.getLong(IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY,
+ 10_000);
+
+ if (delay > 0) {
+ U.quietAndWarn(log, "Local node was dropped from cluster due to network problems, " +
+ "will try to reconnect with new id after " + delay + "ms (reconnect delay " +
+ "can be changed using IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY system " +
+ "property) [" +
+ "newId=" + newId +
+ ", prevId=" + locNode.id() +
+ ", locNode=" + locNode +
+ ", nodeInitiatedFail=" + forceFailMsg.creatorNodeId() +
+ ", msg=" + forceFailMsg.warning() + ']');
+
+ Thread.sleep(delay);
+ }
+ else {
+ U.quietAndWarn(log, "Local node was dropped from cluster due to network problems, " +
+ "will try to reconnect with new id [" +
+ "newId=" + newId +
+ ", prevId=" + locNode.id() +
+ ", locNode=" + locNode +
+ ", nodeInitiatedFail=" + forceFailMsg.creatorNodeId() +
+ ", msg=" + forceFailMsg.warning() + ']');
+ }
+
+ forceFailMsg = null;
+ }
+ else if (log.isInfoEnabled()) {
log.info("Client node disconnected from cluster, will try to reconnect with new id " +
"[newId=" + newId + ", prevId=" + locNode.id() + ", locNode=" + locNode + ']');
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/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 40da281..f33566c 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
@@ -775,6 +775,8 @@ class ServerImpl extends TcpDiscoveryImpl {
msg.warning(warning);
+ msg.force(true);
+
msgWorker.addMessage(msg);
}
}
@@ -4610,8 +4612,12 @@ class ServerImpl extends TcpDiscoveryImpl {
else {
boolean contains;
+ UUID creatorId = msg.creatorNodeId();
+
+ assert creatorId != null : msg;
+
synchronized (mux) {
- contains = failedNodes.containsKey(sndNode);
+ contains = failedNodes.containsKey(sndNode) || ring.node(creatorId) == null;
}
if (contains) {
@@ -4623,25 +4629,29 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
- UUID nodeId = msg.failedNodeId();
+ UUID failedNodeId = msg.failedNodeId();
long order = msg.order();
- TcpDiscoveryNode node = ring.node(nodeId);
+ TcpDiscoveryNode failedNode = ring.node(failedNodeId);
- if (node != null && node.internalOrder() != order) {
+ if (failedNode != null && failedNode.internalOrder() != order) {
if (log.isDebugEnabled())
log.debug("Ignoring node failed message since node internal order does not match " +
- "[msg=" + msg + ", node=" + node + ']');
+ "[msg=" + msg + ", node=" + failedNode + ']');
return;
}
- if (node != null) {
- assert !node.isLocal() || !msg.verified() : msg;
+ if (failedNode != null) {
+ assert !failedNode.isLocal() || !msg.verified() : msg;
- synchronized (mux) {
- if (!failedNodes.containsKey(node))
- failedNodes.put(node, msg.senderNodeId() != null ? msg.senderNodeId() : getLocalNodeId());
+ boolean skipUpdateFailedNodes = msg.force() && !msg.verified();
+
+ if (!skipUpdateFailedNodes) {
+ synchronized (mux) {
+ if (!failedNodes.containsKey(failedNode))
+ failedNodes.put(failedNode, msg.senderNodeId() != null ? msg.senderNodeId() : getLocalNodeId());
+ }
}
}
else {
@@ -4668,11 +4678,11 @@ class ServerImpl extends TcpDiscoveryImpl {
}
if (msg.verified()) {
- node = ring.removeNode(nodeId);
+ failedNode = ring.removeNode(failedNodeId);
- interruptPing(node);
+ interruptPing(failedNode);
- assert node != null;
+ assert failedNode != null;
long topVer;
@@ -4698,16 +4708,18 @@ class ServerImpl extends TcpDiscoveryImpl {
}
synchronized (mux) {
- failedNodes.remove(node);
+ failedNodes.remove(failedNode);
- leavingNodes.remove(node);
+ leavingNodes.remove(failedNode);
- failedNodesMsgSent.remove(node.id());
+ failedNodesMsgSent.remove(failedNode.id());
- ClientMessageWorker worker = clientMsgWorkers.remove(node.id());
+ if (!msg.force()) { // ClientMessageWorker will stop after sending force fail message.
+ ClientMessageWorker worker = clientMsgWorkers.remove(failedNode.id());
- if (worker != null)
- worker.interrupt();
+ if (worker != null)
+ worker.interrupt();
+ }
}
if (msg.warning() != null && !msg.creatorNodeId().equals(getLocalNodeId())) {
@@ -4719,10 +4731,10 @@ class ServerImpl extends TcpDiscoveryImpl {
}
synchronized (mux) {
- joiningNodes.remove(node.id());
+ joiningNodes.remove(failedNode.id());
}
- notifyDiscovery(EVT_NODE_FAILED, topVer, node);
+ notifyDiscovery(EVT_NODE_FAILED, topVer, failedNode);
spi.stats.onNodeFailed();
}
@@ -6317,7 +6329,12 @@ class ServerImpl extends TcpDiscoveryImpl {
spi.failureDetectionTimeout() : spi.getSocketTimeout());
}
- success = true;
+ boolean clientFailed = msg instanceof TcpDiscoveryNodeFailedMessage &&
+ ((TcpDiscoveryNodeFailedMessage)msg).failedNodeId().equals(clientNodeId);
+
+ assert !clientFailed || msg.force() : msg;
+
+ success = !clientFailed;
}
catch (IgniteCheckedException | IOException e) {
if (log.isDebugEnabled())
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
index 783a113..e982b2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
@@ -48,6 +48,9 @@ public abstract class TcpDiscoveryAbstractMessage implements Serializable {
/** */
protected static final int CLIENT_ACK_FLAG_POS = 4;
+ /** */
+ protected static final int FORCE_FAIL_FLAG_POS = 8;
+
/** Sender of the message (transient). */
private transient UUID sndNodeId;
@@ -205,6 +208,24 @@ public abstract class TcpDiscoveryAbstractMessage implements Serializable {
}
/**
+ * Get force fail node flag.
+ *
+ * @return Force fail node flag.
+ */
+ public boolean force() {
+ return getFlag(FORCE_FAIL_FLAG_POS);
+ }
+
+ /**
+ * Sets force fail node flag.
+ *
+ * @param force Force fail node flag.
+ */
+ public void force(boolean force) {
+ setFlag(FORCE_FAIL_FLAG_POS, force);
+ }
+
+ /**
* @return Pending message index.
*/
public short pendingIndex() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
new file mode 100644
index 0000000..d29231e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
@@ -0,0 +1,322 @@
+/*
+ * 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.spi.communication.tcp;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.nio.GridCommunicationClient;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+
+/**
+ *
+ */
+public class TcpCommunicationSpiDropNodesTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Nodes count. */
+ private static final int NODES_CNT = 4;
+
+ /** Block. */
+ private static volatile boolean block;
+
+ /** Predicate. */
+ private static IgniteBiPredicate<ClusterNode, ClusterNode> pred;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setClockSyncFrequency(300000);
+ cfg.setFailureDetectionTimeout(1000);
+
+ TestCommunicationSpi spi = new TestCommunicationSpi();
+
+ spi.setIdleConnectionTimeout(100);
+ spi.setSharedMemoryPort(-1);
+
+ TcpDiscoverySpi discoSpi = (TcpDiscoverySpi) cfg.getDiscoverySpi();
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setCommunicationSpi(spi);
+ cfg.setDiscoverySpi(discoSpi);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ block = false;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testOneNode() throws Exception {
+ pred = new IgniteBiPredicate<ClusterNode, ClusterNode>() {
+ @Override public boolean apply(ClusterNode locNode, ClusterNode rmtNode) {
+ return block && rmtNode.order() == 3;
+ }
+ };
+
+ startGrids(NODES_CNT);
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ grid(0).events().localListen(new IgnitePredicate<Event>() {
+ @Override
+ public boolean apply(Event event) {
+ latch.countDown();
+
+ return true;
+ }
+ }, EVT_NODE_FAILED);
+
+ U.sleep(1000); // Wait for write timeout and closing idle connections.
+
+ block = true;
+
+ grid(0).compute().broadcast(new IgniteRunnable() {
+ @Override public void run() {
+ // No-op.
+ }
+ });
+
+ assertTrue(latch.await(15, TimeUnit.SECONDS));
+
+ assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return grid(3).cluster().topologyVersion() == NODES_CNT + 1;
+ }
+ }, 5000));
+
+ for (int i = 0; i < 10; i++) {
+ U.sleep(1000);
+
+ assertEquals(NODES_CNT - 1, grid(0).cluster().nodes().size());
+
+ int liveNodesCnt = 0;
+
+ for (int j = 0; j < NODES_CNT; j++) {
+ IgniteEx ignite;
+
+ try {
+ ignite = grid(j);
+
+ log.info("Checking topology for grid(" + j + "): " + ignite.cluster().nodes());
+
+ ClusterNode locNode = ignite.localNode();
+
+ if (locNode.order() != 3) {
+ assertEquals(NODES_CNT - 1, ignite.cluster().nodes().size());
+
+ for (ClusterNode node : ignite.cluster().nodes())
+ assertTrue(node.order() != 3);
+
+ liveNodesCnt++;
+ }
+ }
+ catch (Exception e) {
+ log.info("Checking topology for grid(" + j + "): no grid in topology.");
+ }
+ }
+
+ assertEquals(NODES_CNT - 1, liveNodesCnt);
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTwoNodesEachOther() throws Exception {
+ pred = new IgniteBiPredicate<ClusterNode, ClusterNode>() {
+ @Override public boolean apply(ClusterNode locNode, ClusterNode rmtNode) {
+ return block && (locNode.order() == 2 || locNode.order() == 4) &&
+ (rmtNode.order() == 2 || rmtNode.order() == 4);
+ }
+ };
+
+ startGrids(NODES_CNT);
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ grid(0).events().localListen(new IgnitePredicate<Event>() {
+ @Override
+ public boolean apply(Event event) {
+ latch.countDown();
+
+ return true;
+ }
+ }, EVT_NODE_FAILED);
+
+ U.sleep(1000); // Wait for write timeout and closing idle connections.
+
+ block = true;
+
+ final CyclicBarrier barrier = new CyclicBarrier(2);
+
+ IgniteInternalFuture<Void> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ grid(1).compute().withNoFailover().broadcast(new IgniteRunnable() {
+ @Override public void run() {
+ // No-op.
+ }
+ });
+
+ return null;
+ }
+ });
+
+ IgniteInternalFuture<Void> fut2 = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ grid(3).compute().withNoFailover().broadcast(new IgniteRunnable() {
+ @Override public void run() {
+ // No-op.
+ }
+ });
+
+ return null;
+ }
+ });
+
+ assertTrue(latch.await(5, TimeUnit.SECONDS));
+
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return grid(2).cluster().nodes().size() == NODES_CNT - 1;
+ }
+ }, 5000);
+
+ try {
+ fut1.get();
+ }
+ catch (IgniteCheckedException e) {
+ // No-op.
+ }
+
+ try {
+ fut2.get();
+ }
+ catch (IgniteCheckedException e) {
+ // No-op.
+ }
+
+ long failedNodeOrder = 1 + 2 + 3 + 4;
+
+ for (ClusterNode node : grid(0).cluster().nodes())
+ failedNodeOrder -= node.order();
+
+ for (int i = 0; i < 10; i++) {
+ U.sleep(1000);
+
+ assertEquals(NODES_CNT - 1, grid(0).cluster().nodes().size());
+
+ int liveNodesCnt = 0;
+
+ for (int j = 0; j < NODES_CNT; j++) {
+ IgniteEx ignite;
+
+ try {
+ ignite = grid(j);
+
+ log.info("Checking topology for grid(" + j + "): " + ignite.cluster().nodes());
+
+ ClusterNode locNode = ignite.localNode();
+
+ if (locNode.order() != failedNodeOrder) {
+ assertEquals(NODES_CNT - 1, ignite.cluster().nodes().size());
+
+ for (ClusterNode node : ignite.cluster().nodes())
+ assertTrue(node.order() != failedNodeOrder);
+
+ liveNodesCnt++;
+ }
+ }
+ catch (Exception e) {
+ log.info("Checking topology for grid(" + j + "): no grid in topology.");
+ }
+ }
+
+ assertEquals(NODES_CNT - 1, liveNodesCnt);
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCommunicationSpi extends TcpCommunicationSpi {
+ /** {@inheritDoc} */
+ @Override protected GridCommunicationClient createTcpClient(ClusterNode node) throws IgniteCheckedException {
+ if (pred.apply(getLocalNode(), node)) {
+ Map<String, Object> attrs = new HashMap<>(node.attributes());
+
+ attrs.put(createAttributeName(ATTR_ADDRS), Collections.singleton("127.0.0.1"));
+ attrs.put(createAttributeName(ATTR_PORT), 47200);
+ attrs.put(createAttributeName(ATTR_EXT_ADDRS), Collections.emptyList());
+ attrs.put(createAttributeName(ATTR_HOST_NAMES), Collections.emptyList());
+
+ ((TcpDiscoveryNode)node).setAttributes(attrs);
+ }
+
+ return super.createTcpClient(node);
+ }
+
+ /**
+ * @param name Name.
+ */
+ private String createAttributeName(String name) {
+ return getClass().getSimpleName() + '.' + name;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
new file mode 100644
index 0000000..6e99487
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
@@ -0,0 +1,270 @@
+/*
+ * 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.spi.communication.tcp;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.nio.GridCommunicationClient;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+
+/**
+ * Tests that faulty client will be failed if connection can't be established.
+ */
+public class TcpCommunicationSpiFaultyClientTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Predicate. */
+ private static final IgnitePredicate<ClusterNode> PRED = new IgnitePredicate<ClusterNode>() {
+ @Override public boolean apply(ClusterNode node) {
+ return block && node.order() == 3;
+ }
+ };
+
+ /** Client mode. */
+ private static boolean clientMode;
+
+ /** Block. */
+ private static volatile boolean block;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setClockSyncFrequency(300000);
+ cfg.setFailureDetectionTimeout(1000);
+ cfg.setClientMode(clientMode);
+
+ TestCommunicationSpi spi = new TestCommunicationSpi();
+
+ spi.setIdleConnectionTimeout(100);
+ spi.setSharedMemoryPort(-1);
+
+ TcpDiscoverySpi discoSpi = (TcpDiscoverySpi) cfg.getDiscoverySpi();
+
+ discoSpi.setIpFinder(IP_FINDER);
+ discoSpi.setClientReconnectDisabled(true);
+
+ cfg.setCommunicationSpi(spi);
+ cfg.setDiscoverySpi(discoSpi);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ block = false;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNoServerOnHost() throws Exception {
+ testFailClient(null);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNotAcceptedConnection() throws Exception {
+ testFailClient(new FakeServer());
+ }
+
+ /**
+ * @param srv Server.
+ * @throws Exception If failed.
+ */
+ private void testFailClient(FakeServer srv) throws Exception {
+ IgniteInternalFuture<Long> fut = null;
+
+ try {
+ if (srv != null)
+ fut = GridTestUtils.runMultiThreadedAsync(srv, 1, "fake-server");
+
+ clientMode = false;
+
+ startGrids(2);
+
+ clientMode = true;
+
+ startGrid(2);
+ startGrid(3);
+
+ U.sleep(1000); // Wait for write timeout and closing idle connections.
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ grid(0).events().localListen(new IgnitePredicate<Event>() {
+ @Override
+ public boolean apply(Event event) {
+ latch.countDown();
+
+ return true;
+ }
+ }, EVT_NODE_FAILED);
+
+ block = true;
+
+ try {
+ grid(0).compute(grid(0).cluster().forClients()).withNoFailover().broadcast(new IgniteRunnable() {
+ @Override public void run() {
+ // No-op.
+ }
+ });
+ }
+ catch (IgniteException e) {
+ // No-op.
+ }
+
+ assertTrue(latch.await(3, TimeUnit.SECONDS));
+
+ assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return grid(0).cluster().forClients().nodes().size() == 1;
+ }
+ }, 5000));
+
+ for (int i = 0; i < 5; i++) {
+ U.sleep(1000);
+
+ log.info("Check topology (" + (i + 1) + "): " + grid(0).cluster().nodes());
+
+ assertEquals(1, grid(0).cluster().forClients().nodes().size());
+ }
+ }
+ finally {
+ if (srv != null) {
+ srv.stop();
+
+ assert fut != null;
+
+ fut.get();
+ }
+
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * Server that emulates connection troubles.
+ */
+ private static class FakeServer implements Runnable {
+ /** Server. */
+ private final ServerSocket srv;
+
+ /** Stop. */
+ private volatile boolean stop;
+
+ /**
+ * Default constructor.
+ */
+ FakeServer() throws IOException {
+ this.srv = new ServerSocket(47200, 50, InetAddress.getByName("127.0.0.1"));
+ }
+
+ /**
+ *
+ */
+ public void stop() {
+ stop = true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ try {
+ while (!stop) {
+ try {
+ U.sleep(10);
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ // No-op.
+ }
+ }
+ }
+ finally {
+ U.closeQuiet(srv);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCommunicationSpi extends TcpCommunicationSpi {
+ /** {@inheritDoc} */
+ @Override protected GridCommunicationClient createTcpClient(ClusterNode node) throws IgniteCheckedException {
+ if (PRED.apply(node)) {
+ Map<String, Object> attrs = new HashMap<>(node.attributes());
+
+ attrs.put(createAttributeName(ATTR_ADDRS), Collections.singleton("127.0.0.1"));
+ attrs.put(createAttributeName(ATTR_PORT), 47200);
+ attrs.put(createAttributeName(ATTR_EXT_ADDRS), Collections.emptyList());
+ attrs.put(createAttributeName(ATTR_HOST_NAMES), Collections.emptyList());
+
+ ((TcpDiscoveryNode)node).setAttributes(attrs);
+ }
+
+ return super.createTcpClient(node);
+ }
+
+ /**
+ * @param name Name.
+ */
+ private String createAttributeName(String name) {
+ return getClass().getSimpleName() + '.' + name;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java
index e0e8eba..6365443 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestNode.java
@@ -82,6 +82,7 @@ public class GridTestNode extends GridMetadataAwareAdapter implements ClusterNod
private void initAttributes() {
attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, "10");
attrs.put(IgniteNodeAttributes.ATTR_GRID_NAME, "null");
+ attrs.put(IgniteNodeAttributes.ATTR_CLIENT_MODE, false);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 9f507e6..ffaec4f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -102,6 +102,7 @@ import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY;
import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -173,6 +174,7 @@ public abstract class GridAbstractTest extends TestCase {
static {
System.setProperty(IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, "10000");
System.setProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER, "false");
+ System.setProperty(IGNITE_DISCO_FAILED_CLIENT_RECONNECT_DELAY, "1");
if (BINARY_MARSHALLER)
GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
index c557fbb..ddc2551 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
@@ -35,6 +35,8 @@ import org.apache.ignite.spi.communication.tcp.GridTcpCommunicationSpiTcpFailure
import org.apache.ignite.spi.communication.tcp.GridTcpCommunicationSpiTcpNoDelayOffSelfTest;
import org.apache.ignite.spi.communication.tcp.GridTcpCommunicationSpiTcpSelfTest;
import org.apache.ignite.spi.communication.tcp.IgniteTcpCommunicationRecoveryAckClosureSelfTest;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpiDropNodesTest;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpiFaultyClientTest;
/**
* Test suite for all communication SPIs.
@@ -72,6 +74,9 @@ public class IgniteSpiCommunicationSelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(GridTcpCommunicationSpiConfigSelfTest.class));
+ suite.addTest(new TestSuite(TcpCommunicationSpiFaultyClientTest.class));
+ suite.addTest(new TestSuite(TcpCommunicationSpiDropNodesTest.class));
+
return suite;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9aaf035/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index 7e0d20b..9f56877 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -633,7 +633,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
assertEquals(2, qry.getAll().size());
- Throwable throwable = GridTestUtils.assertThrowsInherited(log, new GridPlainCallable<Void>() {
+ GridTestUtils.assertThrows(log, new GridPlainCallable<Void>() {
@Override public Void call() throws Exception {
QueryCursor<Cache.Entry<Integer, Type1>> qry =
cache.query(new SqlQuery<Integer, Type1>(Type1.class, "FROM Type1"));
@@ -642,11 +642,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
return null;
}
- }, RuntimeException.class, null);
-
- assertNotNull(throwable);
-
- assertTrue(throwable instanceof IgniteException || throwable instanceof CacheException);
+ }, CacheException.class, null);
}
/**
[14/50] [abbrv] ignite git commit: Revert "IGNITE-4363: SQL: fixed
inner property updates for DML operations."
Posted by yz...@apache.org.
Revert "IGNITE-4363: SQL: fixed inner property updates for DML operations."
This reverts commit 70cd8e452b94b806a2fe6fe00b4b67ce80eb4373.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bb1ac0a5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bb1ac0a5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bb1ac0a5
Branch: refs/heads/ignite-comm-balance-master
Commit: bb1ac0a5cfecf4af7e8dcfe86efc75997895c431
Parents: e6cc8cd
Author: devozerov <vo...@gridgain.com>
Authored: Wed Feb 8 13:40:02 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Feb 8 13:40:02 2017 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 16 +--
.../processors/query/GridQueryProcessor.java | 81 ++++----------
.../processors/query/GridQueryProperty.java | 21 ++--
.../query/h2/DmlStatementsProcessor.java | 69 ++++++------
.../query/h2/dml/UpdatePlanBuilder.java | 105 ++++++-------------
...niteCacheAbstractInsertSqlQuerySelfTest.java | 4 -
.../IgniteCacheAbstractSqlDmlQuerySelfTest.java | 2 +-
.../IgniteCacheInsertSqlQuerySelfTest.java | 22 ----
.../cache/IgniteCacheMergeSqlQuerySelfTest.java | 24 -----
.../IgniteCacheUpdateSqlQuerySelfTest.java | 63 ++---------
.../h2/GridIndexingSpiAbstractSelfTest.java | 5 -
11 files changed, 111 insertions(+), 301 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/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 f0179ca..0656dda 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
@@ -2358,13 +2358,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
prop.parent(parent);
- // Add parent property before its possible nested properties so that
- // resulting parent column comes before columns corresponding to those
- // nested properties in the resulting table - that way nested
- // properties override will happen properly (first parent, then children).
- type.addProperty(prop, key, true);
-
processAnnotation(key, sqlAnn, txtAnn, field.getType(), prop, type);
+
+ type.addProperty(prop, key, true);
}
}
@@ -2384,13 +2380,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
prop.parent(parent);
- // Add parent property before its possible nested properties so that
- // resulting parent column comes before columns corresponding to those
- // nested properties in the resulting table - that way nested
- // properties override will happen properly (first parent, then children).
- type.addProperty(prop, key, true);
-
processAnnotation(key, sqlAnn, txtAnn, mtd.getReturnType(), prop, type);
+
+ type.addProperty(prop, key, true);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 5bfdde8..a239ee2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -64,7 +64,6 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryObjectEx;
-import org.apache.ignite.internal.binary.BinaryObjectExImpl;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
@@ -1949,7 +1948,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/**
* Description of type property.
*/
- private static class ClassProperty implements GridQueryProperty {
+ private static class ClassProperty extends GridQueryProperty {
/** */
private final PropertyAccessor accessor;
@@ -2042,17 +2041,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
@Override public String toString() {
return S.toString(ClassProperty.class, this);
}
-
- /** {@inheritDoc} */
- @Override public GridQueryProperty parent() {
- return parent;
- }
}
/**
*
*/
- private class BinaryProperty implements GridQueryProperty {
+ private class BinaryProperty extends GridQueryProperty {
/** Property name. */
private String propName;
@@ -2136,17 +2130,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
obj = isKeyProp0 == 1 ? key : val;
}
- if (obj instanceof BinaryObject) {
- BinaryObject obj0 = (BinaryObject) obj;
- return fieldValue(obj0);
- }
- else if (obj instanceof BinaryObjectBuilder) {
- BinaryObjectBuilder obj0 = (BinaryObjectBuilder)obj;
+ assert obj instanceof BinaryObject;
- return obj0.getField(name());
- }
- else
- throw new IgniteCheckedException("Unexpected binary object class [type=" + obj.getClass() + ']');
+ BinaryObject obj0 = (BinaryObject)obj;
+
+ return fieldValue(obj0);
}
/** {@inheritDoc} */
@@ -2156,38 +2144,10 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (obj == null)
return;
- Object srcObj = obj;
-
- if (!(srcObj instanceof BinaryObjectBuilder))
- throw new UnsupportedOperationException("Individual properties can be set for binary builders only");
-
- if (parent != null)
- obj = parent.value(key, val);
-
- boolean needsBuild = false;
-
- if (obj instanceof BinaryObjectExImpl) {
- if (parent == null)
- throw new UnsupportedOperationException("Individual properties can be set for binary builders only");
-
- needsBuild = true;
-
- obj = ((BinaryObjectExImpl)obj).toBuilder();
- }
-
if (!(obj instanceof BinaryObjectBuilder))
throw new UnsupportedOperationException("Individual properties can be set for binary builders only");
setValue0((BinaryObjectBuilder) obj, propName, propVal, type());
-
- if (needsBuild) {
- obj = ((BinaryObjectBuilder) obj).build();
-
- assert parent != null;
-
- // And now let's set this newly constructed object to parent
- setValue0((BinaryObjectBuilder) srcObj, parent.propName, obj, obj.getClass());
- }
}
/**
@@ -2264,11 +2224,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
return isKeyProp0 == 1;
}
-
- /** {@inheritDoc} */
- @Override public GridQueryProperty parent() {
- return parent;
- }
}
/**
@@ -2352,12 +2307,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public GridQueryProperty property(String name) {
- GridQueryProperty res = props.get(name);
-
- if (res == null)
- res = uppercaseProps.get(name.toUpperCase());
-
- return res;
+ return getProperty(name);
}
/** {@inheritDoc} */
@@ -2365,7 +2315,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
@Override public <T> T value(String field, Object key, Object val) throws IgniteCheckedException {
assert field != null;
- GridQueryProperty prop = property(field);
+ GridQueryProperty prop = getProperty(field);
if (prop == null)
throw new IgniteCheckedException("Failed to find field '" + field + "' in type '" + name + "'.");
@@ -2379,7 +2329,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throws IgniteCheckedException {
assert field != null;
- GridQueryProperty prop = property(field);
+ GridQueryProperty prop = getProperty(field);
if (prop == null)
throw new IgniteCheckedException("Failed to find field '" + field + "' in type '" + name + "'.");
@@ -2519,6 +2469,19 @@ public class GridQueryProcessor extends GridProcessorAdapter {
fields.put(name, prop.type());
}
+ /**
+ * @param field Property name.
+ * @return Property with given field name.
+ */
+ private GridQueryProperty getProperty(String field) {
+ GridQueryProperty res = props.get(field);
+
+ if (res == null)
+ res = uppercaseProps.get(field.toUpperCase());
+
+ return res;
+ }
+
/** {@inheritDoc} */
@Override public boolean valueTextIndex() {
return valTextIdx;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java
index fb4c037..5d74a2e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java
@@ -22,7 +22,11 @@ import org.apache.ignite.IgniteCheckedException;
/**
* Description and access method for query entity field.
*/
-public interface GridQueryProperty {
+public abstract class GridQueryProperty {
+ /** */
+ public GridQueryProperty() {
+ }
+
/**
* Gets this property value from the given object.
*
@@ -31,7 +35,7 @@ public interface GridQueryProperty {
* @return Property value.
* @throws IgniteCheckedException If failed.
*/
- public Object value(Object key, Object val) throws IgniteCheckedException;
+ public abstract Object value(Object key, Object val) throws IgniteCheckedException;
/**
* Sets this property value for the given object.
@@ -41,26 +45,21 @@ public interface GridQueryProperty {
* @param propVal Property value.
* @throws IgniteCheckedException If failed.
*/
- public void setValue(Object key, Object val, Object propVal) throws IgniteCheckedException;
+ public abstract void setValue(Object key, Object val, Object propVal) throws IgniteCheckedException;
/**
* @return Property name.
*/
- public String name();
+ public abstract String name();
/**
* @return Class member type.
*/
- public Class<?> type();
+ public abstract Class<?> type();
/**
* Property ownership flag.
* @return {@code true} if this property belongs to key, {@code false} if it belongs to value.
*/
- public boolean key();
-
- /**
- * @return Parent property or {@code null} if this property is not nested.
- */
- public GridQueryProperty parent();
+ public abstract boolean key();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index 7995083..4030758 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -59,6 +59,7 @@ import org.apache.ignite.internal.processors.query.GridQueryProperty;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.h2.dml.FastUpdateArguments;
+import org.apache.ignite.internal.processors.query.h2.dml.KeyValueSupplier;
import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan;
import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
@@ -480,6 +481,7 @@ public class DmlStatementsProcessor {
while (it.hasNext()) {
List<?> e = it.next();
Object key = e.get(0);
+ Object val = (hasNewVal ? e.get(valColIdx) : e.get(1));
Object newVal;
@@ -498,6 +500,9 @@ public class DmlStatementsProcessor {
if (newVal == null)
throw new IgniteSQLException("New value for UPDATE must not be null", IgniteQueryErrorCode.NULL_VALUE);
+ if (bin && !(val instanceof BinaryObject))
+ val = cctx.grid().binary().toBinary(val);
+
// Skip key and value - that's why we start off with 2nd column
for (int i = 0; i < plan.tbl.getColumns().length - 2; i++) {
Column c = plan.tbl.getColumn(i + 2);
@@ -509,10 +514,13 @@ public class DmlStatementsProcessor {
boolean hasNewColVal = newColVals.containsKey(c.getName());
- if (!hasNewColVal)
+ // Binary objects get old field values from the Builder, so we can skip what we're not updating
+ if (bin && !hasNewColVal)
continue;
- Object colVal = newColVals.get(c.getName());
+ // Column values that have been explicitly specified have priority over field values in old or new _val
+ // If no value given for the column, then we expect to find it in value, and not in key - hence null arg.
+ Object colVal = hasNewColVal ? newColVals.get(c.getName()) : prop.value(null, val);
// UPDATE currently does not allow to modify key or its fields, so we must be safe to pass null as key.
desc.setColumnValue(null, newVal, colVal, i);
@@ -688,8 +696,8 @@ public class DmlStatementsProcessor {
// If we have just one item to put, just do so
if (plan.rowsNum == 1) {
- IgniteBiTuple t = rowToKeyValue(cctx, cursor.iterator().next(),
- plan);
+ IgniteBiTuple t = rowToKeyValue(cctx, cursor.iterator().next().toArray(), plan.colNames, plan.colTypes, plan.keySupplier,
+ plan.valSupplier, plan.keyColIdx, plan.valColIdx, desc);
cctx.cache().put(t.getKey(), t.getValue());
return 1;
@@ -701,7 +709,8 @@ public class DmlStatementsProcessor {
for (Iterator<List<?>> it = cursor.iterator(); it.hasNext();) {
List<?> row = it.next();
- IgniteBiTuple t = rowToKeyValue(cctx, row, plan);
+ IgniteBiTuple t = rowToKeyValue(cctx, row.toArray(), plan.colNames, plan.colTypes, plan.keySupplier, plan.valSupplier,
+ plan.keyColIdx, plan.valColIdx, desc);
rows.put(t.getKey(), t.getValue());
@@ -733,7 +742,8 @@ public class DmlStatementsProcessor {
// If we have just one item to put, just do so
if (plan.rowsNum == 1) {
- IgniteBiTuple t = rowToKeyValue(cctx, cursor.iterator().next(), plan);
+ IgniteBiTuple t = rowToKeyValue(cctx, cursor.iterator().next().toArray(), plan.colNames, plan.colTypes,
+ plan.keySupplier, plan.valSupplier, plan.keyColIdx, plan.valColIdx, desc);
if (cctx.cache().putIfAbsent(t.getKey(), t.getValue()))
return 1;
@@ -758,7 +768,8 @@ public class DmlStatementsProcessor {
while (it.hasNext()) {
List<?> row = it.next();
- final IgniteBiTuple t = rowToKeyValue(cctx, row, plan);
+ final IgniteBiTuple t = rowToKeyValue(cctx, row.toArray(), plan.colNames, plan.colTypes, plan.keySupplier,
+ plan.valSupplier, plan.keyColIdx, plan.valColIdx, desc);
rows.put(t.getKey(), new InsertEntryProcessor(t.getValue()));
@@ -826,14 +837,21 @@ public class DmlStatementsProcessor {
* Convert row presented as an array of Objects into key-value pair to be inserted to cache.
* @param cctx Cache context.
* @param row Row to process.
- * @param plan Update plan.
+ * @param cols Query cols.
+ * @param colTypes Column types to convert data from {@code row} to.
+ * @param keySupplier Key instantiation method.
+ * @param valSupplier Key instantiation method.
+ * @param keyColIdx Key column index, or {@code -1} if no key column is mentioned in {@code cols}.
+ * @param valColIdx Value column index, or {@code -1} if no value column is mentioned in {@code cols}.
+ * @param rowDesc Row descriptor.
* @throws IgniteCheckedException if failed.
*/
@SuppressWarnings({"unchecked", "ConstantConditions", "ResultOfMethodCallIgnored"})
- private IgniteBiTuple<?, ?> rowToKeyValue(GridCacheContext cctx, List<?> row, UpdatePlan plan)
- throws IgniteCheckedException {
- Object key = plan.keySupplier.apply(row);
- Object val = plan.valSupplier.apply(row);
+ private IgniteBiTuple<?, ?> rowToKeyValue(GridCacheContext cctx, Object[] row, String[] cols,
+ int[] colTypes, KeyValueSupplier keySupplier, KeyValueSupplier valSupplier, int keyColIdx, int valColIdx,
+ GridH2RowDescriptor rowDesc) throws IgniteCheckedException {
+ Object key = keySupplier.apply(F.asList(row));
+ Object val = valSupplier.apply(F.asList(row));
if (key == null)
throw new IgniteSQLException("Key for INSERT or MERGE must not be null", IgniteQueryErrorCode.NULL_KEY);
@@ -841,32 +859,13 @@ public class DmlStatementsProcessor {
if (val == null)
throw new IgniteSQLException("Value for INSERT or MERGE must not be null", IgniteQueryErrorCode.NULL_VALUE);
- GridQueryTypeDescriptor desc = plan.tbl.rowDescriptor().type();
-
- Map<String, Object> newColVals = new HashMap<>();
-
- for (int i = 0; i < plan.colNames.length; i++) {
- if (i == plan.keyColIdx || i == plan.valColIdx)
- continue;
-
- newColVals.put(plan.colNames[i], convert(row.get(i), plan.colNames[i],
- plan.tbl.rowDescriptor(), plan.colTypes[i]));
- }
-
- // We update columns in the order specified by the table for a reason - table's
- // column order preserves their precedence for correct update of nested properties.
- Column[] cols = plan.tbl.getColumns();
+ GridQueryTypeDescriptor desc = rowDesc.type();
- // First 2 columns are _key and _val, skip 'em.
- for (int i = 2; i < cols.length; i++) {
- String colName = cols[i].getName();
-
- if (!newColVals.containsKey(colName))
+ for (int i = 0; i < cols.length; i++) {
+ if (i == keyColIdx || i == valColIdx)
continue;
- Object colVal = newColVals.get(colName);
-
- desc.setValue(colName, key, val, colVal);
+ desc.setValue(cols[i], key, val, convert(row[i], cols[i], rowDesc, colTypes[i]));
}
if (cctx.binaryMarshaller()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
index ce2971a..fdcd164 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
@@ -48,7 +48,6 @@ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlTable;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlUnion;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlUpdate;
import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.h2.command.Prepared;
import org.h2.table.Column;
@@ -193,8 +192,8 @@ public final class UpdatePlanBuilder {
hasValProps = true;
}
- KeyValueSupplier keySupplier = createSupplier(cctx, desc.type(), keyColIdx, hasKeyProps, true, false);
- KeyValueSupplier valSupplier = createSupplier(cctx, desc.type(), valColIdx, hasValProps, false, false);
+ KeyValueSupplier keySupplier = createSupplier(cctx, desc.type(), keyColIdx, hasKeyProps, true);
+ KeyValueSupplier valSupplier = createSupplier(cctx, desc.type(), valColIdx, hasValProps, false);
if (stmt instanceof GridSqlMerge)
return UpdatePlan.forMerge(tbl.dataTable(), colNames, colTypes, keySupplier, valSupplier, keyColIdx,
@@ -254,6 +253,8 @@ public final class UpdatePlanBuilder {
GridSqlSelect sel;
if (stmt instanceof GridSqlUpdate) {
+ boolean bin = desc.context().binaryMarshaller();
+
List<GridSqlColumn> updatedCols = ((GridSqlUpdate) stmt).cols();
int valColIdx = -1;
@@ -281,10 +282,20 @@ public final class UpdatePlanBuilder {
if (hasNewVal)
valColIdx += 2;
- int newValColIdx = (hasNewVal ? valColIdx : 1);
+ int newValColIdx;
+
+ if (!hasProps) // No distinct properties, only whole new value - let's take it
+ newValColIdx = valColIdx;
+ else if (bin) // We update distinct columns in binary mode - let's choose correct index for the builder
+ newValColIdx = (hasNewVal ? valColIdx : 1);
+ else // Distinct properties, non binary mode - let's instantiate.
+ newValColIdx = -1;
- KeyValueSupplier newValSupplier = createSupplier(desc.context(), desc.type(), newValColIdx, hasProps,
- false, true);
+ // We want supplier to take present value only in case of binary mode as it will create
+ // whole new object as a result anyway, so we don't need to copy previous property values explicitly.
+ // Otherwise we always want it to instantiate new object whose properties we will later
+ // set to current values.
+ KeyValueSupplier newValSupplier = createSupplier(desc.context(), desc.type(), newValColIdx, hasProps, false);
sel = DmlAstUtils.selectForUpdate((GridSqlUpdate) stmt, errKeysPos);
@@ -308,11 +319,11 @@ public final class UpdatePlanBuilder {
* @param hasProps Whether column list affects individual properties of key or value.
* @param key Whether supplier should be created for key or for value.
* @return Closure returning key or value.
- * @throws IgniteCheckedException If failed.
+ * @throws IgniteCheckedException
*/
@SuppressWarnings({"ConstantConditions", "unchecked"})
private static KeyValueSupplier createSupplier(final GridCacheContext<?, ?> cctx, GridQueryTypeDescriptor desc,
- final int colIdx, boolean hasProps, final boolean key, boolean forUpdate) throws IgniteCheckedException {
+ final int colIdx, boolean hasProps, final boolean key) throws IgniteCheckedException {
final String typeName = key ? desc.keyTypeName() : desc.valueTypeName();
//Try to find class for the key locally.
@@ -321,10 +332,15 @@ public final class UpdatePlanBuilder {
boolean isSqlType = GridQueryProcessor.isSqlType(cls);
- // If we don't need to construct anything from scratch, just return value from given list.
- if (isSqlType || !hasProps) {
+ // If we don't need to construct anything from scratch, just return value from array.
+ if (isSqlType || !hasProps || !cctx.binaryMarshaller()) {
if (colIdx != -1)
- return new PlainValueSupplier(colIdx);
+ return new KeyValueSupplier() {
+ /** {@inheritDoc} */
+ @Override public Object apply(List<?> arg) throws IgniteCheckedException {
+ return arg.get(colIdx);
+ }
+ };
else if (isSqlType)
// Non constructable keys and values (SQL types) must be present in the query explicitly.
throw new IgniteCheckedException((key ? "Key" : "Value") + " is missing from query");
@@ -336,12 +352,7 @@ public final class UpdatePlanBuilder {
return new KeyValueSupplier() {
/** {@inheritDoc} */
@Override public Object apply(List<?> arg) throws IgniteCheckedException {
- Object obj = arg.get(colIdx);
-
- if (obj == null)
- return null;
-
- BinaryObject bin = cctx.grid().binary().toBinary(obj);
+ BinaryObject bin = cctx.grid().binary().toBinary(arg.get(colIdx));
return cctx.grid().binary().builder(bin);
}
@@ -358,26 +369,6 @@ public final class UpdatePlanBuilder {
}
}
else {
- if (colIdx != -1) {
- if (forUpdate && colIdx == 1) {
- // It's the case when the old value has to be taken as the basis for the new one on UPDATE,
- // so we have to clone it. And on UPDATE we don't expect any key supplier.
- assert !key;
-
- return new KeyValueSupplier() {
- /** {@inheritDoc} */
- @Override public Object apply(List<?> arg) throws IgniteCheckedException {
- byte[] oldPropBytes = cctx.marshaller().marshal(arg.get(1));
-
- // colVal is another object now, we can mutate it
- return cctx.marshaller().unmarshal(oldPropBytes, U.resolveClassLoader(cctx.gridConfig()));
- }
- };
- }
- else // We either are not updating, or the new value is given explicitly, no cloning needed.
- return new PlainValueSupplier(colIdx);
- }
-
Constructor<?> ctor;
try {
@@ -399,12 +390,8 @@ public final class UpdatePlanBuilder {
return ctor0.newInstance();
}
catch (Exception e) {
- if (S.INCLUDE_SENSITIVE)
- throw new IgniteCheckedException("Failed to instantiate " +
- (key ? "key" : "value") + " [type=" + typeName + ']', e);
- else
- throw new IgniteCheckedException("Failed to instantiate " +
- (key ? "key" : "value") + '.', e);
+ throw new IgniteCheckedException("Failed to invoke default ctor for " +
+ (key ? "key" : "value"), e);
}
}
};
@@ -418,12 +405,8 @@ public final class UpdatePlanBuilder {
return GridUnsafe.allocateInstance(cls);
}
catch (InstantiationException e) {
- if (S.INCLUDE_SENSITIVE)
- throw new IgniteCheckedException("Failed to instantiate " +
- (key ? "key" : "value") + " [type=" + typeName + ']', e);
- else
- throw new IgniteCheckedException("Failed to instantiate " +
- (key ? "key" : "value") + '.', e);
+ throw new IgniteCheckedException("Failed to invoke default ctor for " +
+ (key ? "key" : "value"), e);
}
}
};
@@ -431,6 +414,8 @@ public final class UpdatePlanBuilder {
}
}
+
+
/**
* @param target Expression to extract the table from.
* @return Back end table for this element.
@@ -498,26 +483,4 @@ public final class UpdatePlanBuilder {
return false;
}
-
- /**
- * Simple supplier that just takes specified element of a given row.
- */
- private final static class PlainValueSupplier implements KeyValueSupplier {
- /** Index of column to use. */
- private final int colIdx;
-
- /**
- * Constructor.
- *
- * @param colIdx Column index.
- */
- private PlainValueSupplier(int colIdx) {
- this.colIdx = colIdx;
- }
-
- /** {@inheritDoc} */
- @Override public Object apply(List<?> arg) throws IgniteCheckedException {
- return arg.get(colIdx);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
index 626846b..86d01c7 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
@@ -46,8 +46,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import static org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes;
-
/**
*
*/
@@ -128,8 +126,6 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends GridComm
createCaches();
else
createBinaryCaches();
-
- ignite(0).createCache(cacheConfig("I2AT", true, false, Integer.class, AllTypes.class));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
index 3c92fdf..649012f 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
@@ -65,7 +65,7 @@ public abstract class IgniteCacheAbstractSqlDmlQuerySelfTest extends GridCommonA
/**
* @return whether {@link #marsh} is an instance of {@link BinaryMarshaller} or not.
*/
- protected boolean isBinaryMarshaller() {
+ private boolean isBinaryMarshaller() {
return marsh instanceof BinaryMarshaller;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
index f91f405..e9c21dc 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
@@ -17,8 +17,6 @@
package org.apache.ignite.internal.processors.cache;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.concurrent.Callable;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCache;
@@ -204,24 +202,4 @@ public class IgniteCacheInsertSqlQuerySelfTest extends IgniteCacheAbstractInsert
assertEquals(createPerson(2, "Alex"), p.get(new Key4(2)));
}
-
- /**
- *
- */
- public void testNestedFieldsHandling() {
- IgniteCache<Integer, IgniteCacheUpdateSqlQuerySelfTest.AllTypes> p = ignite(0).cache("I2AT");
-
- p.query(new SqlFieldsQuery("insert into AllTypes(_key, innerTypeCol, arrListCol, _val, innerStrCol) " +
- "values (1, ?, ?, ?, 'sss')") .setArgs(new IgniteCacheUpdateSqlQuerySelfTest.AllTypes.InnerType(50L),
- new ArrayList<>(Arrays.asList(3L, 2L, 1L)), new IgniteCacheUpdateSqlQuerySelfTest.AllTypes(1L)));
-
- IgniteCacheUpdateSqlQuerySelfTest.AllTypes res = p.get(1);
-
- IgniteCacheUpdateSqlQuerySelfTest.AllTypes.InnerType resInner = new IgniteCacheUpdateSqlQuerySelfTest.AllTypes.InnerType(50L);
-
- resInner.innerStrCol = "sss";
- resInner.arrListCol = new ArrayList<>(Arrays.asList(3L, 2L, 1L));
-
- assertEquals(resInner, res.innerTypeCol);
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java
index d9a2d9e..32b7a12 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java
@@ -17,13 +17,9 @@
package org.apache.ignite.internal.processors.cache;
-import java.util.ArrayList;
-import java.util.Arrays;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.SqlFieldsQuery;
-import static org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes;
-
/**
*
*/
@@ -153,24 +149,4 @@ public class IgniteCacheMergeSqlQuerySelfTest extends IgniteCacheAbstractInsertS
assertEquals(createPerson(2, "Alex"), p.get(new Key4(2)));
}
-
- /**
- *
- */
- public void testNestedFieldsHandling() {
- IgniteCache<Integer, AllTypes> p = ignite(0).cache("I2AT");
-
- p.query(new SqlFieldsQuery("merge into AllTypes(_key, innerTypeCol, arrListCol, _val, innerStrCol) " +
- "values (1, ?, ?, ?, 'sss')") .setArgs(new AllTypes.InnerType(50L),
- new ArrayList<>(Arrays.asList(3L, 2L, 1L)), new AllTypes(1L)));
-
- AllTypes res = p.get(1);
-
- AllTypes.InnerType resInner = new AllTypes.InnerType(50L);
-
- resInner.innerStrCol = "sss";
- resInner.arrListCol = new ArrayList<>(Arrays.asList(3L, 2L, 1L));
-
- assertEquals(resInner, res.innerTypeCol);
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
index c3d9d8e..575f617 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
@@ -44,12 +44,6 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
ignite(0).createCache(createAllTypesCacheConfig());
}
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
- ignite(0).cache("L2AT").clear();
- }
-
/**
*
*/
@@ -188,19 +182,17 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
cache.query(new SqlFieldsQuery("insert into \"AllTypes\"(_key, _val, \"dateCol\", \"booleanCol\"," +
"\"tsCol\") values(2, ?, '2016-11-30 12:00:00', false, DATE '2016-12-01')").setArgs(new AllTypes(2L)));
- // Look ma, no hands: first we set value of inner object column (innerTypeCol), then update only one of its
- // fields (innerLongCol), while leaving another inner property (innerStrCol) as specified by innerTypeCol.
- cache.query(new SqlFieldsQuery("update \"AllTypes\" set \"innerLongCol\" = ?, \"doubleCol\" = CAST('50' as INT)," +
+ cache.query(new SqlFieldsQuery("select \"primitiveIntsCol\" from \"AllTypes\"")).getAll();
+
+ cache.query(new SqlFieldsQuery("update \"AllTypes\" set \"doubleCol\" = CAST('50' as INT)," +
" \"booleanCol\" = 80, \"innerTypeCol\" = ?, \"strCol\" = PI(), \"shortCol\" = " +
"CAST(WEEK(PARSEDATETIME('2016-11-30', 'yyyy-MM-dd')) as VARCHAR), " +
"\"sqlDateCol\"=TIMESTAMP '2016-12-02 13:47:00', \"tsCol\"=TIMESTAMPADD('MI', 2, " +
"DATEADD('DAY', 2, \"tsCol\")), \"primitiveIntsCol\" = ?, \"bytesCol\" = ?")
- .setArgs(5, new AllTypes.InnerType(80L), new int[] {2, 3}, new Byte[] {4, 5, 6}));
+ .setArgs(new AllTypes.InnerType(80L), new int[] {2, 3}, new Byte[] {4, 5, 6}));
AllTypes res = (AllTypes) cache.get(2L);
- assertNotNull(res);
-
assertEquals(new BigDecimal(301.0).doubleValue(), res.bigDecimalCol.doubleValue());
assertEquals(50.0, res.doubleCol);
assertEquals(2L, (long) res.longCol);
@@ -210,11 +202,7 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
assertTrue(Arrays.equals(new Byte[] {4, 5, 6}, res.bytesCol));
assertTrue(Arrays.deepEquals(new Integer[] {0, 1}, res.intsCol));
assertTrue(Arrays.equals(new int[] {2, 3}, res.primitiveIntsCol));
-
- AllTypes.InnerType expInnerType = new AllTypes.InnerType(80L);
- expInnerType.innerLongCol = 5L;
-
- assertEquals(expInnerType, res.innerTypeCol);
+ assertEquals(new AllTypes.InnerType(80L), res.innerTypeCol);
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm:SS").parse("2016-11-30 12:00:00"), res.dateCol);
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm:SS").parse("2016-12-03 00:02:00"), res.tsCol);
assertEquals(2, res.intCol);
@@ -225,45 +213,6 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
assertEquals(49, res.shortCol);
}
- /** */
- public void testSingleInnerFieldUpdate() throws ParseException {
- IgniteCache cache = ignite(0).cache("L2AT");
-
- cache.query(new SqlFieldsQuery("insert into \"AllTypes\"(_key, _val, \"dateCol\", \"booleanCol\") values(2, ?," +
- "'2016-11-30 12:00:00', false)").setArgs(new AllTypes(2L)));
-
- assertFalse(cache.query(new SqlFieldsQuery("select * from \"AllTypes\"")).getAll().isEmpty());
-
- cache.query(new SqlFieldsQuery("update \"AllTypes\" set \"innerLongCol\" = 5"));
-
- AllTypes res = (AllTypes) cache.get(2L);
-
- assertNotNull(res);
-
- assertEquals(new BigDecimal(301.0).doubleValue(), res.bigDecimalCol.doubleValue());
- assertEquals(3.01, res.doubleCol);
- assertEquals(2L, (long) res.longCol);
- assertFalse(res.booleanCol);
-
- assertEquals("2", res.strCol);
- assertTrue(Arrays.equals(new byte[] {0, 1}, res.primitiveBytesCol));
- assertTrue(Arrays.deepEquals(new Byte[] {0, 1}, res.bytesCol));
- assertTrue(Arrays.deepEquals(new Integer[] {0, 1}, res.intsCol));
- assertTrue(Arrays.equals(new int[] {0, 1}, res.primitiveIntsCol));
-
- AllTypes.InnerType expInnerType = new AllTypes.InnerType(2L);
- expInnerType.innerLongCol = 5L;
-
- assertEquals(expInnerType, res.innerTypeCol);
- assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm:SS").parse("2016-11-30 12:00:00"), res.dateCol);
- assertNull(res.tsCol);
- assertEquals(2, res.intCol);
- assertEquals(AllTypes.EnumType.ENUMTRUE, res.enumCol);
- assertNull(res.sqlDateCol);
-
- assertEquals(-23000, res.shortCol);
- }
-
/**
*
*/
@@ -359,7 +308,7 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
InnerType innerTypeCol;
/** */
- static class InnerType implements Serializable {
+ static final class InnerType implements Serializable {
/** */
@QuerySqlField
Long innerLongCol;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bb1ac0a5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 69285f1..e412828 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -578,11 +578,6 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
@Override public boolean key() {
return false;
}
-
- /** */
- @Override public GridQueryProperty parent() {
- return null;
- }
};
}
[26/50] [abbrv] ignite git commit: ignite-3994 GridContinuousHandler
cleanup on client disconnect. This closes #1496.
Posted by yz...@apache.org.
ignite-3994 GridContinuousHandler cleanup on client disconnect.
This closes #1496.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2f4bdbb6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2f4bdbb6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2f4bdbb6
Branch: refs/heads/ignite-comm-balance-master
Commit: 2f4bdbb674e5634ce4c1a3432dede4c865977fde
Parents: 543a65f
Author: vdpyatkov <vp...@gridgain.com>
Authored: Fri Feb 10 15:08:45 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Feb 10 15:09:53 2017 +0300
----------------------------------------------------------------------
.../internal/GridEventConsumeHandler.java | 5 +
.../internal/GridMessageListenHandler.java | 5 +
.../continuous/CacheContinuousQueryHandler.java | 16 ++
.../continuous/GridContinuousHandler.java | 5 +
.../continuous/GridContinuousProcessor.java | 3 +
.../ClientReconnectContinuousQueryTest.java | 201 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite3.java | 2 +
7 files changed, 237 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f4bdbb6/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
index 68d34ce..0395434 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
@@ -392,6 +392,11 @@ class GridEventConsumeHandler implements GridContinuousHandler {
}
/** {@inheritDoc} */
+ @Override public void onClientDisconnected() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
@Override public void onBatchAcknowledged(UUID routineId, GridContinuousBatch batch, GridKernalContext ctx) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f4bdbb6/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
index 0eeaa8a..88d4450 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
@@ -199,6 +199,11 @@ public class GridMessageListenHandler implements GridContinuousHandler {
}
/** {@inheritDoc} */
+ @Override public void onClientDisconnected() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
@Override public void onBatchAcknowledged(UUID routineId, GridContinuousBatch batch, GridKernalContext ctx) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f4bdbb6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index a9a7d7c..b3f0684 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -854,6 +854,15 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
return ctx.security().enabled() ? ctx.task().resolveTaskName(taskHash) : null;
}
+ /** {@inheritDoc} */
+ @Override public void onClientDisconnected() {
+ if (internal)
+ return;
+
+ for (PartitionRecovery rec : rcvs.values())
+ rec.resetTopologyCache();
+ }
+
/**
* @param ctx Context.
* @param partId Partition id.
@@ -972,6 +981,13 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
}
/**
+ * Resets cached topology.
+ */
+ void resetTopologyCache() {
+ curTop = AffinityTopologyVersion.NONE;
+ }
+
+ /**
* Add continuous entry.
*
* @param cctx Cache context.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f4bdbb6/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
index f14b450..2a3a052 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
@@ -99,6 +99,11 @@ public interface GridContinuousHandler extends Externalizable, Cloneable {
public GridContinuousBatch createBatch();
/**
+ * Client node disconnected callback.
+ */
+ public void onClientDisconnected();
+
+ /**
* Called when ack for a batch is received from client.
*
* @param routineId Routine ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f4bdbb6/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index 9fd9b6d..b9f42e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -912,6 +912,9 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
unregisterRemote(e.getKey());
}
+ for (LocalRoutineInfo routine : locInfos.values())
+ routine.hnd.onClientDisconnected();
+
rmtInfos.clear();
clientInfos.clear();
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f4bdbb6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
new file mode 100644
index 0000000..feded14
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
@@ -0,0 +1,201 @@
+/*
+ * 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.cache.query.continuous;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.cache.event.CacheEntryListenerException;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.events.EventType;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.managers.communication.GridIoManager;
+import org.apache.ignite.internal.util.nio.GridNioServer;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class ClientReconnectContinuousQueryTest extends GridCommonAbstractTest {
+ /** Client index. */
+ private static final int CLIENT_IDX = 1;
+
+ /** Puts before reconnect. */
+ private static final int PUTS_BEFORE_RECONNECT = 50;
+
+ /** Puts after reconnect. */
+ private static final int PUTS_AFTER_RECONNECT = 50;
+
+ /** Recon latch. */
+ private static final CountDownLatch reconLatch = new CountDownLatch(1);
+
+ /** Discon latch. */
+ private static final CountDownLatch disconLatch = new CountDownLatch(1);
+
+ /** Updater received. */
+ private static final CountDownLatch updaterReceived = new CountDownLatch(PUTS_BEFORE_RECONNECT);
+
+ /** Receiver after reconnect. */
+ private static final CountDownLatch receiverAfterReconnect = new CountDownLatch(PUTS_AFTER_RECONNECT);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpCommunicationSpi commSpi = (TcpCommunicationSpi)cfg.getCommunicationSpi();
+
+ commSpi.setSlowClientQueueLimit(50);
+ commSpi.setIdleConnectionTimeout(300_000);
+
+ if (getTestGridName(CLIENT_IDX).equals(gridName))
+ cfg.setClientMode(true);
+ else {
+ CacheConfiguration ccfg = defaultCacheConfiguration();
+
+ cfg.setCacheConfiguration(ccfg);
+ }
+
+ return cfg;
+ }
+
+ /**
+ * Test client reconnect to alive grid.
+ *
+ * @throws Exception If failed.
+ */
+ public void testClientReconnect() throws Exception {
+ try {
+ startGrids(2);
+
+ IgniteEx client = grid(CLIENT_IDX);
+
+ client.events().localListen(new DisconnectListener(), EventType.EVT_CLIENT_NODE_DISCONNECTED);
+
+ client.events().localListen(new ReconnectListener(), EventType.EVT_CLIENT_NODE_RECONNECTED);
+
+ IgniteCache cache = client.cache(null);
+
+ ContinuousQuery qry = new ContinuousQuery();
+
+ qry.setLocalListener(new CQListener());
+
+ cache.query(qry);
+
+ putSomeKeys(PUTS_BEFORE_RECONNECT);
+
+ info("updaterReceived Count: " + updaterReceived.getCount());
+
+ assertTrue(updaterReceived.await(10_000, TimeUnit.MILLISECONDS));
+
+ skipRead(client, true);
+
+ putSomeKeys(1_000);
+
+ assertTrue(disconLatch.await(10_000, TimeUnit.MILLISECONDS));
+
+ skipRead(client, false);
+
+ assertTrue(reconLatch.await(10_000, TimeUnit.MILLISECONDS));
+
+ putSomeKeys(PUTS_AFTER_RECONNECT);
+
+ info("receiverAfterReconnect Count: " + receiverAfterReconnect.getCount());
+
+ assertTrue(receiverAfterReconnect.await(10_000, TimeUnit.MILLISECONDS));
+ }
+ finally {
+ stopAllGrids();
+ }
+
+ }
+
+ /**
+ *
+ */
+ private static class ReconnectListener implements IgnitePredicate<Event> {
+ /** {@inheritDoc} */
+ @Override public boolean apply(Event evt) {
+ reconLatch.countDown();
+
+ return false;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class DisconnectListener implements IgnitePredicate<Event> {
+ /** {@inheritDoc} */
+ @Override public boolean apply(Event evt) {
+ disconLatch.countDown();
+
+ return false;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class CQListener implements CacheEntryUpdatedListener {
+ /** {@inheritDoc} */
+ @Override public void onUpdated(Iterable iterable) throws CacheEntryListenerException {
+ if (reconLatch.getCount() != 0) {
+ for (Object o : iterable)
+ updaterReceived.countDown();
+ }
+ else {
+ for (Object o : iterable)
+ receiverAfterReconnect.countDown();
+ }
+ }
+ }
+
+ /**
+ * @param cnt Number of keys.
+ */
+ private void putSomeKeys(int cnt) {
+ IgniteEx ignite = grid(0);
+
+ IgniteCache<Object, Object> srvCache = ignite.cache(null);
+
+ for (int i = 0; i < cnt; i++)
+ srvCache.put(0, i);
+ }
+
+ /**
+ * @param igniteClient Ignite client.
+ * @param skip Skip.
+ */
+ private void skipRead(IgniteEx igniteClient, boolean skip) {
+ GridIoManager ioMgr = igniteClient.context().io();
+
+ TcpCommunicationSpi commSpi = (TcpCommunicationSpi)((Object[])U.field(ioMgr, "spis"))[0];
+
+ GridNioServer nioSrvr = U.field(commSpi, "nioSrvr");
+
+ GridTestUtils.setFieldValue(nioSrvr, "skipRead", skip);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f4bdbb6/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
index a865788..07125a6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.cache.query.continuous.CacheKeepBin
import org.apache.ignite.internal.processors.cache.query.continuous.CacheKeepBinaryIterationTest;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheKeepBinaryIterationStoreEnabledTest;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheKeepBinaryIterationSwapEnabledTest;
+import org.apache.ignite.internal.processors.cache.query.continuous.ClientReconnectContinuousQueryTest;
import org.apache.ignite.internal.processors.cache.query.continuous.ContinuousQueryRemoteFilterMissingInClassPathSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicNearEnabledSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicOffheapTieredTest;
@@ -123,6 +124,7 @@ public class IgniteCacheQuerySelfTestSuite3 extends TestSuite {
suite.addTestSuite(CacheKeepBinaryIterationNearEnabledTest.class);
suite.addTestSuite(IgniteCacheContinuousQueryBackupQueueTest.class);
suite.addTestSuite(IgniteCacheContinuousQueryNoUnsubscribeTest.class);
+ suite.addTestSuite(ClientReconnectContinuousQueryTest.class);
return suite;
}
[17/50] [abbrv] ignite git commit: IGNITE-4676 Fixed hang if closure
executed nested internal task with continuation. Added test.
Posted by yz...@apache.org.
IGNITE-4676 Fixed hang if closure executed nested internal task with continuation. Added test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e7a53079
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e7a53079
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e7a53079
Branch: refs/heads/ignite-comm-balance-master
Commit: e7a5307911dff1df93d003b2ef98aeca96a89dac
Parents: db5da76
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Feb 9 16:44:41 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Feb 9 16:44:41 2017 +0700
----------------------------------------------------------------------
.../internal/processors/job/GridJobWorker.java | 4 +
.../internal/GridContinuousTaskSelfTest.java | 79 ++++++++++++++++++++
2 files changed, 83 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7a53079/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
index 6a00d96..acefde7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
@@ -617,6 +617,10 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
// Finish here only if not held by this thread.
if (!HOLD.get())
finishJob(res, ex, sndRes);
+ else
+ // Make sure flag is not set for current thread.
+ // This may happen in case of nested internal task call with continuation.
+ HOLD.set(false);
ctx.job().currentTaskSession(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7a53079/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
index 88667d9..d224fc5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
@@ -21,10 +21,12 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
+import java.util.concurrent.Callable;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
@@ -43,7 +45,9 @@ import org.apache.ignite.compute.ComputeTaskSession;
import org.apache.ignite.compute.ComputeTaskSessionAttributeListener;
import org.apache.ignite.compute.ComputeTaskSessionFullSupport;
import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.JobContextResource;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.resources.TaskContinuousMapperResource;
@@ -51,6 +55,7 @@ import org.apache.ignite.resources.TaskSessionResource;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.common.GridCommonTest;
+import org.jetbrains.annotations.Nullable;
/**
* Continuous task test.
@@ -195,6 +200,80 @@ public class GridContinuousTaskSelfTest extends GridCommonAbstractTest {
}
}
+ /**
+ * @throws Exception If test failed.
+ */
+ public void testClosureWithNestedInternalTask() throws Exception {
+ try {
+ IgniteEx ignite = startGrid(0);
+
+ ComputeTaskInternalFuture<String> fut = ignite.context().closure().callAsync(GridClosureCallMode.BALANCE, new Callable<String>() {
+ /** */
+ @IgniteInstanceResource
+ private IgniteEx g;
+
+ @Override public String call() throws Exception {
+ return g.compute(g.cluster()).execute(NestedHoldccTask.class, null);
+ }
+ }, ignite.cluster().nodes());
+
+ assertEquals("DONE", fut.get(3000));
+ }
+ finally {
+ stopGrid(0, true);
+ }
+ }
+
+ /** Test task with continuation. */
+ @GridInternal
+ public static class NestedHoldccTask extends ComputeTaskAdapter<String, String> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ @Nullable String arg) throws IgniteException {
+ Map<ComputeJob, ClusterNode> map = new HashMap<>();
+
+ for (ClusterNode node : subgrid)
+ map.put(new NestedHoldccJob(), node);
+
+ return map;
+
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public String reduce(List<ComputeJobResult> results) throws IgniteException {
+ return results.get(0).getData();
+ }
+ }
+
+ /** Test job. */
+ public static class NestedHoldccJob extends ComputeJobAdapter {
+ /** */
+ @JobContextResource
+ private ComputeJobContext jobCtx;
+
+ /** */
+ private int cnt = 0;
+
+ /** {@inheritDoc} */
+ @Override public Object execute() throws IgniteException {
+ if (cnt < 1) {
+ cnt++;
+
+ jobCtx.holdcc();
+
+ new Timer().schedule(new TimerTask() {
+ @Override public void run() {
+ jobCtx.callcc();
+ }
+ }, 500);
+
+ return "NOT DONE";
+ }
+
+ return "DONE";
+ }
+ }
+
/** */
@SuppressWarnings({"PublicInnerClass"})
public static class TestMultipleHoldccCallsClosure implements IgniteClosure<Object, Boolean> {
[39/50] [abbrv] ignite git commit: IGNITE-4472 UI fix, minor fixes
Posted by yz...@apache.org.
IGNITE-4472 UI fix, minor fixes
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/79e1e536
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/79e1e536
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/79e1e536
Branch: refs/heads/ignite-comm-balance-master
Commit: 79e1e536e5a6ee366da94f563355429635cbfdd2
Parents: 4923734
Author: Andrey Novikov <an...@gridgain.com>
Authored: Tue Feb 14 23:28:06 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Tue Feb 14 23:28:06 2017 +0700
----------------------------------------------------------------------
.../web-console/backend/routes/activities.js | 7 -
.../web-console/backend/services/activities.js | 27 +---
.../backend/test/unit/ActivitiesService.test.js | 131 +++++++++++++++++++
modules/web-console/frontend/app/app.config.js | 4 +
.../activities-user-dialog.controller.js | 39 +-----
.../activities-user-dialog.jade | 2 +-
.../components/activities-user-dialog/index.js | 5 +-
.../form-field-datepicker.jade | 4 +-
.../list-of-registered-users.column-defs.js | 26 ++--
.../list-of-registered-users.controller.js | 32 +++--
.../app/core/activities/Activities.data.js | 5 -
modules/web-console/frontend/app/data/i18n.js | 1 +
.../ui-ace-pom/ui-ace-pom.controller.js | 4 +-
.../frontend/app/modules/agent/agent.module.js | 15 ---
.../modules/configuration/Version.service.js | 13 +-
.../configuration/generator/Maven.service.js | 10 +-
.../configuration/summary/summary.worker.js | 6 +-
modules/web-console/frontend/package.json | 14 +-
.../frontend/public/stylesheets/style.scss | 8 --
.../frontend/public/stylesheets/variables.scss | 1 -
.../views/templates/agent-download.jade | 6 +-
21 files changed, 206 insertions(+), 154 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/backend/routes/activities.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/activities.js b/modules/web-console/backend/routes/activities.js
index 08c27cf..ad0e469 100644
--- a/modules/web-console/backend/routes/activities.js
+++ b/modules/web-console/backend/routes/activities.js
@@ -33,13 +33,6 @@ module.exports.factory = function(express, activitiesService) {
return new Promise((factoryResolve) => {
const router = new express.Router();
- // Get user activities.
- router.get('/user/:userId', (req, res) => {
- activitiesService.listByUser(req.params.userId, req.query)
- .then(res.api.ok)
- .catch(res.api.error);
- });
-
// Post user activities to page.
router.post('/page', (req, res) => {
activitiesService.merge(req.user._id, req.body)
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/backend/services/activities.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/activities.js b/modules/web-console/backend/services/activities.js
index 7f3a777..124c775 100644
--- a/modules/web-console/backend/services/activities.js
+++ b/modules/web-console/backend/services/activities.js
@@ -35,10 +35,12 @@ module.exports.factory = (_, mongo) => {
* Update page activities.
*
* @param {String} owner - User ID
- * @param {Object} page - The page
+ * @param {String} action - Action string presentation.
+ * @param {String} group - Action group string presentation.
+ * @param {Date} [date] - Optional date to save in activity.
* @returns {Promise.<mongo.ObjectId>} that resolve activity
*/
- static merge(owner, {action, group}) {
+ static merge(owner, {action, group}, date = new Date()) {
mongo.Account.findById(owner)
.then((user) => {
user.lastActivity = new Date();
@@ -46,8 +48,6 @@ module.exports.factory = (_, mongo) => {
return user.save();
});
- const date = new Date();
-
date.setDate(1);
date.setHours(0, 0, 0, 0);
@@ -63,25 +63,6 @@ module.exports.factory = (_, mongo) => {
});
}
- /**
- * Get user activities
- * @param {String} owner - User ID
- * @returns {Promise.<mongo.ObjectId>} that resolve activities
- */
- static listByUser(owner, {startDate, endDate}) {
- const $match = {owner};
-
- if (startDate)
- $match.date = {$gte: new Date(startDate)};
-
- if (endDate) {
- $match.date = $match.date || {};
- $match.date.$lt = new Date(endDate);
- }
-
- return mongo.Activities.find($match);
- }
-
static total({startDate, endDate}) {
const $match = {};
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/backend/test/unit/ActivitiesService.test.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/test/unit/ActivitiesService.test.js b/modules/web-console/backend/test/unit/ActivitiesService.test.js
new file mode 100644
index 0000000..40088bf
--- /dev/null
+++ b/modules/web-console/backend/test/unit/ActivitiesService.test.js
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+
+const assert = require('chai').assert;
+const injector = require('../injector');
+const testAccounts = require('../data/accounts.json');
+
+let activitiesService;
+let mongo;
+let db;
+
+const owner = testAccounts[0]._id;
+const group = 'test';
+const action1 = '/test/activity1';
+const action2 = '/test/activity2';
+
+suite('ActivitiesServiceTestsSuite', () => {
+ suiteSetup(() => {
+ return Promise.all([
+ injector('services/activities'),
+ injector('mongo'),
+ injector('dbHelper')
+ ])
+ .then(([_activitiesService, _mongo, _db]) => {
+ mongo = _mongo;
+ activitiesService = _activitiesService;
+ db = _db;
+ });
+ });
+
+ setup(() => db.init());
+
+ test('Activities creation and update', (done) => {
+ activitiesService.merge(owner, { group, action: action1 })
+ .then((activity) => {
+ assert.isNotNull(activity);
+ assert.equal(activity.amount, 1);
+
+ return mongo.Activities.findById(activity._id);
+ })
+ .then((activityDoc) => {
+ assert.isNotNull(activityDoc);
+ assert.equal(activityDoc.amount, 1);
+ })
+ .then(() => activitiesService.merge(owner, { group, action: action1 }))
+ .then((activity) => {
+ assert.isNotNull(activity);
+ assert.equal(activity.amount, 2);
+
+ return mongo.Activities.findById(activity._id);
+ })
+ .then((activityDoc) => {
+ assert.isNotNull(activityDoc);
+ assert.equal(activityDoc.amount, 2);
+ })
+ .then(done)
+ .catch(done);
+ });
+
+ test('Activities total and detail information', (done) => {
+ const startDate = new Date();
+
+ startDate.setDate(1);
+ startDate.setHours(0, 0, 0, 0);
+
+ const endDate = new Date(startDate);
+ endDate.setMonth(endDate.getMonth() + 1);
+
+ Promise.all([
+ activitiesService.merge(owner, {group, action: action1}),
+ activitiesService.merge(owner, {group, action: action2})
+ ])
+ .then(() => activitiesService.total(owner, {startDate, endDate}))
+ .then((activities) =>
+ assert.equal(activities[owner].test, 2)
+ )
+ .then(() => activitiesService.detail(owner, {startDate, endDate}))
+ .then((activities) =>
+ assert.deepEqual(activities[owner], {
+ '/test/activity2': 1, '/test/activity1': 1
+ })
+ )
+ .then(done)
+ .catch(done);
+ });
+
+ test('Activities periods', (done) => {
+ const startDate = new Date();
+
+ startDate.setDate(1);
+ startDate.setHours(0, 0, 0, 0);
+
+ const nextMonth = (baseDate) => {
+ const date = new Date(baseDate);
+
+ date.setMonth(date.getMonth() + 1);
+
+ return date;
+ };
+
+ const borderDate = nextMonth(startDate);
+ const endDate = nextMonth(borderDate);
+
+ activitiesService.merge(owner, { group, action: action1 })
+ .then(() => activitiesService.merge(owner, { group, action: action1 }, borderDate))
+ .then(() => activitiesService.total({ startDate, endDate: borderDate }))
+ .then((activities) =>
+ assert.equal(activities[owner].test, 1)
+ )
+ .then(() => activitiesService.total({ startDate: borderDate, endDate }))
+ .then((activities) =>
+ assert.equal(activities[owner].test, 1)
+ )
+ .then(done)
+ .catch(done);
+ });
+});
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/app.config.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.config.js b/modules/web-console/frontend/app/app.config.js
index 0e85711..39d761f 100644
--- a/modules/web-console/frontend/app/app.config.js
+++ b/modules/web-console/frontend/app/app.config.js
@@ -103,3 +103,7 @@ igniteConsoleCfg.config(['$datepickerProvider', ($datepickerProvider) => {
iconRight: 'icon-datepicker-right'
});
}]);
+
+igniteConsoleCfg.config(['$translateProvider', ($translateProvider) => {
+ $translateProvider.useSanitizeValueStrategy('sanitize');
+}]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js
index 46853b2..078f725 100644
--- a/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js
+++ b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js
@@ -15,46 +15,13 @@
* limitations under the License.
*/
-const COLUMNS_DEFS = [
- {displayName: 'Action', field: 'action', minWidth: 65 },
- {displayName: 'Description', field: 'title', minWidth: 65 },
- {displayName: 'Visited', field: 'amount', minWidth: 65 }
-];
-
export default class ActivitiesCtrl {
- static $inject = ['$state', 'user', 'params', 'IgniteActivitiesData'];
+ static $inject = ['user'];
- constructor($state, user, params, ActivitiesData) {
+ constructor(user) {
const $ctrl = this;
- const userId = user._id;
$ctrl.user = user;
-
- $ctrl.gridOptions = {
- data: [],
- columnVirtualizationThreshold: 30,
- columnDefs: COLUMNS_DEFS,
- categories: [
- {name: 'Action', visible: true, selectable: true},
- {name: 'Description', visible: true, selectable: true},
- {name: 'Visited', visible: true, selectable: true}
- ],
- enableRowSelection: false,
- enableRowHeaderSelection: false,
- enableColumnMenus: false,
- multiSelect: false,
- modifierKeysToMultiSelect: true,
- noUnselect: true,
- flatEntityAccess: true,
- fastWatch: true,
- onRegisterApi: (api) => {
- $ctrl.gridApi = api;
- }
- };
-
- ActivitiesData.listByUser(userId, params)
- .then((data) => {
- $ctrl.data = data;
- });
+ $ctrl.data = _.map(user.activitiesDetail, (amount, action) => ({ action, amount }));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade
index 2c55ebd..074851c 100644
--- a/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade
+++ b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade
@@ -24,7 +24,7 @@
.modal-body.modal-body-with-scroll(id='activities-user-dialog')
table.table.table-striped.table-bordered.table-hover(scrollable-container='#activities-user-dialog' st-table='displayedRows' st-safe-src='ctrl.data')
thead
- th.text-center(st-sort='title') Description
+ th.text-center(st-sort='action | translate') Description
th.text-center(st-sort='action') Action
th.text-center(st-sort='amount') Visited
tbody
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/components/activities-user-dialog/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/index.js b/modules/web-console/frontend/app/components/activities-user-dialog/index.js
index 03d3585..dca6ba9 100644
--- a/modules/web-console/frontend/app/components/activities-user-dialog/index.js
+++ b/modules/web-console/frontend/app/components/activities-user-dialog/index.js
@@ -18,13 +18,12 @@
import controller from './activities-user-dialog.controller';
import templateUrl from './activities-user-dialog.jade';
- export default ['$modal', ($modal) => ({ show = true, user, params }) => {
+ export default ['$modal', ($modal) => ({ show = true, user }) => {
const ActivitiesUserDialog = $modal({
templateUrl,
show,
resolve: {
- user: () => user,
- params: () => params
+ user: () => user
},
placement: 'center',
controller,
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade b/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade
index 6792977..2578cf4 100644
--- a/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade
+++ b/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade
@@ -28,8 +28,8 @@ mixin ignite-form-field-datepicker(label, model, name, disabled, required, place
data-ng-disabled=disabled && '#{disabled}'
bs-datepicker
- data-date-format='MMM yyyy'
- data-start-view='1'
+ data-date-format='MMM yyyy'
+ data-start-view='1'
data-min-view='1'
data-max-date='today'
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
index 61e1bd8..4dc4655 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
@@ -49,7 +49,7 @@ const ACTIONS_TEMPLATE = `
const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a ng-href="mailto:{{ COL_FIELD }}">{{ COL_FIELD }}</a></div>';
export default [
- {displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'test', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, pinnedLeft: true},
+ {displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, pinnedLeft: true},
{displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by name...' }, pinnedLeft: true},
{displayName: 'Email', categoryDisplayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by email...' }},
{displayName: 'Company', categoryDisplayName: 'Company', field: 'company', minWidth: 160, enableFiltering: true},
@@ -62,19 +62,19 @@ export default [
{displayName: 'Caches count', categoryDisplayName: 'Configurations', headerCellTemplate: CACHE_HEADER_TEMPLATE, field: 'counters.caches', type: 'number', headerTooltip: 'Caches count', minWidth: 50, width: 50, enableFiltering: false, visible: false},
{displayName: 'IGFS count', categoryDisplayName: 'Configurations', headerCellTemplate: IGFS_HEADER_TEMPLATE, field: 'counters.igfs', type: 'number', headerTooltip: 'IGFS count', minWidth: 50, width: 50, enableFiltering: false, visible: false},
// Activities Total
- {displayName: 'Cfg', categoryDisplayName: 'Total activities', field: 'activitiesTotal["configuration"] || 0', type: 'number', headerTooltip: 'Configuration', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'Qry', categoryDisplayName: 'Total activities', field: 'activitiesTotal["queries"] || 0', type: 'number', headerTooltip: 'Queries', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'Demo', categoryDisplayName: 'Total activities', field: 'activitiesTotal["demo"] || 0', type: 'number', headerTooltip: 'Demo', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'AD', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/download"] || 0', type: 'number', headerTooltip: 'Agent Download', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'AS', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/start"] || 0', type: 'number', headerTooltip: 'Agent Start', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Cfg', categoryDisplayName: 'Total activities', field: 'activitiesTotal["configuration"] || 0', type: 'number', headerTooltip: 'Total count of configuration usages', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Qry', categoryDisplayName: 'Total activities', field: 'activitiesTotal["queries"] || 0', type: 'number', headerTooltip: 'Total count of queries usages', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Demo', categoryDisplayName: 'Total activities', field: 'activitiesTotal["demo"] || 0', type: 'number', headerTooltip: 'Total count of demo startup', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Dnld', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/download"] || 0', type: 'number', headerTooltip: 'Total count of agent downloads', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Str', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/start"] || 0', type: 'number', headerTooltip: 'Total count of agent startup', minWidth: 50, width: 50, enableFiltering: false},
// Activities Configuration
- {displayName: 'Clusters', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/clusters"] || 0', type: 'number', headerTooltip: 'Configuration Clusters', minWidth: 50, width: 80, enableFiltering: false, visible: false},
- {displayName: 'Model', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/domains"] || 0', type: 'number', headerTooltip: 'Configuration Model', minWidth: 50, width: 80, enableFiltering: false, visible: false},
- {displayName: 'Caches', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/caches"] || 0', type: 'number', headerTooltip: 'Configuration Caches', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Clusters', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/clusters"] || 0', type: 'number', headerTooltip: 'Configuration clusters', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Model', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/domains"] || 0', type: 'number', headerTooltip: 'Configuration model', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Caches', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/caches"] || 0', type: 'number', headerTooltip: 'Configuration caches', minWidth: 50, width: 80, enableFiltering: false, visible: false},
{displayName: 'IGFS', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/igfs"] || 0', type: 'number', headerTooltip: 'Configuration IGFS', minWidth: 50, width: 80, enableFiltering: false, visible: false},
- {displayName: 'Summary', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/summary"] || 0', type: 'number', headerTooltip: 'Configuration Summary', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Summary', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/summary"] || 0', type: 'number', headerTooltip: 'Configuration summary', minWidth: 50, width: 80, enableFiltering: false, visible: false},
// Activities Queries
- {displayName: 'Execute', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/execute"] || 0', type: 'number', headerTooltip: 'Query execute', minWidth: 50, width: 80, enableFiltering: false, visible: false},
- {displayName: 'Explain', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/explain"] || 0', type: 'number', headerTooltip: 'Query explain', minWidth: 50, width: 80, enableFiltering: false, visible: false},
- {displayName: 'Scan', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/scan"] || 0', type: 'number', headerTooltip: 'Scan', minWidth: 50, width: 80, enableFiltering: false, visible: false}
+ {displayName: 'Execute', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/execute"] || 0', type: 'number', headerTooltip: 'Query executions', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Explain', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/explain"] || 0', type: 'number', headerTooltip: 'Query explain executions', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Scan', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/scan"] || 0', type: 'number', headerTooltip: 'Scan query executions', minWidth: 50, width: 80, enableFiltering: false, visible: false}
];
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
index 19f7921..1f2a348 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
@@ -20,15 +20,26 @@ import headerTemplate from 'app/components/ui-grid-header/ui-grid-header.jade';
import columnDefs from './list-of-registered-users.column-defs';
import categories from './list-of-registered-users.categories';
+const rowTemplate = `<div
+ ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.uid"
+ ng-mouseover="grid.api.selection.selectRow(row.entity);"
+ ui-grid-one-bind-id-grid="rowRenderIndex + '-' + col.uid + '-cell'"
+ class="ui-grid-cell"
+ ng-class="{ 'ui-grid-row-header-cell': col.isRowHeader }"
+ role="{{col.isRowHeader ? 'rowheader' : 'gridcell'}}"
+ ui-grid-cell/>`;
+
export default class IgniteListOfRegisteredUsersCtrl {
- static $inject = ['$scope', '$state', '$templateCache', 'User', 'uiGridConstants', 'IgniteAdminData', 'IgniteNotebookData', 'IgniteConfirm', 'IgniteActivitiesUserDialog'];
+ static $inject = ['$scope', '$state', '$filter', '$templateCache', 'User', 'uiGridConstants', 'IgniteAdminData', 'IgniteNotebookData', 'IgniteConfirm', 'IgniteActivitiesUserDialog'];
- constructor($scope, $state, $templateCache, User, uiGridConstants, AdminData, NotebookData, Confirm, ActivitiesUserDialog) {
+ constructor($scope, $state, $filter, $templateCache, User, uiGridConstants, AdminData, NotebookData, Confirm, ActivitiesUserDialog) {
const $ctrl = this;
const companySelectOptions = [];
const countrySelectOptions = [];
+ const dtFilter = $filter('date');
+
$ctrl.params = {
startDate: new Date()
};
@@ -82,7 +93,7 @@ export default class IgniteListOfRegisteredUsersCtrl {
};
const showActivities = (user) => {
- return new ActivitiesUserDialog({ user, params: $ctrl.params });
+ return new ActivitiesUserDialog({ user });
};
$ctrl.gridOptions = {
@@ -91,14 +102,17 @@ export default class IgniteListOfRegisteredUsersCtrl {
columnDefs,
categories,
headerTemplate: $templateCache.get(headerTemplate),
+ rowTemplate,
enableFiltering: true,
- enableRowSelection: false,
+ enableRowSelection: true,
enableRowHeaderSelection: false,
enableColumnMenus: false,
multiSelect: false,
modifierKeysToMultiSelect: true,
noUnselect: true,
fastWatch: true,
+ exporterSuppressColumns: ['actions'],
+ exporterCsvColumnSeparator: ';',
onRegisterApi: (api) => {
$ctrl.gridApi = api;
@@ -139,14 +153,14 @@ export default class IgniteListOfRegisteredUsersCtrl {
.then((data) => $ctrl.adjustHeight(data.length));
};
- $scope.$watch(() => $ctrl.params.startDate, () => {
- const endDate = new Date($ctrl.params.startDate);
+ $scope.$watch(() => $ctrl.params.startDate, (dt) => {
+ $ctrl.gridOptions.exporterCsvFilename = `web_console_users_${dtFilter(dt, 'yyyy_MM')}.csv`;
- endDate.setMonth(endDate.getMonth() + 1);
+ const endDate = new Date(dt);
- $ctrl.params.endDate = endDate;
+ endDate.setMonth(endDate.getMonth() + 1);
- reloadUsers($ctrl.params);
+ reloadUsers({startDate: dtFilter(dt, 'yyyy-MM-dd'), endDate: dtFilter(endDate, 'yyyy-MM-dd')});
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/core/activities/Activities.data.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/core/activities/Activities.data.js b/modules/web-console/frontend/app/core/activities/Activities.data.js
index 8a67a97..8d9447c 100644
--- a/modules/web-console/frontend/app/core/activities/Activities.data.js
+++ b/modules/web-console/frontend/app/core/activities/Activities.data.js
@@ -31,9 +31,4 @@ export default class ActivitiesData {
return this.$http.post('/api/v1/activities/page', { group, action });
}
-
- listByUser(userId, params) {
- return this.$http.get(`/api/v1/activities/user/${userId}`, { params })
- .then(({ data }) => data);
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/data/i18n.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/data/i18n.js b/modules/web-console/frontend/app/data/i18n.js
index bc8c700..3385f60 100644
--- a/modules/web-console/frontend/app/data/i18n.js
+++ b/modules/web-console/frontend/app/data/i18n.js
@@ -23,6 +23,7 @@ export default {
'/configuration/domains': 'Configure domain model',
'/configuration/igfs': 'Configure IGFS',
'/configuration/summary': 'Configurations summary',
+ '/configuration/download': 'Download project',
'/demo/resume': 'Demo resume',
'/demo/reset': 'Demo reset',
'/queries/execute': 'Query execute',
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js b/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js
index 477cf20..0ae1269 100644
--- a/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js
+++ b/modules/web-console/frontend/app/directives/ui-ace-pom/ui-ace-pom.controller.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-export default ['$scope', 'IgniteMavenGenerator', 'IgniteVersion', function($scope, maven, Version) {
+export default ['$scope', 'IgniteMavenGenerator', function($scope, maven) {
const ctrl = this;
// Watchers definition.
@@ -25,7 +25,7 @@ export default ['$scope', 'IgniteMavenGenerator', 'IgniteVersion', function($sco
if (!value)
return;
- ctrl.data = maven.generate($scope.cluster, Version.productVersion().ignite).asString();
+ ctrl.data = maven.generate($scope.cluster);
};
// Setup watchers.
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/modules/agent/agent.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/agent.module.js b/modules/web-console/frontend/app/modules/agent/agent.module.js
index d6fc863..7ac39d1 100644
--- a/modules/web-console/frontend/app/modules/agent/agent.module.js
+++ b/modules/web-console/frontend/app/modules/agent/agent.module.js
@@ -62,21 +62,6 @@ class IgniteAgentMonitor {
this._scope.$$postDigest(() => $state.go(this._scope.backState));
};
- this._scope.downloadAgent = () => {
- const lnk = document.createElement('a');
-
- lnk.setAttribute('href', '/api/v1/agent/download/zip');
- lnk.setAttribute('target', '_self');
- lnk.setAttribute('download', null);
- lnk.style.display = 'none';
-
- document.body.appendChild(lnk);
-
- lnk.click();
-
- document.body.removeChild(lnk);
- };
-
this._scope.hasAgents = null;
this._scope.showModal = false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/modules/configuration/Version.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/Version.service.js b/modules/web-console/frontend/app/modules/configuration/Version.service.js
index f0e9c4c..746b1ed 100644
--- a/modules/web-console/frontend/app/modules/configuration/Version.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/Version.service.js
@@ -23,6 +23,9 @@ const VERSION_MATCHER = /(\d+)\.(\d+)\.(\d+)([-.]([^0123456789][^-]+)(-SNAPSHOT)
const numberComparator = (a, b) => a > b ? 1 : a < b ? -1 : 0;
export default class IgniteVersion {
+ /** Current product version. */
+ static ignite = '1.8.0';
+
/**
* Tries to parse product version from it's string representation.
*
@@ -74,16 +77,6 @@ export default class IgniteVersion {
}
/**
- * Return current product version.
- * @returns {{ignite: string}}
- */
- productVersion() {
- return {
- ignite: '1.8.0'
- };
- }
-
- /**
* Check if node version is newer or same
* @param {String} nodeVer
* @param {String} sinceVer
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
index 2e01761..23a9c4e 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
@@ -16,6 +16,7 @@
*/
import StringBuilder from './StringBuilder';
+import IgniteVersion from 'app/modules/configuration/Version.service';
// Java built-in class names.
import POM_DEPENDENCIES from 'app/data/pom-dependencies.json';
@@ -142,11 +143,10 @@ export default class IgniteMavenGenerator {
* Generate pom.xml.
*
* @param cluster Cluster to take info about dependencies.
- * @param version Ignite version for Ignite dependencies.
- * @param sb Resulting output with generated pom.
+ * @param version Version for Ignite dependencies.
* @returns {string} Generated content.
*/
- generate(cluster, version, sb = new StringBuilder()) {
+ generate(cluster, version = IgniteVersion.ignite) {
const caches = cluster.caches;
const deps = [];
const storeDeps = [];
@@ -162,6 +162,8 @@ export default class IgniteMavenGenerator {
this.addDependency(deps, 'org.apache.ignite', 'ignite-extdata-p2p', version);
});
+ const sb = new StringBuilder();
+
sb.append('<?xml version="1.0" encoding="UTF-8"?>');
sb.emptyLine();
@@ -229,6 +231,6 @@ export default class IgniteMavenGenerator {
this.build(sb, cluster, excludeGroupIds);
- return sb;
+ return sb.asString();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js
index 6b24001..070b6ce 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js
+++ b/modules/web-console/frontend/app/modules/states/configuration/summary/summary.worker.js
@@ -17,8 +17,6 @@
import JSZip from 'jszip';
-import IgniteVersion from 'app/modules/configuration/Version.service';
-
import MavenGenerator from 'app/modules/configuration/generator/Maven.service';
import DockerGenerator from 'app/modules/configuration/generator/Docker.service';
import ReadmeGenerator from 'app/modules/configuration/generator/Readme.service';
@@ -28,8 +26,6 @@ import ConfigurationGenerator from 'app/modules/configuration/generator/Configur
import JavaTransformer from 'app/modules/configuration/generator/JavaTransformer.service';
import SpringTransformer from 'app/modules/configuration/generator/SpringTransformer.service';
-const Version = new IgniteVersion();
-
const maven = new MavenGenerator();
const docker = new DockerGenerator();
const readme = new ReadmeGenerator();
@@ -100,7 +96,7 @@ onmessage = function(e) {
zip.file(`${startupPath}/ClientNodeCodeStartup.java`, java.nodeStartup(cluster, 'startup.ClientNodeCodeStartup',
'ClientConfigurationFactory.createConfiguration()', 'config.ClientConfigurationFactory', clientNearCaches));
- zip.file('pom.xml', maven.generate(cluster, Version.productVersion().ignite).asString());
+ zip.file('pom.xml', maven.generate(cluster));
zip.file('README.txt', readme.generate());
zip.file('jdbc-drivers/README.txt', readme.generateJDBC());
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index 0fde6d4..2d12655 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -35,7 +35,7 @@
"angular-aria": "1.5.11",
"angular-cookies": "1.5.11",
"angular-drag-and-drop-lists": "1.4.0",
- "angular-gridster": "0.13.4",
+ "angular-gridster": "0.13.14",
"angular-motion": "0.4.4",
"angular-nvd3": "1.0.9",
"angular-retina": "0.4.0",
@@ -66,16 +66,16 @@
"devDependencies": {
"assets-webpack-plugin": "3.5.1",
"autoprefixer-core": "6.0.1",
- "babel-core": "6.23.1",
- "babel-eslint": "7.1.1",
+ "babel-core": "6.20.0",
+ "babel-eslint": "7.0.0",
"babel-loader": "6.2.10",
"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-transform-builtin-extend": "1.1.2",
- "babel-plugin-transform-runtime": "6.23.0",
- "babel-polyfill": "6.23.0",
+ "babel-plugin-transform-runtime": "6.15.0",
+ "babel-polyfill": "6.20.0",
"babel-preset-angular": "6.0.15",
- "babel-preset-es2015": "6.22.0",
- "babel-runtime": "6.22.0",
+ "babel-preset-es2015": "6.18.0",
+ "babel-runtime": "6.20.0",
"chai": "3.5.0",
"cross-env": "1.0.8",
"css-loader": "0.26.1",
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 67cfed1..ab7e3dd 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -2331,14 +2331,6 @@ html,body,.splash-screen {
.ui-grid-cell-contents > i {
line-height: $line-height-base;
}
-
- .ui-grid-row:nth-child(odd):hover .ui-grid-cell {
- background: $ignite-row-hover;
- }
-
- .ui-grid-row:nth-child(even):hover .ui-grid-cell {
- background: $ignite-row-hover;
- }
}
.datepicker.dropdown-menu {
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/public/stylesheets/variables.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/variables.scss b/modules/web-console/frontend/public/stylesheets/variables.scss
index e30bbdd..8500eac 100644
--- a/modules/web-console/frontend/public/stylesheets/variables.scss
+++ b/modules/web-console/frontend/public/stylesheets/variables.scss
@@ -26,4 +26,3 @@ $ignite-border-bottom-color: $brand-primary;
$ignite-background-color: #fff;
$ignite-header-color: #555;
$ignite-invalid-color: $brand-primary;
-$ignite-row-hover: #c9dde1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/79e1e536/modules/web-console/frontend/views/templates/agent-download.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/templates/agent-download.jade b/modules/web-console/frontend/views/templates/agent-download.jade
index f57bf1d..f5a6ba0 100644
--- a/modules/web-console/frontend/views/templates/agent-download.jade
+++ b/modules/web-console/frontend/views/templates/agent-download.jade
@@ -23,10 +23,10 @@
span(ng-if='!hasAgents') Connection to Ignite Web Agent is not established
span(ng-if='hasAgents') Connection to Ignite Node is not established
.agent-download(ng-if='!hasAgents')
- p Please download and run #[a(href='javascript:void(0)' ng-click='downloadAgent()') ignite-web-agent] in order to {{::agentGoal}}
+ p Please download and run #[a(href='/api/v1/agent/download/zip' target='_self') ignite-web-agent] in order to {{::agentGoal}}
p For run:
ul
- li Download and unzip #[a(href='javascript:void(0)' ng-click='downloadAgent()') ignite-web-agent] archive
+ li Download and unzip #[a(href='/api/v1/agent/download/zip' target='_self') ignite-web-agent] archive
li Run shell file #[b ignite-web-agent.{sh|bat}]
p Refer to #[b README.txt] in agent folder for more information
.modal-advanced-options
@@ -47,4 +47,4 @@
li Refer to #[b README.txt] in agent folder for more information
.modal-footer
button.btn.btn-default(ng-click='back()') {{::backText}}
- button.btn.btn-primary(ng-if='!hasAgents' ng-click='downloadAgent()') Download agent
+ a.btn.btn-primary(ng-if='!hasAgents' href='/api/v1/agent/download/zip' target='_self') Download agent
[16/50] [abbrv] ignite git commit: ignite-3537 Added tests. This
closes #1441
Posted by yz...@apache.org.
ignite-3537 Added tests.
This closes #1441
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/db5da76a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/db5da76a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/db5da76a
Branch: refs/heads/ignite-comm-balance-master
Commit: db5da76a57734b0509c70cc3afc284310a35fe0f
Parents: 46ff66e
Author: javaller <vo...@gmail.com>
Authored: Wed Feb 8 21:49:57 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Feb 8 21:49:57 2017 +0300
----------------------------------------------------------------------
...CacheAtomicReferenceApiSelfAbstractTest.java | 60 +++++++++++++++++++-
...idCacheAtomicStampedApiSelfAbstractTest.java | 59 +++++++++++++++++++
.../GridCacheQueueApiSelfAbstractTest.java | 58 +++++++++++++++++++
.../GridCacheSetAbstractSelfTest.java | 53 +++++++++++++++++
.../IgniteAtomicLongApiAbstractSelfTest.java | 27 +++++++++
.../IgniteCountDownLatchAbstractSelfTest.java | 43 ++++++++++++++
.../IgniteLockAbstractSelfTest.java | 54 +++++++++++++++++-
.../IgniteSemaphoreAbstractSelfTest.java | 52 ++++++++++++++++-
8 files changed, 403 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5da76a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
index 278bcf9..3c4b3a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
@@ -18,8 +18,15 @@
package org.apache.ignite.internal.processors.cache.datastructures;
import java.util.UUID;
+import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicReference;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.transactions.Transaction;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Basic tests for atomic reference.
@@ -127,4 +134,55 @@ public abstract class GridCacheAtomicReferenceApiSelfAbstractTest extends Ignite
assertTrue(success);
assertEquals("newVal", atomic.get());
}
-}
+
+ /**
+ * Implementation of ignite data structures internally uses special system caches, need make sure
+ * that transaction on these system caches do not intersect with transactions started by user.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIsolation() throws Exception {
+ Ignite ignite = grid(0);
+
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setName("myCache");
+ cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cfg);
+
+ try {
+ String atomicName = UUID.randomUUID().toString();
+
+ String initValue = "qazwsx";
+
+ IgniteAtomicReference<String> atomicReference = ignite.atomicReference(atomicName, initValue, true);
+
+ try (Transaction tx = ignite.transactions().txStart()) {
+ cache.put(1, 1);
+
+ assertEquals(initValue, atomicReference.get());
+
+ assertTrue(atomicReference.compareAndSet(initValue, "aaa"));
+
+ assertEquals("aaa", atomicReference.get());
+
+ tx.rollback();
+
+ assertEquals(0, cache.size());
+ }
+
+ assertTrue(atomicReference.compareAndSet("aaa", null));
+
+ assertNull(atomicReference.get());
+
+ atomicReference.close();
+
+ assertTrue(atomicReference.removed());
+ }
+ finally {
+ ignite.destroyCache(cfg.getName());
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5da76a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java
index 7474330..81300e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java
@@ -18,8 +18,15 @@
package org.apache.ignite.internal.processors.cache.datastructures;
import java.util.UUID;
+import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteAtomicStamped;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.transactions.Transaction;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Basic tests for atomic stamped.
@@ -120,4 +127,56 @@ public abstract class GridCacheAtomicStampedApiSelfAbstractTest extends IgniteAt
assertEquals(null, atomic.value());
assertEquals(null, atomic.stamp());
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testIsolation() throws Exception {
+ Ignite ignite = grid(0);
+
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setName("MyCache");
+ cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cfg);
+
+ try {
+ String atomicName = UUID.randomUUID().toString();
+
+ String initVal = "qwerty";
+ String initStamp = "asdf";
+
+ IgniteAtomicStamped<String, String> atomicStamped = ignite.atomicStamped(atomicName,
+ initVal,
+ initStamp,
+ true);
+
+ try (Transaction tx = ignite.transactions().txStart()) {
+ cache.put(1,1);
+
+ assertEquals(initVal, atomicStamped.value());
+ assertEquals(initStamp, atomicStamped.stamp());
+ assertEquals(initVal, atomicStamped.get().get1());
+ assertEquals(initStamp, atomicStamped.get().get2());
+
+ assertTrue(atomicStamped.compareAndSet(initVal, "b", initStamp, "d"));
+
+ tx.rollback();
+ }
+
+ assertEquals(0, cache.size());
+
+ assertEquals("b", atomicStamped.value());
+ assertEquals("d", atomicStamped.stamp());
+
+ atomicStamped.close();
+
+ assertTrue(atomicStamped.removed());
+ }
+ finally {
+ ignite.destroyCache(cfg.getName());
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5da76a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
index 93d0989..3e7eff9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
@@ -25,6 +25,8 @@ import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteQueue;
import org.apache.ignite.cache.CacheMode;
@@ -38,9 +40,11 @@ import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Queue basic tests.
@@ -772,6 +776,60 @@ public abstract class GridCacheQueueApiSelfAbstractTest extends IgniteCollection
}
/**
+ * Implementation of ignite data structures internally uses special system caches, need make sure
+ * that transaction on these system caches do not intersect with transactions started by user.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIsolation() throws Exception {
+ Ignite ignite = grid(0);
+
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setName("myCache");
+ cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cfg);
+
+ try {
+ String queueName = UUID.randomUUID().toString();
+
+ IgniteQueue<String> queue = grid(0).queue(queueName, 0, config(false));
+
+ try (Transaction tx = ignite.transactions().txStart()) {
+ cache.put(1, 1);
+
+ for (int i = 0; i < QUEUE_CAPACITY; i++)
+ queue.put("Item-" + i);
+
+ tx.rollback();
+ }
+
+ assertEquals(0, cache.size());
+
+ assertEquals(QUEUE_CAPACITY, queue.size());
+
+ queue.remove("Item-1");
+
+ assertEquals(QUEUE_CAPACITY - 1, queue.size());
+
+ assertEquals("Item-0", queue.peek());
+ assertEquals("Item-0", queue.poll());
+ assertEquals("Item-2", queue.poll());
+
+ assertEquals(0, queue.size());
+
+ queue.clear();
+
+ assertTrue(queue.isEmpty());
+ }
+ finally {
+ ignite.destroyCache(cfg.getName());
+ }
+ }
+
+ /**
* Test class with the same hash code.
*/
private static class SameHashItem implements Serializable {
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5da76a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
index 9973b27..5ccb830 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
@@ -28,11 +28,13 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.AssertionFailedError;
+import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteSet;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.CollectionConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -47,9 +49,12 @@ import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Cache set tests.
@@ -948,6 +953,54 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
}
/**
+ * Implementation of ignite data structures internally uses special system caches, need make sure
+ * that transaction on these system caches do not intersect with transactions started by user.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIsolation() throws Exception {
+ CollectionConfiguration colCfg = collectionConfiguration();
+
+ Ignite ignite = grid(0);
+
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setName("myCache");
+ cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cfg);
+
+ try {
+ IgniteSet<Integer> set0 = ignite.set(SET_NAME, colCfg);
+
+ assertNotNull(set0);
+
+ try (Transaction tx = ignite.transactions().txStart()) {
+ cache.put(1, 1);
+
+ Collection<Integer> items = new ArrayList<>(100);
+
+ for (int i = 0; i < 100; i++)
+ items.add(i);
+
+ set0.addAll(items);
+
+ tx.rollback();
+ }
+
+ assertEquals(0, cache.size());
+
+ assertEquals(100, set0.size());
+
+ set0.close();
+ }
+ finally {
+ ignite.destroyCache(cfg.getName());
+ }
+ }
+
+ /**
* @param set Set.
* @param size Expected size.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5da76a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
index 9672265..49a1c72 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
@@ -265,4 +265,31 @@ public abstract class IgniteAtomicLongApiAbstractSelfTest extends IgniteAtomicsA
assert newVal == atomic.get();
}
}
+
+ /**
+ * Implementation of ignite data structures internally uses special system caches, need make sure that
+ * transaction on these system caches do not intersect with transactions started by user.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIsolation() throws Exception {
+ Ignite ignite = grid(0);
+
+ IgniteCache<Object, Object> cache = ignite.cache(TRANSACTIONAL_CACHE_NAME);
+
+ IgniteAtomicLong atomic = ignite.atomicLong("atomic", 0, true);
+
+ long curAtomicVal = atomic.get();
+
+ try (Transaction tx = ignite.transactions().txStart()) {
+ atomic.getAndIncrement();
+
+ cache.put(1, 1);
+
+ tx.rollback();
+ }
+
+ assertEquals(0, cache.size());
+ assertEquals(curAtomicVal + 1, atomic.get());
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5da76a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
index e9b83d9..88966b0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.IgniteCountDownLatch;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.util.typedef.G;
@@ -45,11 +46,14 @@ import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Cache count down latch self test.
@@ -78,6 +82,45 @@ public abstract class IgniteCountDownLatchAbstractSelfTest extends IgniteAtomics
}
/**
+ * Implementation of ignite data structures internally uses special system caches, need make sure
+ * that transaction on these system caches do not intersect with transactions started by user.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIsolation() throws Exception {
+ Ignite ignite = grid(0);
+
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setName("myCache");
+ cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cfg);
+
+ try {
+ IgniteCountDownLatch latch = ignite.countDownLatch("latch1", 10, false, true);
+
+ assertNotNull(latch);
+
+ try (Transaction tx = ignite.transactions().txStart()) {
+ cache.put(1, 1);
+
+ assertEquals(8, latch.countDown(2));
+
+ tx.rollback();
+ }
+
+ assertEquals(0, cache.size());
+
+ assertEquals(7, latch.countDown(1));
+ }
+ finally {
+ ignite.destroyCache(cfg.getName());
+ }
+ }
+
+ /**
* @throws Exception If failed.
*/
private void checkLatch() throws Exception {
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5da76a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
index 388f167..27e05b9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
@@ -34,6 +34,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteCondition;
@@ -42,6 +43,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLock;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -54,6 +56,7 @@ import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
@@ -61,7 +64,9 @@ import org.junit.rules.ExpectedException;
import static java.util.concurrent.TimeUnit.MICROSECONDS;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Cache reentrant lock self test.
@@ -112,8 +117,55 @@ public abstract class IgniteLockAbstractSelfTest extends IgniteAtomicsAbstractTe
}
/**
+ * Implementation of ignite data structures internally uses special system caches, need make sure
+ * that transaction on these system caches do not intersect with transactions started by user.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIsolation() throws Exception {
+ Ignite ignite = grid(0);
+
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setName("myCache");
+ cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cfg);
+
+ try {
+ IgniteLock lock = ignite.reentrantLock("lock", true, true, true);
+
+ try (Transaction tx = ignite.transactions().txStart()) {
+ cache.put(1, 1);
+
+ boolean success = lock.tryLock(1, MILLISECONDS);
+
+ assertTrue(success);
+
+ tx.rollback();
+ }
+
+ assertEquals(0, cache.size());
+
+ assertTrue(lock.isLocked());
+
+ lock.unlock();
+
+ assertFalse(lock.isLocked());
+
+ lock.close();
+
+ assertTrue(lock.removed());
+ }
+ finally {
+ ignite.destroyCache(cfg.getName());
+ }
+ }
+
+ /**
* @param failoverSafe Failover safe flag.
- * @throws Exception
+ * @throws Exception If failed.
*/
private void checkFailover(final boolean failoverSafe, final boolean fair) throws Exception {
IgniteEx g = startGrid(NODES_CNT + 1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5da76a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
index 5241dd1..8ad8631 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
@@ -26,10 +26,12 @@ import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSemaphore;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -42,6 +44,7 @@ import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.testframework.GridStringLogger;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
@@ -49,7 +52,9 @@ import org.junit.rules.ExpectedException;
import static java.util.concurrent.TimeUnit.MICROSECONDS;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.cache.CacheMode.LOCAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* Cache semaphore self test.
@@ -94,8 +99,53 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr
}
/**
+ * Implementation of ignite data structures internally uses special system caches, need make sure
+ * that transaction on these system caches do not intersect with transactions started by user.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIsolation() throws Exception {
+ Ignite ignite = grid(0);
+
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setName("myCache");
+ cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(cfg);
+
+ try {
+ IgniteSemaphore semaphore = ignite.semaphore("testIsolation", 1, true, true);
+
+ assertNotNull(semaphore);
+
+ try (Transaction tx = ignite.transactions().txStart()) {
+ cache.put(1, 1);
+
+ assertEquals(1, semaphore.availablePermits());
+
+ semaphore.acquire();
+
+ tx.rollback();
+ }
+
+ assertEquals(0, cache.size());
+
+ assertEquals(0, semaphore.availablePermits());
+
+ semaphore.close();
+
+ assertTrue(semaphore.removed());
+ }
+ finally {
+ ignite.destroyCache(cfg.getName());
+ }
+ }
+
+ /**
* @param failoverSafe Failover safe flag.
- * @throws Exception
+ * @throws Exception If failed.
*/
private void checkFailover(boolean failoverSafe) throws Exception {
IgniteEx g = startGrid(NODES_CNT + 1);
[28/50] [abbrv] ignite git commit: IGNITE-4688: Changed copyrights to
2017.
Posted by yz...@apache.org.
IGNITE-4688: Changed copyrights to 2017.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5245214d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5245214d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5245214d
Branch: refs/heads/ignite-comm-balance-master
Commit: 5245214d316437b8ba82093cd356204083aee75b
Parents: d949b73
Author: devozerov <vo...@gridgain.com>
Authored: Mon Feb 13 13:04:37 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Feb 13 13:12:50 2017 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/IgniteVersionUtils.java | 2 +-
.../org/apache/ignite/startup/GridRandomCommandLineLoader.java | 2 +-
.../dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs | 2 +-
.../dotnet/Apache.Ignite.AspNet/Apache.Ignite.AspNet.nuspec | 2 +-
.../dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec | 2 +-
.../platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.nuspec | 2 +-
.../platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs | 2 +-
.../platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.nuspec | 2 +-
.../dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec | 2 +-
.../dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs | 2 +-
.../platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec | 2 +-
.../platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs | 2 +-
.../web-console/frontend/app/modules/branding/branding.provider.js | 2 +-
15 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java
index bd8726f..7cb15be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java
@@ -47,7 +47,7 @@ public class IgniteVersionUtils {
public static final String ACK_VER_STR;
/** Copyright blurb. */
- public static final String COPYRIGHT = "2016 Copyright(C) Apache Software Foundation";
+ public static final String COPYRIGHT = "2017 Copyright(C) Apache Software Foundation";
/**
* Static initializer.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/core/src/test/java/org/apache/ignite/startup/GridRandomCommandLineLoader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/startup/GridRandomCommandLineLoader.java b/modules/core/src/test/java/org/apache/ignite/startup/GridRandomCommandLineLoader.java
index 13c38ef..73a9760 100644
--- a/modules/core/src/test/java/org/apache/ignite/startup/GridRandomCommandLineLoader.java
+++ b/modules/core/src/test/java/org/apache/ignite/startup/GridRandomCommandLineLoader.java
@@ -61,7 +61,7 @@ public final class GridRandomCommandLineLoader {
private static final String IGNITE_PROG_NAME = "IGNITE_PROG_NAME";
/** Copyright text. Ant processed. */
- private static final String COPYRIGHT = "2016 Copyright(C) Apache Software Foundation.";
+ private static final String COPYRIGHT = "2017 Copyright(C) Apache Software Foundation.";
/** Version. Ant processed. */
private static final String VER = "x.x.x";
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
index 1bca0e8..72e65c0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/Properties/AssemblyInfo.cs
@@ -27,7 +27,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright � 2016")]
+[assembly: AssemblyCopyright("Copyright � 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.AspNet/Apache.Ignite.AspNet.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Apache.Ignite.AspNet.nuspec b/modules/platforms/dotnet/Apache.Ignite.AspNet/Apache.Ignite.AspNet.nuspec
index 49f2fe8..7891614 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Apache.Ignite.AspNet.nuspec
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Apache.Ignite.AspNet.nuspec
@@ -45,7 +45,7 @@ Session State Store Provider: stores session state data in a distributed in-memo
More info: https://apacheignite-net.readme.io/
</description>
<releaseNotes></releaseNotes>
- <copyright>Copyright 2016</copyright>
+ <copyright>Copyright 2017</copyright>
<tags>OutputCacheProvider Apache Ignite In-Memory Distributed Computing SQL NoSQL Grid Map Reduce Cache</tags>
<dependencies>
<dependency id="Apache.Ignite" version="[$version$]" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
index 0926a46..1073986 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Properties/AssemblyInfo.cs
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
index b7d8e09..898397d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Properties/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright � 2016")]
+[assembly: AssemblyCopyright("Copyright � 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec
index e57e371..52dc1e0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec
@@ -42,7 +42,7 @@ XSD file describes the structure of IgniteConfigurationSection and enables Intel
More info on Apache Ignite.NET: https://apacheignite-net.readme.io/
</description>
<releaseNotes></releaseNotes>
- <copyright>Copyright 2016</copyright>
+ <copyright>Copyright 2017</copyright>
<tags>Apache Ignite XSD Intellisense</tags>
</metadata>
<files>
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.nuspec b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.nuspec
index 8621103..8f562f1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.nuspec
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.nuspec
@@ -45,7 +45,7 @@ Apache Ignite In-Memory Data Fabric is a high-performance, integrated and distri
More info: https://apacheignite-net.readme.io/
</description>
<releaseNotes></releaseNotes>
- <copyright>Copyright 2016</copyright>
+ <copyright>Copyright 2017</copyright>
<tags>Apache Ignite In-Memory Distributed Computing SQL NoSQL Grid Map Reduce Cache linqpad-samples</tags>
</metadata>
<files>
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
index c0462db..cb903aa 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.nuspec b/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.nuspec
index 330ed29..c71d672 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.nuspec
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Apache.Ignite.Linq.nuspec
@@ -47,7 +47,7 @@ All Ignite SQL features are supported: distributed joins, groupings, aggregates,
More info: https://apacheignite-net.readme.io/
</description>
<releaseNotes></releaseNotes>
- <copyright>Copyright 2016</copyright>
+ <copyright>Copyright 2017</copyright>
<tags>Apache Ignite In-Memory Distributed Computing SQL NoSQL LINQ Grid Map Reduce Cache linqpad-samples</tags>
<dependencies>
<dependency id="Apache.Ignite" version="[$version$]" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec
index fa5c39a..a3f86c1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec
+++ b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Apache.Ignite.Log4Net.nuspec
@@ -40,7 +40,7 @@ Creating NuGet package:
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>log4net Logger for Apache Ignite</description>
<releaseNotes></releaseNotes>
- <copyright>Copyright 2016</copyright>
+ <copyright>Copyright 2017</copyright>
<tags>Apache Ignite In-Memory Distributed Computing SQL NoSQL LINQ Grid Map Reduce Cache log4net logger</tags>
<dependencies>
<dependency id="Apache.Ignite" version="[$version$]" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
index cc37917..396c837 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Log4Net/Properties/AssemblyInfo.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright � 2016")]
+[assembly: AssemblyCopyright("Copyright � 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec b/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec
index 765e26f..e3a6f42 100644
--- a/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec
+++ b/modules/platforms/dotnet/Apache.Ignite.NLog/Apache.Ignite.NLog.nuspec
@@ -40,7 +40,7 @@ Creating NuGet package:
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>NLog Logger for Apache Ignite</description>
<releaseNotes></releaseNotes>
- <copyright>Copyright 2016</copyright>
+ <copyright>Copyright 2017</copyright>
<tags>Apache Ignite In-Memory Distributed Computing SQL NoSQL LINQ Grid Map Reduce Cache NLog logger</tags>
<dependencies>
<dependency id="Apache.Ignite" version="[$version$]" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
index 2f0d89f..6802594 100644
--- a/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.NLog/Properties/AssemblyInfo.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright � 2016")]
+[assembly: AssemblyCopyright("Copyright � 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/5245214d/modules/web-console/frontend/app/modules/branding/branding.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/branding/branding.provider.js b/modules/web-console/frontend/app/modules/branding/branding.provider.js
index ce14b34..0545ff3 100644
--- a/modules/web-console/frontend/app/modules/branding/branding.provider.js
+++ b/modules/web-console/frontend/app/modules/branding/branding.provider.js
@@ -26,7 +26,7 @@ export default ['IgniteBranding', [function() {
let footerHtml = [
'<p>Apache Ignite Web Console</p>',
- '<p>� 2016 The Apache Software Foundation.</p>',
+ '<p>� 2017 The Apache Software Foundation.</p>',
'<p>Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are trademarks of The Apache Software Foundation.</p>'
];
[18/50] [abbrv] ignite git commit: Reviewed and merged IGNITE-4374
contributed by daradurvs daradurvs at gmail.com
Posted by yz...@apache.org.
Reviewed and merged IGNITE-4374 contributed by daradurvs daradurvs at gmail.com
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3459bdd3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3459bdd3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3459bdd3
Branch: refs/heads/ignite-comm-balance-master
Commit: 3459bdd3a35869df13c9b35f616325c0c3e3481e
Parents: e7a5307
Author: daradurvs <da...@gmail.com>
Authored: Thu Feb 9 20:29:02 2017 +0700
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Feb 9 20:29:02 2017 +0700
----------------------------------------------------------------------
.../ignite/internal/GridKernalContext.java | 1 +
.../ignite/internal/GridKernalContextImpl.java | 1 +
.../internal/GridPerformanceSuggestions.java | 92 --------------
.../apache/ignite/internal/IgniteKernal.java | 9 ++
.../processors/cache/GridCacheProcessor.java | 2 +-
.../suggestions/GridPerformanceSuggestions.java | 104 +++++++++++++++
.../JvmConfigurationSuggestions.java | 104 +++++++++++++++
.../suggestions/OsConfigurationSuggestions.java | 127 +++++++++++++++++++
.../internal/suggestions/package-info.java | 21 +++
.../ignite/internal/util/IgniteUtils.java | 14 ++
10 files changed, 382 insertions(+), 93 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index 927944f..00696c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
@@ -65,6 +65,7 @@ import org.apache.ignite.internal.processors.service.GridServiceProcessor;
import org.apache.ignite.internal.processors.session.GridTaskSessionProcessor;
import org.apache.ignite.internal.processors.task.GridTaskProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
import org.apache.ignite.internal.util.IgniteExceptionRegistry;
import org.apache.ignite.internal.util.StripedExecutor;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index a2ad1b2..e80ec6b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -82,6 +82,7 @@ import org.apache.ignite.internal.processors.service.GridServiceProcessor;
import org.apache.ignite.internal.processors.session.GridTaskSessionProcessor;
import org.apache.ignite.internal.processors.task.GridTaskProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
import org.apache.ignite.internal.util.IgniteExceptionRegistry;
import org.apache.ignite.internal.util.StripedExecutor;
import org.apache.ignite.internal.util.spring.IgniteSpringHelper;
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/GridPerformanceSuggestions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridPerformanceSuggestions.java b/modules/core/src/main/java/org/apache/ignite/internal/GridPerformanceSuggestions.java
deleted file mode 100644
index 5e8e520..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridPerformanceSuggestions.java
+++ /dev/null
@@ -1,92 +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;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED;
-
-/**
- * Grid performance suggestions.
- */
-public class GridPerformanceSuggestions {
- /** */
- private static final boolean disabled = Boolean.getBoolean(IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED);
-
- /** */
- private final Collection<String> perfs = !disabled ? new LinkedHashSet<String>() : null;
-
- /** */
- private final Collection<String> suppressed = !disabled ? new HashSet<String>() : null;
-
- /**
- * @param sug Suggestion to add.
- */
- public synchronized void add(String sug) {
- add(sug, false);
- }
-
- /**
- * @param sug Suggestion to add.
- * @param suppress {@code True} to suppress this suggestion.
- */
- public synchronized void add(String sug, boolean suppress) {
- if (disabled)
- return;
-
- if (!suppress)
- perfs.add(sug);
- else
- suppressed.add(sug);
- }
-
- /**
- * @param log Log.
- * @param gridName Grid name.
- */
- public synchronized void logSuggestions(IgniteLogger log, @Nullable String gridName) {
- if (disabled)
- return;
-
- if (!F.isEmpty(perfs) && !suppressed.containsAll(perfs)) {
- U.quietAndInfo(log, "Performance suggestions for grid " +
- (gridName == null ? "" : '\'' + gridName + '\'') + " (fix if possible)");
- U.quietAndInfo(log, "To disable, set -D" + IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED + "=true");
-
- for (String s : perfs)
- if (!suppressed.contains(s))
- U.quietAndInfo(log, " ^-- " + s);
-
- U.quietAndInfo(log, "");
-
- perfs.clear();
- }
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridPerformanceSuggestions.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 9f1c746..a3d8c7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -138,6 +138,9 @@ import org.apache.ignite.internal.processors.service.GridServiceProcessor;
import org.apache.ignite.internal.processors.session.GridTaskSessionProcessor;
import org.apache.ignite.internal.processors.task.GridTaskProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
+import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
+import org.apache.ignite.internal.suggestions.JvmConfigurationSuggestions;
+import org.apache.ignite.internal.suggestions.OsConfigurationSuggestions;
import org.apache.ignite.internal.util.StripedExecutor;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -930,6 +933,12 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
// Suggest configuration optimizations.
suggestOptimizations(cfg);
+ // Suggest JVM optimizations.
+ ctx.performance().addAll(JvmConfigurationSuggestions.getSuggestions());
+
+ // Suggest Operation System optimizations.
+ ctx.performance().addAll(OsConfigurationSuggestions.getSuggestions());
+
// Notify discovery manager the first to make sure that topology is discovered.
ctx.discovery().onKernalStart();
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 87f5236..b0a78f4 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -63,7 +63,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.GridPerformanceSuggestions;
+import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteComponentType;
import org.apache.ignite.internal.IgniteInternalFuture;
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java
new file mode 100644
index 0000000..c51a136
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java
@@ -0,0 +1,104 @@
+/*
+ * 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.suggestions;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED;
+
+/**
+ * Grid performance suggestions.
+ */
+public class GridPerformanceSuggestions {
+ /** Link to article about Ignite performance tuning */
+ private static final String SUGGESTIONS_LINK = "https://apacheignite.readme.io/docs/jvm-and-system-tuning";
+
+ /** */
+ private static final boolean disabled = Boolean.getBoolean(IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED);
+
+ /** */
+ private final Collection<String> perfs = !disabled ? new LinkedHashSet<String>() : null;
+
+ /** */
+ private final Collection<String> suppressed = !disabled ? new HashSet<String>() : null;
+
+ /**
+ * @param suggestions Suggestions to add.
+ */
+ public synchronized void addAll(List<String> suggestions) {
+ for (String suggestion : suggestions)
+ add(suggestion);
+ }
+
+ /**
+ * @param sug Suggestion to add.
+ */
+ public synchronized void add(String sug) {
+ add(sug, false);
+ }
+
+ /**
+ * @param sug Suggestion to add.
+ * @param suppress {@code True} to suppress this suggestion.
+ */
+ public synchronized void add(String sug, boolean suppress) {
+ if (disabled)
+ return;
+
+ if (!suppress)
+ perfs.add(sug);
+ else
+ suppressed.add(sug);
+ }
+
+ /**
+ * @param log Log.
+ * @param gridName Grid name.
+ */
+ public synchronized void logSuggestions(IgniteLogger log, @Nullable String gridName) {
+ if (disabled)
+ return;
+
+ if (!F.isEmpty(perfs) && !suppressed.containsAll(perfs)) {
+ U.quietAndInfo(log, "Performance suggestions for grid " +
+ (gridName == null ? "" : '\'' + gridName + '\'') + " (fix if possible)");
+ U.quietAndInfo(log, "To disable, set -D" + IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED + "=true");
+
+ for (String s : perfs)
+ if (!suppressed.contains(s))
+ U.quietAndInfo(log, " ^-- " + s);
+
+ perfs.clear();
+ }
+ U.quietAndInfo(log, "Refer to this page for more performance suggestions: " + SUGGESTIONS_LINK);
+ U.quietAndInfo(log, "");
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridPerformanceSuggestions.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/suggestions/JvmConfigurationSuggestions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/suggestions/JvmConfigurationSuggestions.java b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/JvmConfigurationSuggestions.java
new file mode 100644
index 0000000..4319229
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/JvmConfigurationSuggestions.java
@@ -0,0 +1,104 @@
+/*
+ * 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.suggestions;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Java Virtual Machine configuration suggestions.
+ */
+public class JvmConfigurationSuggestions {
+ /** */
+ private static final String XMX = "-Xmx";
+
+ /** */
+ private static final String MX = "-mx";
+
+ /** */
+ private static final String MAX_DIRECT_MEMORY_SIZE = "-XX:MaxDirectMemorySize";
+
+ /** */
+ private static final String DISABLE_EXPLICIT_GC = "-XX:+DisableExplicitGC";
+
+ /** */
+ private static final String NOT_USE_TLAB = "-XX:-UseTLAB";
+
+ /** */
+ private static final String SERVER = "-server";
+
+ /** */
+ private static final String USE_G1_GC = "-XX:+UseG1GC";
+
+ /**
+ * Checks JVM configurations and produces tuning suggestions.
+ *
+ * @return List of suggestions of Java Virtual Machine configuration tuning to increase Ignite performance.
+ */
+ public static synchronized List<String> getSuggestions() {
+ List<String> suggestions = new ArrayList<>();
+
+ List<String> args = U.jvmArgs();
+
+ if (!U.jvmName().toLowerCase().contains("server"))
+ suggestions.add("Enable server mode for JVM (add '" + SERVER + "' to JVM options)");
+
+ if (!U.jdkVersion().equals("1.8"))
+ suggestions.add("Switch to the most recent 1.8 JVM version");
+
+ if (U.jdkVersion().equals("1.8") && !args.contains(USE_G1_GC))
+ suggestions.add("Enable G1 Garbage Collector (add '" + USE_G1_GC + "' to JVM options)");
+
+ if (!anyStartWith(args, XMX) && !anyStartWith(args, MX))
+ suggestions.add("Specify JVM heap max size (add '" + XMX + "<size>[g|G|m|M|k|K]' to JVM options)");
+
+ if (!anyStartWith(args, MAX_DIRECT_MEMORY_SIZE))
+ suggestions.add("Set max direct memory size if getting 'OOME: Direct buffer memory' " +
+ "(add '" + MAX_DIRECT_MEMORY_SIZE + "=<size>[g|G|m|M|k|K]' to JVM options)");
+
+ if (args.contains(NOT_USE_TLAB))
+ suggestions.add("Enable thread-local allocation buffer (add '-XX:+UseTLAB' to JVM options)");
+
+ if (!args.contains(DISABLE_EXPLICIT_GC))
+ suggestions.add("Disable processing of calls to System.gc() (add '" + DISABLE_EXPLICIT_GC + "' to JVM options)");
+
+ return suggestions;
+ }
+
+ /**
+ * @param lines Lines to check.
+ * @param prefix Prefix.
+ * @return {@code True} if found.
+ */
+ private static boolean anyStartWith(@NotNull List<String> lines, @NotNull String prefix) {
+ for (String line : lines) {
+ if (line.startsWith(prefix))
+ return true;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(JvmConfigurationSuggestions.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/suggestions/OsConfigurationSuggestions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/suggestions/OsConfigurationSuggestions.java b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/OsConfigurationSuggestions.java
new file mode 100644
index 0000000..e5b4c12
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/OsConfigurationSuggestions.java
@@ -0,0 +1,127 @@
+/*
+ * 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.suggestions;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Operation System configuration suggestions.
+ */
+public class OsConfigurationSuggestions {
+ /** */
+ private static final String VM_PARAMS_BASE_PATH = "/proc/sys/vm/";
+
+ /** */
+ private static final String DIRTY_WRITEBACK_CENTISECS = "dirty_writeback_centisecs";
+
+ /** */
+ private static final String DIRTY_EXPIRE_CENTISECS = "dirty_expire_centisecs";
+
+ /** */
+ private static final String SWAPPINESS = "swappiness";
+
+ /** */
+ private static final String ZONE_RECLAIM_MODE = "zone_reclaim_mode";
+
+ /** */
+ private static final String EXTRA_FREE_KBYTES = "extra_free_kbytes";
+
+ /**
+ * Checks OS configurations and produces tuning suggestions.
+ *
+ * @return List of suggestions of Operation system configuration tuning to increase Ignite performance.
+ */
+ public static synchronized List<String> getSuggestions() {
+ List<String> suggestions = new ArrayList<>();
+
+ if (U.isRedHat()) {
+ String value;
+ String expected = "500";
+
+ boolean dwcParamFlag = (value = readVmParam(DIRTY_WRITEBACK_CENTISECS)) != null && !value.equals(expected);
+ boolean decParamFlag = (value = readVmParam(DIRTY_EXPIRE_CENTISECS)) != null && !value.equals(expected);
+
+ if (dwcParamFlag || decParamFlag)
+ suggestions.add(String.format("Speed up flushing of dirty pages by OS " +
+ "(alter %s%s%s parameter%s by setting to %s)",
+ (dwcParamFlag ? "vm." + DIRTY_WRITEBACK_CENTISECS : ""),
+ (dwcParamFlag && decParamFlag ? " and " : ""),
+ (decParamFlag ? "vm." + DIRTY_EXPIRE_CENTISECS : ""),
+ (dwcParamFlag && decParamFlag ? "s" : ""),
+ expected));
+
+ if ((value = readVmParam(SWAPPINESS)) != null && !value.equals(expected = "10"))
+ suggestions.add(String.format("Reduce pages swapping ratio (set vm.%s=%s)", SWAPPINESS, expected));
+
+ if ((value = readVmParam(ZONE_RECLAIM_MODE)) != null && !value.equals(expected = "0"))
+ suggestions.add(String.format("Disable NUMA memory reclaim (set vm.%s=%s)", ZONE_RECLAIM_MODE,
+ expected));
+
+ if ((value = readVmParam(EXTRA_FREE_KBYTES)) != null && !value.equals(expected = "1240000"))
+ suggestions.add(String.format("Avoid direct reclaim and page allocation failures (set vm.%s=%s)",
+ EXTRA_FREE_KBYTES, expected));
+ }
+
+ return suggestions;
+ }
+
+ /**
+ * @param name Parameter name.
+ * @return Value (possibly null).
+ */
+ @Nullable private static String readVmParam(@NotNull String name) {
+ try {
+ Path path = Paths.get(VM_PARAMS_BASE_PATH + name);
+
+ if (!Files.exists(path))
+ return null;
+
+ return readLine(path);
+ }
+ catch (Exception ignored) {
+ return null;
+ }
+ }
+
+ /**
+ * @param path Path.
+ * @return Read line.
+ * @throws IOException If failed.
+ */
+ @Nullable private static String readLine(@NotNull Path path) throws IOException {
+ try (BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
+ return reader.readLine();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(OsConfigurationSuggestions.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/modules/core/src/main/java/org/apache/ignite/internal/suggestions/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/suggestions/package-info.java b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/package-info.java
new file mode 100644
index 0000000..baced67
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains classes for configurations suggestions.
+ */
+package org.apache.ignite.internal.suggestions;
http://git-wip-us.apache.org/repos/asf/ignite/blob/3459bdd3/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 653302c..f6c8163 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
@@ -73,6 +73,8 @@ import java.nio.channels.FileLock;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.security.AccessController;
import java.security.KeyManagementException;
import java.security.MessageDigest;
@@ -366,6 +368,9 @@ public abstract class IgniteUtils {
/** Indicates whether current OS is Mac OS. */
private static boolean mac;
+ /** Indicates whether current OS is of RedHat family. */
+ private static boolean redHat;
+
/** Indicates whether current OS architecture is Sun Sparc. */
private static boolean sparc;
@@ -525,6 +530,8 @@ public abstract class IgniteUtils {
assertionsEnabled = assertionsEnabled0;
}
+ redHat = Files.exists(Paths.get("/etc/redhat-release")); // RedHat family OS (Fedora, CentOS, RedHat)
+
String osName = System.getProperty("os.name");
String osLow = osName.toLowerCase();
@@ -6282,6 +6289,13 @@ public abstract class IgniteUtils {
}
/**
+ * @return {@code True} if current OS is RedHat.
+ */
+ public static boolean isRedHat() {
+ return redHat;
+ }
+
+ /**
* Indicates whether current OS is Netware.
*
* @return {@code true} if current OS is Netware - {@code false} otherwise.
[47/50] [abbrv] ignite git commit: IGNITE-4472 Minor UI fix.
Posted by yz...@apache.org.
IGNITE-4472 Minor UI fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d4efbf34
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d4efbf34
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d4efbf34
Branch: refs/heads/ignite-comm-balance-master
Commit: d4efbf342142f7376016f0700bc553c60b8f1b90
Parents: 97c7ed7
Author: Andrey Novikov <an...@gridgain.com>
Authored: Thu Feb 16 18:38:40 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu Feb 16 18:38:40 2017 +0700
----------------------------------------------------------------------
.../list-of-registered-users.controller.js | 2 +-
.../frontend/app/components/ui-grid-settings/ui-grid-settings.scss | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d4efbf34/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
index 5761073..272681a 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
@@ -133,7 +133,7 @@ export default class IgniteListOfRegisteredUsersCtrl {
api.toggleAdmin = toggleAdmin;
api.showActivities = showActivities;
- api.grid.registerRowsProcessor(companiesExcludeFilter, 300);
+ api.grid.registerRowsProcessor(companiesExcludeFilter, 50);
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/d4efbf34/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
index bc16271..4beb2a1 100644
--- a/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
+++ b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
@@ -47,7 +47,7 @@
float: right;
.ignite-form-field {
- width: 260px;
+ width: 280px;
margin-right: 10px;
&__label {
[40/50] [abbrv] ignite git commit: IGNITE-4526: Add Spark Shared RDD
examples Reviewed by Denis Magda
Posted by yz...@apache.org.
IGNITE-4526: Add Spark Shared RDD examples
Reviewed by Denis Magda <dm...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b461cb47
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b461cb47
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b461cb47
Branch: refs/heads/ignite-comm-balance-master
Commit: b461cb47882861356ede58775bd9e253dcf26202
Parents: 79e1e53
Author: Manish Mishra <ma...@knoldus.com>
Authored: Tue Feb 14 16:54:11 2017 -0800
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Feb 14 16:54:11 2017 -0800
----------------------------------------------------------------------
examples/config/spark/example-shared-rdd.xml | 83 ++++++++++++++
examples/pom.xml | 27 ++++-
.../examples/java8/spark/SharedRDDExample.java | 110 +++++++++++++++++++
.../examples/spark/ScalarSharedRDDExample.scala | 89 +++++++++++++++
.../examples/SharedRDDExampleSelfTest.java | 36 ++++++
.../IgniteExamplesJ8SelfTestSuite.java | 3 +
.../tests/examples/ScalarExamplesSelfTest.scala | 6 +
.../apache/ignite/spark/JavaIgniteContext.scala | 6 +
8 files changed, 359 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b461cb47/examples/config/spark/example-shared-rdd.xml
----------------------------------------------------------------------
diff --git a/examples/config/spark/example-shared-rdd.xml b/examples/config/spark/example-shared-rdd.xml
new file mode 100644
index 0000000..83de6a3
--- /dev/null
+++ b/examples/config/spark/example-shared-rdd.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ Ignite Spring configuration file to startup Ignite cache.
+
+ This file demonstrates how to configure cache using Spring. Provided cache
+ will be created on node startup.
+
+ When starting a standalone node, you need to execute the following command:
+ {IGNITE_HOME}/bin/ignite.{bat|sh} examples/config/example-shared-rdd.xml
+
+ When starting Ignite from Java IDE, pass path to this file to Ignition:
+ Ignition.start("examples/config/example-shared-rdd.xml");
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="cacheConfiguration">
+ <!-- SharedRDD cache example configuration (Atomic mode). -->
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <!-- Set a cache name. -->
+ <property name="name" value="sharedRDD"/>
+ <!-- Set a cache mode. -->
+ <property name="cacheMode" value="PARTITIONED"/>
+ <!-- Index Integer pairs used in the example. -->
+ <property name="indexedTypes">
+ <list>
+ <value>java.lang.Integer</value>
+ <value>java.lang.Integer</value>
+ </list>
+ </property>
+ <!-- Set atomicity mode. -->
+ <property name="atomicityMode" value="ATOMIC"/>
+ <!-- Configure a number of backups. -->
+ <property name="backups" value="1"/>
+ </bean>
+ </property>
+
+ <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <!--
+ Ignite provides several options for automatic discovery that can be used
+ instead os static IP based discovery. For information on all options refer
+ to our documentation: http://apacheignite.readme.io/docs/cluster-config
+ -->
+ <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47500..47509</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/b461cb47/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 3a6a026..1c4ad25 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -17,7 +17,8 @@
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -138,6 +139,18 @@
</exclusion>
</exclusions>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-spark</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>3.2.9.Final</version>
+ </dependency>
</dependencies>
<build>
@@ -172,6 +185,18 @@
</exclusion>
</exclusions>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-spark_2.10</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>3.2.9.Final</version>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/ignite/blob/b461cb47/examples/src/main/java8/org/apache/ignite/examples/java8/spark/SharedRDDExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java8/org/apache/ignite/examples/java8/spark/SharedRDDExample.java b/examples/src/main/java8/org/apache/ignite/examples/java8/spark/SharedRDDExample.java
new file mode 100644
index 0000000..392180d
--- /dev/null
+++ b/examples/src/main/java8/org/apache/ignite/examples/java8/spark/SharedRDDExample.java
@@ -0,0 +1,110 @@
+/*
+ * 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.examples.java8.spark;
+
+import org.apache.ignite.spark.JavaIgniteContext;
+import org.apache.ignite.spark.JavaIgniteRDD;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.spark.SparkConf;
+import org.apache.spark.api.java.JavaPairRDD;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.api.java.function.PairFunction;
+import org.apache.spark.sql.DataFrame;
+import scala.Tuple2;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * This example demonstrates how to create an JavaIgnitedRDD and share it with multiple spark workers. The goal of this
+ * particular example is to provide the simplest code example of this logic.
+ * <p>
+ * This example will start Ignite in the embedded mode and will start an JavaIgniteContext on each Spark worker node.
+ * <p>
+ * The example can work in the standalone mode as well that can be enabled by setting JavaIgniteContext's
+ * {@code standalone} property to {@code true} and running an Ignite node separately with
+ * `examples/config/spark/example-shared-rdd.xml` config.
+ */
+public class SharedRDDExample {
+ /**
+ * Executes the example.
+ * @param args Command line arguments, none required.
+ */
+ public static void main(String args[]) {
+ // Spark Configuration.
+ SparkConf sparkConf = new SparkConf()
+ .setAppName("JavaIgniteRDDExample")
+ .setMaster("local")
+ .set("spark.executor.instances", "2");
+
+ // Spark context.
+ JavaSparkContext sparkContext = new JavaSparkContext(sparkConf);
+
+ // Adjust the logger to exclude the logs of no interest.
+ Logger.getRootLogger().setLevel(Level.ERROR);
+ Logger.getLogger("org.apache.ignite").setLevel(Level.INFO);
+
+ // Creates Ignite context with specific configuration and runs Ignite in the embedded mode.
+ JavaIgniteContext<Integer, Integer> igniteContext = new JavaIgniteContext<Integer, Integer>(
+ sparkContext,"examples/config/spark/example-shared-rdd.xml", false);
+
+ // Create a Java Ignite RDD of Type (Int,Int) Integer Pair.
+ JavaIgniteRDD<Integer, Integer> sharedRDD = igniteContext.<Integer, Integer>fromCache("sharedRDD");
+
+ // Define data to be stored in the Ignite RDD (cache).
+ List<Integer> data = IntStream.range(0, 20).boxed().collect(Collectors.toList());
+
+ // Preparing a Java RDD.
+ JavaRDD<Integer> javaRDD = sparkContext.<Integer>parallelize(data);
+
+ // Fill the Ignite RDD in with Int pairs. Here Pairs are represented as Scala Tuple2.
+ sharedRDD.savePairs(javaRDD.<Integer, Integer>mapToPair(new PairFunction<Integer, Integer, Integer>() {
+ @Override public Tuple2<Integer, Integer> call(Integer val) throws Exception {
+ return new Tuple2<Integer, Integer>(val, val);
+ }
+ }));
+
+ System.out.println(">>> Iterating over Ignite Shared RDD...");
+
+ // Iterate over the Ignite RDD.
+ sharedRDD.foreach((x) -> System.out.println("(" + x._1 + "," + x._2 + ")"));
+
+ System.out.println(">>> Transforming values stored in Ignite Shared RDD...");
+
+ // Filter out even values as a transformed RDD.
+ JavaPairRDD<Integer, Integer> transformedValues =
+ sharedRDD.filter((Tuple2<Integer, Integer> pair) -> pair._2() % 2 == 0);
+
+ // Print out the transformed values.
+ transformedValues.foreach((x) -> System.out.println("(" + x._1 + "," + x._2 + ")"));
+
+ System.out.println(">>> Executing SQL query over Ignite Shared RDD...");
+
+ // Execute SQL query over the Ignite RDD.
+ DataFrame df = sharedRDD.sql("select _val from Integer where _key < 9");
+
+ // Show the result of the execution.
+ df.show();
+
+ // Close IgniteContext on all the workers.
+ igniteContext.close(true);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b461cb47/examples/src/main/scala/org/apache/ignite/scalar/examples/spark/ScalarSharedRDDExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/spark/ScalarSharedRDDExample.scala b/examples/src/main/scala/org/apache/ignite/scalar/examples/spark/ScalarSharedRDDExample.scala
new file mode 100644
index 0000000..18662e8
--- /dev/null
+++ b/examples/src/main/scala/org/apache/ignite/scalar/examples/spark/ScalarSharedRDDExample.scala
@@ -0,0 +1,89 @@
+/*
+ * 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.scalar.examples.spark
+
+import org.apache.ignite.spark.{IgniteContext, IgniteRDD}
+import org.apache.log4j.{Level, Logger}
+import org.apache.spark.{SparkConf, SparkContext}
+
+/**
+ * This example demonstrates how to create an IgnitedRDD and share it with multiple spark workers.
+ * The goal of this particular example is to provide the simplest code example of this logic.
+ * <p>
+ * This example will start Ignite in the embedded mode and will start an IgniteContext on each Spark worker node.
+ * <p>
+ * The example can work in the standalone mode as well that can be enabled by setting IgniteContext's {@code isClient}
+ * property to {@code true} and running an Ignite node separately with `examples/config/spark/
+ * example-shared-rdd.xml` config.
+ * <p>
+ */
+object ScalarSharedRDDExample extends App {
+ // Spark Configuration.
+ private val conf = new SparkConf()
+ .setAppName("IgniteRDDExample")
+ .setMaster("local")
+ .set("spark.executor.instances", "2")
+
+ // Spark context.
+ val sparkContext = new SparkContext(conf)
+
+ // Adjust the logger to exclude the logs of no interest.
+ Logger.getRootLogger.setLevel(Level.ERROR)
+ Logger.getLogger("org.apache.ignite").setLevel(Level.INFO)
+
+ // Defines spring cache Configuration path.
+ private val CONFIG = "examples/config/spark/example-shared-rdd.xml"
+
+ // Creates Ignite context with above configuration.
+ val igniteContext = new IgniteContext(sparkContext, CONFIG, false)
+
+ // Creates an Ignite Shared RDD of Type (Int,Int) Integer Pair.
+ val sharedRDD: IgniteRDD[Int, Int] = igniteContext.fromCache[Int, Int]("sharedRDD")
+
+ // Fill the Ignite Shared RDD in with Int pairs.
+ sharedRDD.savePairs(sparkContext.parallelize(1 to 100000, 10).map(i => (i, i)))
+
+ // Transforming Pairs to contain their Squared value.
+ sharedRDD.mapValues(x => (x * x))
+
+ // Retrieve sharedRDD back from the Cache.
+ val transformedValues: IgniteRDD[Int, Int] = igniteContext.fromCache("sharedRDD")
+
+ // Perform some transformations on IgniteRDD and print.
+ val squareAndRootPair = transformedValues.map { case (x, y) => (x, Math.sqrt(y.toDouble)) }
+
+ println(">>> Transforming values stored in Ignite Shared RDD...")
+
+ // Filter out pairs which square roots are less than 100 and
+ // take the first five elements from the transformed IgniteRDD and print them.
+ squareAndRootPair.filter(_._2 < 100.0).take(5).foreach(println)
+
+ println(">>> Executing SQL query over Ignite Shared RDD...")
+
+ // Execute a SQL query over the Ignite Shared RDD.
+ val df = transformedValues.sql("select _val from Integer where _val < 100 and _val > 9 ")
+
+ // Show ten rows from the result set.
+ df.show(10)
+
+ // Close IgniteContext on all workers.
+ igniteContext.close(true)
+
+ // Stop SparkContext.
+ sparkContext.stop()
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b461cb47/examples/src/test/java8/org/apache/ignite/java8/examples/SharedRDDExampleSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java8/org/apache/ignite/java8/examples/SharedRDDExampleSelfTest.java b/examples/src/test/java8/org/apache/ignite/java8/examples/SharedRDDExampleSelfTest.java
new file mode 100644
index 0000000..0fafb4d
--- /dev/null
+++ b/examples/src/test/java8/org/apache/ignite/java8/examples/SharedRDDExampleSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.java8.examples;
+
+import org.apache.ignite.examples.java8.spark.SharedRDDExample;
+import org.junit.Test;
+
+/**
+ * SharedRDD examples self test.
+ */
+public class SharedRDDExampleSelfTest {
+ static final String[] EMPTY_ARGS = new String[0];
+ /**
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testSharedRDDExample() throws Exception {
+ SharedRDDExample.main(EMPTY_ARGS);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b461cb47/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java b/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
index 949324c..c32339f 100644
--- a/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
+++ b/examples/src/test/java8/org/apache/ignite/java8/testsuites/IgniteExamplesJ8SelfTestSuite.java
@@ -26,6 +26,7 @@ import org.apache.ignite.java8.examples.EventsExamplesMultiNodeSelfTest;
import org.apache.ignite.java8.examples.EventsExamplesSelfTest;
import org.apache.ignite.java8.examples.IndexingBridgeMethodTest;
import org.apache.ignite.java8.examples.MessagingExamplesSelfTest;
+import org.apache.ignite.java8.examples.SharedRDDExampleSelfTest;
import org.apache.ignite.testframework.GridTestUtils;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_OVERRIDE_MCAST_GRP;
@@ -49,6 +50,8 @@ public class IgniteExamplesJ8SelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(IndexingBridgeMethodTest.class));
suite.addTest(new TestSuite(CacheExamplesSelfTest.class));
suite.addTest(new TestSuite(BasicExamplesSelfTest.class));
+ suite.addTest(new TestSuite(SharedRDDExampleSelfTest.class));
+
// suite.addTest(new TestSuite(ContinuationExamplesSelfTest.class));
// suite.addTest(new TestSuite(ContinuousMapperExamplesSelfTest.class));
// suite.addTest(new TestSuite(DeploymentExamplesSelfTest.class));
http://git-wip-us.apache.org/repos/asf/ignite/blob/b461cb47/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
----------------------------------------------------------------------
diff --git a/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala b/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
index 94c41ad..28e509e 100644
--- a/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
+++ b/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
@@ -18,6 +18,7 @@
package org.apache.ignite.scalar.tests.examples
import org.apache.ignite.scalar.examples._
+import org.apache.ignite.scalar.examples.spark._
import org.apache.ignite.scalar.scalar
import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest
import org.scalatest.junit.JUnitSuiteLike
@@ -95,4 +96,9 @@ class ScalarExamplesSelfTest extends GridAbstractExamplesTest with JUnitSuiteLik
def testScalarSnowflakeSchemaExample() {
ScalarSnowflakeSchemaExample.main(EMPTY_ARGS)
}
+
+ /** */
+ def testScalarSharedRDDExample() {
+ ScalarSharedRDDExample.main(EMPTY_ARGS)
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b461cb47/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteContext.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteContext.scala b/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteContext.scala
index 689a22d..d8a521b 100644
--- a/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteContext.scala
+++ b/modules/spark/src/main/scala/org/apache/ignite/spark/JavaIgniteContext.scala
@@ -51,6 +51,12 @@ class JavaIgniteContext[K, V](
})
}
+ def this(sc: JavaSparkContext, springUrl: String, standalone: Boolean) {
+ this(sc, new IgniteOutClosure[IgniteConfiguration] {
+ override def apply() = IgnitionEx.loadConfiguration(springUrl).get1()
+ }, standalone)
+ }
+
def fromCache(cacheName: String): JavaIgniteRDD[K, V] =
JavaIgniteRDD.fromIgniteRDD(new IgniteRDD[K, V](ic, cacheName, null, false))
[07/50] [abbrv] ignite git commit:
CacheScanPartitionQueryFallbackSelfTest fixed to use default page size.
Posted by yz...@apache.org.
CacheScanPartitionQueryFallbackSelfTest fixed to use default page size.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f3505783
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f3505783
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f3505783
Branch: refs/heads/ignite-comm-balance-master
Commit: f35057833900ba028b3a9a8bd547df61f42a45ed
Parents: 9c9175d
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jan 19 12:44:57 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jan 19 12:44:57 2017 +0300
----------------------------------------------------------------------
.../processors/cache/CacheScanPartitionQueryFallbackSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f3505783/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
index 02b213e..efa9ce5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
@@ -248,7 +248,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
info("Running query [node=" + nodeId + ", part=" + part + ']');
try (QueryCursor<Cache.Entry<Integer, Integer>> cur0 =
- cache.query(new ScanQuery<Integer, Integer>(part).setPageSize(5))) {
+ cache.query(new ScanQuery<Integer, Integer>(part))) {
if (cur)
doTestScanQueryCursor(cur0, part);
[32/50] [abbrv] ignite git commit: IGNITE-4664 - Added lifecycle and
injection support for TopologyValidator. Fixes #1514
Posted by yz...@apache.org.
IGNITE-4664 - Added lifecycle and injection support for TopologyValidator. Fixes #1514
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3ef7a0e0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3ef7a0e0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3ef7a0e0
Branch: refs/heads/ignite-comm-balance-master
Commit: 3ef7a0e03b9cb36fb4037cb075512adac95cc3f7
Parents: 262a341
Author: Aleksei Scherbakov <al...@gmail.com>
Authored: Mon Feb 13 14:19:27 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Feb 13 14:19:27 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 5 +
.../cache/GridCacheLifecycleAwareSelfTest.java | 33 ++
...niteTopologyValidatorGridSplitCacheTest.java | 334 +++++++++++++++++++
.../IgniteTopologyValidatorTestSuit.java | 1 +
4 files changed, 373 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef7a0e0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index b0a78f4..7093403 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -528,6 +528,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
prepare(cfg, cfg.getAffinityMapper(), false);
prepare(cfg, cfg.getEvictionFilter(), false);
prepare(cfg, cfg.getInterceptor(), false);
+ prepare(cfg, cfg.getTopologyValidator(), false);
NearCacheConfiguration nearCfg = cfg.getNearConfiguration();
@@ -563,6 +564,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cleanup(cfg, cfg.getEvictionPolicy(), false);
cleanup(cfg, cfg.getAffinity(), false);
cleanup(cfg, cfg.getAffinityMapper(), false);
+ cleanup(cfg, cfg.getEvictionFilter(), false);
+ cleanup(cfg, cfg.getInterceptor(), false);
+ cleanup(cfg, cfg.getTopologyValidator(), false);
cleanup(cfg, cctx.store().configuredStore(), false);
if (!CU.isUtilityCache(cfg.getName()) && !CU.isSystemCache(cfg.getName())) {
@@ -3561,6 +3565,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
ret.add(ccfg.getEvictionFilter());
ret.add(ccfg.getEvictionPolicy());
ret.add(ccfg.getInterceptor());
+ ret.add(ccfg.getTopologyValidator());
NearCacheConfiguration nearCfg = ccfg.getNearConfiguration();
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef7a0e0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
index 81a6433..aa31ff9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.UUID;
import javax.cache.Cache;
import javax.cache.integration.CacheLoaderException;
+import org.apache.ignite.Ignite;
import org.apache.ignite.cache.CacheInterceptor;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.affinity.AffinityFunction;
@@ -39,10 +40,12 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.configuration.TopologyValidator;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.resources.CacheNameResource;
+import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.testframework.junits.common.GridAbstractLifecycleAwareSelfTest;
import org.jetbrains.annotations.Nullable;
@@ -256,6 +259,30 @@ public class GridCacheLifecycleAwareSelfTest extends GridAbstractLifecycleAwareS
}
}
+ /**
+ */
+ private static class TestTopologyValidator extends TestLifecycleAware implements TopologyValidator {
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /**
+ */
+ public TestTopologyValidator() {
+ super(CACHE_NAME);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean validate(Collection<ClusterNode> nodes) {
+ return false;
+ }
+
+ @Override public void start() {
+ super.start();
+
+ assertNotNull(ignite);
+ }
+ }
+
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected final IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -324,6 +351,12 @@ public class GridCacheLifecycleAwareSelfTest extends GridAbstractLifecycleAwareS
ccfg.setInterceptor(interceptor);
+ TestTopologyValidator topValidator = new TestTopologyValidator();
+
+ lifecycleAwares.add(topValidator);
+
+ ccfg.setTopologyValidator(topValidator);
+
cfg.setCacheConfiguration(ccfg);
return cfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef7a0e0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
new file mode 100644
index 0000000..3593ad6
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
@@ -0,0 +1,334 @@
+/*
+ * 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.cache;
+
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.TopologyValidator;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.events.EventType;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lifecycle.LifecycleAware;
+import org.apache.ignite.resources.CacheNameResource;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Tests complex scenario with topology validator.
+ * Grid is split between to data centers, defined by attribute {@link #DC_NODE_ATTR}.
+ * If only nodes from single DC are left in topology, grid is moved into inoperative state until special
+ * activator node'll enter a topology, enabling grid operations.
+ */
+public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstractTest {
+ /** */
+ private static final String DC_NODE_ATTR = "dc";
+
+ /** */
+ private static final String ACTIVATOR_NODE_ATTR = "split.resolved";
+
+ /** */
+ private static final int GRID_CNT = 4;
+
+ /** */
+ private static final int CACHES_CNT = 10;
+
+ /** */
+ private static final int RESOLVER_GRID_IDX = GRID_CNT;
+
+ /** */
+ private static final int CONFIGLESS_GRID_IDX = GRID_CNT + 1;
+
+ /** */
+ private static CountDownLatch initLatch = new CountDownLatch(GRID_CNT);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ int idx = getTestGridIndex(gridName);
+
+ cfg.setUserAttributes(F.asMap(DC_NODE_ATTR, idx % 2));
+
+ if (idx != CONFIGLESS_GRID_IDX) {
+ if (idx == RESOLVER_GRID_IDX) {
+ cfg.setClientMode(true);
+
+ cfg.setUserAttributes(F.asMap(ACTIVATOR_NODE_ATTR, "true"));
+ }
+ else {
+ CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES_CNT];
+
+ for (int cnt = 0; cnt < CACHES_CNT; cnt++) {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(testCacheName(cnt));
+ ccfg.setCacheMode(PARTITIONED);
+ ccfg.setBackups(0);
+ ccfg.setTopologyValidator(new SplitAwareTopologyValidator());
+
+ ccfgs[cnt] = ccfg;
+ }
+
+ cfg.setCacheConfiguration(ccfgs);
+ }
+ }
+
+ return cfg;
+ }
+
+ /**
+ * @param idx Index.
+ */
+ private String testCacheName(int idx) {
+ return "test" + idx;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(GRID_CNT);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /**
+ * Tests topology split scenario.
+ * @throws Exception
+ */
+ public void testTopologyValidator() throws Exception {
+ assertTrue(initLatch.await(10, TimeUnit.SECONDS));
+
+ // Tests what each node is able to do puts.
+ tryPut(0, 1, 2, 3);
+
+ clearAll();
+
+ stopGrid(1);
+
+ stopGrid(3);
+
+ awaitPartitionMapExchange();
+
+ try {
+ tryPut(0, 2);
+
+ fail();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ resolveSplit();
+
+ tryPut(0, 2);
+
+ clearAll();
+
+ startGrid(CONFIGLESS_GRID_IDX);
+
+ awaitPartitionMapExchange();
+
+ tryPut(CONFIGLESS_GRID_IDX);
+
+ stopGrid(CONFIGLESS_GRID_IDX);
+
+ awaitPartitionMapExchange();
+
+ try {
+ tryPut(0, 2);
+
+ fail();
+ }
+ catch (Exception e) {
+ // No-op.
+ }
+
+ resolveSplit();
+
+ tryPut(0, 2);
+
+ clearAll();
+
+ startGrid(1);
+
+ awaitPartitionMapExchange();
+
+ tryPut(0, 1, 2);
+ }
+
+ /** */
+ private void clearAll() {
+ for (int i = 0; i < CACHES_CNT; i++)
+ grid(0).cache(testCacheName(i)).clear();
+ }
+
+ /**
+ * Resolves split by client node join.
+ */
+ private void resolveSplit() throws Exception {
+ startGrid(RESOLVER_GRID_IDX);
+
+ stopGrid(RESOLVER_GRID_IDX);
+ }
+
+ /**
+ * @param grids Grids to test.
+ */
+ private void tryPut(int... grids) {
+ for (int i = 0; i < grids.length; i++) {
+ IgniteEx g = grid(grids[i]);
+
+ for (int cnt = 0; cnt < CACHES_CNT; cnt++) {
+ String cacheName = testCacheName(cnt);
+
+ for (int k = 0; k < 100; k++) {
+ if (g.affinity(cacheName).isPrimary(g.localNode(), k)) {
+ log().info("Put " + k + " to node " + g.localNode().id().toString());
+
+ IgniteCache<Object, Object> cache = g.cache(cacheName);
+
+ cache.put(k, k);
+
+ assertEquals(1, cache.localSize());
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Prevents cache from performing any operation if only nodes from single data center are left in topology.
+ */
+ private static class SplitAwareTopologyValidator implements TopologyValidator, LifecycleAware {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ @CacheNameResource
+ private String cacheName;
+
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** */
+ private transient volatile long activatorTopVer;
+
+ /** {@inheritDoc} */
+ @Override public boolean validate(Collection<ClusterNode> nodes) {
+ if (!F.view(nodes, new IgnitePredicate<ClusterNode>() {
+ @Override public boolean apply(ClusterNode node) {
+ return !node.isClient() && node.attribute(DC_NODE_ATTR) == null;
+ }
+ }).isEmpty())
+ return false;
+
+ IgniteKernal kernal = (IgniteKernal)ignite.cache(cacheName).unwrap(Ignite.class);
+
+ GridDhtCacheAdapter<Object, Object> dht = kernal.context().cache().internalCache(cacheName).context().dht();
+
+ long cacheTopVer = dht.topology().topologyVersionFuture().topologyVersion().topologyVersion();
+
+ if (hasSplit(nodes)) {
+ boolean resolved = activatorTopVer != 0 && cacheTopVer >= activatorTopVer;
+
+ if (!resolved)
+ log.info("Grid segmentation is detected, switching to inoperative state.");
+
+ return resolved;
+ }
+ else
+ activatorTopVer = 0;
+
+ return true;
+ }
+
+ /** */
+ private boolean hasSplit(Collection<ClusterNode> nodes) {
+ ClusterNode prev = null;
+
+ for (ClusterNode node : nodes) {
+ if (node.isClient())
+ continue;
+
+ if (prev != null &&
+ !prev.attribute(DC_NODE_ATTR).equals(node.attribute(DC_NODE_ATTR)))
+ return false;
+
+ prev = node;
+ }
+
+ return true;
+ }
+
+ @Override public void start() throws IgniteException {
+ if (ignite.cluster().localNode().isClient())
+ return;
+
+ initLatch.countDown();
+
+ ignite.events().localListen(new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ DiscoveryEvent discoEvt = (DiscoveryEvent)evt;
+
+ ClusterNode node = discoEvt.eventNode();
+
+ if (isMarkerNode(node))
+ activatorTopVer = discoEvt.topologyVersion();
+
+ return true;
+ }
+ }, EventType.EVT_NODE_LEFT);
+ }
+
+ /**
+ * @param node Node.
+ */
+ private boolean isMarkerNode(ClusterNode node) {
+ return node.isClient() && node.attribute(ACTIVATOR_NODE_ATTR) != null;
+ }
+
+ @Override public void stop() throws IgniteException {
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/3ef7a0e0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuit.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuit.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuit.java
index b100127..8c4cd11 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuit.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuit.java
@@ -37,6 +37,7 @@ public class IgniteTopologyValidatorTestSuit extends TestSuite {
suite.addTest(new TestSuite(IgniteTopologyValidatorPartitionedTxCacheTest.class));
suite.addTest(new TestSuite(IgniteTopologyValidatorReplicatedAtomicCacheTest.class));
suite.addTest(new TestSuite(IgniteTopologyValidatorReplicatedTxCacheTest.class));
+ suite.addTest(new TestSuite(IgniteTopologyValidatorGridSplitCacheTest.class));
return suite;
}
[23/50] [abbrv] ignite git commit: Merge branch 'master' of
https://github.com/apache/ignite
Posted by yz...@apache.org.
Merge branch 'master' of https://github.com/apache/ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3bf880c1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3bf880c1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3bf880c1
Branch: refs/heads/ignite-comm-balance-master
Commit: 3bf880c16e2787c44f62c4f1daf4c9f0fdab2dba
Parents: aaeda72 605d946
Author: agura <ag...@apache.org>
Authored: Thu Feb 9 20:34:53 2017 +0300
Committer: agura <ag...@apache.org>
Committed: Thu Feb 9 20:34:53 2017 +0300
----------------------------------------------------------------------
modules/yardstick/DEVNOTES-standalone.txt | 15 +++
modules/yardstick/DEVNOTES.txt | 20 ++--
modules/yardstick/README.txt | 119 +++++++++++++------
.../config/benchmark-sample.properties | 62 ++++++++++
modules/yardstick/pom.xml | 4 +-
pom.xml | 1 +
6 files changed, 172 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
[19/50] [abbrv] ignite git commit: minor
Posted by yz...@apache.org.
minor
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4a62232f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4a62232f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4a62232f
Branch: refs/heads/ignite-comm-balance-master
Commit: 4a62232fc95f482ac1610263330b5ef103179b9d
Parents: 3459bdd
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Feb 9 20:29:36 2017 +0700
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Feb 9 20:29:36 2017 +0700
----------------------------------------------------------------------
.../ignite/internal/suggestions/GridPerformanceSuggestions.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a62232f/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java
index c51a136..291840c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/suggestions/GridPerformanceSuggestions.java
@@ -93,6 +93,7 @@ public class GridPerformanceSuggestions {
perfs.clear();
}
+
U.quietAndInfo(log, "Refer to this page for more performance suggestions: " + SUGGESTIONS_LINK);
U.quietAndInfo(log, "");
}
[04/50] [abbrv] ignite git commit: ignite-4314 cache.clear should not
destroy offheap map
Posted by yz...@apache.org.
ignite-4314 cache.clear should not destroy offheap map
(cherry picked from commit 88c06ec)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d396398c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d396398c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d396398c
Branch: refs/heads/ignite-comm-balance-master
Commit: d396398c1b4660b3bca24d2650a10f6c0677b4df
Parents: f9aaf03
Author: sboikov <sb...@gridgain.com>
Authored: Fri Dec 2 10:36:41 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jan 19 10:41:10 2017 +0300
----------------------------------------------------------------------
.../cache/GridCacheClearAllRunnable.java | 58 +++++++++-----------
.../processors/cache/GridCacheSwapManager.java | 8 ---
.../cache/transactions/IgniteTxHandler.java | 2 +-
3 files changed, 26 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d396398c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
index 4f97e7b..9e7f329 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllRunnable.java
@@ -87,48 +87,40 @@ public class GridCacheClearAllRunnable<K, V> implements Runnable {
// Clear swapped entries.
if (!ctx.isNear()) {
if (ctx.swap().offHeapEnabled()) {
- if (GridQueryProcessor.isEnabled(ctx.config())) {
- for (Iterator<KeyCacheObject> it =
- ctx.swap().offHeapKeyIterator(true, true, AffinityTopologyVersion.NONE); it.hasNext();) {
- KeyCacheObject key = it.next();
-
- if (owns(key))
- clearEntry(cache.entryEx(key));
+ for (Iterator<KeyCacheObject> it = ctx.swap().offHeapKeyIterator(true, true, AffinityTopologyVersion.NONE); it.hasNext();) {
+ KeyCacheObject key = it.next();
- }
+ if (owns(key))
+ clearEntry(cache.entryEx(key));
}
- else if (id == 0)
- ctx.swap().clearOffHeap();
}
- if (ctx.isSwapOrOffheapEnabled()) {
- if (ctx.swap().swapEnabled()) {
- if (GridQueryProcessor.isEnabled(ctx.config())) {
- Iterator<KeyCacheObject> it = null;
+ if (ctx.swap().swapEnabled()) {
+ if (GridQueryProcessor.isEnabled(ctx.config())) {
+ Iterator<KeyCacheObject> it = null;
- try {
- it = ctx.swap().swapKeyIterator(true, true, AffinityTopologyVersion.NONE);
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to get iterator over swap.", e);
- }
+ try {
+ it = ctx.swap().swapKeyIterator(true, true, AffinityTopologyVersion.NONE);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to get iterator over swap.", e);
+ }
- if (it != null) {
- while (it.hasNext()) {
- KeyCacheObject key = it.next();
+ if (it != null) {
+ while (it.hasNext()) {
+ KeyCacheObject key = it.next();
- if (owns(key))
- clearEntry(cache.entryEx(key));
- }
+ if (owns(key))
+ clearEntry(cache.entryEx(key));
}
}
- else if (id == 0) {
- try {
- ctx.swap().clearSwap();
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to clearLocally entries from swap storage.", e);
- }
+ }
+ else if (id == 0) {
+ try {
+ ctx.swap().clearSwap();
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to clearLocally entries from swap storage.", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d396398c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index fd0b471..d4499b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1416,14 +1416,6 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
}
/**
- * Clears off-heap.
- */
- public void clearOffHeap() {
- if (offheapEnabled)
- initOffHeap();
- }
-
- /**
* Clears swap.
*
* @throws IgniteCheckedException If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d396398c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index f784ba2..d564156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -1507,7 +1507,7 @@ public class IgniteTxHandler {
if (log.isDebugEnabled())
log.debug("Got entry removed exception, will retry: " + entry.txKey());
- entry.cached(null);
+ entry.cached(cacheCtx.cache().entryEx(entry.key(), req.topologyVersion()));
}
}
}
[35/50] [abbrv] ignite git commit: IGNITE-4159: using logger instead
of system.out.println
Posted by yz...@apache.org.
IGNITE-4159: using logger instead of system.out.println
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b9bf77c1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b9bf77c1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b9bf77c1
Branch: refs/heads/ignite-comm-balance-master
Commit: b9bf77c1a492951bd45abb8653469650d51c38a1
Parents: 37c0a22
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Feb 13 22:03:30 2017 -0800
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Feb 13 22:03:30 2017 -0800
----------------------------------------------------------------------
modules/kubernetes/config/example-kube.xml | 2 +-
.../ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b9bf77c1/modules/kubernetes/config/example-kube.xml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/example-kube.xml b/modules/kubernetes/config/example-kube.xml
index bc04463..11309d8 100644
--- a/modules/kubernetes/config/example-kube.xml
+++ b/modules/kubernetes/config/example-kube.xml
@@ -41,4 +41,4 @@
</bean>
</property>
</bean>
-</beans>
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b9bf77c1/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
index a5bd24f..f312195 100644
--- a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
+++ b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
@@ -52,7 +52,7 @@ import org.codehaus.jackson.map.ObjectMapper;
* cluster is required to be containerized as well. Applications and Ignite nodes running outside of Kubernetes will
* not be able to reach the containerized counterparts.
* <p>
- * The implementation is based on a dedicated Kubernetes service that has to be created and should be deployed prior
+ * The implementation is based on a distinct Kubernetes service that has to be created and should be deployed prior
* Ignite nodes startup. The service will maintain a list of all endpoints (internal IP addresses) of all containerized
* Ignite pods running so far. The name of the service must be equal to {@link #setServiceName(String)} which is
* `ignite` by default.
@@ -137,7 +137,7 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
Collection<InetSocketAddress> addrs = new ArrayList<>();
try {
- System.out.println("Getting Apache Ignite endpoints from: " + url);
+ log.debug("Getting Apache Ignite endpoints from: " + url);
HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
@@ -159,7 +159,7 @@ public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter
for (Address address : subset.addresses) {
addrs.add(new InetSocketAddress(address.ip, 0));
- System.out.println("Added an address to the list: " + address.ip);
+ log.debug("Added an address to the list: " + address.ip);
}
}
}
[29/50] [abbrv] ignite git commit: IGNITE-4688: Changed copyrights to
2017.
Posted by yz...@apache.org.
IGNITE-4688: Changed copyrights to 2017.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cff20e79
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cff20e79
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cff20e79
Branch: refs/heads/ignite-comm-balance-master
Commit: cff20e794cdf8e0e0ff89ea17ab1d2c7f1de4663
Parents: 5245214
Author: devozerov <vo...@gridgain.com>
Authored: Mon Feb 13 13:13:13 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Feb 13 13:13:13 2017 +0300
----------------------------------------------------------------------
.../dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs | 2 +-
.../dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.EntityFramework.nuspec | 2 +-
.../platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs | 2 +-
modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs | 2 +-
.../examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs | 2 +-
.../examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cff20e79/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
index 7da0a1d..ce82281 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Properties/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/cff20e79/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
index 26caa82..e9f93bd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/cff20e79/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
index 1fc6c59..28f6e72 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Properties/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/cff20e79/modules/platforms/dotnet/Apache.Ignite.EntityFramework/Apache.Ignite.EntityFramework.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.EntityFramework/Apache.Ignite.EntityFramework.nuspec b/modules/platforms/dotnet/Apache.Ignite.EntityFramework/Apache.Ignite.EntityFramework.nuspec
index b8bcd46..477dcf8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.EntityFramework/Apache.Ignite.EntityFramework.nuspec
+++ b/modules/platforms/dotnet/Apache.Ignite.EntityFramework/Apache.Ignite.EntityFramework.nuspec
@@ -47,7 +47,7 @@ More info: https://apacheignite-net.readme.io/
Apache Ignite EntityFramework Integration
</summary>
<releaseNotes></releaseNotes>
- <copyright>Copyright 2016</copyright>
+ <copyright>Copyright 2017</copyright>
<tags>EntityFramework Second-Level Apache Ignite In-Memory Distributed Computing SQL NoSQL Grid Map Reduce Cache</tags>
<dependencies>
<dependency id="Apache.Ignite" version="[$version$]" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/cff20e79/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
index a1dae5e..561674a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Properties/AssemblyInfo.cs
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/cff20e79/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
index 97a78d5..3e0e305 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/cff20e79/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
index a75ee0e..f6323e0 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/cff20e79/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
index cc78a5c..6d28b2b 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2016")]
+[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[49/50] [abbrv] ignite git commit: ignite-4710 More information in
IgniteTxOptimisticCheckedException message.
Posted by yz...@apache.org.
ignite-4710 More information in IgniteTxOptimisticCheckedException message.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7f744581
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7f744581
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7f744581
Branch: refs/heads/ignite-comm-balance-master
Commit: 7f74458148268af5bd721fd308b66b57e9a3852b
Parents: d3ccaf6
Author: sboikov <sb...@gridgain.com>
Authored: Thu Feb 16 18:34:02 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Feb 16 18:34:02 2017 +0300
----------------------------------------------------------------------
.../distributed/dht/GridDhtTxPrepareFuture.java | 35 ++++++++++++++++++--
1 file changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f744581/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index eadb69e..1227ba9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -1141,11 +1141,40 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
* @return Optimistic version check error.
*/
private IgniteTxOptimisticCheckedException versionCheckError(IgniteTxEntry entry) {
+ StringBuilder msg = new StringBuilder("Failed to prepare transaction, read/write conflict [");
+
GridCacheContext cctx = entry.context();
- return new IgniteTxOptimisticCheckedException("Failed to prepare transaction, " +
- "read/write conflict [key=" + entry.key().value(cctx.cacheObjectContext(), false) +
- ", cache=" + cctx.name() + ']');
+ try {
+ Object key = cctx.unwrapBinaryIfNeeded(entry.key(), entry.keepBinary(), false);
+
+ assert key != null : entry.key();
+
+ msg.append("key=").append(key.toString()).append(", keyCls=").append(key.getClass().getName());
+ }
+ catch (Exception e) {
+ msg.append("key=<failed to get key: ").append(e.toString()).append(">");
+ }
+
+ try {
+ GridCacheEntryEx entryEx = entry.cached();
+
+ CacheObject cacheVal = entryEx != null ? entryEx.rawGet() : null;
+
+ Object val = cacheVal != null ? cctx.unwrapBinaryIfNeeded(cacheVal, entry.keepBinary(), false) : null;
+
+ if (val != null)
+ msg.append(", val=").append(val.toString()).append(", valCls=").append(val.getClass().getName());
+ else
+ msg.append(", val=null");
+ }
+ catch (Exception e) {
+ msg.append(", val=<failed to get value: ").append(e.toString()).append(">");
+ }
+
+ msg.append(", cache=").append(cctx.name()).append(", thread=").append(Thread.currentThread()).append("]");
+
+ return new IgniteTxOptimisticCheckedException(msg.toString());
}
/**
[24/50] [abbrv] ignite git commit: IGNITE-4678 Web Console:
Implemented demo load as service.
Posted by yz...@apache.org.
IGNITE-4678 Web Console: Implemented demo load as service.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a600cafd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a600cafd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a600cafd
Branch: refs/heads/ignite-comm-balance-master
Commit: a600cafd1eec7581e8edde5a10b7d171997551f7
Parents: 3bf880c
Author: Andrey Novikov <an...@gridgain.com>
Authored: Fri Feb 10 15:55:05 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri Feb 10 15:55:05 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/agent.js | 34 ++
modules/web-console/backend/app/browser.js | 26 +
modules/web-console/frontend/package.json | 2 +-
.../ignite/console/demo/AgentClusterDemo.java | 475 +------------------
.../ignite/console/demo/AgentDemoUtils.java | 79 +++
.../demo/service/DemoCachesLoadService.java | 456 ++++++++++++++++++
.../service/DemoRandomCacheLoadService.java | 120 +++++
.../service/DemoServiceClusterSingleton.java | 41 ++
.../demo/service/DemoServiceKeyAffinity.java | 41 ++
.../service/DemoServiceMultipleInstances.java | 41 ++
.../demo/service/DemoServiceNodeSingleton.java | 41 ++
11 files changed, 897 insertions(+), 459 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/backend/app/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/agent.js b/modules/web-console/backend/app/agent.js
index 8170280..4cae8ee 100644
--- a/modules/web-console/backend/app/agent.js
+++ b/modules/web-console/backend/app/agent.js
@@ -581,6 +581,40 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
return this.executeRest(cmd);
}
+
+ /**
+ * Collect service information.
+ * @param {Boolean} demo Is need run command on demo node.
+ * @param {String} nid Node ID.
+ * @returns {Promise}
+ */
+ services(demo, nid) {
+ const cmd = new Command(demo, 'exe')
+ .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
+ .addParam('p1', nid)
+ .addParam('p2', 'org.apache.ignite.internal.visor.service.VisorServiceTask')
+ .addParam('p3', 'java.lang.Void');
+
+ return this.executeRest(cmd);
+ }
+
+ /**
+ * Cancel service with specified name.
+ * @param {Boolean} demo Is need run command on demo node.
+ * @param {String} nid Node ID.
+ * @param {String} name Name of service to cancel.
+ * @returns {Promise}
+ */
+ serviceCancel(demo, nid, name) {
+ const cmd = new Command(demo, 'exe')
+ .addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
+ .addParam('p1', nid)
+ .addParam('p2', 'org.apache.ignite.internal.visor.service.VisorCancelServiceTask')
+ .addParam('p3', 'java.lang.String')
+ .addParam('p4', name);
+
+ return this.executeRest(cmd);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/backend/app/browser.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/browser.js b/modules/web-console/backend/app/browser.js
index 499d84d..2b1285e 100644
--- a/modules/web-console/backend/app/browser.js
+++ b/modules/web-console/backend/app/browser.js
@@ -455,6 +455,32 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
.catch((err) => cb(_errorToJson(err)));
});
+ // Collect service information from grid.
+ socket.on('service:collect', (nid, cb) => {
+ agentMgr.findAgent(accountId())
+ .then((agent) => agent.services(demo, nid))
+ .then((data) => {
+ if (data.finished)
+ return cb(null, data.result);
+
+ cb(_errorToJson(data.error));
+ })
+ .catch((err) => cb(_errorToJson(err)));
+ });
+
+ // Collect service information from grid.
+ socket.on('service:cancel', (nid, name, cb) => {
+ agentMgr.findAgent(accountId())
+ .then((agent) => agent.serviceCancel(demo, nid, name))
+ .then((data) => {
+ if (data.finished)
+ return cb(null, data.result);
+
+ cb(_errorToJson(data.error));
+ })
+ .catch((err) => cb(_errorToJson(err)));
+ });
+
const count = agentMgr.addAgentListener(user._id, socket);
socket.emit('agent:count', {count});
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index ff52ba4..651f496 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -46,7 +46,7 @@
"angular-touch": "~1.5.9",
"angular-translate": "~2.13.1",
"angular-tree-control": "~0.2.26",
- "angular-ui-grid": "~3.2.9",
+ "angular-ui-grid": "~4.0.0",
"angular-ui-router": "~0.3.1",
"bootstrap-sass": "~3.3.6",
"brace": "~0.8.0",
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
index 489e762..252692e 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
@@ -17,37 +17,24 @@
package org.apache.ignite.console.demo;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Random;
-import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteServices;
import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.QueryEntity;
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.cache.QueryIndexType;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.console.agent.AgentConfiguration;
-import org.apache.ignite.console.demo.model.Car;
-import org.apache.ignite.console.demo.model.Country;
-import org.apache.ignite.console.demo.model.Department;
-import org.apache.ignite.console.demo.model.Employee;
-import org.apache.ignite.console.demo.model.Parking;
+import org.apache.ignite.console.demo.service.DemoCachesLoadService;
+import org.apache.ignite.console.demo.service.DemoRandomCacheLoadService;
+import org.apache.ignite.console.demo.service.DemoServiceMultipleInstances;
+import org.apache.ignite.console.demo.service.DemoServiceClusterSingleton;
+import org.apache.ignite.console.demo.service.DemoServiceKeyAffinity;
+import org.apache.ignite.console.demo.service.DemoServiceNodeSingleton;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.logger.log4j.Log4JLogger;
@@ -55,7 +42,6 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
-import org.apache.ignite.transactions.Transaction;
import org.apache.log4j.Logger;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE;
@@ -66,8 +52,6 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_NO_ASCII;
import static org.apache.ignite.events.EventType.EVTS_DISCOVERY;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_JETTY_ADDRS;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_JETTY_PORT;
-import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
/**
* Demo for cluster features like SQL and Monitoring.
@@ -84,247 +68,6 @@ public class AgentClusterDemo {
/** */
private static final int NODE_CNT = 3;
- /** */
- private static final String COUNTRY_CACHE_NAME = "CountryCache";
-
- /** */
- private static final String DEPARTMENT_CACHE_NAME = "DepartmentCache";
-
- /** */
- private static final String EMPLOYEE_CACHE_NAME = "EmployeeCache";
-
- /** */
- private static final String PARKING_CACHE_NAME = "ParkingCache";
-
- /** */
- private static final String CAR_CACHE_NAME = "CarCache";
-
- /** */
- private static final Set<String> DEMO_CACHES = new HashSet<>(Arrays.asList(COUNTRY_CACHE_NAME,
- DEPARTMENT_CACHE_NAME, EMPLOYEE_CACHE_NAME, PARKING_CACHE_NAME, CAR_CACHE_NAME));
-
- /** */
- private static final Random rnd = new Random();
-
- /** Countries count. */
- private static final int CNTR_CNT = 10;
-
- /** Departments count */
- private static final int DEP_CNT = 100;
-
- /** Employees count. */
- private static final int EMPL_CNT = 1000;
-
- /** Countries count. */
- private static final int CAR_CNT = 100;
-
- /** Departments count */
- private static final int PARK_CNT = 10;
-
- /** Counter for threads in pool. */
- private static final AtomicInteger THREAD_CNT = new AtomicInteger(0);
-
- /**
- * Create base cache configuration.
- *
- * @param name cache name.
- * @return Cache configuration with basic properties set.
- */
- private static <K, V> CacheConfiguration<K, V> cacheConfiguration(String name) {
- CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(name);
-
- ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
- ccfg.setQueryDetailMetricsSize(10);
- ccfg.setStartSize(100);
- ccfg.setStatisticsEnabled(true);
-
- return ccfg;
- }
-
- /**
- * Configure cacheCountry.
- */
- private static <K, V> CacheConfiguration<K, V> cacheCountry() {
- CacheConfiguration<K, V> ccfg = cacheConfiguration(COUNTRY_CACHE_NAME);
-
- // Configure cacheCountry types.
- Collection<QueryEntity> qryEntities = new ArrayList<>();
-
- // COUNTRY.
- QueryEntity type = new QueryEntity();
-
- qryEntities.add(type);
-
- type.setKeyType(Integer.class.getName());
- type.setValueType(Country.class.getName());
-
- // Query fields for COUNTRY.
- LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
-
- qryFlds.put("id", "java.lang.Integer");
- qryFlds.put("name", "java.lang.String");
- qryFlds.put("population", "java.lang.Integer");
-
- type.setFields(qryFlds);
-
- ccfg.setQueryEntities(qryEntities);
-
- return ccfg;
- }
-
- /**
- * Configure cacheEmployee.
- */
- private static <K, V> CacheConfiguration<K, V> cacheDepartment() {
- CacheConfiguration<K, V> ccfg = cacheConfiguration(DEPARTMENT_CACHE_NAME);
-
- // Configure cacheDepartment types.
- Collection<QueryEntity> qryEntities = new ArrayList<>();
-
- // DEPARTMENT.
- QueryEntity type = new QueryEntity();
-
- qryEntities.add(type);
-
- type.setKeyType(Integer.class.getName());
- type.setValueType(Department.class.getName());
-
- // Query fields for DEPARTMENT.
- LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
-
- qryFlds.put("id", "java.lang.Integer");
- qryFlds.put("countryId", "java.lang.Integer");
- qryFlds.put("name", "java.lang.String");
-
- type.setFields(qryFlds);
-
- ccfg.setQueryEntities(qryEntities);
-
- return ccfg;
- }
-
- /**
- * Configure cacheEmployee.
- */
- private static <K, V> CacheConfiguration<K, V> cacheEmployee() {
- CacheConfiguration<K, V> ccfg = cacheConfiguration(EMPLOYEE_CACHE_NAME);
-
- ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
- ccfg.setBackups(1);
-
- // Configure cacheEmployee types.
- Collection<QueryEntity> qryEntities = new ArrayList<>();
-
- // EMPLOYEE.
- QueryEntity type = new QueryEntity();
-
- qryEntities.add(type);
-
- type.setKeyType(Integer.class.getName());
- type.setValueType(Employee.class.getName());
-
- // Query fields for EMPLOYEE.
- LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
-
- qryFlds.put("id", "java.lang.Integer");
- qryFlds.put("departmentId", "java.lang.Integer");
- qryFlds.put("managerId", "java.lang.Integer");
- qryFlds.put("firstName", "java.lang.String");
- qryFlds.put("lastName", "java.lang.String");
- qryFlds.put("email", "java.lang.String");
- qryFlds.put("phoneNumber", "java.lang.String");
- qryFlds.put("hireDate", "java.sql.Date");
- qryFlds.put("job", "java.lang.String");
- qryFlds.put("salary", "java.lang.Double");
-
- type.setFields(qryFlds);
-
- // Indexes for EMPLOYEE.
- Collection<QueryIndex> indexes = new ArrayList<>();
-
- QueryIndex idx = new QueryIndex();
-
- idx.setName("EMP_NAMES");
- idx.setIndexType(QueryIndexType.SORTED);
- LinkedHashMap<String, Boolean> indFlds = new LinkedHashMap<>();
-
- indFlds.put("firstName", Boolean.FALSE);
- indFlds.put("lastName", Boolean.FALSE);
-
- idx.setFields(indFlds);
-
- indexes.add(idx);
- indexes.add(new QueryIndex("salary", QueryIndexType.SORTED, false, "EMP_SALARY"));
-
- type.setIndexes(indexes);
-
- ccfg.setQueryEntities(qryEntities);
-
- return ccfg;
- }
-
- /**
- * Configure cacheEmployee.
- */
- private static <K, V> CacheConfiguration<K, V> cacheParking() {
- CacheConfiguration<K, V> ccfg = cacheConfiguration(PARKING_CACHE_NAME);
-
- // Configure cacheParking types.
- Collection<QueryEntity> qryEntities = new ArrayList<>();
-
- // PARKING.
- QueryEntity type = new QueryEntity();
-
- qryEntities.add(type);
-
- type.setKeyType(Integer.class.getName());
- type.setValueType(Parking.class.getName());
-
- // Query fields for PARKING.
- LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
-
- qryFlds.put("id", "java.lang.Integer");
- qryFlds.put("name", "java.lang.String");
- qryFlds.put("capacity", "java.lang.Integer");
-
- type.setFields(qryFlds);
-
- ccfg.setQueryEntities(qryEntities);
-
- return ccfg;
- }
-
- /**
- * Configure cacheEmployee.
- */
- private static <K, V> CacheConfiguration<K, V> cacheCar() {
- CacheConfiguration<K, V> ccfg = cacheConfiguration(CAR_CACHE_NAME);
-
- // Configure cacheCar types.
- Collection<QueryEntity> qryEntities = new ArrayList<>();
-
- // CAR.
- QueryEntity type = new QueryEntity();
-
- qryEntities.add(type);
-
- type.setKeyType(Integer.class.getName());
- type.setValueType(Car.class.getName());
-
- // Query fields for CAR.
- LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
-
- qryFlds.put("id", "java.lang.Integer");
- qryFlds.put("parkingId", "java.lang.Integer");
- qryFlds.put("name", "java.lang.String");
-
- type.setFields(qryFlds);
-
- ccfg.setQueryEntities(qryEntities);
-
- return ccfg;
- }
-
/**
* Configure node.
* @param gridIdx Grid name index.
@@ -363,212 +106,20 @@ public class AgentClusterDemo {
if (client)
cfg.setClientMode(true);
- cfg.setCacheConfiguration(cacheCountry(), cacheDepartment(), cacheEmployee(), cacheParking(), cacheCar());
-
cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
return cfg;
}
/**
- * @param val Value to round.
- * @param places Numbers after point.
- * @return Rounded value;
- */
- private static double round(double val, int places) {
- if (places < 0)
- throw new IllegalArgumentException();
-
- long factor = (long)Math.pow(10, places);
-
- val *= factor;
-
- long tmp = Math.round(val);
-
- return (double)tmp / factor;
- }
-
- /**
- * @param ignite Ignite.
- * @param range Time range in milliseconds.
- */
- private static void populateCacheEmployee(Ignite ignite, long range) {
- if (log.isDebugEnabled())
- log.debug("DEMO: Start employees population with data...");
-
- IgniteCache<Integer, Country> cacheCountry = ignite.cache(COUNTRY_CACHE_NAME);
-
- for (int i = 0, n = 1; i < CNTR_CNT; i++, n++)
- cacheCountry.put(i, new Country(i, "Country #" + n, n * 10000000));
-
- IgniteCache<Integer, Department> cacheDepartment = ignite.cache(DEPARTMENT_CACHE_NAME);
-
- IgniteCache<Integer, Employee> cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME);
-
- for (int i = 0, n = 1; i < DEP_CNT; i++, n++) {
- cacheDepartment.put(i, new Department(n, rnd.nextInt(CNTR_CNT), "Department #" + n));
-
- double r = rnd.nextDouble();
-
- cacheEmployee.put(i, new Employee(i, rnd.nextInt(DEP_CNT), null, "First name manager #" + n,
- "Last name manager #" + n, "Email manager #" + n, "Phone number manager #" + n,
- new java.sql.Date((long)(r * range)), "Job manager #" + n, 1000 + round(r * 4000, 2)));
- }
-
- for (int i = 0, n = 1; i < EMPL_CNT; i++, n++) {
- Integer depId = rnd.nextInt(DEP_CNT);
-
- double r = rnd.nextDouble();
-
- cacheEmployee.put(i, new Employee(i, depId, depId, "First name employee #" + n,
- "Last name employee #" + n, "Email employee #" + n, "Phone number employee #" + n,
- new java.sql.Date((long)(r * range)), "Job employee #" + n, 500 + round(r * 2000, 2)));
- }
-
- if (log.isDebugEnabled())
- log.debug("DEMO: Finished employees population.");
- }
-
- /**
- * @param ignite Ignite.
- */
- private static void populateCacheCar(Ignite ignite) {
- if (log.isDebugEnabled())
- log.debug("DEMO: Start cars population...");
-
- IgniteCache<Integer, Parking> cacheParking = ignite.cache(PARKING_CACHE_NAME);
-
- for (int i = 0, n = 1; i < PARK_CNT; i++, n++)
- cacheParking.put(i, new Parking(i, "Parking #" + n, n * 10));
-
- IgniteCache<Integer, Car> cacheCar = ignite.cache(CAR_CACHE_NAME);
-
- for (int i = 0, n = 1; i < CAR_CNT; i++, n++)
- cacheCar.put(i, new Car(i, rnd.nextInt(PARK_CNT), "Car #" + n));
-
- if (log.isDebugEnabled())
- log.debug("DEMO: Finished cars population.");
- }
-
- /**
- * Creates a thread pool that can schedule commands to run after a given delay, or to execute periodically.
- *
- * @param corePoolSize Number of threads to keep in the pool, even if they are idle.
- * @param threadName Part of thread name that would be used by thread factory.
- * @return Newly created scheduled thread pool.
- */
- private static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, final String threadName) {
- ScheduledExecutorService srvc = Executors.newScheduledThreadPool(corePoolSize, new ThreadFactory() {
- @Override public Thread newThread(Runnable r) {
- Thread thread = new Thread(r, String.format("%s-%d", threadName, THREAD_CNT.getAndIncrement()));
-
- thread.setDaemon(true);
-
- return thread;
- }
- });
-
- ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor)srvc;
-
- // Setting up shutdown policy.
- executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
- executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
-
- return srvc;
- }
-
- /**
* Starts read and write from cache in background.
*
* @param ignite Ignite.
* @param cnt - maximum count read/write key
*/
private static void startLoad(final Ignite ignite, final int cnt) {
- final long diff = new java.util.Date().getTime();
-
- populateCacheEmployee(ignite, diff);
- populateCacheCar(ignite);
-
- ScheduledExecutorService cachePool = newScheduledThreadPool(2, "demo-sql-load-cache-tasks");
-
- cachePool.scheduleWithFixedDelay(new Runnable() {
- @Override public void run() {
- try {
- for (String cacheName : ignite.cacheNames()) {
- if (!DEMO_CACHES.contains(cacheName)) {
- IgniteCache<Integer, String> otherCache = ignite.cache(cacheName);
-
- if (otherCache != null) {
- for (int i = 0, n = 1; i < cnt; i++, n++) {
- Integer key = rnd.nextInt(1000);
-
- String val = otherCache.get(key);
-
- if (val == null)
- otherCache.put(key, "other-" + key);
- else if (rnd.nextInt(100) < 30)
- otherCache.remove(key);
- }
- }
- }
- }
-
- IgniteCache<Integer, Employee> cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME);
-
- if (cacheEmployee != null)
- try(Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
- for (int i = 0, n = 1; i < cnt; i++, n++) {
- Integer id = rnd.nextInt(EMPL_CNT);
-
- Integer depId = rnd.nextInt(DEP_CNT);
-
- double r = rnd.nextDouble();
-
- cacheEmployee.put(id, new Employee(id, depId, depId, "First name employee #" + n,
- "Last name employee #" + n, "Email employee #" + n, "Phone number employee #" + n,
- new java.sql.Date((long)(r * diff)), "Job employee #" + n, 500 + round(r * 2000, 2)));
-
- if (rnd.nextBoolean())
- cacheEmployee.remove(rnd.nextInt(EMPL_CNT));
-
- cacheEmployee.get(rnd.nextInt(EMPL_CNT));
- }
-
- if (rnd.nextInt(100) > 20)
- tx.commit();
- }
- }
- catch (Throwable e) {
- if (!e.getMessage().contains("cache is stopped"))
- ignite.log().error("Cache write task execution error", e);
- }
- }
- }, 10, 3, TimeUnit.SECONDS);
-
- cachePool.scheduleWithFixedDelay(new Runnable() {
- @Override public void run() {
- try {
- IgniteCache<Integer, Car> cache = ignite.cache(CAR_CACHE_NAME);
-
- if (cache != null)
- for (int i = 0; i < cnt; i++) {
- Integer carId = rnd.nextInt(CAR_CNT);
-
- cache.put(carId, new Car(carId, rnd.nextInt(PARK_CNT), "Car #" + (i + 1)));
-
- if (rnd.nextBoolean())
- cache.remove(rnd.nextInt(CAR_CNT));
- }
- }
- catch (IllegalStateException ignored) {
- // No-op.
- }
- catch (Throwable e) {
- if (!e.getMessage().contains("cache is stopped"))
- ignite.log().error("Cache write task execution error", e);
- }
- }
- }, 10, 3, TimeUnit.SECONDS);
+ ignite.services().deployClusterSingleton("Demo caches load service", new DemoCachesLoadService(cnt));
+ ignite.services().deployNodeSingleton("RandomCache load service", new DemoRandomCacheLoadService(cnt));
}
/**
@@ -609,6 +160,14 @@ public class AgentClusterDemo {
}
}, 10, 10, TimeUnit.SECONDS);
+ IgniteServices services = ignite.services();
+
+ services.deployMultiple("Demo service: Multiple instances", new DemoServiceMultipleInstances(), 7, 3);
+ services.deployNodeSingleton("Demo service: Node singleton", new DemoServiceNodeSingleton());
+ services.deployClusterSingleton("Demo service: Cluster singleton", new DemoServiceClusterSingleton());
+ services.deployKeyAffinitySingleton("Demo service: Key affinity singleton",
+ new DemoServiceKeyAffinity(), DemoCachesLoadService.CAR_CACHE_NAME, "id");
+
if (log.isDebugEnabled())
log.debug("DEMO: Started embedded nodes with indexed enabled caches...");
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentDemoUtils.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentDemoUtils.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentDemoUtils.java
new file mode 100644
index 0000000..fb34de7
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentDemoUtils.java
@@ -0,0 +1,79 @@
+/*
+ * 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.console.demo;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Utilites for Agent demo mode.
+ */
+public class AgentDemoUtils {
+ /** Counter for threads in pool. */
+ private static final AtomicInteger THREAD_CNT = new AtomicInteger(0);
+
+ /**
+ * Creates a thread pool that can schedule commands to run after a given delay, or to execute periodically.
+ *
+ * @param corePoolSize Number of threads to keep in the pool, even if they are idle.
+ * @param threadName Part of thread name that would be used by thread factory.
+ * @return Newly created scheduled thread pool.
+ */
+ public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, final String threadName) {
+ ScheduledExecutorService srvc = Executors.newScheduledThreadPool(corePoolSize, new ThreadFactory() {
+ @Override public Thread newThread(Runnable r) {
+ Thread thread = new Thread(r, String.format("%s-%d", threadName, THREAD_CNT.getAndIncrement()));
+
+ thread.setDaemon(true);
+
+ return thread;
+ }
+ });
+
+ ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor)srvc;
+
+ // Setting up shutdown policy.
+ executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+ executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
+
+ return srvc;
+ }
+
+ /**
+ * Round value.
+ *
+ * @param val Value to round.
+ * @param places Numbers after point.
+ * @return Rounded value;
+ */
+ public static double round(double val, int places) {
+ if (places < 0)
+ throw new IllegalArgumentException();
+
+ long factor = (long)Math.pow(10, places);
+
+ val *= factor;
+
+ long tmp = Math.round(val);
+
+ return (double)tmp / factor;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
new file mode 100644
index 0000000..9117646
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoCachesLoadService.java
@@ -0,0 +1,456 @@
+/*
+ * 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.console.demo.service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.QueryIndexType;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.console.demo.AgentDemoUtils;
+import org.apache.ignite.console.demo.model.Car;
+import org.apache.ignite.console.demo.model.Country;
+import org.apache.ignite.console.demo.model.Department;
+import org.apache.ignite.console.demo.model.Employee;
+import org.apache.ignite.console.demo.model.Parking;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceContext;
+import org.apache.ignite.transactions.Transaction;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Demo service. Create and populate caches. Run demo load on caches.
+ */
+public class DemoCachesLoadService implements Service {
+ /** Ignite instance. */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** Thread pool to execute cache load operations. */
+ private ScheduledExecutorService cachePool;
+
+ /** */
+ private static final String COUNTRY_CACHE_NAME = "CountryCache";
+
+ /** */
+ private static final String DEPARTMENT_CACHE_NAME = "DepartmentCache";
+
+ /** */
+ private static final String EMPLOYEE_CACHE_NAME = "EmployeeCache";
+
+ /** */
+ private static final String PARKING_CACHE_NAME = "ParkingCache";
+
+ /** */
+ public static final String CAR_CACHE_NAME = "CarCache";
+
+ /** */
+ static final Set<String> DEMO_CACHES = new HashSet<>(Arrays.asList(COUNTRY_CACHE_NAME,
+ DEPARTMENT_CACHE_NAME, EMPLOYEE_CACHE_NAME, PARKING_CACHE_NAME, CAR_CACHE_NAME));
+
+ /** Countries count. */
+ private static final int CNTR_CNT = 10;
+
+ /** Departments count */
+ private static final int DEP_CNT = 100;
+
+ /** Employees count. */
+ private static final int EMPL_CNT = 1000;
+
+ /** Countries count. */
+ private static final int CAR_CNT = 100;
+
+ /** Departments count */
+ private static final int PARK_CNT = 10;
+
+ /** */
+ private static final Random rnd = new Random();
+
+ /** Maximum count read/write key. */
+ private final int cnt;
+
+ /** Time range in milliseconds. */
+ private final long range;
+
+ /**
+ * @param cnt Maximum count read/write key.
+ */
+ public DemoCachesLoadService(int cnt) {
+ this.cnt = cnt;
+
+ range = new java.util.Date().getTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ if (cachePool != null)
+ cachePool.shutdown();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void init(ServiceContext ctx) throws Exception {
+ ignite.createCache(cacheCountry());
+ ignite.createCache(cacheDepartment());
+ ignite.createCache(cacheEmployee());
+ ignite.createCache(cacheCar());
+ ignite.createCache(cacheParking());
+
+ populateCacheEmployee();
+ populateCacheCar();
+
+ cachePool = AgentDemoUtils.newScheduledThreadPool(2, "demo-sql-load-cache-tasks");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) throws Exception {
+ cachePool.scheduleWithFixedDelay(new Runnable() {
+ @Override public void run() {
+ try {
+ IgniteCache<Integer, Employee> cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME);
+
+ if (cacheEmployee != null)
+ try(Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+ for (int i = 0, n = 1; i < cnt; i++, n++) {
+ Integer id = rnd.nextInt(EMPL_CNT);
+
+ Integer depId = rnd.nextInt(DEP_CNT);
+
+ double r = rnd.nextDouble();
+
+ cacheEmployee.put(id, new Employee(id, depId, depId, "First name employee #" + n,
+ "Last name employee #" + n, "Email employee #" + n, "Phone number employee #" + n,
+ new java.sql.Date((long)(r * range)), "Job employee #" + n,
+ 500 + AgentDemoUtils.round(r * 2000, 2)));
+
+ if (rnd.nextBoolean())
+ cacheEmployee.remove(rnd.nextInt(EMPL_CNT));
+
+ cacheEmployee.get(rnd.nextInt(EMPL_CNT));
+ }
+
+ if (rnd.nextInt(100) > 20)
+ tx.commit();
+ }
+ }
+ catch (Throwable e) {
+ if (!e.getMessage().contains("cache is stopped"))
+ ignite.log().error("Cache write task execution error", e);
+ }
+ }
+ }, 10, 3, TimeUnit.SECONDS);
+
+ cachePool.scheduleWithFixedDelay(new Runnable() {
+ @Override public void run() {
+ try {
+ IgniteCache<Integer, Car> cache = ignite.cache(CAR_CACHE_NAME);
+
+ if (cache != null)
+ for (int i = 0; i < cnt; i++) {
+ Integer carId = rnd.nextInt(CAR_CNT);
+
+ cache.put(carId, new Car(carId, rnd.nextInt(PARK_CNT), "Car #" + (i + 1)));
+
+ if (rnd.nextBoolean())
+ cache.remove(rnd.nextInt(CAR_CNT));
+ }
+ }
+ catch (IllegalStateException ignored) {
+ // No-op.
+ }
+ catch (Throwable e) {
+ if (!e.getMessage().contains("cache is stopped"))
+ ignite.log().error("Cache write task execution error", e);
+ }
+ }
+ }, 10, 3, TimeUnit.SECONDS);
+ }
+
+
+ /**
+ * Create base cache configuration.
+ *
+ * @param name cache name.
+ * @return Cache configuration with basic properties set.
+ */
+ private static <K, V> CacheConfiguration<K, V> cacheConfiguration(String name) {
+ CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(name);
+
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+ ccfg.setQueryDetailMetricsSize(10);
+ ccfg.setStartSize(100);
+ ccfg.setStatisticsEnabled(true);
+
+ return ccfg;
+ }
+
+ /**
+ * Configure cacheCountry.
+ */
+ private static <K, V> CacheConfiguration<K, V> cacheCountry() {
+ CacheConfiguration<K, V> ccfg = cacheConfiguration(COUNTRY_CACHE_NAME);
+
+ // Configure cacheCountry types.
+ Collection<QueryEntity> qryEntities = new ArrayList<>();
+
+ // COUNTRY.
+ QueryEntity type = new QueryEntity();
+
+ qryEntities.add(type);
+
+ type.setKeyType(Integer.class.getName());
+ type.setValueType(Country.class.getName());
+
+ // Query fields for COUNTRY.
+ LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
+
+ qryFlds.put("id", "java.lang.Integer");
+ qryFlds.put("name", "java.lang.String");
+ qryFlds.put("population", "java.lang.Integer");
+
+ type.setFields(qryFlds);
+
+ ccfg.setQueryEntities(qryEntities);
+
+ return ccfg;
+ }
+
+ /**
+ * Configure cacheEmployee.
+ */
+ private static <K, V> CacheConfiguration<K, V> cacheDepartment() {
+ CacheConfiguration<K, V> ccfg = cacheConfiguration(DEPARTMENT_CACHE_NAME);
+
+ // Configure cacheDepartment types.
+ Collection<QueryEntity> qryEntities = new ArrayList<>();
+
+ // DEPARTMENT.
+ QueryEntity type = new QueryEntity();
+
+ qryEntities.add(type);
+
+ type.setKeyType(Integer.class.getName());
+ type.setValueType(Department.class.getName());
+
+ // Query fields for DEPARTMENT.
+ LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
+
+ qryFlds.put("id", "java.lang.Integer");
+ qryFlds.put("countryId", "java.lang.Integer");
+ qryFlds.put("name", "java.lang.String");
+
+ type.setFields(qryFlds);
+
+ ccfg.setQueryEntities(qryEntities);
+
+ return ccfg;
+ }
+
+ /**
+ * Configure cacheEmployee.
+ */
+ private static <K, V> CacheConfiguration<K, V> cacheEmployee() {
+ CacheConfiguration<K, V> ccfg = cacheConfiguration(EMPLOYEE_CACHE_NAME);
+
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ ccfg.setBackups(1);
+
+ // Configure cacheEmployee types.
+ Collection<QueryEntity> qryEntities = new ArrayList<>();
+
+ // EMPLOYEE.
+ QueryEntity type = new QueryEntity();
+
+ qryEntities.add(type);
+
+ type.setKeyType(Integer.class.getName());
+ type.setValueType(Employee.class.getName());
+
+ // Query fields for EMPLOYEE.
+ LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
+
+ qryFlds.put("id", "java.lang.Integer");
+ qryFlds.put("departmentId", "java.lang.Integer");
+ qryFlds.put("managerId", "java.lang.Integer");
+ qryFlds.put("firstName", "java.lang.String");
+ qryFlds.put("lastName", "java.lang.String");
+ qryFlds.put("email", "java.lang.String");
+ qryFlds.put("phoneNumber", "java.lang.String");
+ qryFlds.put("hireDate", "java.sql.Date");
+ qryFlds.put("job", "java.lang.String");
+ qryFlds.put("salary", "java.lang.Double");
+
+ type.setFields(qryFlds);
+
+ // Indexes for EMPLOYEE.
+ Collection<QueryIndex> indexes = new ArrayList<>();
+
+ QueryIndex idx = new QueryIndex();
+
+ idx.setName("EMP_NAMES");
+ idx.setIndexType(QueryIndexType.SORTED);
+ LinkedHashMap<String, Boolean> indFlds = new LinkedHashMap<>();
+
+ indFlds.put("firstName", Boolean.FALSE);
+ indFlds.put("lastName", Boolean.FALSE);
+
+ idx.setFields(indFlds);
+
+ indexes.add(idx);
+ indexes.add(new QueryIndex("salary", QueryIndexType.SORTED, false, "EMP_SALARY"));
+
+ type.setIndexes(indexes);
+
+ ccfg.setQueryEntities(qryEntities);
+
+ return ccfg;
+ }
+
+ /**
+ * Configure cacheEmployee.
+ */
+ private static <K, V> CacheConfiguration<K, V> cacheParking() {
+ CacheConfiguration<K, V> ccfg = cacheConfiguration(PARKING_CACHE_NAME);
+
+ // Configure cacheParking types.
+ Collection<QueryEntity> qryEntities = new ArrayList<>();
+
+ // PARKING.
+ QueryEntity type = new QueryEntity();
+
+ qryEntities.add(type);
+
+ type.setKeyType(Integer.class.getName());
+ type.setValueType(Parking.class.getName());
+
+ // Query fields for PARKING.
+ LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
+
+ qryFlds.put("id", "java.lang.Integer");
+ qryFlds.put("name", "java.lang.String");
+ qryFlds.put("capacity", "java.lang.Integer");
+
+ type.setFields(qryFlds);
+
+ ccfg.setQueryEntities(qryEntities);
+
+ return ccfg;
+ }
+
+ /**
+ * Configure cacheEmployee.
+ */
+ private static <K, V> CacheConfiguration<K, V> cacheCar() {
+ CacheConfiguration<K, V> ccfg = cacheConfiguration(CAR_CACHE_NAME);
+
+ // Configure cacheCar types.
+ Collection<QueryEntity> qryEntities = new ArrayList<>();
+
+ // CAR.
+ QueryEntity type = new QueryEntity();
+
+ qryEntities.add(type);
+
+ type.setKeyType(Integer.class.getName());
+ type.setValueType(Car.class.getName());
+
+ // Query fields for CAR.
+ LinkedHashMap<String, String> qryFlds = new LinkedHashMap<>();
+
+ qryFlds.put("id", "java.lang.Integer");
+ qryFlds.put("parkingId", "java.lang.Integer");
+ qryFlds.put("name", "java.lang.String");
+
+ type.setFields(qryFlds);
+
+ ccfg.setQueryEntities(qryEntities);
+
+ return ccfg;
+ }
+
+ /** */
+ private void populateCacheEmployee() {
+ if (ignite.log().isDebugEnabled())
+ ignite.log().debug("DEMO: Start employees population with data...");
+
+ IgniteCache<Integer, Country> cacheCountry = ignite.cache(COUNTRY_CACHE_NAME);
+
+ for (int i = 0, n = 1; i < CNTR_CNT; i++, n++)
+ cacheCountry.put(i, new Country(i, "Country #" + n, n * 10000000));
+
+ IgniteCache<Integer, Department> cacheDepartment = ignite.cache(DEPARTMENT_CACHE_NAME);
+
+ IgniteCache<Integer, Employee> cacheEmployee = ignite.cache(EMPLOYEE_CACHE_NAME);
+
+ for (int i = 0, n = 1; i < DEP_CNT; i++, n++) {
+ cacheDepartment.put(i, new Department(n, rnd.nextInt(CNTR_CNT), "Department #" + n));
+
+ double r = rnd.nextDouble();
+
+ cacheEmployee.put(i, new Employee(i, rnd.nextInt(DEP_CNT), null, "First name manager #" + n,
+ "Last name manager #" + n, "Email manager #" + n, "Phone number manager #" + n,
+ new java.sql.Date((long)(r * range)), "Job manager #" + n, 1000 + AgentDemoUtils.round(r * 4000, 2)));
+ }
+
+ for (int i = 0, n = 1; i < EMPL_CNT; i++, n++) {
+ Integer depId = rnd.nextInt(DEP_CNT);
+
+ double r = rnd.nextDouble();
+
+ cacheEmployee.put(i, new Employee(i, depId, depId, "First name employee #" + n,
+ "Last name employee #" + n, "Email employee #" + n, "Phone number employee #" + n,
+ new java.sql.Date((long)(r * range)), "Job employee #" + n, 500 + AgentDemoUtils.round(r * 2000, 2)));
+ }
+
+ if (ignite.log().isDebugEnabled())
+ ignite.log().debug("DEMO: Finished employees population.");
+ }
+
+ /** */
+ private void populateCacheCar() {
+ if (ignite.log().isDebugEnabled())
+ ignite.log().debug("DEMO: Start cars population...");
+
+ IgniteCache<Integer, Parking> cacheParking = ignite.cache(PARKING_CACHE_NAME);
+
+ for (int i = 0, n = 1; i < PARK_CNT; i++, n++)
+ cacheParking.put(i, new Parking(i, "Parking #" + n, n * 10));
+
+ IgniteCache<Integer, Car> cacheCar = ignite.cache(CAR_CACHE_NAME);
+
+ for (int i = 0, n = 1; i < CAR_CNT; i++, n++)
+ cacheCar.put(i, new Car(i, rnd.nextInt(PARK_CNT), "Car #" + n));
+
+ if (ignite.log().isDebugEnabled())
+ ignite.log().debug("DEMO: Finished cars population.");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
new file mode 100644
index 0000000..57b26a2
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoRandomCacheLoadService.java
@@ -0,0 +1,120 @@
+/*
+ * 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.console.demo.service;
+
+import java.util.Random;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.console.demo.AgentDemoUtils;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceContext;
+
+/**
+ * Demo service. Create cache and populate it by random int pairs.
+ */
+public class DemoRandomCacheLoadService implements Service {
+ /** Ignite instance. */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** Thread pool to execute cache load operations. */
+ private ScheduledExecutorService cachePool;
+
+ /** */
+ public static final String RANDOM_CACHE_NAME = "RandomCache";
+
+ /** Employees count. */
+ private static final int RND_CNT = 1024;
+
+ /** */
+ private static final Random rnd = new Random();
+
+ /** Maximum count read/write key. */
+ private final int cnt;
+
+ /**
+ * @param cnt Maximum count read/write key.
+ */
+ public DemoRandomCacheLoadService(int cnt) {
+ this.cnt = cnt;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ if (cachePool != null)
+ cachePool.shutdown();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void init(ServiceContext ctx) throws Exception {
+ ignite.getOrCreateCache(cacheRandom());
+
+ cachePool = AgentDemoUtils.newScheduledThreadPool(2, "demo-sql-random-load-cache-tasks");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) throws Exception {
+ cachePool.scheduleWithFixedDelay(new Runnable() {
+ @Override public void run() {
+ try {
+ for (String cacheName : ignite.cacheNames()) {
+ if (!DemoCachesLoadService.DEMO_CACHES.contains(cacheName)) {
+ IgniteCache<Integer, Integer> cache = ignite.cache(cacheName);
+
+ if (cache != null) {
+ for (int i = 0, n = 1; i < cnt; i++, n++) {
+ Integer key = rnd.nextInt(RND_CNT);
+ Integer val = rnd.nextInt(RND_CNT);
+
+ cache.put(key, val);
+
+ if (rnd.nextInt(100) < 30)
+ cache.remove(key);
+ }
+ }
+ }
+ }
+ }
+ catch (Throwable e) {
+ if (!e.getMessage().contains("cache is stopped"))
+ ignite.log().error("Cache write task execution error", e);
+ }
+ }
+ }, 10, 3, TimeUnit.SECONDS);
+ }
+
+ /**
+ * Configure cacheCountry.
+ */
+ private static <K, V> CacheConfiguration<K, V> cacheRandom() {
+ CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(RANDOM_CACHE_NAME);
+
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+ ccfg.setQueryDetailMetricsSize(10);
+ ccfg.setStartSize(100);
+ ccfg.setStatisticsEnabled(true);
+ ccfg.setIndexedTypes(Integer.class, Integer.class);
+
+ return ccfg;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceClusterSingleton.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceClusterSingleton.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceClusterSingleton.java
new file mode 100644
index 0000000..8c0623a
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceClusterSingleton.java
@@ -0,0 +1,41 @@
+/*
+ * 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.console.demo.service;
+
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceContext;
+
+/**
+ * Demo service to provide on one node in cluster.
+ */
+public class DemoServiceClusterSingleton implements Service {
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void init(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceKeyAffinity.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceKeyAffinity.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceKeyAffinity.java
new file mode 100644
index 0000000..081ae27
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceKeyAffinity.java
@@ -0,0 +1,41 @@
+/*
+ * 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.console.demo.service;
+
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceContext;
+
+/**
+ * Demo service to provide for cache.
+ */
+public class DemoServiceKeyAffinity implements Service {
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void init(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceMultipleInstances.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceMultipleInstances.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceMultipleInstances.java
new file mode 100644
index 0000000..0d10753
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceMultipleInstances.java
@@ -0,0 +1,41 @@
+/*
+ * 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.console.demo.service;
+
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceContext;
+
+/**
+ * Demo service to provide on all nodes.
+ */
+public class DemoServiceMultipleInstances implements Service {
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void init(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a600cafd/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceNodeSingleton.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceNodeSingleton.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceNodeSingleton.java
new file mode 100644
index 0000000..4d491da
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/service/DemoServiceNodeSingleton.java
@@ -0,0 +1,41 @@
+/*
+ * 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.console.demo.service;
+
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceContext;
+
+/**
+ * Demo service to provide on all nodes by one.
+ */
+public class DemoServiceNodeSingleton implements Service {
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void init(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+}
[10/50] [abbrv] ignite git commit: ignite-4552 Use for rmvQueue
ConcurrentLinkedDeque instead of GridCircularBuffer to reduce memory usage.
This closes #1465.
Posted by yz...@apache.org.
ignite-4552 Use for rmvQueue ConcurrentLinkedDeque instead of GridCircularBuffer to reduce memory usage.
This closes #1465.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e6ea938d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e6ea938d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e6ea938d
Branch: refs/heads/ignite-comm-balance-master
Commit: e6ea938d193353b173366fdd7ef132b8c2a12904
Parents: 70cd8e4
Author: sboikov <sb...@gridgain.com>
Authored: Tue Feb 7 14:19:16 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Feb 7 14:19:16 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../processors/cache/GridCacheProcessor.java | 85 ++++++++++++
.../distributed/dht/GridDhtCacheAdapter.java | 10 +-
.../distributed/dht/GridDhtLocalPartition.java | 120 +++++++++++++----
.../cache/CacheDeferredDeleteQueueTest.java | 134 +++++++++++++++++++
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
6 files changed, 322 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6ea938d/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index c479076..703f52a 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -279,6 +279,9 @@ public final class IgniteSystemProperties {
/** Maximum size for atomic cache queue delete history (default is 200 000 entries per partition). */
public static final String IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE = "IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE";
+ /** Ttl of removed cache entries (ms). */
+ public static final String IGNITE_CACHE_REMOVED_ENTRIES_TTL = "IGNITE_CACHE_REMOVED_ENTRIES_TTL";
+
/**
* Comma separated list of addresses in format "10.100.22.100:45000,10.100.22.101:45000".
* Makes sense only for {@link org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder}.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6ea938d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 84126e4..87f5236 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -79,6 +79,8 @@ import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProce
import org.apache.ignite.internal.processors.cache.datastructures.CacheDataStructuresManager;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache;
@@ -99,6 +101,7 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManag
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.internal.processors.plugin.CachePluginManager;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -120,6 +123,7 @@ import org.apache.ignite.marshaller.MarshallerUtils;
import org.apache.ignite.spi.IgniteNodeValidationResult;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_REMOVED_ENTRIES_TTL;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK;
import static org.apache.ignite.IgniteSystemProperties.getBoolean;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
@@ -846,6 +850,17 @@ public class GridCacheProcessor extends GridProcessorAdapter {
assert caches.containsKey(CU.MARSH_CACHE_NAME) : "Marshaller cache should be started";
assert ctx.config().isDaemon() || caches.containsKey(CU.UTILITY_CACHE_NAME) : "Utility cache should be started";
+
+ if (!ctx.clientNode() && !ctx.isDaemon())
+ addRemovedItemsCleanupTask(Long.getLong(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 10_000));
+
+ }
+
+ /**
+ * @param timeout Cleanup timeout.
+ */
+ private void addRemovedItemsCleanupTask(long timeout) {
+ ctx.timeout().addTimeoutObject(new RemovedItemsCleanupTask(timeout));
}
/** {@inheritDoc} */
@@ -3913,4 +3928,74 @@ public class GridCacheProcessor extends GridProcessorAdapter {
// No-op.
}
}
+
+ /**
+ *
+ */
+ private class RemovedItemsCleanupTask implements GridTimeoutObject {
+ /** */
+ private final IgniteUuid id = IgniteUuid.randomUuid();
+
+ /** */
+ private final long endTime;
+
+ /** */
+ private final long timeout;
+
+ /**
+ * @param timeout Timeout.
+ */
+ RemovedItemsCleanupTask(long timeout) {
+ this.timeout = timeout;
+ this.endTime = U.currentTimeMillis() + timeout;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteUuid timeoutId() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long endTime() {
+ return endTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onTimeout() {
+ ctx.closure().runLocalSafe(new Runnable() {
+ @Override public void run() {
+ try {
+ for (GridCacheContext cacheCtx : sharedCtx.cacheContexts()) {
+ if (!cacheCtx.isLocal() && cacheCtx.affinityNode()) {
+ GridDhtPartitionTopology top = null;
+
+ try {
+ top = cacheCtx.topology();
+ }
+ catch (IllegalStateException ignore) {
+ // Cache stopped.
+ }
+
+ if (top != null) {
+ for (GridDhtLocalPartition part : top.currentLocalPartitions())
+ part.cleanupRemoveQueue();
+ }
+
+ if (ctx.isStopping())
+ return;
+ }
+ }
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to cleanup removed cache items: " + e, e);
+ }
+
+ if (ctx.isStopping())
+ return;
+
+ addRemovedItemsCleanupTask(timeout);
+ }
+ }, true);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6ea938d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 9e8788f..fb7a932 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -1183,14 +1183,8 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
GridDhtLocalPartition part = topology().localPartition(entry.partition(), AffinityTopologyVersion.NONE,
false);
- if (part != null) {
- try {
- part.onDeferredDelete(entry.key(), ver);
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to enqueue deleted entry [key=" + entry.key() + ", ver=" + ver + ']', e);
- }
- }
+ if (part != null)
+ part.onDeferredDelete(entry.key(), ver);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6ea938d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 67b29ca..9f8498a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -29,7 +29,6 @@ import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -46,21 +45,20 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
import org.apache.ignite.internal.processors.cache.extras.GridCacheObsoleteEntryExtras;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
-import org.apache.ignite.internal.util.GridCircularBuffer;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jsr166.ConcurrentLinkedDeque8;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_REMOVED_ENTRIES_TTL;
import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_OBJECT_UNLOADED;
import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.EVICTED;
import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
@@ -72,8 +70,13 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
*/
public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>, GridReservable, GridCacheConcurrentMap {
/** Maximum size for delete queue. */
- public static final int MAX_DELETE_QUEUE_SIZE = Integer.getInteger(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE,
- 200_000);
+ public static final int MAX_DELETE_QUEUE_SIZE = Integer.getInteger(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, 200_000);
+
+ /** Maximum size for {@link #rmvQueue}. */
+ private final int rmvQueueMaxSize;
+
+ /** Removed items TTL. */
+ private final long rmvdEntryTtl;
/** Static logger to avoid re-creation. */
private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
@@ -109,7 +112,7 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
private final ReentrantLock lock = new ReentrantLock();
/** Remove queue. */
- private final GridCircularBuffer<T2<KeyCacheObject, GridCacheVersion>> rmvQueue;
+ private final ConcurrentLinkedDeque8<RemovedEntryHolder> rmvQueue = new ConcurrentLinkedDeque8<>();
/** Group reservations. */
private final CopyOnWriteArrayList<GridDhtPartitionsReservation> reservations = new CopyOnWriteArrayList<>();
@@ -146,7 +149,9 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
int delQueueSize = CU.isSystemCache(cctx.name()) ? 100 :
Math.max(MAX_DELETE_QUEUE_SIZE / cctx.affinity().partitions(), 20);
- rmvQueue = new GridCircularBuffer<>(U.ceilPow2(delQueueSize));
+ rmvQueueMaxSize = U.ceilPow2(delQueueSize);
+
+ rmvdEntryTtl = Long.getLong(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 10_000);
}
/**
@@ -299,25 +304,43 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
}
/**
- * @param key Removed key.
- * @param ver Removed version.
- * @throws IgniteCheckedException If failed.
+ *
*/
- public void onDeferredDelete(KeyCacheObject key, GridCacheVersion ver) throws IgniteCheckedException {
- try {
- T2<KeyCacheObject, GridCacheVersion> evicted = rmvQueue.add(new T2<>(key, ver));
+ public void cleanupRemoveQueue() {
+ while (rmvQueue.sizex() >= rmvQueueMaxSize) {
+ RemovedEntryHolder item = rmvQueue.pollFirst();
- if (evicted != null)
- cctx.dht().removeVersionedEntry(evicted.get1(), evicted.get2());
+ if (item != null)
+ cctx.dht().removeVersionedEntry(item.key(), item.version());
}
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new IgniteInterruptedCheckedException(e);
+ if (!cctx.isDrEnabled()) {
+ RemovedEntryHolder item = rmvQueue.peekFirst();
+
+ while (item != null && item.expireTime() < U.currentTimeMillis()) {
+ item = rmvQueue.pollFirst();
+
+ if (item == null)
+ break;
+
+ cctx.dht().removeVersionedEntry(item.key(), item.version());
+
+ item = rmvQueue.peekFirst();
+ }
}
}
/**
+ * @param key Removed key.
+ * @param ver Removed version.
+ */
+ public void onDeferredDelete(KeyCacheObject key, GridCacheVersion ver) {
+ cleanupRemoveQueue();
+
+ rmvQueue.add(new RemovedEntryHolder(key, ver, rmvdEntryTtl));
+ }
+
+ /**
* Locks partition.
*/
@SuppressWarnings({"LockAcquiredButNotSafelyReleased"})
@@ -807,11 +830,8 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
*
*/
private void clearDeferredDeletes() {
- rmvQueue.forEach(new CI1<T2<KeyCacheObject, GridCacheVersion>>() {
- @Override public void apply(T2<KeyCacheObject, GridCacheVersion> t) {
- cctx.dht().removeVersionedEntry(t.get1(), t.get2());
- }
- });
+ for (RemovedEntryHolder e : rmvQueue)
+ cctx.dht().removeVersionedEntry(e.key(), e.version());
}
/** {@inheritDoc} */
@@ -841,4 +861,56 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
"empty", isEmpty(),
"createTime", U.format(createTime));
}
+
+ /**
+ * Removed entry holder.
+ */
+ private static class RemovedEntryHolder {
+ /** Cache key */
+ private final KeyCacheObject key;
+
+ /** Entry version */
+ private final GridCacheVersion ver;
+
+ /** Entry expire time. */
+ private final long expireTime;
+
+ /**
+ * @param key Key.
+ * @param ver Entry version.
+ * @param ttl TTL.
+ */
+ private RemovedEntryHolder(KeyCacheObject key, GridCacheVersion ver, long ttl) {
+ this.key = key;
+ this.ver = ver;
+
+ expireTime = U.currentTimeMillis() + ttl;
+ }
+
+ /**
+ * @return Key.
+ */
+ KeyCacheObject key() {
+ return key;
+ }
+
+ /**
+ * @return Version.
+ */
+ GridCacheVersion version() {
+ return ver;
+ }
+
+ /**
+ * @return item expired time
+ */
+ long expireTime() {
+ return expireTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(RemovedEntryHolder.class, this);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6ea938d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java
new file mode 100644
index 0000000..b764d5b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java
@@ -0,0 +1,134 @@
+/*
+ * 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.cache;
+
+import java.util.Collection;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_REMOVED_ENTRIES_TTL;
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class CacheDeferredDeleteQueueTest extends GridCommonAbstractTest {
+ /** */
+ private static String ttlProp;
+
+ /** */
+ private static int NODES = 2;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ ttlProp = System.getProperty(IGNITE_CACHE_REMOVED_ENTRIES_TTL);
+
+ System.setProperty(IGNITE_CACHE_REMOVED_ENTRIES_TTL, "1000");
+
+ startGridsMultiThreaded(NODES);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ if (ttlProp != null)
+ System.setProperty(IGNITE_CACHE_REMOVED_ENTRIES_TTL, ttlProp);
+ else
+ System.clearProperty(IGNITE_CACHE_REMOVED_ENTRIES_TTL);
+
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeferredDeleteQueue() throws Exception {
+ testQueue(ATOMIC, false);
+
+ testQueue(TRANSACTIONAL, false);
+
+ testQueue(ATOMIC, true);
+
+ testQueue(TRANSACTIONAL, true);
+ }
+
+ /**
+ * @param atomicityMode Cache atomicity mode.
+ * @param nearCache {@code True} if need create near cache.
+ *
+ * @throws Exception If failed.
+ */
+ private void testQueue(CacheAtomicityMode atomicityMode, boolean nearCache) throws Exception {
+ CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+
+ ccfg.setCacheMode(PARTITIONED);
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setBackups(1);
+
+ if (nearCache)
+ ccfg.setNearConfiguration(new NearCacheConfiguration<Integer, Integer>());
+
+ IgniteCache<Integer, Integer> cache = ignite(0).createCache(ccfg);
+
+ try {
+ final int KEYS = cache.getConfiguration(CacheConfiguration.class).getAffinity().partitions() * 3;
+
+ for (int i = 0; i < KEYS; i++)
+ cache.put(i, i);
+
+ for (int i = 0; i < KEYS; i++)
+ cache.remove(i);
+
+ boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ for (int i = 0; i < NODES; i++) {
+ final GridDhtPartitionTopology top =
+ ((IgniteKernal)ignite(i)).context().cache().cache(null).context().topology();
+
+ for (GridDhtLocalPartition p : top.currentLocalPartitions()) {
+ Collection<Object> rmvQueue = GridTestUtils.getFieldValue(p, "rmvQueue");
+
+ if (!rmvQueue.isEmpty() || p.size() != 0)
+ return false;
+ }
+ }
+
+ return true;
+ }
+ }, 5000);
+
+ assertTrue("Failed to wait for rmvQueue cleanup.", wait);
+ }
+ finally {
+ ignite(0).destroyCache(ccfg.getName());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6ea938d/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 092d95e..3f0073d 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -46,6 +46,7 @@ import org.apache.ignite.internal.managers.communication.IgniteIoTestMessagesTes
import org.apache.ignite.internal.managers.communication.IgniteVariousConnectionNumberTest;
import org.apache.ignite.cache.store.jdbc.JdbcTypesDefaultTransformerTest;
import org.apache.ignite.internal.processors.cache.CacheAffinityCallSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheDeferredDeleteQueueTest;
import org.apache.ignite.internal.processors.cache.CacheDeferredDeleteSanitySelfTest;
import org.apache.ignite.internal.processors.cache.CacheEntryProcessorCopySelfTest;
import org.apache.ignite.internal.processors.cache.CacheFutureExceptionSelfTest;
@@ -320,6 +321,7 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(GridCacheTxPartitionedLocalStoreSelfTest.class);
suite.addTestSuite(IgniteCacheSystemTransactionsSelfTest.class);
suite.addTestSuite(CacheDeferredDeleteSanitySelfTest.class);
+ suite.addTestSuite(CacheDeferredDeleteQueueTest.class);
suite.addTest(IgniteCacheTcpClientDiscoveryTestSuite.suite());
[27/50] [abbrv] ignite git commit: IGNITE-4425 .NET: Support
"ICollection.Contains" in LINQ
Posted by yz...@apache.org.
IGNITE-4425 .NET: Support "ICollection.Contains" in LINQ
This closes #1502
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d949b739
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d949b739
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d949b739
Branch: refs/heads/ignite-comm-balance-master
Commit: d949b739d1fc47a13dcbf8fe107276bc603b6d92
Parents: 2f4bdbb
Author: Sergey Stronchinskiy <gu...@gmail.com>
Authored: Fri Feb 10 15:38:01 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Feb 10 15:38:52 2017 +0300
----------------------------------------------------------------------
.../Cache/Query/CacheLinqTest.cs | 96 ++++++++++++++
.../Impl/CacheQueryExpressionVisitor.cs | 127 ++++++++++++++++++-
.../Impl/CacheQueryModelVisitor.cs | 3 +
3 files changed, 224 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d949b739/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index 798e7e8..931fdd4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -28,6 +28,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
{
using System;
using System.Collections;
+ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text.RegularExpressions;
@@ -106,6 +107,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
orgCache[1000] = new Organization {Id = 1000, Name = "Org_0"};
orgCache[1001] = new Organization {Id = 1001, Name = "Org_1"};
+ orgCache[1002] = new Organization {Id = 1002, Name = null};
var roleCache = GetRoleCache();
@@ -747,6 +749,74 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
+ /// Tests IEnumerable.Contains.
+ /// </summary>
+ [Test]
+ public void TestContains()
+ {
+ var cache = GetPersonCache().AsCacheQueryable();
+ var orgCache = GetOrgCache().AsCacheQueryable();
+
+ var keys = new[] { 1, 2, 3 };
+ var emptyKeys = new int[0];
+
+ var bigNumberOfKeys = 10000;
+ var aLotOfKeys = Enumerable.Range(-bigNumberOfKeys + 10 - PersonCount, bigNumberOfKeys + PersonCount)
+ .ToArray();
+ var hashSetKeys = new HashSet<int>(keys);
+
+ CheckWhereFunc(cache, e => new[] { 1, 2, 3 }.Contains(e.Key));
+ CheckWhereFunc(cache, e => emptyKeys.Contains(e.Key));
+ CheckWhereFunc(cache, e => new int[0].Contains(e.Key));
+ CheckWhereFunc(cache, e => new int[0].Contains(e.Key));
+ CheckWhereFunc(cache, e => new List<int> { 1, 2, 3 }.Contains(e.Key));
+ CheckWhereFunc(cache, e => new List<int>(keys).Contains(e.Key));
+ CheckWhereFunc(cache, e => aLotOfKeys.Contains(e.Key));
+ CheckWhereFunc(cache, e => hashSetKeys.Contains(e.Key));
+ CheckWhereFunc(cache, e => !keys.Contains(e.Key));
+ CheckWhereFunc(orgCache, e => new[] { "Org_1", "NonExistentName", null }.Contains(e.Value.Name));
+ CheckWhereFunc(orgCache, e => !new[] { "Org_1", "NonExistentName", null }.Contains(e.Value.Name));
+ CheckWhereFunc(orgCache, e => new[] { "Org_1", null, null }.Contains(e.Value.Name));
+ CheckWhereFunc(orgCache, e => !new[] { "Org_1", null, null }.Contains(e.Value.Name));
+ CheckWhereFunc(orgCache, e => new string[] { null }.Contains(e.Value.Name));
+ CheckWhereFunc(orgCache, e => !new string[] { null }.Contains(e.Value.Name));
+ CheckWhereFunc(orgCache, e => !new string[] { null, null }.Contains(e.Value.Name));
+ CheckWhereFunc(orgCache, e => new string[] { null, null }.Contains(e.Value.Name));
+
+ //check passing a null object as collection
+ int[] nullKeys = null;
+ var nullKeysEntries = cache
+ .Where(e => nullKeys.Contains(e.Key))
+ .ToArray();
+ Assert.AreEqual(0, nullKeysEntries.Length, "Evaluating 'null.Contains' should return zero results");
+
+
+ Func<int[]> getKeysFunc = () => null;
+ var funcNullKeyEntries = cache
+ .Where(e => getKeysFunc().Contains(e.Key))
+ .ToArray();
+ Assert.AreEqual(0, funcNullKeyEntries.Length, "Evaluating 'null.Contains' should return zero results");
+
+
+ // Check subselect from other cache
+ var subSelectCount = cache
+ .Count(entry => orgCache
+ .Where(orgEntry => orgEntry.Value.Name == "Org_1")
+ .Select(orgEntry => orgEntry.Key)
+ .Contains(entry.Value.OrganizationId));
+ var orgNumberOne = orgCache
+ .Where(orgEntry => orgEntry.Value.Name == "Org_1")
+ .Select(orgEntry => orgEntry.Key)
+ .First();
+ var subSelectCheckCount = cache.Count(entry => entry.Value.OrganizationId == orgNumberOne);
+ Assert.AreEqual(subSelectCheckCount, subSelectCount, "subselecting another CacheQueryable failed");
+
+ var ex = Assert.Throws<NotSupportedException>(() =>
+ CompiledQuery2.Compile((int[] k) => cache.Where(x => k.Contains(x.Key))));
+ Assert.AreEqual("'Contains' clause coming from compiled query parameter is not supported.", ex.Message);
+ }
+
+ /// <summary>
/// Tests nulls.
/// </summary>
[Test]
@@ -1412,6 +1482,32 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
CollectionAssert.AreEqual(expected, actual, new NumericComparer());
}
+ /// <summary>
+ /// Checks that function used in Where Clause maps to SQL function properly
+ /// </summary>
+ private static void CheckWhereFunc<TKey, TEntry>(IQueryable<ICacheEntry<TKey,TEntry>> query, Expression<Func<ICacheEntry<TKey, TEntry>,bool>> whereExpression)
+ {
+ // Calculate result locally, using real method invocation
+ var expected = query
+ .ToArray()
+ .AsQueryable()
+ .Where(whereExpression)
+ .Select(entry => entry.Key)
+ .OrderBy(x => x)
+ .ToArray();
+
+ // Perform SQL query
+ var actual = query
+ .Where(whereExpression)
+ .Select(entry => entry.Key)
+ .ToArray()
+ .OrderBy(x => x)
+ .ToArray();
+
+ // Compare results
+ CollectionAssert.AreEqual(expected, actual, new NumericComparer());
+ }
+
public interface IPerson
{
int Age { get; set; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/d949b739/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
index 1f9da1c..94e59fa 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
@@ -20,6 +20,7 @@ using System.Text;
namespace Apache.Ignite.Linq.Impl
{
+ using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
@@ -29,6 +30,7 @@ namespace Apache.Ignite.Linq.Impl
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Impl.Common;
+ using Remotion.Linq;
using Remotion.Linq.Clauses;
using Remotion.Linq.Clauses.Expressions;
using Remotion.Linq.Clauses.ResultOperators;
@@ -470,15 +472,136 @@ namespace Apache.Ignite.Linq.Impl
}
/** <inheritdoc /> */
+
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
protected override Expression VisitSubQuery(SubQueryExpression expression)
{
- // This happens when New expression uses a subquery, in a GroupBy.
- _modelVisitor.VisitSelectors(expression.QueryModel, false);
+ var subQueryModel = expression.QueryModel;
+
+ var contains = subQueryModel.ResultOperators.FirstOrDefault() as ContainsResultOperator;
+
+ // Check if IEnumerable.Contains is used.
+ if (subQueryModel.ResultOperators.Count == 1 && contains != null)
+ {
+ VisitContains(subQueryModel, contains);
+ }
+ else
+ {
+ // This happens when New expression uses a subquery, in a GroupBy.
+ _modelVisitor.VisitSelectors(expression.QueryModel, false);
+ }
return expression;
}
+ /// <summary>
+ /// Visits IEnumerable.Contains
+ /// </summary>
+ private void VisitContains(QueryModel subQueryModel, ContainsResultOperator contains)
+ {
+ ResultBuilder.Append("(");
+
+ var fromExpression = subQueryModel.MainFromClause.FromExpression;
+
+ var queryable = ExpressionWalker.GetCacheQueryable(fromExpression, false);
+
+ if (queryable != null)
+ {
+ Visit(contains.Item);
+
+ ResultBuilder.Append(" IN (");
+ _modelVisitor.VisitQueryModel(subQueryModel);
+ ResultBuilder.Append(")");
+ }
+ else
+ {
+ var inValues = GetInValues(fromExpression).ToArray();
+
+ var hasNulls = inValues.Any(o => o == null);
+
+ if (hasNulls)
+ {
+ ResultBuilder.Append("(");
+ }
+
+ Visit(contains.Item);
+
+ ResultBuilder.Append(" IN (");
+ AppendInParameters(inValues);
+ ResultBuilder.Append(")");
+
+ if (hasNulls)
+ {
+ ResultBuilder.Append(") OR ");
+ Visit(contains.Item);
+ ResultBuilder.Append(" IS NULL");
+ }
+ }
+
+ ResultBuilder.Append(")");
+ }
+
+ /// <summary>
+ /// Gets values for IN expression.
+ /// </summary>
+ private static IEnumerable<object> GetInValues(Expression fromExpression)
+ {
+ IEnumerable result;
+ switch (fromExpression.NodeType)
+ {
+ case ExpressionType.MemberAccess:
+ var memberExpression = (MemberExpression) fromExpression;
+ result = ExpressionWalker.EvaluateExpression<IEnumerable>(memberExpression);
+ break;
+ case ExpressionType.ListInit:
+ var listInitExpression = (ListInitExpression) fromExpression;
+ result = listInitExpression.Initializers
+ .SelectMany(init => init.Arguments)
+ .Select(ExpressionWalker.EvaluateExpression<object>);
+ break;
+ case ExpressionType.NewArrayInit:
+ var newArrayExpression = (NewArrayExpression) fromExpression;
+ result = newArrayExpression.Expressions
+ .Select(ExpressionWalker.EvaluateExpression<object>);
+ break;
+ case ExpressionType.Parameter:
+ // This should happen only when 'IEnumerable.Contains' is called on parameter of compiled query
+ throw new NotSupportedException("'Contains' clause coming from compiled query parameter is not supported.");
+ default:
+ result = Expression.Lambda(fromExpression).Compile().DynamicInvoke() as IEnumerable;
+ break;
+ }
+
+ result = result ?? Enumerable.Empty<object>();
+
+ return result
+ .Cast<object>()
+ .ToArray();
+ }
+
+ /// <summary>
+ /// Appends not null parameters using ", " as delimeter.
+ /// </summary>
+ private void AppendInParameters(IEnumerable<object> values)
+ {
+ var first = true;
+
+ foreach (var val in values)
+ {
+ if (val == null)
+ continue;
+
+ if (!first)
+ {
+ ResultBuilder.Append(", ");
+ }
+
+ first = false;
+
+ AppendParameter(val);
+ }
+ }
+
/** <inheritdoc /> */
protected override Exception CreateUnhandledItemException<T>(T unhandledItem, string visitMethod)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/d949b739/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs
index ae94cfb..7cc9265 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs
@@ -184,6 +184,9 @@ namespace Apache.Ignite.Linq.Impl
|| op is DefaultIfEmptyResultOperator || op is SkipResultOperator || op is TakeResultOperator)
// Will be processed later
break;
+ else if (op is ContainsResultOperator)
+ // Should be processed already
+ break;
else
throw new NotSupportedException("Operator is not supported: " + op);
}
[12/50] [abbrv] ignite git commit: IGNITE-4472 Added user activities
in Web Console.
Posted by yz...@apache.org.
IGNITE-4472 Added user activities in Web Console.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/26ee9c28
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/26ee9c28
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/26ee9c28
Branch: refs/heads/ignite-comm-balance-master
Commit: 26ee9c2865648118da97ee8ef84df990359edb96
Parents: e6ea938
Author: Andrey Novikov <an...@gridgain.com>
Authored: Wed Feb 8 11:43:22 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Wed Feb 8 11:43:22 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/agent.js | 10 +-
modules/web-console/backend/app/mongo.js | 49 ++--
modules/web-console/backend/app/routes.js | 5 +-
.../web-console/backend/routes/activities.js | 52 +++++
modules/web-console/backend/routes/admin.js | 2 +-
modules/web-console/backend/routes/agent.js | 10 +-
modules/web-console/backend/routes/public.js | 1 -
.../web-console/backend/services/activities.js | 136 +++++++++++
modules/web-console/backend/services/users.js | 13 +-
modules/web-console/frontend/app/app.config.js | 9 +
modules/web-console/frontend/app/app.js | 29 ++-
.../activities-user-dialog.controller.js | 60 +++++
.../activities-user-dialog.jade | 36 +++
.../components/activities-user-dialog/index.js | 36 +++
.../form-field-datepicker.jade | 55 +++++
.../form-field-datepicker.scss | 20 ++
.../list-of-registered-users/index.js | 28 +++
.../list-of-registered-users.categories.js | 30 +++
.../list-of-registered-users.column-defs.js | 80 +++++++
.../list-of-registered-users.controller.js | 207 ++++++++++++++++
.../list-of-registered-users.jade | 54 +++++
.../ui-grid-header/ui-grid-header.jade | 27 +++
.../ui-grid-header/ui-grid-header.scss | 84 +++++++
.../ui-grid-settings/ui-grid-settings.jade | 33 +++
.../ui-grid-settings/ui-grid-settings.scss | 70 ++++++
.../app/core/activities/Activities.data.js | 39 ++++
.../frontend/app/core/admin/Admin.data.js | 77 ++++++
modules/web-console/frontend/app/core/index.js | 25 ++
modules/web-console/frontend/app/data/i18n.js | 38 +++
.../ui-grid-settings/ui-grid-settings.jade | 33 ---
.../ui-grid-settings/ui-grid-settings.scss | 38 ---
.../app/filters/uiGridSubcategories.filter.js | 24 ++
.../frontend/app/modules/Demo/Demo.module.js | 166 -------------
.../frontend/app/modules/demo/Demo.module.js | 172 ++++++++++++++
.../frontend/app/modules/sql/sql.controller.js | 14 +-
.../frontend/app/modules/sql/sql.module.js | 2 +-
.../frontend/app/modules/states/admin.state.js | 2 +-
.../configuration/summary/summary.controller.js | 6 +-
.../app/modules/user/AclRoute.provider.js | 31 +--
.../frontend/app/modules/user/Auth.service.js | 2 +-
.../frontend/app/modules/user/permissions.js | 2 +-
.../frontend/app/modules/user/user.module.js | 6 +-
modules/web-console/frontend/app/vendor.js | 1 +
.../frontend/controllers/admin-controller.js | 234 -------------------
.../frontend/controllers/domains-controller.js | 12 +-
modules/web-console/frontend/package.json | 1 +
.../stylesheets/_font-awesome-custom.scss | 28 +++
.../frontend/public/stylesheets/style.scss | 39 +++-
.../frontend/public/stylesheets/variables.scss | 1 +
.../frontend/views/settings/admin.jade | 32 +--
modules/web-console/frontend/views/sql/sql.jade | 4 +-
51 files changed, 1603 insertions(+), 562 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/app/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/agent.js b/modules/web-console/backend/app/agent.js
index 961253f..8170280 100644
--- a/modules/web-console/backend/app/agent.js
+++ b/modules/web-console/backend/app/agent.js
@@ -24,7 +24,7 @@
*/
module.exports = {
implements: 'agent-manager',
- inject: ['require(lodash)', 'require(fs)', 'require(path)', 'require(jszip)', 'require(socket.io)', 'settings', 'mongo']
+ inject: ['require(lodash)', 'require(fs)', 'require(path)', 'require(jszip)', 'require(socket.io)', 'settings', 'mongo', 'services/activities']
};
/**
@@ -35,9 +35,10 @@ module.exports = {
* @param socketio
* @param settings
* @param mongo
+ * @param {ActivitiesService} activitiesService
* @returns {AgentManager}
*/
-module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo) {
+module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo, activitiesService) {
/**
*
*/
@@ -823,6 +824,11 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo)
const sockets = this._browsers[accountId];
_.forEach(sockets, (socket) => socket.emit('agent:count', {count: agents.length}));
+
+ activitiesService.merge(accountId, {
+ group: 'agent',
+ action: '/agent/start'
+ });
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index dd71f3a..2d252b9 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -48,6 +48,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
company: String,
country: String,
lastLogin: Date,
+ lastActivity: Date,
admin: Boolean,
token: String,
resetPasswordToken: String
@@ -59,22 +60,26 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
usernameLowerCase: true
});
+ const transform = (doc, ret) => {
+ return {
+ _id: ret._id,
+ email: ret.email,
+ firstName: ret.firstName,
+ lastName: ret.lastName,
+ company: ret.company,
+ country: ret.country,
+ admin: ret.admin,
+ token: ret.token,
+ lastLogin: ret.lastLogin,
+ lastActivity: ret.lastActivity
+ };
+ };
+
// Configure transformation to JSON.
- AccountSchema.set('toJSON', {
- transform: (doc, ret) => {
- return {
- _id: ret._id,
- email: ret.email,
- firstName: ret.firstName,
- lastName: ret.lastName,
- company: ret.company,
- country: ret.country,
- admin: ret.admin,
- token: ret.token,
- lastLogin: ret.lastLogin
- };
- }
- });
+ AccountSchema.set('toJSON', { transform });
+
+ // Configure transformation to JSON.
+ AccountSchema.set('toObject', { transform });
result.errCodes = {
DUPLICATE_KEY_ERROR: 11000,
@@ -902,6 +907,20 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
res.status(err.code || 500).send(err.message);
};
+ // Define Activities schema.
+ const ActivitiesSchema = new Schema({
+ owner: {type: ObjectId, ref: 'Account'},
+ date: Date,
+ group: String,
+ action: String,
+ amount: { type: Number, default: 1 }
+ });
+
+ ActivitiesSchema.index({ owner: 1, group: 1, action: 1, date: 1}, { unique: true });
+
+ // Define Activities model.
+ result.Activities = mongoose.model('Activities', ActivitiesSchema);
+
// Registering the routes of all plugin modules
for (const name in pluginMongo) {
if (pluginMongo.hasOwnProperty(name))
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/app/routes.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/routes.js b/modules/web-console/backend/app/routes.js
index 6961173..6b5d052 100644
--- a/modules/web-console/backend/app/routes.js
+++ b/modules/web-console/backend/app/routes.js
@@ -22,11 +22,11 @@
module.exports = {
implements: 'routes',
inject: ['routes/public', 'routes/admin', 'routes/profiles', 'routes/demo', 'routes/clusters', 'routes/domains',
- 'routes/caches', 'routes/igfss', 'routes/notebooks', 'routes/agents', 'routes/configurations']
+ 'routes/caches', 'routes/igfss', 'routes/notebooks', 'routes/agents', 'routes/configurations', 'routes/activities']
};
module.exports.factory = function(publicRoute, adminRoute, profilesRoute, demoRoute,
- clustersRoute, domainsRoute, cachesRoute, igfssRoute, notebooksRoute, agentsRoute, configurationsRoute) {
+ clustersRoute, domainsRoute, cachesRoute, igfssRoute, notebooksRoute, agentsRoute, configurationsRoute, activitiesRoute) {
return {
register: (app) => {
const _mustAuthenticated = (req, res, next) => {
@@ -59,6 +59,7 @@ module.exports.factory = function(publicRoute, adminRoute, profilesRoute, demoRo
app.use('/notebooks', _mustAuthenticated, notebooksRoute);
app.use('/agent', _mustAuthenticated, agentsRoute);
+ app.use('/activities', _mustAuthenticated, activitiesRoute);
}
};
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/routes/activities.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/activities.js b/modules/web-console/backend/routes/activities.js
new file mode 100644
index 0000000..08c27cf
--- /dev/null
+++ b/modules/web-console/backend/routes/activities.js
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+ implements: 'routes/activities',
+ inject: ['require(express)', 'services/activities']
+};
+
+/**
+ * @param express
+ * @param {ActivitiesService} activitiesService
+ * @returns {Promise}
+ */
+module.exports.factory = function(express, activitiesService) {
+ return new Promise((factoryResolve) => {
+ const router = new express.Router();
+
+ // Get user activities.
+ router.get('/user/:userId', (req, res) => {
+ activitiesService.listByUser(req.params.userId, req.query)
+ .then(res.api.ok)
+ .catch(res.api.error);
+ });
+
+ // Post user activities to page.
+ router.post('/page', (req, res) => {
+ activitiesService.merge(req.user._id, req.body)
+ .then(res.api.ok)
+ .catch(res.api.error);
+ });
+
+ factoryResolve(router);
+ });
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/routes/admin.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/admin.js b/modules/web-console/backend/routes/admin.js
index 70736d0..5b0896a 100644
--- a/modules/web-console/backend/routes/admin.js
+++ b/modules/web-console/backend/routes/admin.js
@@ -43,7 +43,7 @@ module.exports.factory = function(_, express, settings, mongo, spacesService, ma
* Get list of user accounts.
*/
router.post('/list', (req, res) => {
- usersService.list()
+ usersService.list(req.body)
.then(res.api.ok)
.catch(res.api.error);
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/agent.js b/modules/web-console/backend/routes/agent.js
index 477363f..5ae807b 100644
--- a/modules/web-console/backend/routes/agent.js
+++ b/modules/web-console/backend/routes/agent.js
@@ -21,21 +21,27 @@
module.exports = {
implements: 'routes/agents',
- inject: ['require(lodash)', 'require(express)', 'services/agents']
+ inject: ['require(lodash)', 'require(express)', 'services/agents', 'services/activities']
};
/**
* @param _
* @param express
* @param {AgentsService} agentsService
+ * @param {ActivitiesService} activitiesService
* @returns {Promise}
*/
-module.exports.factory = function(_, express, agentsService) {
+module.exports.factory = function(_, express, agentsService, activitiesService) {
return new Promise((resolveFactory) => {
const router = new express.Router();
/* Get grid topology. */
router.get('/download/zip', (req, res) => {
+ activitiesService.merge(req.user._id, {
+ group: 'agent',
+ action: '/agent/download'
+ });
+
agentsService.getArchive(req.origin(), req.user.token)
.then(({fileName, buffer}) => {
// Set the archive name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/routes/public.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/public.js b/modules/web-console/backend/routes/public.js
index 590d395..860e267 100644
--- a/modules/web-console/backend/routes/public.js
+++ b/modules/web-console/backend/routes/public.js
@@ -25,7 +25,6 @@ module.exports = {
};
/**
- *
* @param express
* @param passport
* @param mongo
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/services/activities.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/activities.js b/modules/web-console/backend/services/activities.js
new file mode 100644
index 0000000..7f3a777
--- /dev/null
+++ b/modules/web-console/backend/services/activities.js
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+ implements: 'services/activities',
+ inject: ['require(lodash)', 'mongo']
+};
+
+/**
+ * @param _
+ * @param mongo
+ * @returns {ActivitiesService}
+ */
+module.exports.factory = (_, mongo) => {
+ class ActivitiesService {
+ /**
+ * Update page activities.
+ *
+ * @param {String} owner - User ID
+ * @param {Object} page - The page
+ * @returns {Promise.<mongo.ObjectId>} that resolve activity
+ */
+ static merge(owner, {action, group}) {
+ mongo.Account.findById(owner)
+ .then((user) => {
+ user.lastActivity = new Date();
+
+ return user.save();
+ });
+
+ const date = new Date();
+
+ date.setDate(1);
+ date.setHours(0, 0, 0, 0);
+
+ return mongo.Activities.findOne({owner, action, date}).exec()
+ .then((activity) => {
+ if (activity) {
+ activity.amount++;
+
+ return activity.save();
+ }
+
+ return mongo.Activities.create({owner, action, group, date});
+ });
+ }
+
+ /**
+ * Get user activities
+ * @param {String} owner - User ID
+ * @returns {Promise.<mongo.ObjectId>} that resolve activities
+ */
+ static listByUser(owner, {startDate, endDate}) {
+ const $match = {owner};
+
+ if (startDate)
+ $match.date = {$gte: new Date(startDate)};
+
+ if (endDate) {
+ $match.date = $match.date || {};
+ $match.date.$lt = new Date(endDate);
+ }
+
+ return mongo.Activities.find($match);
+ }
+
+ static total({startDate, endDate}) {
+ const $match = {};
+
+ if (startDate)
+ $match.date = {$gte: new Date(startDate)};
+
+ if (endDate) {
+ $match.date = $match.date || {};
+ $match.date.$lt = new Date(endDate);
+ }
+
+ return mongo.Activities.aggregate([
+ {$match},
+ {$group: {
+ _id: {owner: '$owner', group: '$group'},
+ amount: {$sum: '$amount'}
+ }}
+ ]).exec().then((data) => {
+ return _.reduce(data, (acc, { _id, amount }) => {
+ const {owner, group} = _id;
+ acc[owner] = _.merge(acc[owner] || {}, { [group]: amount });
+ return acc;
+ }, {});
+ });
+ }
+
+ static detail({startDate, endDate}) {
+ const $match = { };
+
+ if (startDate)
+ $match.date = {$gte: new Date(startDate)};
+
+ if (endDate) {
+ $match.date = $match.date || {};
+ $match.date.$lt = new Date(endDate);
+ }
+
+ return mongo.Activities.aggregate([
+ {$match},
+ {$group: {_id: {owner: '$owner', action: '$action'}, total: {$sum: '$amount'}}}
+ ]).exec().then((data) => {
+ return _.reduce(data, (acc, { _id, total }) => {
+ const {owner, action} = _id;
+ acc[owner] = _.merge(acc[owner] || {}, { [action]: total });
+ return acc;
+ }, {});
+ });
+ }
+ }
+
+ return ActivitiesService;
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/backend/services/users.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/users.js b/modules/web-console/backend/services/users.js
index 8058b25..2dd603f 100644
--- a/modules/web-console/backend/services/users.js
+++ b/modules/web-console/backend/services/users.js
@@ -21,7 +21,7 @@
module.exports = {
implements: 'services/users',
- inject: ['require(lodash)', 'mongo', 'settings', 'services/spaces', 'services/mails', 'agent-manager', 'errors']
+ inject: ['require(lodash)', 'mongo', 'settings', 'services/spaces', 'services/mails', 'services/activities', 'agent-manager', 'errors']
};
/**
@@ -30,11 +30,12 @@ module.exports = {
* @param settings
* @param {SpacesService} spacesService
* @param {MailsService} mailsService
+ * @param {ActivitiesService} activitiesService
* @param agentMgr
* @param errors
* @returns {UsersService}
*/
-module.exports.factory = (_, mongo, settings, spacesService, mailsService, agentMgr, errors) => {
+module.exports.factory = (_, mongo, settings, spacesService, mailsService, activitiesService, agentMgr, errors) => {
const _randomString = () => {
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const possibleLen = possible.length;
@@ -143,7 +144,7 @@ module.exports.factory = (_, mongo, settings, spacesService, mailsService, agent
* Get list of user accounts and summary information.
* @returns {mongo.Account[]} - returns all accounts with counters object
*/
- static list() {
+ static list(params) {
return Promise.all([
mongo.Space.aggregate([
{$match: {demo: false}},
@@ -161,13 +162,17 @@ module.exports.factory = (_, mongo, settings, spacesService, mailsService, agent
}
}
]).exec(),
+ activitiesService.total(params),
+ activitiesService.detail(params),
mongo.Account.find({}).sort('firstName lastName').lean().exec()
])
- .then(([counters, users]) => {
+ .then(([counters, activitiesTotal, activitiesDetail, users]) => {
const countersMap = _.keyBy(counters, 'owner');
_.forEach(users, (user) => {
user.counters = _.omit(countersMap[user._id], '_id', 'owner');
+ user.activitiesTotal = activitiesTotal[user._id];
+ user.activitiesDetail = activitiesDetail[user._id];
});
return users;
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/app.config.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.config.js b/modules/web-console/frontend/app/app.config.js
index 7416ce9..0e85711 100644
--- a/modules/web-console/frontend/app/app.config.js
+++ b/modules/web-console/frontend/app/app.config.js
@@ -94,3 +94,12 @@ igniteConsoleCfg.config(['$dropdownProvider', ($dropdownProvider) => {
templateUrl: 'templates/dropdown.html'
});
}]);
+
+// AngularStrap dropdowns () configuration.
+igniteConsoleCfg.config(['$datepickerProvider', ($datepickerProvider) => {
+ angular.extend($datepickerProvider.defaults, {
+ autoclose: true,
+ iconLeft: 'icon-datepicker-left',
+ iconRight: 'icon-datepicker-right'
+ });
+}]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index 4ecd9b5..9958cb5 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -16,7 +16,9 @@
*/
import '../public/stylesheets/style.scss';
-import '../app/directives/ui-grid-settings/ui-grid-settings.scss';
+import '../app/components/ui-grid-header/ui-grid-header.scss';
+import '../app/components/ui-grid-settings/ui-grid-settings.scss';
+import '../app/components/form-field-datepicker/form-field-datepicker.scss';
import './helpers/jade/mixins.jade';
import './app.config';
@@ -25,10 +27,10 @@ import './decorator/select';
import './decorator/tooltip';
import './modules/form/form.module';
-import './modules/agent/agent.module.js';
+import './modules/agent/agent.module';
import './modules/sql/sql.module';
import './modules/nodes/nodes.module';
-import './modules/Demo/Demo.module.js';
+import './modules/demo/Demo.module';
import './modules/states/signin.state';
import './modules/states/logout.state';
@@ -39,6 +41,7 @@ import './modules/states/admin.state';
import './modules/states/errors.state';
// ignite:modules
+import './core';
import './modules/user/user.module';
import './modules/branding/branding.module';
import './modules/navbar/navbar.module';
@@ -50,6 +53,9 @@ import './modules/socket.module';
import './modules/loading/loading.module';
// endignite
+// Data
+import i18n from './data/i18n';
+
// Directives.
import igniteAutoFocus from './directives/auto-focus.directive.js';
import igniteBsAffixUpdate from './directives/bs-affix-update.directive';
@@ -98,9 +104,9 @@ import defaultName from './filters/default-name.filter';
import domainsValidation from './filters/domainsValidation.filter';
import duration from './filters/duration.filter';
import hasPojo from './filters/hasPojo.filter';
+import uiGridSubcategories from './filters/uiGridSubcategories.filter';
// Controllers
-import admin from 'controllers/admin-controller';
import caches from 'controllers/caches-controller';
import clusters from 'controllers/clusters-controller';
import domains from 'controllers/domains-controller';
@@ -109,6 +115,10 @@ import profile from 'controllers/profile-controller';
import auth from './controllers/auth.controller';
import resetPassword from './controllers/reset-password.controller';
+// Components
+import igniteListOfRegisteredUsers from './components/list-of-registered-users';
+import IgniteActivitiesUserDialog from './components/activities-user-dialog';
+
// Inject external modules.
import 'ignite_modules_temp/index';
@@ -129,6 +139,7 @@ angular
'nvd3',
'smart-table',
'treeControl',
+ 'pascalprecht.translate',
'ui.grid',
'ui.grid.saveState',
'ui.grid.selection',
@@ -136,6 +147,7 @@ angular
'ui.grid.autoResize',
'ui.grid.exporter',
// Base modules.
+ 'ignite-console.core',
'ignite-console.ace',
'ignite-console.Form',
'ignite-console.user',
@@ -186,6 +198,7 @@ angular
.directive(...igniteRetainSelection)
.directive('igniteOnFocusOut', igniteOnFocusOut)
.directive('igniteRestoreInputFocus', igniteRestoreInputFocus)
+.directive('igniteListOfRegisteredUsers', igniteListOfRegisteredUsers)
// Services.
.service('IgniteErrorPopover', ErrorPopover)
.service('JavaTypes', JavaTypes)
@@ -204,8 +217,8 @@ angular
.service(...FormUtils)
.service(...LegacyUtils)
.service(...UnsavedChangesGuard)
+.service('IgniteActivitiesUserDialog', IgniteActivitiesUserDialog)
// Controllers.
-.controller(...admin)
.controller(...auth)
.controller(...resetPassword)
.controller(...caches)
@@ -219,7 +232,11 @@ angular
.filter(...domainsValidation)
.filter(...duration)
.filter(...hasPojo)
-.config(['$stateProvider', '$locationProvider', '$urlRouterProvider', ($stateProvider, $locationProvider, $urlRouterProvider) => {
+.filter('uiGridSubcategories', uiGridSubcategories)
+.config(['$translateProvider', '$stateProvider', '$locationProvider', '$urlRouterProvider', ($translateProvider, $stateProvider, $locationProvider, $urlRouterProvider) => {
+ $translateProvider.translations('en', i18n);
+ $translateProvider.preferredLanguage('en');
+
// Set up the states.
$stateProvider
.state('base', {
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js
new file mode 100644
index 0000000..46853b2
--- /dev/null
+++ b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.controller.js
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+const COLUMNS_DEFS = [
+ {displayName: 'Action', field: 'action', minWidth: 65 },
+ {displayName: 'Description', field: 'title', minWidth: 65 },
+ {displayName: 'Visited', field: 'amount', minWidth: 65 }
+];
+
+export default class ActivitiesCtrl {
+ static $inject = ['$state', 'user', 'params', 'IgniteActivitiesData'];
+
+ constructor($state, user, params, ActivitiesData) {
+ const $ctrl = this;
+ const userId = user._id;
+
+ $ctrl.user = user;
+
+ $ctrl.gridOptions = {
+ data: [],
+ columnVirtualizationThreshold: 30,
+ columnDefs: COLUMNS_DEFS,
+ categories: [
+ {name: 'Action', visible: true, selectable: true},
+ {name: 'Description', visible: true, selectable: true},
+ {name: 'Visited', visible: true, selectable: true}
+ ],
+ enableRowSelection: false,
+ enableRowHeaderSelection: false,
+ enableColumnMenus: false,
+ multiSelect: false,
+ modifierKeysToMultiSelect: true,
+ noUnselect: true,
+ flatEntityAccess: true,
+ fastWatch: true,
+ onRegisterApi: (api) => {
+ $ctrl.gridApi = api;
+ }
+ };
+
+ ActivitiesData.listByUser(userId, params)
+ .then((data) => {
+ $ctrl.data = data;
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade
new file mode 100644
index 0000000..2c55ebd
--- /dev/null
+++ b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.jade
@@ -0,0 +1,36 @@
+//-
+ 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.
+
+.modal(tabindex='-1' role='dialog')
+ .modal-dialog
+ .modal-content
+ .modal-header
+ h4.modal-title
+ i.fa.fa-info-circle
+ | Activities: {{ ctrl.user.userName }}
+ .modal-body.modal-body-with-scroll(id='activities-user-dialog')
+ table.table.table-striped.table-bordered.table-hover(scrollable-container='#activities-user-dialog' st-table='displayedRows' st-safe-src='ctrl.data')
+ thead
+ th.text-center(st-sort='title') Description
+ th.text-center(st-sort='action') Action
+ th.text-center(st-sort='amount') Visited
+ tbody
+ tr(ng-repeat='row in displayedRows')
+ td.text-left {{ row.action | translate }}
+ td.text-left {{ row.action }}
+ td.text-left {{ row.amount }}
+ .modal-footer
+ button.btn.btn-primary(id='confirm-btn-confirm' ng-click='$hide()') Close
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/activities-user-dialog/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/index.js b/modules/web-console/frontend/app/components/activities-user-dialog/index.js
new file mode 100644
index 0000000..03d3585
--- /dev/null
+++ b/modules/web-console/frontend/app/components/activities-user-dialog/index.js
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+ import controller from './activities-user-dialog.controller';
+ import templateUrl from './activities-user-dialog.jade';
+
+ export default ['$modal', ($modal) => ({ show = true, user, params }) => {
+ const ActivitiesUserDialog = $modal({
+ templateUrl,
+ show,
+ resolve: {
+ user: () => user,
+ params: () => params
+ },
+ placement: 'center',
+ controller,
+ controllerAs: 'ctrl'
+ });
+
+ return ActivitiesUserDialog.$promise
+ .then(() => ActivitiesUserDialog);
+ }];
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade b/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade
new file mode 100644
index 0000000..6792977
--- /dev/null
+++ b/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.jade
@@ -0,0 +1,55 @@
+//-
+ 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.
+
+mixin ignite-form-field-datepicker(label, model, name, disabled, required, placeholder, tip)
+ mixin form-field-input()
+ input.form-control(
+ id='{{ #{name} }}Input'
+ name='{{ #{name} }}'
+
+ placeholder=placeholder
+
+ data-ng-model=model
+
+ data-ng-required=required && '#{required}'
+ data-ng-disabled=disabled && '#{disabled}'
+
+ bs-datepicker
+ data-date-format='MMM yyyy'
+ data-start-view='1'
+ data-min-view='1'
+ data-max-date='today'
+
+ data-container='body > .wrapper'
+
+ tabindex='0'
+
+ onkeydown="return false"
+
+ data-ignite-form-panel-field=''
+ )&attributes(attributes.attributes)
+
+ .ignite-form-field
+ +ignite-form-field__label(label, name, required)
+ .ignite-form-field__control
+ if tip
+ i.tipField.icon-help(bs-tooltip='' data-title=tip)
+
+ if block
+ block
+
+ .input-tip
+ +form-field-input(attributes=attributes)
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.scss b/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.scss
new file mode 100644
index 0000000..0f6fe6e
--- /dev/null
+++ b/modules/web-console/frontend/app/components/form-field-datepicker/form-field-datepicker.scss
@@ -0,0 +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.
+ */
+
+.datepicker.dropdown-menu tbody button {
+ height: 100%;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/list-of-registered-users/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/index.js b/modules/web-console/frontend/app/components/list-of-registered-users/index.js
new file mode 100644
index 0000000..32a34f4
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/index.js
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+import templateUrl from './list-of-registered-users.jade';
+import controller from './list-of-registered-users.controller';
+
+export default [() => {
+ return {
+ scope: true,
+ templateUrl,
+ controller,
+ controllerAs: '$ctrl'
+ };
+}];
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
new file mode 100644
index 0000000..95edf8b
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+export default [
+ {name: 'Actions', visible: true, selectable: true},
+ {name: 'User', visible: true, selectable: true},
+ {name: 'Email', visible: true, selectable: true},
+ {name: 'Company', visible: true, selectable: true},
+ {name: 'Country', visible: true, selectable: true},
+ {name: 'Last login', visible: false, selectable: true},
+ {name: 'Last activity', visible: true, selectable: true},
+ {name: 'Configurations', visible: false, selectable: true},
+ {name: 'Total activities', visible: true, selectable: true},
+ {name: 'Configuration\'s activities', visible: false, selectable: true},
+ {name: 'Queries\' activities', visible: false, selectable: true}
+];
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
new file mode 100644
index 0000000..61e1bd8
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+
+const ICON_SORT = '<span ui-grid-one-bind-id-grid="col.uid + \'-sortdir-text\'" ui-grid-visible="col.sort.direction" aria-label="Sort Descending"><i ng-class="{ \'ui-grid-icon-up-dir\': col.sort.direction == asc, \'ui-grid-icon-down-dir\': col.sort.direction == desc, \'ui-grid-icon-blank\': !col.sort.direction }" title="" aria-hidden="true"></i></span>';
+
+const USER_TEMPLATE = '<div class="ui-grid-cell-contents"><i class="pull-left" ng-class="row.entity.admin ? \'icon-admin\' : \'icon-user\'"></i>{{ COL_FIELD }}</div>';
+
+const CLUSTER_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-sitemap'></i>${ICON_SORT}</div>`;
+const MODEL_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-object-group'></i>${ICON_SORT}</div>`;
+const CACHE_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-database'></i>${ICON_SORT}</div>`;
+const IGFS_HEADER_TEMPLATE = `<div class='ui-grid-cell-contents' bs-tooltip data-title='{{ col.headerTooltip(col) }}' data-placement='top'><i class='fa fa-folder-o'></i>${ICON_SORT}</div>`;
+
+const ACTIONS_TEMPLATE = `
+<div class='text-center ui-grid-cell-actions'>
+ <a class='btn btn-default dropdown-toggle' bs-dropdown='' data-placement='bottom-right' data-container='.panel'>
+ <i class='fa fa-gear'></i>
+ <span class='caret'></span>
+ </a>
+ <ul class='dropdown-menu' role='menu'>
+ <li ng-show='row.entity._id != $root.user._id'>
+ <a ng-click='grid.api.becomeUser(row.entity)'>Become this user</a>
+ </li>
+ <li ng-show='row.entity._id != $root.user._id'>
+ <a ng-click='grid.api.toggleAdmin(row.entity)' ng-if='row.entity.admin && row.entity._id !== $root.user._id'>Revoke admin</a>
+ <a ng-click='grid.api.toggleAdmin(row.entity)' ng-if='!row.entity.admin && row.entity._id !== $root.user._id'>Grant admin</a>
+ </li>
+ <li ng-show='row.entity._id != $root.user._id'>
+ <a ng-click='grid.api.removeUser(row.entity)'>Remove user</a>
+ </li>
+ <li>
+ <a ng-click='grid.api.showActivities(row.entity)'>Activity detail</a>
+ </li>
+</div>`;
+
+const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a ng-href="mailto:{{ COL_FIELD }}">{{ COL_FIELD }}</a></div>';
+
+export default [
+ {displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'test', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, pinnedLeft: true},
+ {displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by name...' }, pinnedLeft: true},
+ {displayName: 'Email', categoryDisplayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by email...' }},
+ {displayName: 'Company', categoryDisplayName: 'Company', field: 'company', minWidth: 160, enableFiltering: true},
+ {displayName: 'Country', categoryDisplayName: 'Country', field: 'countryCode', minWidth: 80, enableFiltering: true},
+ {displayName: 'Last login', categoryDisplayName: 'Last login', field: 'lastLogin', cellFilter: 'date:"M/d/yy HH:mm"', minWidth: 105, width: 105, enableFiltering: false, visible: false},
+ {displayName: 'Last activity', categoryDisplayName: 'Last activity', field: 'lastActivity', cellFilter: 'date:"M/d/yy HH:mm"', minWidth: 105, width: 105, enableFiltering: false, visible: true, sort: { direction: 'desc', priority: 0 }},
+ // Configurations
+ {displayName: 'Clusters count', categoryDisplayName: 'Configurations', headerCellTemplate: CLUSTER_HEADER_TEMPLATE, field: 'counters.clusters', type: 'number', headerTooltip: 'Clusters count', minWidth: 50, width: 50, enableFiltering: false, visible: false},
+ {displayName: 'Models count', categoryDisplayName: 'Configurations', headerCellTemplate: MODEL_HEADER_TEMPLATE, field: 'counters.models', type: 'number', headerTooltip: 'Models count', minWidth: 50, width: 50, enableFiltering: false, visible: false},
+ {displayName: 'Caches count', categoryDisplayName: 'Configurations', headerCellTemplate: CACHE_HEADER_TEMPLATE, field: 'counters.caches', type: 'number', headerTooltip: 'Caches count', minWidth: 50, width: 50, enableFiltering: false, visible: false},
+ {displayName: 'IGFS count', categoryDisplayName: 'Configurations', headerCellTemplate: IGFS_HEADER_TEMPLATE, field: 'counters.igfs', type: 'number', headerTooltip: 'IGFS count', minWidth: 50, width: 50, enableFiltering: false, visible: false},
+ // Activities Total
+ {displayName: 'Cfg', categoryDisplayName: 'Total activities', field: 'activitiesTotal["configuration"] || 0', type: 'number', headerTooltip: 'Configuration', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Qry', categoryDisplayName: 'Total activities', field: 'activitiesTotal["queries"] || 0', type: 'number', headerTooltip: 'Queries', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Demo', categoryDisplayName: 'Total activities', field: 'activitiesTotal["demo"] || 0', type: 'number', headerTooltip: 'Demo', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'AD', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/download"] || 0', type: 'number', headerTooltip: 'Agent Download', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'AS', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/start"] || 0', type: 'number', headerTooltip: 'Agent Start', minWidth: 50, width: 50, enableFiltering: false},
+ // Activities Configuration
+ {displayName: 'Clusters', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/clusters"] || 0', type: 'number', headerTooltip: 'Configuration Clusters', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Model', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/domains"] || 0', type: 'number', headerTooltip: 'Configuration Model', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Caches', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/caches"] || 0', type: 'number', headerTooltip: 'Configuration Caches', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'IGFS', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/igfs"] || 0', type: 'number', headerTooltip: 'Configuration IGFS', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Summary', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/summary"] || 0', type: 'number', headerTooltip: 'Configuration Summary', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ // Activities Queries
+ {displayName: 'Execute', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/execute"] || 0', type: 'number', headerTooltip: 'Query execute', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Explain', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/explain"] || 0', type: 'number', headerTooltip: 'Query explain', minWidth: 50, width: 80, enableFiltering: false, visible: false},
+ {displayName: 'Scan', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/scan"] || 0', type: 'number', headerTooltip: 'Scan', minWidth: 50, width: 80, enableFiltering: false, visible: false}
+];
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
new file mode 100644
index 0000000..19f7921
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
@@ -0,0 +1,207 @@
+/*
+ * 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.
+ */
+
+import headerTemplate from 'app/components/ui-grid-header/ui-grid-header.jade';
+
+import columnDefs from './list-of-registered-users.column-defs';
+import categories from './list-of-registered-users.categories';
+
+export default class IgniteListOfRegisteredUsersCtrl {
+ static $inject = ['$scope', '$state', '$templateCache', 'User', 'uiGridConstants', 'IgniteAdminData', 'IgniteNotebookData', 'IgniteConfirm', 'IgniteActivitiesUserDialog'];
+
+ constructor($scope, $state, $templateCache, User, uiGridConstants, AdminData, NotebookData, Confirm, ActivitiesUserDialog) {
+ const $ctrl = this;
+
+ const companySelectOptions = [];
+ const countrySelectOptions = [];
+
+ $ctrl.params = {
+ startDate: new Date()
+ };
+
+ $ctrl.params.startDate.setDate(1);
+ $ctrl.params.startDate.setHours(0, 0, 0, 0);
+
+ const columnCompany = _.find(columnDefs, { displayName: 'Company' });
+ const columnCountry = _.find(columnDefs, { displayName: 'Country' });
+
+ columnCompany.filter = {
+ selectOptions: companySelectOptions,
+ type: uiGridConstants.filter.SELECT,
+ condition: uiGridConstants.filter.EXACT
+ };
+
+ columnCountry.filter = {
+ selectOptions: countrySelectOptions,
+ type: uiGridConstants.filter.SELECT,
+ condition: uiGridConstants.filter.EXACT
+ };
+
+ const becomeUser = (user) => {
+ AdminData.becomeUser(user._id)
+ .then(() => User.load())
+ .then(() => $state.go('base.configuration.clusters'))
+ .then(() => NotebookData.load());
+ };
+
+ const removeUser = (user) => {
+ Confirm.confirm(`Are you sure you want to remove user: "${user.userName}"?`)
+ .then(() => AdminData.removeUser(user))
+ .then(() => {
+ const i = _.findIndex($ctrl.gridOptions.data, (u) => u._id === user._id);
+
+ if (i >= 0)
+ $ctrl.gridOptions.data.splice(i, 1);
+ })
+ .then(() => $ctrl.adjustHeight($ctrl.gridOptions.data.length));
+ };
+
+ const toggleAdmin = (user) => {
+ if (user.adminChanging)
+ return;
+
+ user.adminChanging = true;
+
+ AdminData.toggleAdmin(user)
+ .then(() => user.admin = !user.admin)
+ .finally(() => user.adminChanging = false);
+ };
+
+ const showActivities = (user) => {
+ return new ActivitiesUserDialog({ user, params: $ctrl.params });
+ };
+
+ $ctrl.gridOptions = {
+ data: [],
+ columnVirtualizationThreshold: 30,
+ columnDefs,
+ categories,
+ headerTemplate: $templateCache.get(headerTemplate),
+ enableFiltering: true,
+ enableRowSelection: false,
+ enableRowHeaderSelection: false,
+ enableColumnMenus: false,
+ multiSelect: false,
+ modifierKeysToMultiSelect: true,
+ noUnselect: true,
+ fastWatch: true,
+ onRegisterApi: (api) => {
+ $ctrl.gridApi = api;
+
+ api.becomeUser = becomeUser;
+ api.removeUser = removeUser;
+ api.toggleAdmin = toggleAdmin;
+ api.showActivities = showActivities;
+ }
+ };
+
+ const usersToFilterOptions = (column) => {
+ return _.sortBy(
+ _.map(
+ _.groupBy($ctrl.gridOptions.data, (usr) => {
+ const fld = usr[column];
+
+ return _.isNil(fld) ? fld : fld.toUpperCase();
+ }),
+ (arr, value) => ({label: `${_.head(arr)[column] || 'Not set'} (${arr.length})`, value})
+ ),
+ 'value');
+ };
+
+ /**
+ * @param {{startDate: Date, endDate: Date}} params
+ */
+ const reloadUsers = (params) => {
+ AdminData.loadUsers(params)
+ .then((data) => $ctrl.gridOptions.data = data)
+ .then((data) => {
+ companySelectOptions.push(...usersToFilterOptions('company'));
+ countrySelectOptions.push(...usersToFilterOptions('countryCode'));
+
+ this.gridApi.grid.refresh();
+
+ return data;
+ })
+ .then((data) => $ctrl.adjustHeight(data.length));
+ };
+
+ $scope.$watch(() => $ctrl.params.startDate, () => {
+ const endDate = new Date($ctrl.params.startDate);
+
+ endDate.setMonth(endDate.getMonth() + 1);
+
+ $ctrl.params.endDate = endDate;
+
+ reloadUsers($ctrl.params);
+ });
+ }
+
+ adjustHeight(rows) {
+ const height = Math.min(rows, 20) * 30 + 75;
+
+ // Remove header height.
+ this.gridApi.grid.element.css('height', height + 'px');
+
+ this.gridApi.core.handleWindowResize();
+ }
+
+ _enableColumns(_categories, visible) {
+ _.forEach(_categories, (cat) => {
+ cat.visible = visible;
+
+ _.forEach(this.gridOptions.columnDefs, (col) => {
+ if (col.categoryDisplayName === cat.name)
+ col.visible = visible;
+ });
+ });
+
+ // Workaround for this.gridApi.grid.refresh() didn't return promise.
+ this.gridApi.grid.processColumnsProcessors(this.gridApi.grid.columns)
+ .then((renderableColumns) => this.gridApi.grid.setVisibleColumns(renderableColumns))
+ .then(() => this.gridApi.grid.redrawInPlace())
+ .then(() => this.gridApi.grid.refreshCanvas(true))
+ .then(() => {
+ if (visible) {
+ const categoryDisplayName = _.last(_categories).name;
+
+ const col = _.findLast(this.gridOptions.columnDefs, {categoryDisplayName});
+
+ this.gridApi.grid.scrollTo(null, col);
+ }
+ });
+ }
+
+ _selectableColumns() {
+ return _.filter(this.gridOptions.categories, (cat) => cat.selectable);
+ }
+
+ toggleColumns(category, visible) {
+ this._enableColumns([category], visible);
+ }
+
+ selectAllColumns() {
+ this._enableColumns(this._selectableColumns(), true);
+ }
+
+ clearAllColumns() {
+ this._enableColumns(this._selectableColumns(), false);
+ }
+
+ exportCsv() {
+ this.gridApi.exporter.csvExport('all', 'visible');
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade
new file mode 100644
index 0000000..efed9c0
--- /dev/null
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade
@@ -0,0 +1,54 @@
+//-
+ 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.
+
+include /app/helpers/jade/mixins.jade
+include /app/components/form-field-datepicker/form-field-datepicker.jade
+
+mixin grid-settings()
+ i.fa.fa-bars(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
+ ul.select.dropdown-menu(role='menu')
+ li(ng-repeat='item in $ctrl.gridOptions.categories|filter:{selectable:true}')
+ a(ng-click='$ctrl.toggleColumns(item, !item.visible)')
+ i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
+ i.fa.fa-square-o.pull-left(ng-if='!item.visible')
+ span {{::item.name}}
+ li.divider
+ li
+ a(ng-click='$ctrl.selectAllColumns()') Select all
+ li
+ a(ng-click='$ctrl.clearAllColumns()') Clear all
+ li.divider
+ li
+ a(ng-click='$hide()') Close
+
+.panel.panel-default
+ .panel-heading.ui-grid-settings
+ +grid-settings
+ label Total users:
+ strong {{ $ctrl.gridOptions.data.length }}
+ label Showing users:
+ strong {{ $ctrl.gridApi.grid.getVisibleRows().length }}
+ sub(ng-show='users.length === $ctrl.gridApi.grid.getVisibleRows().length') all
+ div.ui-grid-settings-dateperiod
+ form(ng-form=form novalidate)
+ -var form = 'admin'
+
+ +ignite-form-field-datepicker('Period:', '$ctrl.params.startDate', '"period"')
+
+ button.btn.btn-primary(ng-click='$ctrl.exportCsv()' bs-tooltip data-title='Export table to csv') Export
+
+ .panel-collapse
+ .grid.ui-grid--ignite(ui-grid='$ctrl.gridOptions' ui-grid-resize-columns ui-grid-selection ui-grid-exporter ui-grid-pinning)
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/ui-grid-header/ui-grid-header.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ui-grid-header/ui-grid-header.jade b/modules/web-console/frontend/app/components/ui-grid-header/ui-grid-header.jade
new file mode 100644
index 0000000..7e44d94
--- /dev/null
+++ b/modules/web-console/frontend/app/components/ui-grid-header/ui-grid-header.jade
@@ -0,0 +1,27 @@
+//-
+ 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.
+
+.ui-grid-header.ui-grid-header--subcategories(role='rowgroup')
+ .ui-grid-top-panel
+ .ui-grid-header-viewport
+ .ui-grid-header-canvas
+ .ui-grid-header-cell-wrapper(ng-style='colContainer.headerCellWrapperStyle()')
+ .ui-grid-header-cell-row(role='row')
+ .ui-grid-header-span.ui-grid-header-cell.ui-grid-clearfix(ng-repeat='cat in grid.options.categories')
+ div(ng-show='(colContainer.renderedColumns|uiGridSubcategories:cat.name).length > 1')
+ .ui-grid-cell-contents {{ cat.name }}
+ .ui-grid-header-cell-row
+ .ui-grid-header-cell.ui-grid-clearfix(ng-repeat='col in (colContainer.renderedColumns|uiGridSubcategories:cat.name) track by col.uid' ui-grid-header-cell='' col='col' render-index='$index')
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/ui-grid-header/ui-grid-header.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ui-grid-header/ui-grid-header.scss b/modules/web-console/frontend/app/components/ui-grid-header/ui-grid-header.scss
new file mode 100644
index 0000000..c390504
--- /dev/null
+++ b/modules/web-console/frontend/app/components/ui-grid-header/ui-grid-header.scss
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+.ui-grid-header--subcategories {
+ .ui-grid-row:nth-child(even) .ui-grid-cell.cell-total {
+ background-color: rgba(102,175,233,.6);
+ }
+
+ .ui-grid-row:nth-child(odd) .ui-grid-cell.cell-total {
+ background-color: rgba(102,175,233,.3);
+ }
+
+ .ui-grid-header-cell-row {
+ height: 30px;
+ }
+
+ .ui-grid-header-cell [role="columnheader"] {
+ display: flex;
+
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: center;
+
+ height: 100%;
+
+ & > div {
+ flex: 1 100%;
+ height: auto;
+ }
+
+ & > div[ui-grid-filter] {
+ flex: auto;
+ }
+ }
+
+ .ui-grid-header-span {
+ position: relative;
+ border-right: 0;
+
+ .ng-hide + .ui-grid-header-cell-row .ui-grid-header-cell {
+ height: 58px;
+ }
+
+ .ng-hide + .ui-grid-header-cell-row .ui-grid-cell-contents {
+ padding: 5px 5px;
+ }
+
+ .ui-grid-column-resizer.right {
+ top: -100px;
+ }
+ .ng-hide + .ui-grid-header-cell-row .ui-grid-column-resizer.right {
+ bottom: -100px;
+ }
+
+ &.ui-grid-header-cell .ui-grid-header-cell .ui-grid-column-resizer.right {
+ border-right-width: 0;
+ }
+ &.ui-grid-header-cell .ui-grid-header-cell:last-child .ui-grid-column-resizer.right {
+ border-right-width: 1px;
+ }
+
+ & > div > .ui-grid-cell-contents {
+ border-bottom: 1px solid #d4d4d4;
+ }
+ }
+
+ input {
+ line-height: 21px;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.jade b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.jade
new file mode 100644
index 0000000..8f1487e
--- /dev/null
+++ b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.jade
@@ -0,0 +1,33 @@
+//-
+ 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.
+
+mixin ui-grid-settings()
+ .ui-grid-settings
+ i.fa.fa-bars(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
+ ul.select.dropdown-menu(role='menu')
+ li(ng-repeat='item in paragraph.gridOptions.categories|filter:{selectable:true}')
+ a(ng-click='paragraph.toggleColumns(item, !item.visible)')
+ i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
+ i.fa.fa-square-o.pull-left(ng-if='!item.visible')
+ span {{::item.name}}
+ li.divider
+ li
+ a(ng-click='paragraph.selectAllColumns()') Select all
+ li
+ a(ng-click='paragraph.clearAllColumns()') Clear all
+ li.divider
+ li
+ a(ng-click='$hide()') Close
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
new file mode 100644
index 0000000..3016488
--- /dev/null
+++ b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+.ui-grid-settings {
+ ul.select.dropdown-menu > li > a {
+ padding-top: 0;
+ padding-bottom: 0;
+ }
+
+ ul.select.dropdown-menu > li > a > i {
+ position: relative;
+ line-height: 26px;
+ width: 14px;
+ margin-left: 0;
+ color: inherit;
+ }
+
+ ul.select.dropdown-menu > li > a > span {
+ line-height: 26px;
+ padding-left: 5px;
+ padding-right: 8px;
+ cursor: pointer;
+ }
+
+ &-dateperiod {
+ float: right;
+
+ .ignite-form-field {
+ width: 160px;
+ margin-right: 10px;
+
+ &__label {
+ }
+
+ &__control {
+ }
+
+ &:nth-child(1) {
+ float: left;
+
+ .ignite-form-field__label {
+ width: 40%;
+ }
+
+ .ignite-form-field__control {
+ width: 60%;
+ }
+ }
+ }
+
+ .btn {
+ line-height: 20px;
+ margin-right: 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/core/activities/Activities.data.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/core/activities/Activities.data.js b/modules/web-console/frontend/app/core/activities/Activities.data.js
new file mode 100644
index 0000000..8a67a97
--- /dev/null
+++ b/modules/web-console/frontend/app/core/activities/Activities.data.js
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+export default class ActivitiesData {
+ static $inject = ['$http', '$state'];
+
+ constructor($http, $state) {
+ this.$http = $http;
+ this.$state = $state;
+ }
+
+ post(options = {}) {
+ let { group, action } = options;
+
+ action = action || this.$state.$current.url.source;
+ group = group || action.match(/^\/([^/]+)/)[1];
+
+ return this.$http.post('/api/v1/activities/page', { group, action });
+ }
+
+ listByUser(userId, params) {
+ return this.$http.get(`/api/v1/activities/user/${userId}`, { params })
+ .then(({ data }) => data);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/core/admin/Admin.data.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/core/admin/Admin.data.js b/modules/web-console/frontend/app/core/admin/Admin.data.js
new file mode 100644
index 0000000..66d82f0
--- /dev/null
+++ b/modules/web-console/frontend/app/core/admin/Admin.data.js
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+export default class IgniteAdminData {
+ static $inject = ['$http', 'IgniteMessages', 'IgniteCountries'];
+
+ constructor($http, Messages, Countries) {
+ this.$http = $http;
+ this.Messages = Messages;
+ this.Countries = Countries;
+ }
+
+ becomeUser(viewedUserId) {
+ return this.$http.get('/api/v1/admin/become', {
+ params: {viewedUserId}
+ })
+ .catch(this.Messages.showError);
+ }
+
+ removeUser(user) {
+ return this.$http.post('/api/v1/admin/remove', {
+ userId: user._id
+ })
+ .then(() => {
+ this.Messages.showInfo(`User has been removed: "${user.userName}"`);
+ })
+ .catch(({data, status}) => {
+ if (status === 503)
+ this.Messages.showInfo(data);
+ else
+ this.Messages.showError('Failed to remove user: ', data);
+ });
+ }
+
+ toggleAdmin(user) {
+ return this.$http.post('/api/v1/admin/save', {
+ userId: user._id,
+ adminFlag: !user.admin
+ })
+ .then(() => {
+ this.Messages.showInfo(`Admin right was successfully toggled for user: "${user.userName}"`);
+ })
+ .catch((res) => {
+ this.Messages.showError('Failed to toggle admin right for user: ', res);
+ });
+ }
+
+ prepareUsers(user) {
+ const { Countries } = this;
+
+ user.userName = user.firstName + ' ' + user.lastName;
+ user.countryCode = Countries.getByName(user.country).code;
+
+ return user;
+ }
+
+ loadUsers(params) {
+ return this.$http.post('/api/v1/admin/list', params)
+ .then(({ data }) => data)
+ .then((users) => _.map(users, this.prepareUsers.bind(this)))
+ .catch(this.Messages.showError);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/core/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/core/index.js b/modules/web-console/frontend/app/core/index.js
new file mode 100644
index 0000000..7f72ee3
--- /dev/null
+++ b/modules/web-console/frontend/app/core/index.js
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import IgniteAdminData from './admin/Admin.data';
+import IgniteActivitiesData from './activities/Activities.data';
+
+angular.module('ignite-console.core', [])
+ .service('IgniteAdminData', IgniteAdminData)
+ .service('IgniteActivitiesData', IgniteActivitiesData);
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/data/i18n.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/data/i18n.js b/modules/web-console/frontend/app/data/i18n.js
new file mode 100644
index 0000000..bc8c700
--- /dev/null
+++ b/modules/web-console/frontend/app/data/i18n.js
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+export default {
+ '/agent/start': 'Agent start',
+ '/agent/download': 'Agent download',
+ '/configuration/clusters': 'Configure clusters',
+ '/configuration/caches': 'Configure caches',
+ '/configuration/domains': 'Configure domain model',
+ '/configuration/igfs': 'Configure IGFS',
+ '/configuration/summary': 'Configurations summary',
+ '/demo/resume': 'Demo resume',
+ '/demo/reset': 'Demo reset',
+ '/queries/execute': 'Query execute',
+ '/queries/explain': 'Query explain',
+ '/queries/scan': 'Scan',
+ '/queries/add/query': 'Add query',
+ '/queries/add/scan': 'Add scan',
+ '/queries/demo': 'SQL demo',
+ '/queries/notebook/': 'Query notebook',
+ '/settings/profile': 'User profile',
+ '/settings/admin': 'Admin panel',
+ '/logout': 'Logout'
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/directives/ui-grid-settings/ui-grid-settings.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/directives/ui-grid-settings/ui-grid-settings.jade b/modules/web-console/frontend/app/directives/ui-grid-settings/ui-grid-settings.jade
deleted file mode 100644
index 8f1487e..0000000
--- a/modules/web-console/frontend/app/directives/ui-grid-settings/ui-grid-settings.jade
+++ /dev/null
@@ -1,33 +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.
-
-mixin ui-grid-settings()
- .ui-grid-settings
- i.fa.fa-bars(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
- ul.select.dropdown-menu(role='menu')
- li(ng-repeat='item in paragraph.gridOptions.categories|filter:{selectable:true}')
- a(ng-click='paragraph.toggleColumns(item, !item.visible)')
- i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
- i.fa.fa-square-o.pull-left(ng-if='!item.visible')
- span {{::item.name}}
- li.divider
- li
- a(ng-click='paragraph.selectAllColumns()') Select all
- li
- a(ng-click='paragraph.clearAllColumns()') Clear all
- li.divider
- li
- a(ng-click='$hide()') Close
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/directives/ui-grid-settings/ui-grid-settings.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/directives/ui-grid-settings/ui-grid-settings.scss b/modules/web-console/frontend/app/directives/ui-grid-settings/ui-grid-settings.scss
deleted file mode 100644
index 6517a60..0000000
--- a/modules/web-console/frontend/app/directives/ui-grid-settings/ui-grid-settings.scss
+++ /dev/null
@@ -1,38 +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.
- */
-
-.ui-grid-settings {
- ul.select.dropdown-menu > li > a {
- padding-top: 0;
- padding-bottom: 0;
- }
-
- ul.select.dropdown-menu > li > a > i {
- position: relative;
- line-height: 26px;
- width: 14px;
- margin-left: 0;
- color: inherit;
- }
-
- ul.select.dropdown-menu > li > a > span {
- line-height: 26px;
- padding-left: 5px;
- padding-right: 8px;
- cursor: pointer;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/26ee9c28/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js b/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js
new file mode 100644
index 0000000..f36ae6e
--- /dev/null
+++ b/modules/web-console/frontend/app/filters/uiGridSubcategories.filter.js
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+export default [() => {
+ return (arr, category) => {
+ return _.filter(arr, (item) => {
+ return item.colDef.categoryDisplayName === category;
+ });
+ };
+}];
[41/50] [abbrv] ignite git commit: Minor fix: missing toString()
method.
Posted by yz...@apache.org.
Minor fix: missing toString() method.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/571586cd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/571586cd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/571586cd
Branch: refs/heads/ignite-comm-balance-master
Commit: 571586cdc7d6271b671c76404075be3793cd1ac9
Parents: b461cb4
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Wed Feb 15 11:08:23 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Feb 15 11:08:23 2017 +0700
----------------------------------------------------------------------
.../ignite/internal/visor/cache/VisorCacheTypeMetadata.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/571586cd/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
index f17e588..c87ad05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheTypeMetadata.java
@@ -32,6 +32,7 @@ import org.apache.ignite.cache.store.jdbc.JdbcType;
import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
import org.apache.ignite.internal.LessNamingBean;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
@@ -372,4 +373,9 @@ public class VisorCacheTypeMetadata implements Serializable, LessNamingBean {
public Map<String, LinkedHashMap<String, IgniteBiTuple<String, Boolean>>> grps() {
return grps;
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheTypeMetadata.class, this);
+ }
}
[46/50] [abbrv] ignite git commit: IGNITE-4472 Minor UI fix.
Posted by yz...@apache.org.
IGNITE-4472 Minor UI fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/97c7ed7b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/97c7ed7b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/97c7ed7b
Branch: refs/heads/ignite-comm-balance-master
Commit: 97c7ed7b36eb605f275df707ebe726b905b3db54
Parents: 06908d2
Author: Andrey Novikov <an...@gridgain.com>
Authored: Thu Feb 16 14:22:22 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu Feb 16 14:22:22 2017 +0700
----------------------------------------------------------------------
.../list-of-registered-users.column-defs.js | 8 ++--
.../list-of-registered-users.controller.js | 18 +++++++++
.../list-of-registered-users.jade | 16 +++++---
.../ui-grid-settings/ui-grid-settings.scss | 39 +++++++++++++++++---
4 files changed, 66 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c7ed7b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
index 4dc4655..e6ba842 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
@@ -49,7 +49,7 @@ const ACTIONS_TEMPLATE = `
const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a ng-href="mailto:{{ COL_FIELD }}">{{ COL_FIELD }}</a></div>';
export default [
- {displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, pinnedLeft: true},
+ {displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 65, width: 65, enableFiltering: false, enableSorting: false, pinnedLeft: true},
{displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by name...' }, pinnedLeft: true},
{displayName: 'Email', categoryDisplayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by email...' }},
{displayName: 'Company', categoryDisplayName: 'Company', field: 'company', minWidth: 160, enableFiltering: true},
@@ -64,9 +64,9 @@ export default [
// Activities Total
{displayName: 'Cfg', categoryDisplayName: 'Total activities', field: 'activitiesTotal["configuration"] || 0', type: 'number', headerTooltip: 'Total count of configuration usages', minWidth: 50, width: 50, enableFiltering: false},
{displayName: 'Qry', categoryDisplayName: 'Total activities', field: 'activitiesTotal["queries"] || 0', type: 'number', headerTooltip: 'Total count of queries usages', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'Demo', categoryDisplayName: 'Total activities', field: 'activitiesTotal["demo"] || 0', type: 'number', headerTooltip: 'Total count of demo startup', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'Dnld', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/download"] || 0', type: 'number', headerTooltip: 'Total count of agent downloads', minWidth: 50, width: 50, enableFiltering: false},
- {displayName: 'Str', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/start"] || 0', type: 'number', headerTooltip: 'Total count of agent startup', minWidth: 50, width: 50, enableFiltering: false},
+ {displayName: 'Demo', categoryDisplayName: 'Total activities', field: 'activitiesTotal["demo"] || 0', type: 'number', headerTooltip: 'Total count of demo startup', minWidth: 60, width: 60, enableFiltering: false},
+ {displayName: 'Dnld', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/download"] || 0', type: 'number', headerTooltip: 'Total count of agent downloads', minWidth: 55, width: 55, enableFiltering: false},
+ {displayName: 'Starts', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/start"] || 0', type: 'number', headerTooltip: 'Total count of agent startup', minWidth: 60, width: 60, enableFiltering: false},
// Activities Configuration
{displayName: 'Clusters', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/clusters"] || 0', type: 'number', headerTooltip: 'Configuration clusters', minWidth: 50, width: 80, enableFiltering: false, visible: false},
{displayName: 'Model', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/domains"] || 0', type: 'number', headerTooltip: 'Configuration model', minWidth: 50, width: 80, enableFiltering: false, visible: false},
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c7ed7b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
index 1f2a348..5761073 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
@@ -96,6 +96,18 @@ export default class IgniteListOfRegisteredUsersCtrl {
return new ActivitiesUserDialog({ user });
};
+ const companiesExcludeFilter = (renderableRows) => {
+ if (_.isNil($ctrl.params.companiesExclude))
+ return renderableRows;
+
+ _.forEach(renderableRows, (row) => {
+ row.visible = _.isEmpty($ctrl.params.companiesExclude) ||
+ row.entity.company.toLowerCase().indexOf($ctrl.params.companiesExclude.toLowerCase()) === -1;
+ });
+
+ return renderableRows;
+ };
+
$ctrl.gridOptions = {
data: [],
columnVirtualizationThreshold: 30,
@@ -120,6 +132,8 @@ export default class IgniteListOfRegisteredUsersCtrl {
api.removeUser = removeUser;
api.toggleAdmin = toggleAdmin;
api.showActivities = showActivities;
+
+ api.grid.registerRowsProcessor(companiesExcludeFilter, 300);
}
};
@@ -153,6 +167,10 @@ export default class IgniteListOfRegisteredUsersCtrl {
.then((data) => $ctrl.adjustHeight(data.length));
};
+ $scope.$watch(() => $ctrl.params.companiesExclude, () => {
+ $ctrl.gridApi.grid.refreshRows();
+ });
+
$scope.$watch(() => $ctrl.params.startDate, (dt) => {
$ctrl.gridOptions.exporterCsvFilename = `web_console_users_${dtFilter(dt, 'yyyy_MM')}.csv`;
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c7ed7b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade
index efed9c0..1195910 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.jade
@@ -39,16 +39,20 @@ mixin grid-settings()
+grid-settings
label Total users:
strong {{ $ctrl.gridOptions.data.length }}
- label Showing users:
+ label Showing users:
strong {{ $ctrl.gridApi.grid.getVisibleRows().length }}
sub(ng-show='users.length === $ctrl.gridApi.grid.getVisibleRows().length') all
- div.ui-grid-settings-dateperiod
- form(ng-form=form novalidate)
- -var form = 'admin'
+ form.pull-right(ng-form=form novalidate)
+ -var form = 'admin'
+
+ button.btn.btn-primary(ng-click='$ctrl.exportCsv()' bs-tooltip data-title='Export table to csv') Export
+
+ .ui-grid-settings-dateperiod
+ignite-form-field-datepicker('Period:', '$ctrl.params.startDate', '"period"')
-
- button.btn.btn-primary(ng-click='$ctrl.exportCsv()' bs-tooltip data-title='Export table to csv') Export
+
+ .ui-grid-settings-filter
+ +ignite-form-field-text('Exclude:', '$ctrl.params.companiesExclude', '"exclude"', false, false, 'Exclude by company name...')
.panel-collapse
.grid.ui-grid--ignite(ui-grid='$ctrl.gridOptions' ui-grid-resize-columns ui-grid-selection ui-grid-exporter ui-grid-pinning)
http://git-wip-us.apache.org/repos/asf/ignite/blob/97c7ed7b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
index 3016488..bc16271 100644
--- a/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
+++ b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
@@ -36,6 +36,40 @@
cursor: pointer;
}
+ .btn {
+ float: right;
+
+ line-height: 20px;
+ margin-right: 0;
+ }
+
+ &-filter {
+ float: right;
+
+ .ignite-form-field {
+ width: 260px;
+ margin-right: 10px;
+
+ &__label {
+ }
+
+ &__control {
+ }
+
+ &:nth-child(1) {
+ float: left;
+
+ .ignite-form-field__label {
+ width: 30%;
+ }
+
+ .ignite-form-field__control {
+ width: 70%;
+ }
+ }
+ }
+ }
+
&-dateperiod {
float: right;
@@ -61,10 +95,5 @@
}
}
}
-
- .btn {
- line-height: 20px;
- margin-right: 0;
- }
}
}
[06/50] [abbrv] ignite git commit: ignite-4147 - Rollback due to test
failing on many restarts, should be improved to be more durable
Posted by yz...@apache.org.
ignite-4147 - Rollback due to test failing on many restarts, should be improved to be more durable
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9c9175d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9c9175d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9c9175d4
Branch: refs/heads/ignite-comm-balance-master
Commit: 9c9175d4a84194a224a4020e6185d1e2aee0a5aa
Parents: 51e1f87
Author: dkarachentsev <dk...@gridgain.com>
Authored: Thu Jan 19 11:19:18 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Thu Jan 19 11:19:18 2017 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ClientImpl.java | 20 +----
.../ignite/spi/discovery/tcp/ServerImpl.java | 9 --
.../TcpDiscoverySslSecuredUnsecuredTest.java | 93 --------------------
.../IgniteSpiDiscoverySelfTestSuite.java | 2 -
4 files changed, 1 insertion(+), 123 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c9175d4/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 35f0908..39c539c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -20,7 +20,6 @@ package org.apache.ignite.spi.discovery.tcp;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.StreamCorruptedException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
@@ -45,7 +44,6 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicReference;
-import javax.net.ssl.SSLException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteException;
@@ -664,14 +662,6 @@ class ClientImpl extends TcpDiscoveryImpl {
errs.add(e);
- if (X.hasCause(e, SSLException.class))
- throw new IgniteSpiException("Unable to establish secure connection. " +
- "Was remote cluster configured with SSL? [rmtAddr=" + addr + ", errMsg=\"" + e.getMessage() + "\"]", e);
-
- if (X.hasCause(e, StreamCorruptedException.class))
- throw new IgniteSpiException("Unable to establish plain connection. " +
- "Was remote cluster configured with SSL? [rmtAddr=" + addr + ", errMsg=\"" + e.getMessage() + "\"]", e);
-
if (timeoutHelper.checkFailureTimeoutReached(e))
break;
@@ -1603,15 +1593,7 @@ class ClientImpl extends TcpDiscoveryImpl {
joinCnt++;
- T2<SocketStream, Boolean> joinRes;
- try {
- joinRes = joinTopology(false, spi.joinTimeout);
- }
- catch (IgniteSpiException e) {
- joinError(e);
-
- return;
- }
+ T2<SocketStream, Boolean> joinRes = joinTopology(false, spi.joinTimeout);
if (joinRes == null) {
if (join)
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c9175d4/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 f33566c..d462ac2 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
@@ -24,7 +24,6 @@ import java.io.InputStream;
import java.io.ObjectStreamException;
import java.io.OutputStream;
import java.io.Serializable;
-import java.io.StreamCorruptedException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -1221,14 +1220,6 @@ class ServerImpl extends TcpDiscoveryImpl {
errs.add(e);
- if (X.hasCause(e, SSLException.class))
- throw new IgniteException("Unable to establish secure connection. " +
- "Was remote cluster configured with SSL? [rmtAddr=" + addr + ", errMsg=\"" + e.getMessage() + "\"]", e);
-
- if (X.hasCause(e, StreamCorruptedException.class))
- throw new IgniteException("Unable to establish plain connection. " +
- "Was remote cluster configured with SSL? [rmtAddr=" + addr + ", errMsg=\"" + e.getMessage() + "\"]", e);
-
if (timeoutHelper.checkFailureTimeoutReached(e))
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c9175d4/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSecuredUnsecuredTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSecuredUnsecuredTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSecuredUnsecuredTest.java
deleted file mode 100644
index 2296165..0000000
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSecuredUnsecuredTest.java
+++ /dev/null
@@ -1,93 +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.spi.discovery.tcp;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Tests cases when node connects to cluster with different SSL configuration.
- * Exception with meaningful message should be thrown.
- */
-public class TcpDiscoverySslSecuredUnsecuredTest extends GridCommonAbstractTest {
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
- final IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setClientMode(gridName.contains("client"));
-
- if (gridName.contains("ssl"))
- cfg.setSslContextFactory(GridTestUtils.sslFactory());
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSecuredUnsecuredServerConnection() throws Exception {
- checkConnection("plain-server", "ssl-server");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testUnsecuredSecuredServerConnection() throws Exception {
- checkConnection("ssl-server", "plain-server");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSecuredClientUnsecuredServerConnection() throws Exception {
- checkConnection("plain-server", "ssl-client");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testUnsecuredClientSecuredServerConnection() throws Exception {
- checkConnection("ssl-server", "plain-client");
- }
-
- /**
- * @param name1 First grid name.
- * @param name2 Second grid name.
- * @throws Exception If failed.
- */
- @SuppressWarnings("ThrowableNotThrown")
- private void checkConnection(final String name1, final String name2) throws Exception {
- startGrid(name1);
-
- GridTestUtils.assertThrows(null, new Callable<Object>() {
- @Override public Object call() throws Exception {
- startGrid(name2);
-
- return null;
- }
- }, IgniteCheckedException.class, null);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c9175d4/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
index 98bf6da..5f870a4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
@@ -34,7 +34,6 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpiConfigSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpiFailureTimeoutSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpiSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpiStartStopSelfTest;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySslSecuredUnsecuredTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySslSelfTest;
import org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinderSelfTest;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinderSelfTest;
@@ -87,7 +86,6 @@ public class IgniteSpiDiscoverySelfTestSuite extends TestSuite {
// SSL.
suite.addTest(new TestSuite(TcpDiscoverySslSelfTest.class));
- suite.addTest(new TestSuite(TcpDiscoverySslSecuredUnsecuredTest.class));
return suite;
}
[08/50] [abbrv] ignite git commit: Added put/remove benchmarks.
Posted by yz...@apache.org.
Added put/remove benchmarks.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0726d320
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0726d320
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0726d320
Branch: refs/heads/ignite-comm-balance-master
Commit: 0726d3200a411817dae8c00cc183c49b25bb1f6f
Parents: d20b7f1
Author: sboikov <sb...@gridgain.com>
Authored: Mon Feb 6 14:11:06 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Feb 6 14:11:06 2017 +0300
----------------------------------------------------------------------
.../cache/IgnitePutRemoveBenchmark.java | 42 ++++++++++++++++++++
.../cache/IgnitePutRemoveTxBenchmark.java | 30 ++++++++++++++
2 files changed, 72 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0726d320/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveBenchmark.java
new file mode 100644
index 0000000..7ea3d91
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveBenchmark.java
@@ -0,0 +1,42 @@
+/*
+ * 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.yardstick.cache;
+
+import java.util.Map;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.yardstick.cache.model.SampleValue;
+
+/**
+ * Ignite benchmark that performs put and immediate remove operations.
+ */
+public class IgnitePutRemoveBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ int key = nextRandom(args.range());
+
+ cache.put(key, new SampleValue(key));
+ cache.remove(key);
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("atomic");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0726d320/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveTxBenchmark.java
new file mode 100644
index 0000000..ec88083
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutRemoveTxBenchmark.java
@@ -0,0 +1,30 @@
+/*
+ * 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.yardstick.cache;
+
+import org.apache.ignite.IgniteCache;
+
+/**
+ *
+ */
+public class IgnitePutRemoveTxBenchmark extends IgnitePutRemoveBenchmark {
+ /** {@inheritDoc} */
+ @Override protected IgniteCache<Integer, Object> cache() {
+ return ignite().cache("tx");
+ }
+}
[37/50] [abbrv] ignite git commit: ignite-4492 Add MBean for
StripedExecutor This closes #1491.
Posted by yz...@apache.org.
ignite-4492 Add MBean for StripedExecutor
This closes #1491.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8e12513e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8e12513e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8e12513e
Branch: refs/heads/ignite-comm-balance-master
Commit: 8e12513efb24cc6df1da0968560ac932544ee68d
Parents: c52cb9f
Author: voipp <al...@gmail.com>
Authored: Tue Feb 14 15:08:59 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Feb 14 15:08:59 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 48 +++++-
.../internal/StripedExecutorMXBeanAdapter.java | 90 ++++++++++
.../ignite/internal/util/StripedExecutor.java | 55 +++++-
.../ignite/mxbean/StripedExecutorMXBean.java | 90 ++++++++++
.../internal/util/StripedExecutorTest.java | 168 +++++++++++++++++++
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
6 files changed, 447 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e12513e/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index a3d8c7b..cdbe2e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -168,6 +168,7 @@ import org.apache.ignite.marshaller.MarshallerExclusions;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
import org.apache.ignite.mxbean.IgniteMXBean;
+import org.apache.ignite.mxbean.StripedExecutorMXBean;
import org.apache.ignite.mxbean.ThreadPoolMXBean;
import org.apache.ignite.plugin.IgnitePlugin;
import org.apache.ignite.plugin.PluginNotFoundException;
@@ -296,6 +297,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
@GridToStringExclude
private ObjectName restExecSvcMBean;
+ /** */
+ @GridToStringExclude
+ private ObjectName stripedExecSvcMBean;
+
/** Kernal start timestamp. */
private long startTime = U.currentTimeMillis();
@@ -963,6 +968,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
registerKernalMBean();
registerLocalNodeMBean();
registerExecutorMBeans(execSvc, sysExecSvc, p2pExecSvc, mgmtExecSvc, restExecSvc);
+ registerStripedExecutorMBean(stripedExecSvc);
// Lifecycle bean notifications.
notifyLifecycleBeans(AFTER_NODE_START);
@@ -1541,7 +1547,14 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
}
- /** @throws IgniteCheckedException If registration failed. */
+ /**
+ * @param execSvc
+ * @param sysExecSvc
+ * @param p2pExecSvc
+ * @param mgmtExecSvc
+ * @param restExecSvc
+ * @throws IgniteCheckedException If failed.
+ */
private void registerExecutorMBeans(ExecutorService execSvc,
ExecutorService sysExecSvc,
ExecutorService p2pExecSvc,
@@ -1582,8 +1595,34 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
return res;
}
catch (JMException e) {
- throw new IgniteCheckedException("Failed to register executor service MBean [name=" + name + ", exec=" + exec + ']',
- e);
+ throw new IgniteCheckedException("Failed to register executor service MBean [name=" + name +
+ ", exec=" + exec + ']', e);
+ }
+ }
+
+ /**
+ * @param stripedExecSvc Executor service.
+ * @throws IgniteCheckedException If registration failed.
+ */
+ private void registerStripedExecutorMBean(StripedExecutor stripedExecSvc) throws IgniteCheckedException {
+ if (stripedExecSvc != null) {
+ String name = "StripedExecutor";
+
+ try {
+ stripedExecSvcMBean = U.registerMBean(
+ cfg.getMBeanServer(),
+ cfg.getGridName(),
+ "Thread Pools",
+ name,
+ new StripedExecutorMXBeanAdapter(stripedExecSvc),
+ StripedExecutorMXBean.class);
+
+ if (log.isDebugEnabled())
+ log.debug("Registered executor service MBean: " + stripedExecSvcMBean);
+ } catch (JMException e) {
+ throw new IgniteCheckedException("Failed to register executor service MBean [name="
+ + name + ", exec=" + stripedExecSvc + ']', e);
+ }
}
}
@@ -2046,7 +2085,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
unregisterMBean(p2PExecSvcMBean) &
unregisterMBean(kernalMBean) &
unregisterMBean(locNodeMBean) &
- unregisterMBean(restExecSvcMBean)
+ unregisterMBean(restExecSvcMBean) &
+ unregisterMBean(stripedExecSvcMBean)
))
errOnStop = false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e12513e/modules/core/src/main/java/org/apache/ignite/internal/StripedExecutorMXBeanAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/StripedExecutorMXBeanAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/StripedExecutorMXBeanAdapter.java
new file mode 100644
index 0000000..e6811b7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/StripedExecutorMXBeanAdapter.java
@@ -0,0 +1,90 @@
+/*
+ * 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;
+
+import java.util.concurrent.ExecutorService;
+import org.apache.ignite.internal.util.StripedExecutor;
+import org.apache.ignite.mxbean.StripedExecutorMXBean;
+
+/**
+ * Adapter for {@link StripedExecutorMXBean} which delegates all method calls to the underlying
+ * {@link ExecutorService} instance.
+ */
+public class StripedExecutorMXBeanAdapter implements StripedExecutorMXBean {
+ /** */
+ private final StripedExecutor exec;
+
+ /**
+ * @param exec Executor service
+ */
+ StripedExecutorMXBeanAdapter(StripedExecutor exec) {
+ assert exec != null;
+
+ this.exec = exec;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void checkStarvation() {
+ exec.checkStarvation();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getStripesCount() {
+ return exec.stripes();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isShutdown() {
+ return exec.isShutdown();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isTerminated() {
+ return exec.isTerminated();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getTotalQueueSize() {
+ return exec.queueSize();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalCompletedTasksCount() {
+ return exec.completedTasks();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long[] getStripesCompletedTasksCounts() {
+ return exec.stripesCompletedTasks();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getActiveCount() {
+ return exec.activeStripesCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean[] getStripesActiveStatuses() {
+ return exec.stripesActiveStatuses();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int[] getStripesQueueSizes() {
+ return exec.stripesQueueSizes();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e12513e/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java b/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
index 201cb34..e70f0ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
@@ -55,9 +55,10 @@ public class StripedExecutor implements ExecutorService {
private final IgniteLogger log;
/**
- * Constructor.
- *
* @param cnt Count.
+ * @param gridName Node name.
+ * @param poolName Pool name.
+ * @param log Logger.
*/
public StripedExecutor(int cnt, String gridName, String poolName, final IgniteLogger log) {
A.ensure(cnt > 0, "cnt > 0");
@@ -268,6 +269,56 @@ public class StripedExecutor implements ExecutorService {
}
/**
+ * @return Completed tasks per stripe count.
+ */
+ public long[] stripesCompletedTasks() {
+ long[] res = new long[stripes()];
+
+ for (int i = 0; i < res.length; i++)
+ res[i] = stripes[i].completedCnt;
+
+ return res;
+ }
+
+ /**
+ * @return Number of active tasks per stripe.
+ */
+ public boolean[] stripesActiveStatuses() {
+ boolean[] res = new boolean[stripes()];
+
+ for (int i = 0; i < res.length; i++)
+ res[i] = stripes[i].active;
+
+ return res;
+ }
+
+ /**
+ * @return Number of active tasks.
+ */
+ public int activeStripesCount() {
+ int res = 0;
+
+ for (boolean status : stripesActiveStatuses()) {
+ if (status)
+ res++;
+ }
+
+ return res;
+ }
+
+ /**
+ * @return Size of queue per stripe.
+ */
+ public int[] stripesQueueSizes() {
+ int[] res = new int[stripes()];
+
+ for (int i = 0; i < res.length; i++)
+ res[i] = stripes[i].queueSize();
+
+ return res;
+ }
+
+ /**
* Operation not supported.
*/
@NotNull @Override public <T> Future<T> submit(
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e12513e/modules/core/src/main/java/org/apache/ignite/mxbean/StripedExecutorMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/StripedExecutorMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/StripedExecutorMXBean.java
new file mode 100644
index 0000000..7428b19
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/StripedExecutorMXBean.java
@@ -0,0 +1,90 @@
+/*
+ * 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.mxbean;
+
+/**
+ * MBean that provides access to information about striped executor service.
+ */
+@MXBeanDescription("MBean that provides access to information about striped executor service.")
+public interface StripedExecutorMXBean {
+ /**
+ * Checks for starvation in striped pool, dumps in log information if potential starvation
+ * was found.
+ */
+ @MXBeanDescription("Checks for starvation in striped pool.")
+ public void checkStarvation();
+
+ /**
+ * @return Stripes count.
+ */
+ @MXBeanDescription("Stripes count.")
+ public int getStripesCount();
+
+ /**
+ *
+ * @return {@code True} if this executor has been shut down.
+ */
+ @MXBeanDescription("True if this executor has been shut down.")
+ public boolean isShutdown();
+
+ /**
+ * Note that
+ * {@code isTerminated()} is never {@code true} unless either {@code shutdown()} or
+ * {@code shutdownNow()} was called first.
+ *
+ * @return {@code True} if all tasks have completed following shut down.
+ */
+ @MXBeanDescription("True if all tasks have completed following shut down.")
+ public boolean isTerminated();
+
+ /**
+ * @return Return total queue size of all stripes.
+ */
+ @MXBeanDescription("Total queue size of all stripes.")
+ public int getTotalQueueSize();
+
+ /**
+ * @return Completed tasks count.
+ */
+ @MXBeanDescription("Completed tasks count of all stripes.")
+ public long getTotalCompletedTasksCount();
+
+ /**
+ * @return Number of completed tasks per stripe.
+ */
+ @MXBeanDescription("Number of completed tasks per stripe.")
+ public long[] getStripesCompletedTasksCounts();
+
+ /**
+ * @return Number of active tasks.
+ */
+ @MXBeanDescription("Number of active tasks of all stripes.")
+ public int getActiveCount();
+
+ /**
+ * @return Number of active tasks per stripe.
+ */
+ @MXBeanDescription("Number of active tasks per stripe.")
+ public boolean[] getStripesActiveStatuses();
+
+ /**
+ * @return Size of queue per stripe.
+ */
+ @MXBeanDescription("Size of queue per stripe.")
+ public int[] getStripesQueueSizes();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e12513e/modules/core/src/test/java/org/apache/ignite/internal/util/StripedExecutorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/StripedExecutorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/StripedExecutorTest.java
new file mode 100644
index 0000000..543907f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/StripedExecutorTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.util;
+
+import org.apache.ignite.logger.java.JavaLogger;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class StripedExecutorTest extends GridCommonAbstractTest {
+ /** */
+ private StripedExecutor stripedExecSvc;
+
+ /** {@inheritDoc} */
+ @Override public void beforeTest() {
+ stripedExecSvc = new StripedExecutor(3, "foo name", "pool name", new JavaLogger());
+ }
+
+ /** {@inheritDoc} */
+ @Override public void afterTest() {
+ stripedExecSvc.shutdown();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCompletedTasks() throws Exception {
+ stripedExecSvc.execute(0, new TestRunnable());
+ stripedExecSvc.execute(1, new TestRunnable());
+
+ sleepASec();
+
+ assertEquals(2, stripedExecSvc.completedTasks());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStripesCompletedTasks() throws Exception {
+ stripedExecSvc.execute(0, new TestRunnable());
+ stripedExecSvc.execute(1, new TestRunnable());
+
+ sleepASec();
+
+ long[] completedTaks = stripedExecSvc.stripesCompletedTasks();
+
+ assertEquals(1, completedTaks[0]);
+ assertEquals(1, completedTaks[1]);
+ assertEquals(0, completedTaks[2]);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStripesActiveStatuses() throws Exception {
+ stripedExecSvc.execute(0, new TestRunnable());
+ stripedExecSvc.execute(1, new TestRunnable(true));
+
+ sleepASec();
+
+ boolean[] statuses = stripedExecSvc.stripesActiveStatuses();
+
+ assertFalse(statuses[0]);
+ assertTrue(statuses[1]);
+ assertFalse(statuses[0]);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActiveStripesCount() throws Exception {
+ stripedExecSvc.execute(0, new TestRunnable());
+ stripedExecSvc.execute(1, new TestRunnable(true));
+
+ sleepASec();
+
+ assertEquals(1, stripedExecSvc.activeStripesCount());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStripesQueueSizes() throws Exception {
+ stripedExecSvc.execute(0, new TestRunnable());
+ stripedExecSvc.execute(0, new TestRunnable(true));
+ stripedExecSvc.execute(0, new TestRunnable(true));
+ stripedExecSvc.execute(1, new TestRunnable(true));
+ stripedExecSvc.execute(1, new TestRunnable(true));
+ stripedExecSvc.execute(1, new TestRunnable(true));
+
+ sleepASec();
+
+ int[] queueSizes = stripedExecSvc.stripesQueueSizes();
+
+ assertEquals(1, queueSizes[0]);
+ assertEquals(2, queueSizes[1]);
+ assertEquals(0, queueSizes[2]);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testQueueSize() throws Exception {
+ stripedExecSvc.execute(1, new TestRunnable());
+ stripedExecSvc.execute(1, new TestRunnable(true));
+ stripedExecSvc.execute(1, new TestRunnable(true));
+
+ sleepASec();
+
+ assertEquals(1, stripedExecSvc.queueSize());
+ }
+
+ /**
+ *
+ */
+ private final class TestRunnable implements Runnable {
+ /** */
+ private final boolean infinitely;
+
+ /**
+ *
+ */
+ public TestRunnable() {
+ this(false);
+ }
+
+ /**
+ * @param infinitely {@code True} if should sleep infinitely.
+ */
+ public TestRunnable(boolean infinitely) {
+ this.infinitely = infinitely;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ try {
+ while (infinitely)
+ sleepASec();
+ }
+ catch (InterruptedException e) {
+ info("Got interrupted exception while sleeping: " + e);
+ }
+ }
+ }
+
+ /**
+ * @throws InterruptedException If interrupted.
+ */
+ private void sleepASec() throws InterruptedException {
+ Thread.sleep(1000);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8e12513e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
index 8a501fd..9a80b10 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
@@ -72,6 +72,7 @@ import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManagerSelfT
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointTaskSelfTest;
import org.apache.ignite.internal.managers.communication.GridCommunicationManagerListenersSelfTest;
import org.apache.ignite.internal.processors.compute.PublicThreadpoolStarvationTest;
+import org.apache.ignite.internal.util.StripedExecutorTest;
import org.apache.ignite.p2p.GridMultinodeRedeployContinuousModeSelfTest;
import org.apache.ignite.p2p.GridMultinodeRedeployIsolatedModeSelfTest;
import org.apache.ignite.p2p.GridMultinodeRedeployPrivateModeSelfTest;
@@ -152,6 +153,7 @@ public class IgniteComputeGridTestSuite {
suite.addTestSuite(TaskNodeRestartTest.class);
suite.addTestSuite(IgniteRoundRobinErrorAfterClientReconnectTest.class);
suite.addTestSuite(PublicThreadpoolStarvationTest.class);
+ suite.addTestSuite(StripedExecutorTest.class);
return suite;
}
[33/50] [abbrv] ignite git commit: IGNITE-4159: Kubernetes IP finder.
Posted by yz...@apache.org.
IGNITE-4159: Kubernetes IP finder.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/37c0a220
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/37c0a220
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/37c0a220
Branch: refs/heads/ignite-comm-balance-master
Commit: 37c0a220284527a38b181561865e8a57cfb1549b
Parents: 3ef7a0e
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Feb 13 17:33:32 2017 -0800
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Feb 13 17:33:32 2017 -0800
----------------------------------------------------------------------
modules/kubernetes/DEVNOTES.txt | 63 ++++
modules/kubernetes/README.txt | 33 ++
modules/kubernetes/config/Dockerfile | 45 +++
modules/kubernetes/config/example-kube.xml | 44 +++
.../kubernetes/config/ignite-deployment.yaml | 26 ++
modules/kubernetes/config/ignite-service.yaml | 14 +
modules/kubernetes/config/run.sh | 50 +++
modules/kubernetes/licenses/apache-2.0.txt | 202 ++++++++++++
modules/kubernetes/pom.xml | 93 ++++++
.../TcpDiscoveryKubernetesIpFinder.java | 315 +++++++++++++++++++
.../tcp/ipfinder/kubernetes/package-info.java | 22 ++
.../TcpDiscoveryKubernetesIpFinderSelfTest.java | 93 ++++++
.../tcp/ipfinder/kubernetes/package-info.java | 22 ++
.../testsuites/IgniteKubernetesTestSuite.java | 41 +++
pom.xml | 1 +
15 files changed, 1064 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/kubernetes/DEVNOTES.txt b/modules/kubernetes/DEVNOTES.txt
new file mode 100644
index 0000000..b2a8173
--- /dev/null
+++ b/modules/kubernetes/DEVNOTES.txt
@@ -0,0 +1,63 @@
+Building and testing Kubernetes module
+=========================================
+
+The instructions provide a guidance on how to build and test Ignite Kubernetes IP finder in Kubernetes environment.
+
+To test the IP finder you have to build the whole Apache Ignite project, package the binary as a Docker image and
+feed the image to your kubernetes environment.
+
+Building Apache Ignite
+=========================
+
+Use the command below to assemble an Apache Ignite binary:
+ mvn clean package -Prelease -Dignite.edition=fabric-lgpl -DskipTests
+
+Note, if you alter the build instruction somehow make sure to update the files under 'config' folder if needed.
+
+Installing Docker and Minikube
+==============================
+
+Install Docker and Minikube for testing purpose in your development environment.
+
+Once this is done, make sure that Minikube sees Docker images registered locally:
+ eval $(minikube docker-env)
+
+Start Minikube:
+ minikube start --vm-driver=xhyve
+
+Assembling Apache Ignite Docker Image
+=====================================
+
+Create a folder for all the files to be placed in the Docker image and copy the following there:
+ - Apache Ignite binary in a zip form built at the step above.
+ - Dockerfile from `ignite-kubernetes/config/Dockerfile`.
+ - Ignite configuration with enabled Kubernetes IP finder from `ignite-kubernetes/config/example-kube.xml`.
+ - The executable file that will start an Ignite node process from `ignite-kubernetes/config/run.sh`
+
+Go to the folder and execute a command below to prepare the image:
+ docker build -t ignite-kube:v1 .
+
+Creating containerized Ignite pods and Ignite lookup service
+============================================================
+
+Start the Kubernetes service that is used for IP addresses lookup. Use `ignite-kubernetes/config/ignite-service.yaml`:
+ kubectl create -f {path_to}/ignite-service.yaml
+
+Create and deploy Ignite pods using `ignite-kubernetes/config/ignite-deployment.yaml` configuration:
+ kubectl create -f {path_to}/ignite-deployment.yaml
+
+Make sure that the pods were deployed and running properly:
+ kubectl get pod
+ kubectl logs {pod name}
+
+Increase or decrease number of Ignite pods checking that Kubernetes IP finder works as expected:
+ kubectl scale --replicas=4 -f {path_to}/ignite-deployment.yaml
+
+Docker Image Redeployment
+=========================
+
+If you need to redeploy the docker image after it gets updated and you prefer not to change the image version then
+delete a current Kubernetes Ignite deployment (don't delete the service):
+ kubectl delete deployment ignite-cluster
+
+After that you are free to build and deploy an updated docker image using the same commands as listed above.
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/README.txt
----------------------------------------------------------------------
diff --git a/modules/kubernetes/README.txt b/modules/kubernetes/README.txt
new file mode 100644
index 0000000..a9a5a09
--- /dev/null
+++ b/modules/kubernetes/README.txt
@@ -0,0 +1,33 @@
+Apache Ignite Kubernetes Module
+------------------------
+
+Apache Ignite Kubernetes module provides a TCP Discovery IP Finder that uses a dedicated Kubernetes service
+for IP addresses lookup of Apache Ignite pods containerized by Kubernetes.
+
+To enable Kubernetes module when starting a standalone node, move 'optional/ignite-kubernetes' folder to
+'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
+be added to classpath in this case.
+
+Importing Kubernetes Module In Maven Project
+-------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add Kubernetes module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ ...
+ <dependencies>
+ ...
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-kubernetes</artifactId>
+ <version>${ignite.version}</version>
+ </dependency>
+ ...
+ </dependencies>
+ ...
+</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/config/Dockerfile
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/Dockerfile b/modules/kubernetes/config/Dockerfile
new file mode 100644
index 0000000..4e08ce8
--- /dev/null
+++ b/modules/kubernetes/config/Dockerfile
@@ -0,0 +1,45 @@
+# Use Java 8 image as default one.
+FROM java:8
+
+# Set Apache Ignite version.
+ENV IGNITE_VERSION 2.0.0-SNAPSHOT
+
+# Set IGNITE_HOME variable.
+ENV IGNITE_HOME /opt/ignite/apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin
+
+# Setting a path to an Apache Ignite configuration file. Used by run.sh script below.
+ENV CONFIG_URI ${IGNITE_HOME}/config/example-kube.xml
+
+# Make sure kubernetes lib is copied to 'libs' folder.
+ENV OPTION_LIBS ignite-kubernetes
+
+# Disabling quiet mode.
+ENV IGNITE_QUIET=false
+
+# Install or update needed tools.
+RUN apt-get update && apt-get install -y --no-install-recommends unzip
+
+# Creating and setting a working directory for following commands.
+WORKDIR /opt/ignite
+
+# Copying local Apache Ignite build to the docker image.
+COPY ./apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin.zip apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin.zip
+
+# Unpacking the build.
+RUN unzip apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin.zip
+RUN rm apache-ignite-fabric-lgpl-${IGNITE_VERSION}-bin.zip
+
+# Copying the executable file and setting permissions.
+COPY ./run.sh $IGNITE_HOME/
+RUN chmod +x $IGNITE_HOME/run.sh
+
+# Copying the configuration.
+COPY ./example-kube.xml $IGNITE_HOME/config
+
+# Starting an Apache Ignite node.
+CMD $IGNITE_HOME/run.sh
+
+# Exposing the ports.
+EXPOSE 11211 47100 47500 49112
+
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/config/example-kube.xml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/example-kube.xml b/modules/kubernetes/config/example-kube.xml
new file mode 100644
index 0000000..bc04463
--- /dev/null
+++ b/modules/kubernetes/config/example-kube.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ Configuration example with Kubernetes IP finder enabled.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+
+ <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <!--
+ Enables Kubernetes IP finder with default settings.
+ -->
+ <bean
+ class="org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder"/>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/config/ignite-deployment.yaml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/ignite-deployment.yaml b/modules/kubernetes/config/ignite-deployment.yaml
new file mode 100644
index 0000000..ed5c102
--- /dev/null
+++ b/modules/kubernetes/config/ignite-deployment.yaml
@@ -0,0 +1,26 @@
+# An example of a Kubernetes configuration for Ignite pods deployment.
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+ # Custom Ignite cluster's name.
+ name: ignite-cluster
+spec:
+ # Number of nodes to be started by Kubernetes initially.
+ replicas: 2
+ template:
+ metadata:
+ labels:
+ # Must be equal to Ignite's Kubernetes service name.
+ app: ignite
+ spec:
+ containers:
+ # Custom Ignite node's pod name.
+ - name: ignite-node
+ # Custom Ignite Docker image name.
+ image: ignite-kube:v1
+ ports:
+ # Ports to open.
+ - containerPort: 11211 # REST port number.
+ - containerPort: 47100 # communication SPI port number.
+ - containerPort: 47500 # discovery SPI port number.
+ - containerPort: 49112 # JMX port number.
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/config/ignite-service.yaml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/ignite-service.yaml b/modules/kubernetes/config/ignite-service.yaml
new file mode 100644
index 0000000..07b7516
--- /dev/null
+++ b/modules/kubernetes/config/ignite-service.yaml
@@ -0,0 +1,14 @@
+# An example of a Kubernetes configuration for Ignite lookup service deployment.
+apiVersion: v1
+kind: Service
+metadata:
+ # Name of Ignite Service used by Kubernetes IP finder for IP addresses lookup.
+ # The name must be equal to TcpDiscoveryKubernetesIpFinder.setServiceName parameter.
+ name: ignite
+spec:
+ clusterIP: None
+ ports:
+ - port: 9042 # some custom port (optional).
+ selector:
+ # Must be equal to the label set for Ignite pods.
+ app: ignite
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/config/run.sh
----------------------------------------------------------------------
diff --git a/modules/kubernetes/config/run.sh b/modules/kubernetes/config/run.sh
new file mode 100644
index 0000000..dbf2871
--- /dev/null
+++ b/modules/kubernetes/config/run.sh
@@ -0,0 +1,50 @@
+#!/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 "$OPTION_LIBS" ]; then
+ IFS=, LIBS_LIST=("$OPTION_LIBS")
+
+ for lib in ${LIBS_LIST[@]}; do
+ cp -r $IGNITE_HOME/libs/optional/"$lib"/* \
+ $IGNITE_HOME/libs/
+ done
+fi
+
+if [ ! -z "$EXTERNAL_LIBS" ]; then
+ IFS=, LIBS_LIST=("$EXTERNAL_LIBS")
+
+ for lib in ${LIBS_LIST[@]}; do
+ echo $lib >> temp
+ done
+
+ wget -i temp -P $IGNITE_HOME/libs
+
+ rm temp
+fi
+
+QUIET=""
+
+if [ "$IGNITE_QUIET" = "false" ]; then
+ QUIET="-v"
+fi
+
+if [ -z $CONFIG_URI ]; then
+ $IGNITE_HOME/bin/ignite.sh $QUIET
+else
+ $IGNITE_HOME/bin/ignite.sh $QUIET $CONFIG_URI
+fi
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/kubernetes/licenses/apache-2.0.txt b/modules/kubernetes/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/kubernetes/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/pom.xml
----------------------------------------------------------------------
diff --git a/modules/kubernetes/pom.xml b/modules/kubernetes/pom.xml
new file mode 100644
index 0000000..5d4e5f0
--- /dev/null
+++ b/modules/kubernetes/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!--
+ POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-parent</artifactId>
+ <version>1</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
+ <artifactId>ignite-kubernetes</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <url>http://ignite.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
new file mode 100644
index 0000000..a5bd24f
--- /dev/null
+++ b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinder.java
@@ -0,0 +1,315 @@
+/*
+ * 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.spi.discovery.tcp.ipfinder.kubernetes;
+
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.SecureRandom;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.ObjectMapper;
+
+/**
+ * IP finder for automatic lookup of Ignite nodes running in Kubernetes environment. All Ignite nodes have to deployed
+ * as Kubernetes pods in order to be discovered. An application that uses Ignite client nodes as a gateway to the
+ * cluster is required to be containerized as well. Applications and Ignite nodes running outside of Kubernetes will
+ * not be able to reach the containerized counterparts.
+ * <p>
+ * The implementation is based on a dedicated Kubernetes service that has to be created and should be deployed prior
+ * Ignite nodes startup. The service will maintain a list of all endpoints (internal IP addresses) of all containerized
+ * Ignite pods running so far. The name of the service must be equal to {@link #setServiceName(String)} which is
+ * `ignite` by default.
+ * <p>
+ * As for Ignite pods, it's recommended to label them in such a way that the service will use the label in its selector
+ * configuration excluding endpoints of irrelevant Kubernetes pods running in parallel.
+ * <p>
+ * The IP finder, in its turn, will call this service to retrieve Ignite pods IP addresses. The port will be
+ * either the one that is set with {@link TcpDiscoverySpi#setLocalPort(int)} or {@link TcpDiscoverySpi#DFLT_PORT}.
+ * Make sure that all Ignite pods occupy a similar discovery port, otherwise they will not be able to discover each
+ * other using this IP finder.
+ * <h2 class="header">Optional configuration</h2>
+ * <ul>
+ * <li>The Kubernetes service name for IP addresses lookup (see {@link #setServiceName(String)})</li>
+ * <li>The Kubernetes service namespace for IP addresses lookup (see {@link #setNamespace(String)}</li>
+ * <li>The host name of the Kubernetes API server (see {@link #setMasterUrl(String)})</li>
+ * <li>Path to the service token (see {@link #setAccountToken(String)}</li>
+ * </ul>
+ * <p>
+ * Both {@link #registerAddresses(Collection)} and {@link #unregisterAddresses(Collection)} have no effect.
+ * <p>
+ * Note, this IP finder is only workable when it used in Kubernetes environment.
+ * Choose another implementation of {@link org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} for local
+ * or home network tests.
+ */
+public class TcpDiscoveryKubernetesIpFinder extends TcpDiscoveryIpFinderAdapter {
+ /** Grid logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** Init routine guard. */
+ private final AtomicBoolean initGuard = new AtomicBoolean();
+
+ /** Init routine latch. */
+ private final CountDownLatch initLatch = new CountDownLatch(1);
+
+ /** Trust manager. */
+ private TrustManager[] trustAll = new TrustManager[] {
+ new X509TrustManager() {
+ public void checkServerTrusted(X509Certificate[] certs, String authType) {}
+ public void checkClientTrusted(X509Certificate[] certs, String authType) {}
+ public X509Certificate[] getAcceptedIssuers() { return null; }
+ }
+ };
+
+ /** Host verifier. */
+ private HostnameVerifier trustAllHosts = new HostnameVerifier() {
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ };
+
+ /** Ignite's Kubernetes Service name. */
+ private String serviceName = "ignite";
+
+ /** Ignite Pod setNamespace name. */
+ private String namespace = "default";
+
+ /** Kubernetes API server URL in a string form. */
+ private String master = "https://kubernetes.default.svc.cluster.local:443";
+
+ /** Account token location. */
+ private String accountToken = "/var/run/secrets/kubernetes.io/serviceaccount/token";
+
+ /** Kubernetes API server URL. */
+ private URL url;
+
+ /** SSL context */
+ private SSLContext ctx;
+
+ /**
+ * Creates an instance of Kubernetes IP finder.
+ */
+ public TcpDiscoveryKubernetesIpFinder() {
+ setShared(true);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<InetSocketAddress> getRegisteredAddresses() throws IgniteSpiException {
+ init();
+
+ Collection<InetSocketAddress> addrs = new ArrayList<>();
+
+ try {
+ System.out.println("Getting Apache Ignite endpoints from: " + url);
+
+ HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
+
+ conn.setHostnameVerifier(trustAllHosts);
+
+ conn.setSSLSocketFactory(ctx.getSocketFactory());
+ conn.addRequestProperty("Authorization", "Bearer " + serviceAccountToken(accountToken));
+
+ // Sending the request and processing a response.
+ ObjectMapper mapper = new ObjectMapper();
+
+ Endpoints endpoints = mapper.readValue(conn.getInputStream(), Endpoints.class);
+
+ if (endpoints != null) {
+ if (endpoints.subsets != null && !endpoints.subsets.isEmpty()) {
+ for (Subset subset : endpoints.subsets) {
+
+ if (subset.addresses != null && !subset.addresses.isEmpty()) {
+ for (Address address : subset.addresses) {
+ addrs.add(new InetSocketAddress(address.ip, 0));
+
+ System.out.println("Added an address to the list: " + address.ip);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new IgniteSpiException("Failed to retrieve Ignite pods IP addresses.", e);
+ }
+
+ return addrs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void registerAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException {
+ // No-op
+ }
+
+ /** {@inheritDoc} */
+ @Override public void unregisterAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException {
+ // No-op
+ }
+
+ /**
+ * Sets the name of Kubernetes service for Ignite pods' IP addresses lookup. The name of the service must be equal
+ * to the name set in service's Kubernetes configuration. If this parameter is not changed then the name of the
+ * service has to be set to 'ignite' in the corresponding Kubernetes configuration.
+ *
+ * @param service Kubernetes service name for IP addresses lookup. If it's not set then 'ignite' is used by default.
+ */
+ public void setServiceName(String service) {
+ this.serviceName = service;
+ }
+
+ /**
+ * Sets the namespace the Kubernetes service belongs to. By default, it's supposed that the service is running under
+ * Kubernetes `default` namespace.
+ *
+ * @param namespace The Kubernetes service namespace for IP addresses lookup.
+ */
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ /**
+ * Sets the host name of the Kubernetes API server. By default the following host name is used:
+ * 'https://kubernetes.default.svc.cluster.local:443'.
+ *
+ * @param master The host name of the Kubernetes API server.
+ */
+ public void setMasterUrl(String master) {
+ this.master = master;
+ }
+
+ /**
+ * Specifies the path to the service token file. By default the following account token is used:
+ * '/var/run/secrets/kubernetes.io/serviceaccount/token'.
+ *
+ * @param accountToken The path to the service token file.
+ */
+ public void setAccountToken(String accountToken) {
+ this.accountToken = accountToken;
+ }
+
+ /**
+ * Kubernetes IP finder initialization.
+ *
+ * @throws IgniteSpiException In case of error.
+ */
+ private void init() throws IgniteSpiException {
+ if (initGuard.compareAndSet(false, true)) {
+
+ if (serviceName == null || serviceName.isEmpty() ||
+ namespace == null || namespace.isEmpty() ||
+ master == null || master.isEmpty() ||
+ accountToken == null || accountToken.isEmpty()) {
+ throw new IgniteSpiException(
+ "One or more configuration parameters are invalid [setServiceName=" +
+ serviceName + ", setNamespace=" + namespace + ", setMasterUrl=" +
+ master + ", setAccountToken=" + accountToken + "]");
+ }
+
+ try {
+ // Preparing the URL and SSL context to be used for connection purposes.
+ String path = String.format("/api/v1/namespaces/%s/endpoints/%s", namespace, serviceName);
+
+ url = new URL(master + path);
+
+ ctx = SSLContext.getInstance("SSL");
+
+ ctx.init(null, trustAll, new SecureRandom());
+ }
+ catch (Exception e) {
+ throw new IgniteSpiException("Failed to connect to Ignite's Kubernetes Service.", e);
+ }
+ finally {
+ initLatch.countDown();
+ }
+ }
+ else {
+ try {
+ U.await(initLatch);
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ throw new IgniteSpiException("Thread has been interrupted.", e);
+ }
+
+ if (url == null || ctx == null)
+ throw new IgniteSpiException("IP finder has not been initialized properly.");
+ }
+ }
+
+ /**
+ * Reads content of the service account token file.
+ *
+ * @param file The path to the service account token.
+ * @return Service account token.
+ */
+ private String serviceAccountToken(String file) {
+ try {
+ return new String(Files.readAllBytes(Paths.get(file)));
+ } catch (IOException e) {
+ throw new IgniteSpiException("Failed to load services account token [setAccountToken= " + file + "]", e);
+ }
+ }
+
+ /**
+ * Object used by Jackson for processing of Kubernetes lookup service's response.
+ */
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ private static class Address {
+ /** */
+ public String ip;
+ }
+
+ /**
+ * Object used by Jackson for processing of Kubernetes lookup service's response.
+ */
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ private static class Subset {
+ /** */
+ public List<Address> addresses;
+ }
+
+ /**
+ * Object used by Jackson for processing of Kubernetes lookup service's response.
+ */
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ private static class Endpoints {
+ /** */
+ public List<Subset> subsets;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
new file mode 100644
index 0000000..a572cb2
--- /dev/null
+++ b/modules/kubernetes/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains Kubernetes IP finder implementation.
+ */
+package org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinderSelfTest.java b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinderSelfTest.java
new file mode 100644
index 0000000..fd3e2a3
--- /dev/null
+++ b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/TcpDiscoveryKubernetesIpFinderSelfTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.spi.discovery.tcp.ipfinder.kubernetes;
+
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAbstractSelfTest;
+
+/**
+ * TcpDiscoveryKubernetesIpFinder test.
+ */
+public class TcpDiscoveryKubernetesIpFinderSelfTest extends
+ TcpDiscoveryIpFinderAbstractSelfTest<TcpDiscoveryKubernetesIpFinder> {
+ /**
+ * Constructor.
+ *
+ * @throws Exception If any error occurs.
+ */
+ public TcpDiscoveryKubernetesIpFinderSelfTest() throws Exception {
+ // No-op.
+ }
+
+ @Override protected void beforeTest() throws Exception {
+ // No-op.
+ }
+
+ /* {@inheritDoc} */
+ @Override protected TcpDiscoveryKubernetesIpFinder ipFinder() throws Exception {
+ // No-op.
+ return null;
+ }
+
+ /* {@inheritDoc} */
+ @Override public void testIpFinder() throws Exception {
+ TcpDiscoveryKubernetesIpFinder ipFinder = new TcpDiscoveryKubernetesIpFinder();
+
+ ipFinder.setAccountToken(null);
+
+ try {
+ ipFinder.getRegisteredAddresses();
+ }
+ catch (IgniteSpiException e) {
+ assertTrue(e.getMessage().startsWith("One or more configuration parameters are invalid"));
+ }
+
+ ipFinder = new TcpDiscoveryKubernetesIpFinder();
+
+ ipFinder.setMasterUrl(null);
+
+ try {
+ ipFinder.getRegisteredAddresses();
+ }
+ catch (IgniteSpiException e) {
+ assertTrue(e.getMessage().startsWith("One or more configuration parameters are invalid"));
+ }
+
+ ipFinder = new TcpDiscoveryKubernetesIpFinder();
+
+ ipFinder.setNamespace(null);
+
+ try {
+ ipFinder.getRegisteredAddresses();
+ }
+ catch (IgniteSpiException e) {
+ assertTrue(e.getMessage().startsWith("One or more configuration parameters are invalid"));
+ }
+
+ ipFinder = new TcpDiscoveryKubernetesIpFinder();
+
+ ipFinder.setServiceName("");
+
+ try {
+ ipFinder.getRegisteredAddresses();
+ }
+ catch (IgniteSpiException e) {
+ assertTrue(e.getMessage().startsWith("One or more configuration parameters are invalid"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
new file mode 100644
index 0000000..83ab56f
--- /dev/null
+++ b/modules/kubernetes/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/kubernetes/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains Kubernetes IP finder internal tests.
+ */
+package org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/modules/kubernetes/src/test/java/org/apache/ignite/testsuites/IgniteKubernetesTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/kubernetes/src/test/java/org/apache/ignite/testsuites/IgniteKubernetesTestSuite.java b/modules/kubernetes/src/test/java/org/apache/ignite/testsuites/IgniteKubernetesTestSuite.java
new file mode 100644
index 0000000..540657e
--- /dev/null
+++ b/modules/kubernetes/src/test/java/org/apache/ignite/testsuites/IgniteKubernetesTestSuite.java
@@ -0,0 +1,41 @@
+/*
+ * 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.testsuites;
+
+
+import junit.framework.TestSuite;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinderSelfTest;
+import org.apache.ignite.testframework.IgniteTestSuite;
+
+/**
+ * Ignite Kubernetes integration test.
+ */
+public class IgniteKubernetesTestSuite extends TestSuite {
+ /**
+ * @return Test suite.
+ * @throws Exception Thrown in case of the failure.
+ */
+ public static TestSuite suite() throws Exception {
+ TestSuite suite = new IgniteTestSuite("Kubernetes Integration Test Suite");
+
+ // Cloud Nodes IP finder.
+ suite.addTestSuite(TcpDiscoveryKubernetesIpFinderSelfTest.class);
+
+ return suite;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/37c0a220/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ea76053..238361b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,6 +88,7 @@
<module>modules/web/ignite-websphere-test</module>
<module>modules/cassandra</module>
<module>modules/flink</module>
+ <module>modules/kubernetes</module>
</modules>
<profiles>
[36/50] [abbrv] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite
Posted by yz...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c52cb9f1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c52cb9f1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c52cb9f1
Branch: refs/heads/ignite-comm-balance-master
Commit: c52cb9f1fa32d7339f24310bbb37733e94ef85ce
Parents: b9bf77c 0bdcfb0
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Feb 13 22:03:58 2017 -0800
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Feb 13 22:03:58 2017 -0800
----------------------------------------------------------------------
modules/web-console/frontend/package.json | 182 ++++++++++++-------------
1 file changed, 91 insertions(+), 91 deletions(-)
----------------------------------------------------------------------
[15/50] [abbrv] ignite git commit: IGNITE-4631: Added check to ensure
QueryEntity 'keyFields' is subset of 'fields'. This closes #1484.
Posted by yz...@apache.org.
IGNITE-4631: Added check to ensure QueryEntity 'keyFields' is subset of 'fields'. This closes #1484.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/46ff66ef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/46ff66ef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/46ff66ef
Branch: refs/heads/ignite-comm-balance-master
Commit: 46ff66efda93fa91a44d44ae68e7ade9add1c697
Parents: bb1ac0a
Author: Sergey Kalashnikov <sk...@gridgain.com>
Authored: Wed Feb 8 17:11:30 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Feb 8 17:11:30 2017 +0300
----------------------------------------------------------------------
.../processors/query/GridQueryProcessor.java | 9 ++
.../cache/QueryEntityCaseMismatchTest.java | 107 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 2 +
3 files changed, 118 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/46ff66ef/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index a239ee2..fd06828 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1530,6 +1530,15 @@ public class GridQueryProcessor extends GridProcessorAdapter {
boolean isKeyClsSqlType = isSqlType(d.keyClass());
+ if (hasKeyFields && !isKeyClsSqlType) {
+ //ensure that 'keyFields' is case sensitive subset of 'fields'
+ for (String keyField : keyFields) {
+ if (!qryEntity.getFields().containsKey(keyField))
+ throw new IgniteCheckedException("QueryEntity 'keyFields' property must be a subset of keys " +
+ "from 'fields' property (case sensitive): " + keyField);
+ }
+ }
+
for (Map.Entry<String, String> entry : qryEntity.getFields().entrySet()) {
Boolean isKeyField;
http://git-wip-us.apache.org/repos/asf/ignite/blob/46ff66ef/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
new file mode 100644
index 0000000..4f8cfee
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
@@ -0,0 +1,107 @@
+/*
+ * 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.cache;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.concurrent.Callable;
+
+/**
+ * Test reveals issue of null values in SQL query resultset columns that correspond to compound key.
+ * That happens when QueryEntity.keyFields has wrong register compared to QueryEntity.fields.
+ * Issue only manifests for BinaryMarshaller case. Otherwise the keyFields aren't taken into account.
+ */
+public class QueryEntityCaseMismatchTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setLocalHost("127.0.0.1");
+
+ cfg.setPeerClassLoadingEnabled(true);
+
+ TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+ ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ CacheConfiguration<Object, Integer> ccfg = new CacheConfiguration<>("");
+
+ cfg.setMarshaller(new BinaryMarshaller());
+
+ QueryEntity queryEntity = new QueryEntity("KeyType", Integer.class.getName());
+
+ LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+
+ fields.put("a", "TypeA");
+ fields.put("b", "TypeB");
+
+ queryEntity.setFields(fields);
+
+ //Specify key fields in upper register
+ HashSet<String> keyFields = new HashSet<>();
+
+ keyFields.add("a");
+ keyFields.add("B");
+
+ queryEntity.setKeyFields(keyFields);
+
+ ccfg.setQueryEntities(F.asList(queryEntity));
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /**
+ * The cache must not initialize if QueryEntity.keyFields isn't subset of QueryEntity.fields
+ *
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testCacheInitializationFailure() throws Exception {
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ startGrid(1);
+
+ return null;
+ }
+ }, IgniteCheckedException.class, null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/46ff66ef/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index d85e111..386b8fd 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -68,6 +68,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheQueryIndexSelfTest
import org.apache.ignite.internal.processors.cache.IgniteCacheQueryLoadSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCrossCachesJoinsQueryTest;
+import org.apache.ignite.internal.processors.cache.QueryEntityCaseMismatchTest;
import org.apache.ignite.internal.processors.cache.SqlFieldsQuerySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheAtomicFieldsQuerySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheAtomicNearEnabledFieldsQuerySelfTest;
@@ -242,6 +243,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(CacheSqlQueryValueCopySelfTest.class);
suite.addTestSuite(IgniteCacheQueryCacheDestroySelfTest.class);
suite.addTestSuite(IgniteSqlEntryCacheModeAgnosticTest.class);
+ suite.addTestSuite(QueryEntityCaseMismatchTest.class);
return suite;
}
[43/50] [abbrv] ignite git commit: ignite-3727 Support local
listeners async execution for IgniteMessage.send
Posted by yz...@apache.org.
ignite-3727 Support local listeners async execution for IgniteMessage.send
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e8f8e0ac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e8f8e0ac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e8f8e0ac
Branch: refs/heads/ignite-comm-balance-master
Commit: e8f8e0acf254133dd978d72adb73c5362752f706
Parents: 2cfd55d
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Wed Feb 15 13:51:33 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Feb 15 13:52:22 2017 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteMessaging.java | 11 +-
.../ignite/internal/IgniteMessagingImpl.java | 6 +-
.../internal/managers/GridManagerAdapter.java | 2 +-
.../managers/communication/GridIoManager.java | 55 +-
.../communication/GridIoManagerSelfTest.java | 6 +-
...niteMessagingConfigVariationFullApiTest.java | 195 +++++--
.../ignite/messaging/GridMessagingSelfTest.java | 114 +++-
.../messaging/IgniteMessagingSendAsyncTest.java | 544 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
.../hadoop/shuffle/HadoopShuffle.java | 2 +-
10 files changed, 865 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java b/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
index ab554af..e64ded5 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteMessaging.java
@@ -77,6 +77,10 @@ public interface IgniteMessaging extends IgniteAsyncSupport {
/**
* Sends given message with specified topic to the nodes in the underlying cluster group.
+ * <p>
+ * By default all local listeners will be executed in the calling thread, or if you use
+ * {@link #withAsync()}, listeners will execute in public thread pool (in this case it is user's
+ * responsibility to implement back-pressure and limit number of concurrently executed async messages).
*
* @param topic Topic to send to, {@code null} for default topic.
* @param msg Message to send.
@@ -87,6 +91,10 @@ public interface IgniteMessaging extends IgniteAsyncSupport {
/**
* Sends given messages with the specified topic to the nodes in the underlying cluster group.
+ * <p>
+ * By default all local listeners will be executed in the calling thread, or if you use
+ * {@link #withAsync()}, listeners will execute in public thread pool (in this case it is user's
+ * responsibility to implement back-pressure and limit number of concurrently executed async messages).
*
* @param topic Topic to send to, {@code null} for default topic.
* @param msgs Messages to send. Order of the sending is undefined. If the method produces
@@ -99,7 +107,8 @@ public interface IgniteMessaging extends IgniteAsyncSupport {
/**
* Sends given message with specified topic to the nodes in the underlying cluster group. Messages sent with
* this method will arrive in the same order they were sent. Note that if a topic is used
- * for ordered messages, then it cannot be reused for non-ordered messages.
+ * for ordered messages, then it cannot be reused for non-ordered messages. Note that local listeners
+ * are always executed in public thread pool, no matter default or {@link #withAsync()} mode is used.
* <p>
* The {@code timeout} parameter specifies how long an out-of-order message will stay in a queue,
* waiting for messages that are ordered ahead of it to arrive. If timeout expires, then all ordered
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java
index 2800777..541fad4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteMessagingImpl.java
@@ -86,7 +86,7 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
if (snapshot.isEmpty())
throw U.emptyTopologyException();
- ctx.io().sendUserMessage(snapshot, msg, topic, false, 0);
+ ctx.io().sendUserMessage(snapshot, msg, topic, false, 0, isAsync());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -111,7 +111,7 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
for (Object msg : msgs) {
A.notNull(msg, "msg");
- ctx.io().sendUserMessage(snapshot, msg, topic, false, 0);
+ ctx.io().sendUserMessage(snapshot, msg, topic, false, 0, isAsync());
}
}
catch (IgniteCheckedException e) {
@@ -137,7 +137,7 @@ public class IgniteMessagingImpl extends AsyncSupportAdapter<IgniteMessaging>
if (timeout == 0)
timeout = ctx.config().getNetworkTimeout();
- ctx.io().sendUserMessage(snapshot, msg, topic, true, timeout);
+ ctx.io().sendUserMessage(snapshot, msg, topic, true, timeout, false);
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
index 584cc56..5992eda 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
@@ -390,7 +390,7 @@ public abstract class GridManagerAdapter<T extends IgniteSpi> implements GridMan
if (msg instanceof Message)
ctx.io().send(node, topic, (Message)msg, SYSTEM_POOL);
else
- ctx.io().sendUserMessage(Collections.singletonList(node), msg, topic, false, 0);
+ ctx.io().sendUserMessage(Collections.singletonList(node), msg, topic, false, 0, false);
}
catch (IgniteCheckedException e) {
throw unwrapException(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/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 7ef7bc0..84b4543 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
@@ -785,7 +785,8 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
finally {
threadProcessingMessage(false);
- msgC.run();
+ if (msgC != null)
+ msgC.run();
}
}
@@ -1237,6 +1238,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
* @param timeout Timeout.
* @param skipOnTimeout Whether message can be skipped on timeout.
* @param ackC Ack closure.
+ * @param async If {@code true} message for local node will be processed in pool, otherwise in current thread.
* @throws IgniteCheckedException Thrown in case of any errors.
*/
private void send(
@@ -1248,7 +1250,8 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
boolean ordered,
long timeout,
boolean skipOnTimeout,
- IgniteInClosure<IgniteException> ackC
+ IgniteInClosure<IgniteException> ackC,
+ boolean async
) throws IgniteCheckedException {
assert node != null;
assert topic != null;
@@ -1266,6 +1269,11 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
if (ordered)
processOrderedMessage(locNodeId, ioMsg, plc, null);
+ else if (async) {
+ assert msg instanceof GridIoUserMessage : ioMsg; // Async execution was added only for IgniteMessaging.
+
+ processRegularMessage(locNodeId, ioMsg, plc, null);
+ }
else
processRegularMessage0(ioMsg, locNodeId);
@@ -1323,7 +1331,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
if (node == null)
throw new IgniteCheckedException("Failed to send message to node (has node left grid?): " + nodeId);
- send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null);
+ send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null, false);
}
/**
@@ -1335,7 +1343,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
*/
public void send(ClusterNode node, Object topic, Message msg, byte plc)
throws IgniteCheckedException {
- send(node, topic, -1, msg, plc, false, 0, false, null);
+ send(node, topic, -1, msg, plc, false, 0, false, null, false);
}
/**
@@ -1343,11 +1351,12 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
* @param topic Topic to send the message to.
* @param msg Message to send.
* @param plc Type of processing.
+ * @param async Async flag.
* @throws IgniteCheckedException Thrown in case of any errors.
*/
- public void send(ClusterNode node, GridTopic topic, Message msg, byte plc)
+ public void send(ClusterNode node, GridTopic topic, Message msg, byte plc, boolean async)
throws IgniteCheckedException {
- send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null);
+ send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null, async);
}
/**
@@ -1360,7 +1369,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
*/
public void send(ClusterNode node, Object topic, int topicOrd, Message msg, byte plc)
throws IgniteCheckedException {
- send(node, topic, topicOrd, msg, plc, false, 0, false, null);
+ send(node, topic, topicOrd, msg, plc, false, 0, false, null, false);
}
/**
@@ -1382,7 +1391,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
) throws IgniteCheckedException {
assert timeout > 0 || skipOnTimeout;
- send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, null);
+ send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, null, false);
}
/**
@@ -1409,7 +1418,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
if (node == null)
throw new IgniteCheckedException("Failed to send message to node (has node left grid?): " + nodeId);
- send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, null);
+ send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, null, false);
}
/**
@@ -1422,7 +1431,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
*/
public void send(ClusterNode node, GridTopic topic, Message msg, byte plc,
IgniteInClosure<IgniteException> ackC) throws IgniteCheckedException {
- send(node, topic, topic.ordinal(), msg, plc, false, 0, false, ackC);
+ send(node, topic, topic.ordinal(), msg, plc, false, 0, false, ackC, false);
}
/**
@@ -1458,7 +1467,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
*/
public void send(ClusterNode node, Object topic, Message msg, byte plc, IgniteInClosure<IgniteException> ackC)
throws IgniteCheckedException {
- send(node, topic, -1, msg, plc, false, 0, false, ackC);
+ send(node, topic, -1, msg, plc, false, 0, false, ackC, false);
}
/**
@@ -1514,10 +1523,10 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
) throws IgniteCheckedException {
assert timeout > 0 || skipOnTimeout;
- send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, ackC);
+ send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, ackC, false);
}
- /**
+ /**
* Sends a peer deployable user message.
*
* @param nodes Destination nodes.
@@ -1525,7 +1534,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
* @throws IgniteCheckedException Thrown in case of any errors.
*/
public void sendUserMessage(Collection<? extends ClusterNode> nodes, Object msg) throws IgniteCheckedException {
- sendUserMessage(nodes, msg, null, false, 0);
+ sendUserMessage(nodes, msg, null, false, 0, false);
}
/**
@@ -1536,11 +1545,12 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
* @param topic Message topic to use.
* @param ordered Is message ordered?
* @param timeout Message timeout in milliseconds for ordered messages.
+ * @param async Async flag.
* @throws IgniteCheckedException Thrown in case of any errors.
*/
@SuppressWarnings("ConstantConditions")
public void sendUserMessage(Collection<? extends ClusterNode> nodes, Object msg,
- @Nullable Object topic, boolean ordered, long timeout) throws IgniteCheckedException {
+ @Nullable Object topic, boolean ordered, long timeout, boolean async) throws IgniteCheckedException {
boolean loc = nodes.size() == 1 && F.first(nodes).id().equals(locNodeId);
byte[] serMsg = null;
@@ -1585,7 +1595,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
if (ordered)
sendOrderedMessage(nodes, TOPIC_COMM_USER, ioMsg, PUBLIC_POOL, timeout, true);
else if (loc)
- send(F.first(nodes), TOPIC_COMM_USER, ioMsg, PUBLIC_POOL);
+ send(F.first(nodes), TOPIC_COMM_USER, ioMsg, PUBLIC_POOL, async);
else {
ClusterNode locNode = F.find(nodes, null, F.localNode(locNodeId));
@@ -1594,10 +1604,11 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
if (!rmtNodes.isEmpty())
send(rmtNodes, TOPIC_COMM_USER, ioMsg, PUBLIC_POOL);
- // Will call local listeners in current thread synchronously, so must go the last
+ // Will call local listeners in current thread synchronously or through pool,
+ // depending async flag, so must go the last
// to allow remote nodes execute the requested operation in parallel.
if (locNode != null)
- send(locNode, TOPIC_COMM_USER, ioMsg, PUBLIC_POOL);
+ send(locNode, TOPIC_COMM_USER, ioMsg, PUBLIC_POOL, async);
}
}
@@ -1664,7 +1675,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
if (node == null)
throw new IgniteCheckedException("Failed to send message to node (has node left grid?): " + nodeId);
- send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, ackC);
+ send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, ackC, false);
}
/**
@@ -1701,7 +1712,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
// messages to one node vs. many.
if (!nodes.isEmpty()) {
for (ClusterNode node : nodes)
- send(node, topic, topicOrd, msg, plc, ordered, timeout, skipOnTimeout, null);
+ send(node, topic, topicOrd, msg, plc, ordered, timeout, skipOnTimeout, null, false);
}
else if (log.isDebugEnabled())
log.debug("Failed to send message to empty nodes collection [topic=" + topic + ", msg=" +
@@ -1929,8 +1940,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
if (rmv && log.isDebugEnabled())
log.debug("Removed message listener [topic=" + topic + ", lsnr=" + lsnr + ']');
- if (lsnr instanceof ArrayListener)
- {
+ if (lsnr instanceof ArrayListener) {
for (GridMessageListener childLsnr : ((ArrayListener)lsnr).arr)
closeListener(childLsnr);
}
@@ -1942,6 +1952,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
/**
* Closes a listener, if applicable.
+ *
* @param lsnr Listener.
*/
private void closeListener(GridMessageListener lsnr) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
index c2cfa76..f5499d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
@@ -145,7 +145,7 @@ public class GridIoManagerSelfTest extends GridCommonAbstractTest {
GridIoManager ioMgr = spy(new TestGridIoManager(ctx));
try {
- ioMgr.sendUserMessage(F.asList(locNode, rmtNode), msg, GridTopic.TOPIC_IGFS, false, 123L);
+ ioMgr.sendUserMessage(F.asList(locNode, rmtNode), msg, GridTopic.TOPIC_IGFS, false, 123L, false);
}
catch (IgniteCheckedException ignored) {
// No-op. We are using mocks so real sending is impossible.
@@ -169,7 +169,7 @@ public class GridIoManagerSelfTest extends GridCommonAbstractTest {
GridIoManager ioMgr = spy(new TestGridIoManager(ctx));
try {
- ioMgr.sendUserMessage(F.asList(locNode, rmtNode), msg, GridTopic.TOPIC_IGFS, true, 123L);
+ ioMgr.sendUserMessage(F.asList(locNode, rmtNode), msg, GridTopic.TOPIC_IGFS, true, 123L, false);
}
catch (Exception ignored) {
// No-op. We are using mocks so real sending is impossible.
@@ -196,7 +196,7 @@ public class GridIoManagerSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public void send(ClusterNode node, GridTopic topic, Message msg, byte plc)
+ @Override public void send(ClusterNode node, GridTopic topic, Message msg, byte plc, boolean async)
throws IgniteCheckedException {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java
index 31b0663..49aab10 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/messaging/IgniteMessagingConfigVariationFullApiTest.java
@@ -58,7 +58,18 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
public void testLocalServer() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- localServerInternal();
+ localServerInternal(false);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testLocalServerAsync() throws Exception {
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ localServerInternal(true);
}
});
}
@@ -83,7 +94,21 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- serverClientMessage();
+ serverClientMessage(false);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testServerClientMessageAsync() throws Exception {
+ if (!testsCfg.withClients())
+ return;
+
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ serverClientMessage(true);
}
});
}
@@ -97,7 +122,21 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- clientClientMessage();
+ clientClientMessage(false);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientClientMessageAsync() throws Exception {
+ if (!testsCfg.withClients())
+ return;
+
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ clientClientMessage(true);
}
});
}
@@ -111,7 +150,21 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- clientServerMessage();
+ clientServerMessage(false);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientServerMessageAsync() throws Exception {
+ if (!testsCfg.withClients())
+ return;
+
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ clientServerMessage(true);
}
});
}
@@ -133,7 +186,18 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
public void testOrderedMessage() throws Exception {
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- orderedMessage();
+ orderedMessage(false);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testOrderedMessageAsync() throws Exception {
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ orderedMessage(true);
}
});
}
@@ -147,7 +211,7 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- clientServerOrderedMessage();
+ clientServerOrderedMessage(false);
}
});
}
@@ -155,13 +219,42 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
/**
* @throws Exception If failed.
*/
+ public void testClientServerOrderedMessageAsync() throws Exception {
+ if (!testsCfg.withClients())
+ return;
+
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ clientServerOrderedMessage(true);
+ }
+ });
+ }
+
+
+ /**
+ * @throws Exception If failed.
+ */
public void testClientClientOrderedMessage() throws Exception {
if (!testsCfg.withClients())
return;
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- clientClientOrderedMessage();
+ clientClientOrderedMessage(false);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientClientOrderedMessageAsync() throws Exception {
+ if (!testsCfg.withClients())
+ return;
+
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ clientClientOrderedMessage(true);
}
});
}
@@ -175,16 +268,32 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
runInAllDataModes(new TestRunnable() {
@Override public void run() throws Exception {
- serverClientOrderedMessage();
+ serverClientOrderedMessage(false);
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testServerClientOrderedMessageAsync() throws Exception {
+ if (!testsCfg.withClients())
+ return;
+
+ runInAllDataModes(new TestRunnable() {
+ @Override public void run() throws Exception {
+ serverClientOrderedMessage(true);
}
});
}
/**
* Single server test.
+ *
+ * @param async Async message send flag.
* @throws Exception If failed.
*/
- private void localServerInternal() throws Exception {
+ private void localServerInternal(boolean async) throws Exception {
int messages = MSGS;
Ignite ignite = grid(SERVER_NODE_IDX);
@@ -197,7 +306,7 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
try {
for (int i = 0; i < messages; i++)
- sendMessage(ignite, grp, value(i));
+ sendMessage(ignite, grp, value(i), async);
assertTrue(LATCH.await(10, TimeUnit.SECONDS));
@@ -238,52 +347,59 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
/**
* Server sends a message and client receives it.
+ *
+ * @param async Async message send flag.
* @throws Exception If failed.
*/
- private void serverClientMessage() throws Exception {
+ private void serverClientMessage(boolean async) throws Exception {
Ignite ignite = grid(SERVER_NODE_IDX);
ClusterGroup grp = ignite.cluster().forClients();
assert grp.nodes().size() > 0;
- registerListenerAndSendMessages(ignite, grp);
+ registerListenerAndSendMessages(ignite, grp, async);
}
/**
* Client sends a message and client receives it.
+ *
+ * @param async Async message send flag.
* @throws Exception If failed.
*/
- private void clientClientMessage() throws Exception {
+ private void clientClientMessage(boolean async) throws Exception {
Ignite ignite = grid(CLIENT_NODE_IDX);
ClusterGroup grp = ignite.cluster().forClients();
assert grp.nodes().size() > 0;
- registerListenerAndSendMessages(ignite, grp);
+ registerListenerAndSendMessages(ignite, grp, async);
}
/**
* Client sends a message and client receives it.
+ *
+ * @param async Async message send flag.
* @throws Exception If failed.
*/
- private void clientServerMessage() throws Exception {
+ private void clientServerMessage(boolean async) throws Exception {
Ignite ignite = grid(CLIENT_NODE_IDX);
ClusterGroup grp = ignite.cluster().forServers();
assert grp.nodes().size() > 0;
- registerListenerAndSendMessages(ignite, grp);
+ registerListenerAndSendMessages(ignite, grp, async);
}
/**
* @param ignite Ignite.
* @param grp Cluster group.
+ * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void registerListenerAndSendMessages(Ignite ignite, ClusterGroup grp) throws Exception {
+ private void registerListenerAndSendMessages(Ignite ignite, ClusterGroup grp, boolean async) throws Exception {
int messages = MSGS;
LATCH = new CountDownLatch(grp.nodes().size() * messages);
@@ -292,7 +408,7 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
try {
for (int i = 0; i < messages; i++)
- sendMessage(ignite, grp, value(i));
+ sendMessage(ignite, grp, value(i), async);
assertTrue(LATCH.await(10, TimeUnit.SECONDS));
@@ -335,67 +451,68 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
}
/**
- *
+ * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void orderedMessage() throws Exception {
+ private void orderedMessage(boolean async) throws Exception {
Ignite ignite = grid(SERVER_NODE_IDX);
ClusterGroup grp = gridCount() > 1 ? ignite.cluster().forRemotes() : ignite.cluster().forLocal();
assert grp.nodes().size() > 0;
- registerListenerAndSendOrderedMessages(ignite, grp);
+ registerListenerAndSendOrderedMessages(ignite, grp, async);
}
/**
- *
+ * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void clientServerOrderedMessage() throws Exception {
+ private void clientServerOrderedMessage(boolean async) throws Exception {
Ignite ignite = grid(CLIENT_NODE_IDX);
ClusterGroup grp = ignite.cluster().forServers();
assert grp.nodes().size() > 0;
- registerListenerAndSendOrderedMessages(ignite, grp);
+ registerListenerAndSendOrderedMessages(ignite, grp, async);
}
/**
- *
+ * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void clientClientOrderedMessage() throws Exception {
+ private void clientClientOrderedMessage(boolean async) throws Exception {
Ignite ignite = grid(CLIENT_NODE_IDX);
ClusterGroup grp = ignite.cluster().forClients();
assert grp.nodes().size() > 0;
- registerListenerAndSendOrderedMessages(ignite, grp);
+ registerListenerAndSendOrderedMessages(ignite, grp, async);
}
/**
- *
+ * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void serverClientOrderedMessage() throws Exception {
+ private void serverClientOrderedMessage(boolean async) throws Exception {
Ignite ignite = grid(SERVER_NODE_IDX);
ClusterGroup grp = ignite.cluster().forClients();
assert grp.nodes().size() > 0;
- registerListenerAndSendOrderedMessages(ignite, grp);
+ registerListenerAndSendOrderedMessages(ignite, grp, async);
}
/**
* @param ignite Ignite.
* @param grp Cluster group.
+ * @param async Async message send flag.
* @throws Exception If fail.
*/
- private void registerListenerAndSendOrderedMessages(Ignite ignite, ClusterGroup grp) throws Exception {
+ private void registerListenerAndSendOrderedMessages(Ignite ignite, ClusterGroup grp, boolean async) throws Exception {
int messages = MSGS;
LATCH = new CountDownLatch(grp.nodes().size() * messages);
@@ -403,8 +520,12 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
UUID opId = ignite.message(grp).remoteListen(MESSAGE_TOPIC, new OrderedMessageListener());
try {
- for (int i=0; i < messages; i++)
- ignite.message(grp).sendOrdered(MESSAGE_TOPIC, value(i), 2000);
+ for (int i=0; i < messages; i++){
+ if (async)
+ ignite.message(grp).withAsync().sendOrdered(MESSAGE_TOPIC, value(i), 2000);
+ else
+ ignite.message(grp).sendOrdered(MESSAGE_TOPIC, value(i), 2000);
+ }
assertTrue(LATCH.await(10, TimeUnit.SECONDS));
@@ -419,9 +540,13 @@ public class IgniteMessagingConfigVariationFullApiTest extends IgniteConfigVaria
* @param nodeSnd Sender Ignite node.
* @param grp Cluster group.
* @param msg Message.
+ * @param async Async message send flag.
*/
- private void sendMessage(Ignite nodeSnd, ClusterGroup grp, Object msg) {
- nodeSnd.message(grp).send(MESSAGE_TOPIC, msg);
+ private void sendMessage(Ignite nodeSnd, ClusterGroup grp, Object msg, boolean async) {
+ if (async)
+ nodeSnd.message(grp).withAsync().send(MESSAGE_TOPIC, msg);
+ else
+ nodeSnd.message(grp).send(MESSAGE_TOPIC, msg);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
index e796eb5..a166c3d 100644
--- a/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
@@ -24,6 +24,7 @@ import java.io.ObjectOutput;
import java.io.Serializable;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -36,15 +37,20 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteMessaging;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.processors.continuous.StartRoutineDiscoveryMessage;
+import org.apache.ignite.internal.processors.continuous.StopRoutineDiscoveryMessage;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.typedef.P2;
import org.apache.ignite.internal.util.typedef.PA;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.IgniteInstanceResource;;
+import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -198,7 +204,7 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+ TestTcpDiscoverySpi discoSpi = new TestTcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
@@ -944,7 +950,7 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
* @throws Exception If error occurs.
*/
public void testSendMessageWithExternalClassLoader() throws Exception {
- URL[] urls = new URL[] { new URL(GridTestProperties.getProperty("p2p.uri.cls")) };
+ URL[] urls = new URL[] {new URL(GridTestProperties.getProperty("p2p.uri.cls"))};
ClassLoader extLdr = new URLClassLoader(urls);
@@ -1028,6 +1034,8 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
public void testAsync() throws Exception {
final AtomicInteger msgCnt = new AtomicInteger();
+ TestTcpDiscoverySpi discoSpi = (TestTcpDiscoverySpi)ignite2.configuration().getDiscoverySpi();
+
assertFalse(ignite2.message().isAsync());
final IgniteMessaging msg = ignite2.message().withAsync();
@@ -1044,6 +1052,8 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
}
}, IllegalStateException.class, null);
+ discoSpi.blockCustomEvent();
+
final String topic = "topic";
UUID id = msg.remoteListen(topic, new P2<UUID, Object>() {
@@ -1059,9 +1069,15 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
Assert.assertNull(id);
- IgniteFuture<UUID> fut = msg.future();
+ IgniteFuture<UUID> starFut = msg.future();
+
+ Assert.assertNotNull(starFut);
+
+ U.sleep(500);
- Assert.assertNotNull(fut);
+ Assert.assertFalse(starFut.isDone());
+
+ discoSpi.stopBlock();
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
@@ -1071,10 +1087,14 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
}
}, IllegalStateException.class, null);
- id = fut.get();
+ id = starFut.get();
Assert.assertNotNull(id);
+ Assert.assertTrue(starFut.isDone());
+
+ discoSpi.blockCustomEvent();
+
message(ignite1.cluster().forRemotes()).send(topic, "msg1");
GridTestUtils.waitForCondition(new PA() {
@@ -1099,8 +1119,16 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
}
}, IllegalStateException.class, null);
+ U.sleep(500);
+
+ Assert.assertFalse(stopFut.isDone());
+
+ discoSpi.stopBlock();
+
stopFut.get();
+ Assert.assertTrue(stopFut.isDone());
+
message(ignite1.cluster().forRemotes()).send(topic, "msg2");
U.sleep(1000);
@@ -1109,6 +1137,80 @@ public class GridMessagingSelfTest extends GridCommonAbstractTest implements Ser
}
/**
+ *
+ */
+ static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
+ /** */
+ private boolean blockCustomEvt;
+
+ /** */
+ private final Object mux = new Object();
+
+ /** */
+ private List<DiscoverySpiCustomMessage> blockedMsgs = new ArrayList<>();
+
+ /** {@inheritDoc} */
+ @Override public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
+ synchronized (mux) {
+ if (blockCustomEvt) {
+ DiscoveryCustomMessage msg0 = GridTestUtils.getFieldValue(msg, "delegate");
+ if (msg0 instanceof StopRoutineDiscoveryMessage || msg0 instanceof StartRoutineDiscoveryMessage) {
+ log.info("Block custom message: " + msg0);
+ blockedMsgs.add(msg);
+
+ mux.notifyAll();
+ }
+ return;
+ }
+ }
+
+ super.sendCustomEvent(msg);
+ }
+
+ /**
+ *
+ */
+ public void blockCustomEvent() {
+ synchronized (mux) {
+ assert blockedMsgs.isEmpty() : blockedMsgs;
+
+ blockCustomEvt = true;
+ }
+ }
+
+ /**
+ * @throws InterruptedException If interrupted.
+ */
+ public void waitCustomEvent() throws InterruptedException {
+ synchronized (mux) {
+ while (blockedMsgs.isEmpty())
+ mux.wait();
+ }
+ }
+
+ /**
+ *
+ */
+ public void stopBlock() {
+ List<DiscoverySpiCustomMessage> msgs;
+
+ synchronized (this) {
+ msgs = new ArrayList<>(blockedMsgs);
+
+ blockCustomEvt = false;
+
+ blockedMsgs.clear();
+ }
+
+ for (DiscoverySpiCustomMessage msg : msgs) {
+ log.info("Resend blocked message: " + msg);
+
+ super.sendCustomEvent(msg);
+ }
+ }
+ }
+
+ /**
* Tests that message listener registers only for one oldest node.
*
* @throws Exception If an error occurred.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java b/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java
new file mode 100644
index 0000000..75e7d22
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/messaging/IgniteMessagingSendAsyncTest.java
@@ -0,0 +1,544 @@
+/*
+ * 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.messaging;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteMessaging;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jsr166.ThreadLocalRandom8;
+import org.junit.Assert;
+
+/**
+ *
+ */
+public class IgniteMessagingSendAsyncTest extends GridCommonAbstractTest implements Serializable {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** Threads number for multi-thread tests. */
+ private static final int THREADS = 10;
+
+ /** */
+ private final String TOPIC = "topic";
+
+ /** */
+ private final String msgStr = "message";
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
+ /**
+ * Checks if use default mode, local listeners execute in the same thread, 1 node in topology.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSendDefaultMode() throws Exception {
+ Ignite ignite1 = startGrid(1);
+
+ send(ignite1.message(), msgStr, new IgniteBiInClosure<String, Thread> () {
+ @Override public void apply(String msg, Thread thread) {
+ Assert.assertEquals(Thread.currentThread(), thread);
+ Assert.assertEquals(msgStr, msg);
+ }
+ });
+ }
+
+ /**
+ * Checks if use async mode, local listeners execute in another thread, 1 node in topology.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSendAsyncMode() throws Exception {
+ Ignite ignite1 = startGrid(1);
+
+ send(ignite1.message().withAsync(), msgStr, new IgniteBiInClosure<String, Thread> () {
+ @Override public void apply(String msg, Thread thread) {
+ Assert.assertTrue(!Thread.currentThread().equals(thread));
+ Assert.assertEquals(msgStr, msg);
+ }
+ });
+ }
+
+ /**
+ * Checks if use default mode, local listeners execute in the same thread, 2 nodes in topology.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSendDefaultMode2Nodes() throws Exception {
+ Ignite ignite1 = startGrid(1);
+ Ignite ignite2 = startGrid(2);
+
+ sendWith2Nodes(ignite2, ignite1.message(), msgStr, new IgniteBiInClosure<String, Thread> () {
+ @Override public void apply(String msg, Thread thread) {
+ Assert.assertEquals(Thread.currentThread(), thread);
+ Assert.assertEquals(msgStr, msg);
+ }
+ });
+ }
+
+ /**
+ * Checks if use async mode, local listeners execute in another thread, 2 nodes in topology.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSendAsyncMode2Node() throws Exception {
+ Ignite ignite1 = startGrid(1);
+ Ignite ignite2 = startGrid(2);
+
+ sendWith2Nodes(ignite2, ignite1.message().withAsync(), msgStr, new IgniteBiInClosure<String, Thread> () {
+ @Override public void apply(String msg, Thread thread) {
+ Assert.assertTrue(!Thread.currentThread().equals(thread));
+ Assert.assertEquals(msgStr, msg);
+ }
+ });
+ }
+
+ /**
+ * Checks that sendOrdered works in thread pool, 1 node in topology.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSendOrderedDefaultMode() throws Exception {
+ Ignite ignite1 = startGrid(1);
+
+ final List<String> msgs = orderedMessages();
+
+ sendOrdered(ignite1.message(), msgs, new IgniteBiInClosure< List<String>, List<Thread>> () {
+ @Override public void apply(List<String> received, List<Thread> threads) {
+ assertFalse(threads.contains(Thread.currentThread()));
+ assertTrue(msgs.equals(received));
+ }
+ });
+ }
+
+ /**
+ * Checks that sendOrdered work in thread pool, 1 node in topology.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSendOrderedAsyncMode() throws Exception {
+ Ignite ignite1 = startGrid(1);
+
+ final List<String> msgs = orderedMessages();
+
+ sendOrdered(ignite1.message().withAsync(), msgs, new IgniteBiInClosure< List<String>, List<Thread>> () {
+ @Override public void apply(List<String> received, List<Thread> threads) {
+ assertFalse(threads.contains(Thread.currentThread()));
+ assertTrue(msgs.equals(received));
+ }
+ });
+ }
+
+ /**
+ * Checks that sendOrdered work in thread pool, 2 nodes in topology.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSendOrderedDefaultMode2Node() throws Exception {
+ Ignite ignite1 = startGrid(1);
+ Ignite ignite2 = startGrid(2);
+
+ final List<String> msgs = orderedMessages();
+
+ sendOrderedWith2Node(ignite2, ignite1.message(), msgs, new IgniteBiInClosure<List<String>, List<Thread>>() {
+ @Override public void apply(List<String> received, List<Thread> threads) {
+ assertFalse(threads.contains(Thread.currentThread()));
+ assertTrue(msgs.equals(received));
+ }
+ });
+ }
+
+ /**
+ * Checks that sendOrdered work in thread pool, 2 nodes in topology.
+ *
+ * @throws Exception If failed.
+ */
+ public void testSendOrderedAsyncMode2Node() throws Exception {
+ Ignite ignite1 = startGrid(1);
+ Ignite ignite2 = startGrid(2);
+
+ final List<String> msgs = orderedMessages();
+
+ sendOrderedWith2Node(ignite2, ignite1.message().withAsync(), msgs, new IgniteBiInClosure<List<String>, List<Thread>>() {
+ @Override public void apply(List<String> received, List<Thread> threads) {
+ assertFalse(threads.contains(Thread.currentThread()));
+ assertTrue(msgs.equals(received));
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSendOrderedDefaultModeMultiThreads() throws Exception {
+ Ignite ignite = startGrid(1);
+
+ sendOrderedMultiThreads(ignite.message());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSendOrderedAsyncModeMultiThreads() throws Exception {
+ Ignite ignite = startGrid(1);
+
+ sendOrderedMultiThreads(ignite.message().withAsync());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSendOrderedDefaultModeMultiThreadsWith2Node() throws Exception {
+ Ignite ignite1 = startGrid(1);
+ Ignite ignite2 = startGrid(2);
+
+ sendOrderedMultiThreadsWith2Node(ignite2, ignite1.message());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSendOrderedAsyncModeMultiThreadsWith2Node() throws Exception {
+ Ignite ignite1 = startGrid(1);
+ Ignite ignite2 = startGrid(2);
+
+ sendOrderedMultiThreadsWith2Node(ignite2, ignite1.message().withAsync());
+ }
+
+ /**
+ * @param ignite2 Second node.
+ * @param ignMsg IgniteMessage.
+ * @throws Exception If failed.
+ */
+ private void sendOrderedMultiThreadsWith2Node(
+ final Ignite ignite2,
+ final IgniteMessaging ignMsg
+ ) throws Exception {
+ final ConcurrentMap<String, List<String>> expMsg = Maps.newConcurrentMap();
+ final ConcurrentMap<String, List<String>> actlMsg = Maps.newConcurrentMap();
+
+ final List<String> msgs = orderedMessages();
+
+ sendOrderedMultiThreadsWith2Node(ignite2, ignMsg, expMsg, actlMsg, msgs);
+
+ }
+
+ /**
+ * @param ignMsg IgniteMessaging.
+ * @throws Exception If failed.
+ */
+ private void sendOrderedMultiThreads(
+ final IgniteMessaging ignMsg
+ ) throws Exception {
+ final ConcurrentMap<String, List<String>> expMsg = Maps.newConcurrentMap();
+ final ConcurrentMap<String, List<String>> actlMsg = Maps.newConcurrentMap();
+
+ final List<String> msgs = orderedMessages();
+
+ sendOrderedMultiThreads(ignMsg, expMsg, actlMsg, msgs);
+ }
+
+ /**
+ * @param ignite2 Second node.
+ * @param ignMsg Ignite for send message.
+ * @param expMsg Expected messages map.
+ * @param actlMsg Actual message map.
+ * @param msgs List of messages.
+ * @throws Exception If failed.
+ */
+ private void sendOrderedMultiThreadsWith2Node(
+ final Ignite ignite2,
+ final IgniteMessaging ignMsg,
+ final ConcurrentMap<String, List<String>> expMsg,
+ final ConcurrentMap<String, List<String>> actlMsg,
+ final List<String> msgs
+ ) throws Exception {
+ final CountDownLatch latch = new CountDownLatch(THREADS * msgs.size());
+
+ final ConcurrentMap<String, List<String>> actlMsgNode2 = Maps.newConcurrentMap();
+
+ ignite2.message().localListen(TOPIC, new IgniteBiPredicate<UUID, Message>() {
+ @Override public boolean apply(UUID uuid, Message msg) {
+ actlMsgNode2.putIfAbsent(msg.threadName, Lists.<String>newArrayList());
+
+ actlMsgNode2.get(msg.threadName).add(msg.msg);
+
+ latch.countDown();
+
+ return true;
+ }
+ });
+
+ sendOrderedMultiThreads(ignMsg, expMsg, actlMsg, msgs);
+
+ latch.await();
+
+ assertEquals(expMsg.size(), actlMsgNode2.size());
+
+ for (Map.Entry<String, List<String>> entry : expMsg.entrySet())
+ assertTrue(actlMsgNode2.get(entry.getKey()).equals(entry.getValue()));
+ }
+
+ /**
+ * @param ignMsg Ignite for send message.
+ * @param expMsg Expected messages map.
+ * @param actlMsg Actual message map.
+ * @param msgs List of messages.
+ * @throws Exception If failed.
+ */
+ private void sendOrderedMultiThreads(
+ final IgniteMessaging ignMsg,
+ final ConcurrentMap<String, List<String>> expMsg,
+ final ConcurrentMap<String, List<String>> actlMsg,
+ final List<String> msgs
+ ) throws Exception {
+ final CountDownLatch latch = new CountDownLatch(THREADS * msgs.size());
+
+ ignMsg.localListen(TOPIC, new IgniteBiPredicate<UUID, Message>() {
+ @Override public boolean apply(UUID uuid, Message msg) {
+ actlMsg.putIfAbsent(msg.threadName, Lists.<String>newArrayList());
+
+ actlMsg.get(msg.threadName).add(msg.msg);
+
+ latch.countDown();
+
+ return true;
+ }
+ });
+
+ for (int i = 0; i < THREADS; i++)
+ new Thread(new Runnable() {
+ @Override public void run() {
+ String thdName = Thread.currentThread().getName();
+
+ List<String> exp = Lists.newArrayList();
+
+ expMsg.put(thdName, exp);
+
+ for (String msg : msgs) {
+ exp.add(msg);
+
+ ignMsg.sendOrdered(TOPIC, new Message(thdName, msg), 1000);
+ }
+
+ }
+ }).start();
+
+ latch.await();
+
+ assertEquals(expMsg.size(), actlMsg.size());
+
+ for (Map.Entry<String, List<String>> entry : expMsg.entrySet())
+ assertTrue(actlMsg.get(entry.getKey()).equals(entry.getValue()));
+ }
+
+ /**
+ * @param ignite2 Second node.
+ * @param igniteMsg Ignite message.
+ * @param msgStr Message string.
+ * @param cls Callback for compare result.
+ * @throws Exception If failed.
+ */
+ private void sendWith2Nodes(
+ final Ignite ignite2,
+ final IgniteMessaging igniteMsg,
+ final String msgStr,
+ final IgniteBiInClosure<String, Thread> cls
+ ) throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ ignite2.message().localListen(TOPIC, new IgniteBiPredicate<UUID, String>() {
+ @Override public boolean apply(UUID uuid, String msg) {
+ Assert.assertEquals(msgStr, msg);
+
+ latch.countDown();
+
+ return true;
+ }
+ });
+
+ send(igniteMsg, msgStr, cls);
+
+ latch.await();
+ }
+
+ /**
+ * @param igniteMsg Ignite messaging.
+ * @param msgStr Message string.
+ * @param cls Callback for compare result.
+ * @throws Exception If failed.
+ */
+ private void send(
+ final IgniteMessaging igniteMsg,
+ final String msgStr,
+ final IgniteBiInClosure<String, Thread> cls
+ ) throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ final AtomicReference<Thread> thread = new AtomicReference<>();
+ final AtomicReference<String> val = new AtomicReference<>();
+
+ igniteMsg.localListen(TOPIC, new IgniteBiPredicate<UUID, String>() {
+ @Override public boolean apply(UUID uuid, String msgStr) {
+ thread.set(Thread.currentThread());
+
+ val.set(msgStr);
+
+ latch.countDown();
+
+ return true;
+ }
+ });
+
+ igniteMsg.send(TOPIC, msgStr);
+
+ latch.await();
+
+ cls.apply(val.get(), thread.get());
+ }
+
+ /**
+ * @param ignite2 Second node.
+ * @param igniteMsg Ignite message.
+ * @param msgs messages for send.
+ * @param cls Callback for compare result.
+ * @throws Exception If failed.
+ */
+ private void sendOrderedWith2Node(
+ final Ignite ignite2,
+ final IgniteMessaging igniteMsg,
+ final List<String> msgs,
+ final IgniteBiInClosure<List<String>, List<Thread>> cls
+ ) throws Exception {
+ final CountDownLatch latch = new CountDownLatch(msgs.size());
+
+ final List<String> received = Lists.newArrayList();
+
+ ignite2.message().localListen(TOPIC, new IgniteBiPredicate<UUID, String>() {
+ @Override public boolean apply(UUID uuid, String msg) {
+ received.add(msg);
+
+ latch.countDown();
+
+ return true;
+ }
+ });
+
+ sendOrdered(igniteMsg, msgs, cls);
+
+ latch.await();
+
+ assertTrue(msgs.equals(received));
+ }
+
+ /**
+ * @param igniteMsg Ignite message.
+ * @param msgs messages for send.
+ * @param cls Callback for compare result.
+ * @throws Exception If failed.
+ */
+ private<T> void sendOrdered(
+ final IgniteMessaging igniteMsg,
+ final List<T> msgs,
+ final IgniteBiInClosure<List<T>,List<Thread>> cls
+ ) throws Exception {
+ final CountDownLatch latch = new CountDownLatch(msgs.size());
+
+ final List<T> received = Lists.newArrayList();
+ final List<Thread> threads = Lists.newArrayList();
+
+ for (T msg : msgs)
+ igniteMsg.sendOrdered(TOPIC, msg, 1000);
+
+ igniteMsg.localListen(TOPIC, new IgniteBiPredicate<UUID, T>() {
+ @Override public boolean apply(UUID uuid, T s) {
+ received.add(s);
+
+ threads.add(Thread.currentThread());
+
+ latch.countDown();
+
+ return true;
+ }
+ });
+
+ latch.await();
+
+ cls.apply(received, threads);
+ }
+
+ /**
+ * @return List of ordered messages
+ */
+ private List<String> orderedMessages() {
+ final List<String> msgs = Lists.newArrayList();
+
+ for (int i = 0; i < 1000; i++)
+ msgs.add(String.valueOf(ThreadLocalRandom8.current().nextInt()));
+
+ return msgs;
+ }
+
+ /**
+ *
+ */
+ private static class Message implements Serializable{
+ /** Thread name. */
+ private final String threadName;
+
+ /** Message. */
+ private final String msg;
+
+ /**
+ * @param threadName Thread name.
+ * @param msg Message.
+ */
+ private Message(String threadName, String msg) {
+ this.threadName = threadName;
+ this.msg = msg;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 9e20d2a..688edf7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -56,6 +56,7 @@ import org.apache.ignite.marshaller.DynamicProxySerializationMultiJvmSelfTest;
import org.apache.ignite.marshaller.MarshallerContextSelfTest;
import org.apache.ignite.messaging.GridMessagingNoPeerClassLoadingSelfTest;
import org.apache.ignite.messaging.GridMessagingSelfTest;
+import org.apache.ignite.messaging.IgniteMessagingSendAsyncTest;
import org.apache.ignite.messaging.IgniteMessagingWithClientTest;
import org.apache.ignite.plugin.security.SecurityPermissionSetBuilderTest;
import org.apache.ignite.spi.GridSpiLocalHostInjectionTest;
@@ -101,6 +102,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTest(new TestSuite(GridSelfTest.class));
suite.addTest(new TestSuite(ClusterGroupHostsSelfTest.class));
suite.addTest(new TestSuite(IgniteMessagingWithClientTest.class));
+ suite.addTest(new TestSuite(IgniteMessagingSendAsyncTest.class));
GridTestUtils.addTestIfNeeded(suite, ClusterGroupSelfTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridMessagingSelfTest.class, ignoredTests);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8f8e0ac/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffle.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffle.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffle.java
index 8ffea8c..3db68c4 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffle.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/shuffle/HadoopShuffle.java
@@ -147,7 +147,7 @@ public class HadoopShuffle extends HadoopComponent {
if (msg instanceof Message)
ctx.kernalContext().io().send(node, GridTopic.TOPIC_HADOOP_MSG, (Message)msg, GridIoPolicy.PUBLIC_POOL);
else
- ctx.kernalContext().io().sendUserMessage(F.asList(node), msg, GridTopic.TOPIC_HADOOP, false, 0);
+ ctx.kernalContext().io().sendUserMessage(F.asList(node), msg, GridTopic.TOPIC_HADOOP, false, 0, false);
}
/**
[02/50] [abbrv] ignite git commit: Minor fix test for Ignite-4247.
Posted by yz...@apache.org.
Minor fix test for Ignite-4247.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ecf4b8b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ecf4b8b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ecf4b8b5
Branch: refs/heads/ignite-comm-balance-master
Commit: ecf4b8b5bd05a5c1120e08d9951cddd26d0e924c
Parents: 2305e38
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Wed Jan 18 17:22:14 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Wed Jan 18 17:22:14 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheAbstractQuerySelfTest.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecf4b8b5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index 9f56877..7e0d20b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -633,7 +633,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
assertEquals(2, qry.getAll().size());
- GridTestUtils.assertThrows(log, new GridPlainCallable<Void>() {
+ Throwable throwable = GridTestUtils.assertThrowsInherited(log, new GridPlainCallable<Void>() {
@Override public Void call() throws Exception {
QueryCursor<Cache.Entry<Integer, Type1>> qry =
cache.query(new SqlQuery<Integer, Type1>(Type1.class, "FROM Type1"));
@@ -642,7 +642,11 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
return null;
}
- }, CacheException.class, null);
+ }, RuntimeException.class, null);
+
+ assertNotNull(throwable);
+
+ assertTrue(throwable instanceof IgniteException || throwable instanceof CacheException);
}
/**
[44/50] [abbrv] ignite git commit: IGNITE-4472 Fixed became this user.
Posted by yz...@apache.org.
IGNITE-4472 Fixed became this user.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ee832e4c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ee832e4c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ee832e4c
Branch: refs/heads/ignite-comm-balance-master
Commit: ee832e4ca502e70e5891cb299ea348adcea96d93
Parents: e8f8e0a
Author: Andrey Novikov <an...@gridgain.com>
Authored: Thu Feb 16 10:41:30 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu Feb 16 10:41:30 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/routes/profile.js | 4 ++--
modules/web-console/backend/services/sessions.js | 6 +-----
modules/web-console/backend/services/users.js | 7 ++-----
.../web-console/frontend/views/templates/agent-download.jade | 4 ++--
4 files changed, 7 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee832e4c/modules/web-console/backend/routes/profile.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/profile.js b/modules/web-console/backend/routes/profile.js
index 1d6fccb..76edf72 100644
--- a/modules/web-console/backend/routes/profile.js
+++ b/modules/web-console/backend/routes/profile.js
@@ -50,7 +50,7 @@ module.exports.factory = function(_, express, mongo, usersService) {
if (becomeUsed) {
req.session.viewedUser = user;
- return user;
+ return req.user;
}
return new Promise((resolve, reject) => {
@@ -64,7 +64,7 @@ module.exports.factory = function(_, express, mongo, usersService) {
});
});
})
- .then(() => usersService.get(req.user, req.session.viewedUser))
+ .then((user) => usersService.get(user, req.session.viewedUser))
.then(res.api.ok)
.catch(res.api.error);
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee832e4c/modules/web-console/backend/services/sessions.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/sessions.js b/modules/web-console/backend/services/sessions.js
index 7f62a60..7f3fc73 100644
--- a/modules/web-console/backend/services/sessions.js
+++ b/modules/web-console/backend/services/sessions.js
@@ -42,11 +42,7 @@ module.exports.factory = (_, mongo, errors) => {
return Promise.reject(new errors.IllegalAccessError('Became this user is not permitted. Only administrators can perform this actions.'));
return mongo.Account.findById(viewedUserId).lean().exec()
- .then((viewedUser) => {
- viewedUser.token = session.req.user.token;
-
- session.viewedUser = viewedUser;
- });
+ .then((viewedUser) => session.viewedUser = viewedUser);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee832e4c/modules/web-console/backend/services/users.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/users.js b/modules/web-console/backend/services/users.js
index 2dd603f..0aff45f 100644
--- a/modules/web-console/backend/services/users.js
+++ b/modules/web-console/backend/services/users.js
@@ -212,11 +212,8 @@ module.exports.factory = (_, mongo, settings, spacesService, mailsService, activ
const becomeUsed = viewedUser && user.admin;
- if (becomeUsed) {
- user = viewedUser;
-
- user.becomeUsed = true;
- }
+ if (becomeUsed)
+ user = _.extend({}, viewedUser, {becomeUsed: true, becameToken: user.token});
else
user = user.toJSON();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee832e4c/modules/web-console/frontend/views/templates/agent-download.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/templates/agent-download.jade b/modules/web-console/frontend/views/templates/agent-download.jade
index f5a6ba0..b913636 100644
--- a/modules/web-console/frontend/views/templates/agent-download.jade
+++ b/modules/web-console/frontend/views/templates/agent-download.jade
@@ -34,8 +34,8 @@
i.fa.fa-chevron-circle-right(ng-show='!agentLoad.showToken' ng-click='agentLoad.showToken = ! agentLoad.showToken')
a(ng-click='agentLoad.showToken = ! agentLoad.showToken') {{agentLoad.showToken ? 'Hide security token...' : 'Show security token...'}}
.details-row(ng-show='agentLoad.showToken')
- label.labelField Security token: {{user.token}}
- i.tipLabel.fa.fa-clipboard(ignite-copy-to-clipboard='{{user.token}}' bs-tooltip='' data-title='Copy security token to clipboard')
+ label.labelField Security token: {{user.becameToken || user.token}}
+ i.tipLabel.fa.fa-clipboard(ignite-copy-to-clipboard='{{user.becameToken || user.token}}' bs-tooltip='' data-title='Copy security token to clipboard')
i.tipLabel.icon-help(ng-if=lines bs-tooltip='' data-title='The security token is used for authorization of web agent')
.agent-download(ng-if='hasAgents')
p Connection to Ignite Web Agent is established, but agent failed to connect to Ignite Node
[21/50] [abbrv] ignite git commit: IGNITE-4212 Ignite Benchmarking
Simplification and Automation / IGNITE-4478 Fixing documentation and
resolving lack of usability
Posted by yz...@apache.org.
IGNITE-4212 Ignite Benchmarking Simplification and Automation / IGNITE-4478 Fixing documentation and resolving lack of usability
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/605d946a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/605d946a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/605d946a
Branch: refs/heads/ignite-comm-balance-master
Commit: 605d946ada5ca4e562e256fa0edb29cc25dea7dc
Parents: e1c3dda
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Thu Feb 9 20:08:57 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Feb 9 20:08:57 2017 +0300
----------------------------------------------------------------------
modules/yardstick/DEVNOTES-standalone.txt | 15 +++
modules/yardstick/DEVNOTES.txt | 20 ++--
modules/yardstick/README.txt | 119 +++++++++++++------
.../config/benchmark-sample.properties | 62 ++++++++++
modules/yardstick/pom.xml | 4 +-
pom.xml | 1 +
6 files changed, 172 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/605d946a/modules/yardstick/DEVNOTES-standalone.txt
----------------------------------------------------------------------
diff --git a/modules/yardstick/DEVNOTES-standalone.txt b/modules/yardstick/DEVNOTES-standalone.txt
new file mode 100644
index 0000000..d14dde2
--- /dev/null
+++ b/modules/yardstick/DEVNOTES-standalone.txt
@@ -0,0 +1,15 @@
+Building from standalone sources
+================================
+
+Run
+
+mvn clean package
+
+Artifacts can be found in `/target/assembly directory.`
+
+
+Writing Ignite Benchmarks
+=========================
+
+All benchmarks extend `AbstractBenchmark` class. A new benchmark should also extend this abstract class
+and implement `test` method. This is the method which actually tests performance.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/605d946a/modules/yardstick/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/yardstick/DEVNOTES.txt b/modules/yardstick/DEVNOTES.txt
index 6921243..b8b1f53 100644
--- a/modules/yardstick/DEVNOTES.txt
+++ b/modules/yardstick/DEVNOTES.txt
@@ -1,16 +1,20 @@
-Yardstick Ignite Maven Build Instructions
+Building from Ignite sources
=========================================
-Yardstick can be build from standalone sources using following maven command:
+Run
-mvn clean package
+mvn clean package -Pyardstick -pl modules/yardstick -am -DskipTests
-Artifacts can be found in /target/assembly directory.
+in the Apache Ignite root directory.
-To build yardstick from Apache Ignite sources use:
+This command will compile the project and also unpack scripts from `yardstick-resources.zip` file to
+`modules/yardstick/target/assembly/bin` directory.
-mvn clean package -Pyardstick -pl modules/yardstick -am -DskipTests
+Artifacts can be found in `modules/yardstick/target/assembly` directory.
+
+Writing Ignite Benchmarks
+=========================
-in Apache Ignite root directory
+All benchmarks extend `AbstractBenchmark` class. A new benchmark should also extend this abstract class
+and implement `test` method. This is the method which actually tests performance.
-Artifacts can be found in modules/yardstick/target/assembly directory.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/605d946a/modules/yardstick/README.txt
----------------------------------------------------------------------
diff --git a/modules/yardstick/README.txt b/modules/yardstick/README.txt
index 353ddd8..dcfe0e6 100644
--- a/modules/yardstick/README.txt
+++ b/modules/yardstick/README.txt
@@ -1,55 +1,92 @@
Yardstick Ignite Benchmarks
===========================
-Yardstick Ignite is a set of Ignite Grid (http://ignite.apache.org/) benchmarks written on top of Yardstick framework.
+Apache Ignite benchmarks are written on top of Yardstick Framework (https://github.com/gridgain/yardstick) and allow
+you to measure performance of various Apache Ignite components and modules.
-Yardstick Framework
-===================
-Visit Yardstick Repository (https://github.com/gridgain/yardstick) for detailed information on how to run Yardstick benchmarks and how to generate graphs.
+The documentation below describes how to execute and configure already assembled benchmarks. If you need to add new
+benchmarks or build existing one then refer to instruction from `DEVNOTES.txt` in source directory.
-The documentation below describes configuration parameters in addition to standard Yardstick parameters.
+Visit Yardstick Repository (https://github.com/gridgain/yardstick) for detailed information in regards resulting graphs
+generation and how the frameworks works.
-Building from Ignite sources
-============
-1. Create a local clone of Ignite repository
-2. Run
-mvn package
+Running Ignite Benchmarks Locally
+==========================================
-command for Yardstick Ignite POM
+The simplest way to start with benchmarking is to use one of the executable scripts available under `benchmarks\bin` directory:
-Building from standalone sources
-=====================
-Run
+./bin/benchmark-run-all.sh config/benchmark-atomic-put.properties
-mvn package
+The command above will benchmark the cache put operation for a distributed atomic cache. The results of the benchmark will be added
+to auto-generated `results-{DATE-TIME}` directory.
-command for Yardstick Ignite POM
+If `./bin/benchmark-run-all.sh` command is executed as is without any parameters and modifications in configurations files then
+all the available benchmarks will be executed on a local machine using `config/benchmark.properties` configuration.
-Provided Benchmarks
-===================
-The following benchmarks are provided:
+To get more information about available benchmarks and configuration parameters refer to \u201cProvided Benchmarks\u201d and
+\u201cProperties And Command Line Arguments\u201d sections below.
+
+
+Running Ignite Benchmarks Remotely
+=========================================
+
+For running Ignite benchmarks on remote hosts you need to upload Ignite-Yardstick to each one of your remote hosts.
+
+NOTE: The path to the uploaded Ignite-Yardstick should be exactly the same on each host.
+
+Then you need to make some changes in config files:
-1. `GetBenchmark` - benchmarks atomic distributed cache get operation
-2. `PutBenchmark` - benchmarks atomic distributed cache put operation
-3. `PutGetBenchmark` - benchmarks atomic distributed cache put and get operations together
-4. `PutTxBenchmark` - benchmarks transactional distributed cache put operation
-5. `PutGetTxBenchmark` - benchmarks transactional distributed cache put and get operations together
-6. `SqlQueryBenchmark` - benchmarks distributed SQL query over cached data
-7. `SqlQueryJoinBenchmark` - benchmarks distributed SQL query with a Join over cached data
-8. `SqlQueryPutBenchmark` - benchmarks distributed SQL query with simultaneous cache updates
+1. You need to comment or delete the
+ <property name="localHost" value="127.0.0.1"/>
+line in `config/ignite-localhost-config.xml` file.
-Writing Ignite Benchmarks
-=========================
-All benchmarks extend `AbstractBenchmark` class. A new benchmark should also extend this abstract class
-and implement `test` method. This is the method that is actually benchmarked.
+2. You need to replace all the `127.0.0.1` addresses in `ignite-localhost-config.xml` file by actual IPs of your remote
+servers. You can add or delete lines with IP addresses if you want to run benchmarks on different number of hosts.
+There must be at least one IP address in the list.
-Running Ignite Benchmarks
-=========================
-Before running Ignite benchmarks, run:
+3. You need to replace the `localhost` strings by actual IP of your servers in the lines
+SERVERS='localhost,localhost'
+DRIVERS='localhost'
+in `config/benchmark-atomic-put.properties` file.
+
+Then use the following command:
+
+./bin/benchmark-run-all.sh config/benchmark-atomic-put.properties
+
+
+It is recommended to create some copies of original config files, edit these copies and then use as a
+parameter for `./bin/benchmark-run-all.sh` script.
+
+
+Provided Benchmarks
+===================
+The following benchmarks are provided:
-mvn package
+1. `GetBenchmark` - benchmarks atomic distributed cache get operation
+2. `PutBenchmark` - benchmarks atomic distributed cache put operation
+3. `PutGetBenchmark` - benchmarks atomic distributed cache put and get operations together
+4. `PutTxBenchmark` - benchmarks transactional distributed cache put operation
+5. `PutGetTxBenchmark` - benchmarks transactional distributed cache put and get operations together
+6. `SqlQueryBenchmark` - benchmarks distributed SQL query over cached data
+7. `SqlQueryJoinBenchmark` - benchmarks distributed SQL query with a Join over cached data
+8. `SqlQueryPutBenchmark` - benchmarks distributed SQL query with simultaneous cache updates
+9. `AffinityCallBenchmark` - benchmarks affinity call operation
+10. `ApplyBenchmark` - benchmarks apply operation
+11. `BroadcastBenchmark` - benchmarks broadcast operations
+12. `ExecuteBenchmark` - benchmarks execute operations
+13. `RunBenchmark` - benchmarks running task operations
+14. `PutGetOffHeapBenchmark` - benchmarks atomic distributed cache put and get operations together off heap
+15. `PutGetOffHeapValuesBenchmark` - benchmarks atomic distributed cache put value operations off heap
+16. `PutOffHeapBenchmark` - benchmarks atomic distributed cache put operations off heap
+17. `PutOffHeapValuesBenchmark` - benchmarks atomic distributed cache get value operations off heap
+18. `PutTxOffHeapBenchmark` - benchmarks transactional distributed cache put operation off heap
+19. `PutTxOffHeapValuesBenchmark` - benchmarks transactional distributed cache put value operation off heap
+20. `SqlQueryOffHeapBenchmark` -benchmarks distributed SQL query over cached data off heap
+21. `SqlQueryJoinOffHeapBenchmark` - benchmarks distributed SQL query with a Join over cached data off heap
+22. `SqlQueryPutOffHeapBenchmark` - benchmarks distributed SQL query with simultaneous cache updates off heap
+23. `PutAllBenchmark` - benchmarks atomic distributed cache batch put operation
+24. `PutAllTxBenchmark` - benchmarks transactional distributed cache batch put operation
-command. This command will compile the project and also will unpack scripts from `yardstick-resources.zip` file to `bin` directory.
Properties And Command Line Arguments
=====================================
@@ -67,15 +104,19 @@ The following Ignite benchmark properties can be defined in the benchmark config
* `-cs` or `--cacheStore` - Enable or disable cache store readThrough, writeThrough
* `-cl` or `--client` - Client flag
* `-nc` or `--nearCache` - Near cache flag
-* `-nn <num>` or `--nodeNumber <num>` - Number of nodes (automatically set in `benchmark.properties`), used to wait for the specified number of nodes to start
+* `-nn <num>` or `--nodeNumber <num>` - Number of nodes (automatically set in `benchmark.properties`), used to wait for
+ the specified number of nodes to start
* `-sm <mode>` or `-syncMode <mode>` - Synchronization mode (defined in `CacheWriteSynchronizationMode`)
* `-ot` or `--offheapTiered` - Flag indicating whether tiered off-heap mode is on
* `-ov` or `--offheapValuesOnly` - Flag indicating whether off-heap mode is on and only cache values are stored off-heap
* `-r <num>` or `--range` - Range of keys that are randomly generated for cache operations
+* `-rd or --restartdelay` - Restart delay in seconds
+* `-rs or --restartsleep` - Restart sleep in seconds
* `-rth <host>` or `--restHost <host>` - REST TCP host
* `-rtp <num>` or `--restPort <num>` - REST TCP port, indicates that a Ignite node is ready to process Ignite Clients
* `-ss` or `--syncSend` - Flag indicating whether synchronous send is used in `TcpCommunicationSpi`
-* `-txc <value>` or `--txConcurrency <value>` - Cache transaction concurrency control, either `OPTIMISTIC` or `PESSIMISTIC` (defined in `CacheTxConcurrency`)
+* `-txc <value>` or `--txConcurrency <value>` - Cache transaction concurrency control, either `OPTIMISTIC` or
+ `PESSIMISTIC` (defined in `CacheTxConcurrency`)
* `-txi <value>` or `--txIsolation <value>` - Cache transaction isolation (defined in `CacheTxIsolation`)
* `-wb` or `--writeBehind` - Enable or disable writeBehind for cache store
* `-wom <mode>` or `--writeOrderMode <mode>` - Write order mode for ATOMIC caches (defined in `CacheAtomicWriteOrderMode`)
@@ -91,7 +132,7 @@ SERVER_HOSTS=localhost,localhost
Note that -dn and -sn, which stand for data node and server node, are native Yardstick parameters and are documented in Yardstick framework.
===========================================================================================================================================
-CONFIGS="-b 1 -sm PRIMARY_SYNC -dn PutBenchmark -sn IgniteNode"
+CONFIGS="-b 1 -sm PRIMARY_SYNC -dn PutBenchmark`IgniteNode"
```
Issues
http://git-wip-us.apache.org/repos/asf/ignite/blob/605d946a/modules/yardstick/config/benchmark-sample.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-sample.properties b/modules/yardstick/config/benchmark-sample.properties
new file mode 100644
index 0000000..fee7cbb
--- /dev/null
+++ b/modules/yardstick/config/benchmark-sample.properties
@@ -0,0 +1,62 @@
+# 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.
+
+#
+# Contains benchmarks for ATOMIC cache.
+#
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+# JVM_OPTS=${JVM_OPTS}" \
+# -XX:+UseParNewGC \
+# -XX:+UseConcMarkSweepGC \
+# -XX:+UseTLAB \
+# -XX:NewSize=128m \
+# -XX:MaxNewSize=128m \
+# -XX:MaxTenuringThreshold=0 \
+# -XX:SurvivorRatio=1024 \
+# -XX:+UseCMSInitiatingOccupancyOnly \
+# -XX:CMSInitiatingOccupancyFraction=60 \
+#"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost,localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+DRIVER_HOSTS=localhost
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgnitePutBenchmark -sn IgniteNode -ds atomic-put-1-backup,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/605d946a/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml
index 4c4d138..d96fcc6 100644
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@ -35,7 +35,7 @@
<url>http://ignite.apache.org</url>
<properties>
- <yardstick.version>0.8.0</yardstick.version>
+ <yardstick.version>0.8.2</yardstick.version>
<spring.version>4.1.0.RELEASE</spring.version>
</properties>
@@ -56,7 +56,7 @@
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
http://git-wip-us.apache.org/repos/asf/ignite/blob/605d946a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 790cd4b..ea76053 100644
--- a/pom.xml
+++ b/pom.xml
@@ -506,6 +506,7 @@
<fileset dir="${basedir}/target/release-package/benchmarks/config/">
<include name="*.*" />
<exclude name="benchmark.properties"/>
+ <exclude name="benchmark-sample.properties"/>
<exclude name="benchmark-multicast.properties"/>
<exclude name="ignite-base-config.xml"/>
<exclude name="ignite-localhost-config.xml"/>
[38/50] [abbrv] ignite git commit: IGNITE-4436 API for collecting
list of running queries and cancel them.
Posted by yz...@apache.org.
IGNITE-4436 API for collecting list of running queries and cancel them.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/49237343
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/49237343
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/49237343
Branch: refs/heads/ignite-comm-balance-master
Commit: 49237343d53ee33d44e5599cd7fe7da868ee30a1
Parents: 8e12513
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Feb 14 20:54:31 2017 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Feb 14 20:54:31 2017 +0700
----------------------------------------------------------------------
.../processors/query/GridQueryIndexing.java | 17 +-
.../processors/query/GridQueryProcessor.java | 32 ++-
.../processors/query/GridRunningQueryInfo.java | 132 ++++++++++++
.../internal/visor/VisorMultiNodeTask.java | 2 +-
.../visor/query/VisorCancelQueriesTask.java | 72 +++++++
.../query/VisorCollectRunningQueriesTask.java | 96 +++++++++
.../internal/visor/query/VisorRunningQuery.java | 132 ++++++++++++
.../cache/query/GridCacheTwoStepQuery.java | 18 +-
.../processors/query/h2/IgniteH2Indexing.java | 81 +++++++-
.../query/h2/sql/GridSqlQuerySplitter.java | 4 +-
.../h2/twostep/GridReduceQueryExecutor.java | 60 +++++-
.../cache/CacheSqlQueryValueCopySelfTest.java | 208 +++++++++++++++++--
.../cache/GridCacheCrossCacheQuerySelfTest.java | 2 +-
.../h2/GridIndexingSpiAbstractSelfTest.java | 7 +
14 files changed, 823 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index ef39d96..ca04724 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -241,7 +241,22 @@ public interface GridQueryIndexing {
public PreparedStatement prepareNativeStatement(String schema, String sql) throws SQLException;
/**
+ * Collect queries that already running more than specified duration.
+ *
+ * @param duration Duration to check.
+ * @return Collection of long running queries.
+ */
+ public Collection<GridRunningQueryInfo> runningQueries(long duration);
+
+ /**
+ * Cancel specified queries.
+ *
+ * @param queries Queries ID's to cancel.
+ */
+ public void cancelQueries(Collection<Long> queries);
+
+ /**
* Cancels all executing queries.
*/
public void cancelAllQueries();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index cb7c7e7..ee9224b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -44,7 +44,6 @@ import javax.cache.Cache;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.binary.BinaryField;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
@@ -119,7 +118,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
private static final int QRY_DETAIL_METRICS_EVICTION_FREQ = 3_000;
/** */
- private static Set<Class<?>> SQL_TYPES = new HashSet<>(F.<Class<?>>asList(
+ private static final Set<Class<?>> SQL_TYPES = new HashSet<>(F.<Class<?>>asList(
Integer.class,
Boolean.class,
Byte.class,
@@ -920,6 +919,29 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * Collect queries that already running more than specified duration.
+ *
+ * @param duration Duration to check.
+ * @return Collection of long running queries.
+ */
+ public Collection<GridRunningQueryInfo> runningQueries(long duration) {
+ if (moduleEnabled())
+ return idx.runningQueries(duration);
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Cancel specified queries.
+ *
+ * @param queries Queries ID's to cancel.
+ */
+ public void cancelQueries(Collection<Long> queries) {
+ if (moduleEnabled())
+ idx.cancelQueries(queries);
+ }
+
+ /**
* @param sqlQry Sql query.
* @param params Params.
*/
@@ -2731,7 +2753,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/** Accessor that deals with fields. */
- private final static class FieldAccessor implements PropertyAccessor {
+ private static final class FieldAccessor implements PropertyAccessor {
/** Field to access. */
private final Field fld;
@@ -2774,7 +2796,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/** Getter and setter methods based accessor. */
- private final static class MethodsAccessor implements PropertyAccessor {
+ private static final class MethodsAccessor implements PropertyAccessor {
/** */
private final Method getter;
@@ -2832,7 +2854,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/** Accessor with getter only. */
- private final static class ReadOnlyMethodsAccessor implements PropertyAccessor {
+ private static final class ReadOnlyMethodsAccessor implements PropertyAccessor {
/** */
private final Method getter;
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
new file mode 100644
index 0000000..d77c8c0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
@@ -0,0 +1,132 @@
+/*
+ * 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.query;
+
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
+
+/**
+ * Query descriptor.
+ */
+public class GridRunningQueryInfo {
+ /** */
+ private final long id;
+
+ /** */
+ private final String qry;
+
+ /** Query type. */
+ private final GridCacheQueryType qryType;
+
+ /** */
+ private final String cache;
+
+ /** */
+ private final long startTime;
+
+ /** */
+ private final GridQueryCancel cancel;
+
+ /** */
+ private final boolean loc;
+
+ /**
+ * @param id Query ID.
+ * @param qry Query text.
+ * @param qryType Query type.
+ * @param cache Cache where query was executed.
+ * @param startTime Query start time.
+ * @param cancel Query cancel.
+ * @param loc Local query flag.
+ */
+ public GridRunningQueryInfo(Long id, String qry, GridCacheQueryType qryType, String cache, long startTime,
+ GridQueryCancel cancel, boolean loc) {
+ this.id = id;
+ this.qry = qry;
+ this.qryType = qryType;
+ this.cache = cache;
+ this.startTime = startTime;
+ this.cancel = cancel;
+ this.loc = loc;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public Long id() {
+ return id;
+ }
+
+ /**
+ * @return Query text.
+ */
+ public String query() {
+ return qry;
+ }
+
+ /**
+ * @return Query type.
+ */
+ public GridCacheQueryType queryType() {
+ return qryType;
+ }
+
+ /**
+ * @return Cache where query was executed.
+ */
+ public String cache() {
+ return cache;
+ }
+
+ /**
+ * @return Query start time.
+ */
+ public long startTime() {
+ return startTime;
+ }
+
+ /**
+ * @param curTime Current time.
+ * @param duration Duration of long query.
+ * @return {@code true} if this query should be considered as long running query.
+ */
+ public boolean longQuery(long curTime, long duration) {
+ return curTime - startTime > duration;
+ }
+
+ /**
+ * Cancel query.
+ */
+ public void cancel() {
+ if (cancel != null)
+ cancel.cancel();
+ }
+
+ /**
+ * @return {@code true} if query can be cancelled.
+ */
+ public boolean cancelable() {
+ return cancel != null;
+ }
+
+ /**
+ * @return {@code true} if query is local.
+ */
+ public boolean local() {
+ return loc;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
index 57f1346..ece1a17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
@@ -130,4 +130,4 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
logFinish(ignite.log(), getClass(), start);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
new file mode 100644
index 0000000..a6f2d82
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.query;
+
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Task to cancel queries.
+ */
+@GridInternal
+public class VisorCancelQueriesTask extends VisorOneNodeTask<Collection<Long>, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCancelQueriesJob job(Collection<Long> arg) {
+ return new VisorCancelQueriesJob(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected Void reduce0(List<ComputeJobResult> results) throws IgniteException {
+ return null;
+ }
+
+ /**
+ * Job to cancel queries on node.
+ */
+ private static class VisorCancelQueriesJob extends VisorJob<Collection<Long>, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with specified argument.
+ *
+ * @param arg Job argument.
+ * @param debug Flag indicating whether debug information should be printed into node log.
+ */
+ protected VisorCancelQueriesJob(@Nullable Collection<Long> arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Void run(@Nullable Collection<Long> queries) throws IgniteException {
+ ignite.context().query().cancelQueries(queries);
+
+ return null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
new file mode 100644
index 0000000..2b40e61
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.query;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Task to collect currently running queries.
+ */
+@GridInternal
+public class VisorCollectRunningQueriesTask extends VisorMultiNodeTask<Long, Map<UUID, Collection<VisorRunningQuery>>, Collection<VisorRunningQuery>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCollectRunningQueriesJob job(Long arg) {
+ return new VisorCollectRunningQueriesJob(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected Map<UUID, Collection<VisorRunningQuery>> reduce0(List<ComputeJobResult> results) throws IgniteException {
+ Map<UUID, Collection<VisorRunningQuery>> map = new HashMap<>();
+
+ for (ComputeJobResult res : results)
+ if (res.getException() == null) {
+ Collection<VisorRunningQuery> queries = res.getData();
+
+ map.put(res.getNode().id(), queries);
+ }
+
+ return map;
+ }
+
+ /**
+ * Job to collect currently running queries from node.
+ */
+ private static class VisorCollectRunningQueriesJob extends VisorJob<Long, Collection<VisorRunningQuery>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with specified argument.
+ *
+ * @param arg Job argument.
+ * @param debug Flag indicating whether debug information should be printed into node log.
+ */
+ protected VisorCollectRunningQueriesJob(@Nullable Long arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Collection<VisorRunningQuery> run(@Nullable Long duration) throws IgniteException {
+ Collection<GridRunningQueryInfo> queries = ignite.context().query()
+ .runningQueries(duration != null ? duration : 0);
+
+ Collection<VisorRunningQuery> res = new ArrayList<>(queries.size());
+
+ long curTime = U.currentTimeMillis();
+
+ for (GridRunningQueryInfo qry : queries)
+ res.add(new VisorRunningQuery(qry.id(), qry.query(), qry.queryType(), qry.cache(),
+ qry.startTime(), curTime - qry.startTime(),
+ qry.cancelable(), qry.local()));
+
+ return res;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
new file mode 100644
index 0000000..fc6bc7a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.query;
+
+import java.io.Serializable;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
+
+/**
+ * Descriptor of running query.
+ */
+public class VisorRunningQuery implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private long id;
+
+ /** Query text. */
+ private String qry;
+
+ /** Query type. */
+ private GridCacheQueryType qryType;
+
+ /** Cache name for query. */
+ private String cache;
+
+ /** */
+ private long startTime;
+
+ /** */
+ private long duration;
+
+ /** */
+ private boolean cancellable;
+
+ /** */
+ private boolean loc;
+
+ /**
+ * @param id Query ID.
+ * @param qry Query text.
+ * @param qryType Query type.
+ * @param cache Cache where query was executed.
+ * @param startTime Query start time.
+ * @param duration Query current duration.
+ * @param cancellable {@code true} if query can be canceled.
+ * @param loc {@code true} if query is local.
+ */
+ public VisorRunningQuery(long id, String qry, GridCacheQueryType qryType, String cache,
+ long startTime, long duration,
+ boolean cancellable, boolean loc) {
+ this.id = id;
+ this.qry = qry;
+ this.qryType = qryType;
+ this.cache = cache;
+ this.startTime = startTime;
+ this.duration = duration;
+ this.cancellable = cancellable;
+ this.loc = loc;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @return Query txt.
+ */
+ public String getQuery() {
+ return qry;
+ }
+
+ /**
+ * @return Query type.
+ */
+ public GridCacheQueryType getQueryType() {
+ return qryType;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String getCache() {
+ return cache;
+ }
+
+ /**
+ * @return Query start time.
+ */
+ public long getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * @return Query duration.
+ */
+ public long getDuration() {
+ return duration;
+ }
+
+ /**
+ * @return {@code true} if query can be cancelled.
+ */
+ public boolean isCancelable() {
+ return cancellable;
+ }
+
+ /**
+ * @return {@code true} if query is local.
+ */
+ public boolean isLocal() {
+ return loc;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index 8dcba2f..f53936f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -46,6 +46,9 @@ public class GridCacheTwoStepQuery {
private boolean explain;
/** */
+ private String originalSql;
+
+ /** */
private Collection<String> spaces;
/** */
@@ -67,10 +70,12 @@ public class GridCacheTwoStepQuery {
private List<Integer> extraCaches;
/**
+ * @param originalSql Original query SQL.
* @param schemas Schema names in query.
* @param tbls Tables in query.
*/
- public GridCacheTwoStepQuery(Set<String> schemas, Set<String> tbls) {
+ public GridCacheTwoStepQuery(String originalSql, Set<String> schemas, Set<String> tbls) {
+ this.originalSql = originalSql;
this.schemas = schemas;
this.tbls = tbls;
}
@@ -196,6 +201,13 @@ public class GridCacheTwoStepQuery {
}
/**
+ * @return Original query SQL.
+ */
+ public String originalSql() {
+ return originalSql;
+ }
+
+ /**
* @return Spaces.
*/
public Collection<String> spaces() {
@@ -223,7 +235,7 @@ public class GridCacheTwoStepQuery {
public GridCacheTwoStepQuery copy(Object[] args) {
assert !explain;
- GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(schemas, tbls);
+ GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(originalSql, schemas, tbls);
cp.caches = caches;
cp.extraCaches = extraCaches;
@@ -250,4 +262,4 @@ public class GridCacheTwoStepQuery {
@Override public String toString() {
return S.toString(GridCacheTwoStepQuery.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 9416621..e4b0c1f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -52,6 +52,7 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
import javax.cache.Cache;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
@@ -81,6 +82,7 @@ import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
@@ -179,6 +181,9 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_H2_INDEXING_CACHE_
import static org.apache.ignite.IgniteSystemProperties.IGNITE_H2_INDEXING_CACHE_THREAD_USAGE_TIMEOUT;
import static org.apache.ignite.IgniteSystemProperties.getInteger;
import static org.apache.ignite.IgniteSystemProperties.getString;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL_FIELDS;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.TEXT;
import static org.apache.ignite.internal.processors.query.GridQueryIndexType.FULLTEXT;
import static org.apache.ignite.internal.processors.query.GridQueryIndexType.GEO_SPATIAL;
import static org.apache.ignite.internal.processors.query.GridQueryIndexType.SORTED;
@@ -286,9 +291,15 @@ public class IgniteH2Indexing implements GridQueryIndexing {
private final Map<String, String> space2schema = new ConcurrentHashMap8<>();
/** */
+ private AtomicLong qryIdGen;
+
+ /** */
private GridSpinBusyLock busyLock;
/** */
+ private final ConcurrentMap<Long, GridRunningQueryInfo> runs = new ConcurrentHashMap8<>();
+
+ /** */
private final ThreadLocal<ConnectionWrapper> connCache = new ThreadLocal<ConnectionWrapper>() {
@Nullable @Override public ConnectionWrapper get() {
ConnectionWrapper c = super.get();
@@ -773,8 +784,19 @@ public class IgniteH2Indexing implements GridQueryIndexing {
IndexingQueryFilter filters) throws IgniteCheckedException {
TableDescriptor tbl = tableDescriptor(spaceName, type);
- if (tbl != null && tbl.luceneIdx != null)
- return tbl.luceneIdx.query(qry, filters);
+ if (tbl != null && tbl.luceneIdx != null) {
+ GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, TEXT, spaceName,
+ U.currentTimeMillis(), null, true);
+
+ try {
+ runs.put(run.id(), run);
+
+ return tbl.luceneIdx.query(qry, filters);
+ }
+ finally {
+ runs.remove(run.id());
+ }
+ }
return new GridEmptyCloseableIterator<>();
}
@@ -832,6 +854,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridH2QueryContext.set(ctx);
+ GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, SQL_FIELDS,
+ spaceName, U.currentTimeMillis(), cancel, true);
+
+ runs.putIfAbsent(run.id(), run);
+
try {
ResultSet rs = executeSqlQueryWithTimer(spaceName, stmt, conn, qry, params, timeout, cancel);
@@ -839,6 +866,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
finally {
GridH2QueryContext.clearThreadLocal();
+
+ runs.remove(run.id());
}
}
};
@@ -1088,6 +1117,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridH2QueryContext.set(new GridH2QueryContext(nodeId, nodeId, 0, LOCAL).filter(filter).distributedJoins(false));
+ GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, SQL, spaceName,
+ U.currentTimeMillis(), null, true);
+
+ runs.put(run.id(), run);
+
try {
ResultSet rs = executeSqlQueryWithTimer(spaceName, conn, sql, params, true, 0, null);
@@ -1095,6 +1129,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
finally {
GridH2QueryContext.clearThreadLocal();
+
+ runs.remove(run.id());
}
}
@@ -1739,6 +1775,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
this.busyLock = busyLock;
+ qryIdGen = new AtomicLong();
+
if (SysProperties.serializeJavaObject) {
U.warn(log, "Serialization of Java objects in H2 was enabled.");
@@ -1793,7 +1831,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
marshaller = ctx.config().getMarshaller();
mapQryExec = new GridMapQueryExecutor(busyLock);
- rdcQryExec = new GridReduceQueryExecutor(busyLock);
+ rdcQryExec = new GridReduceQueryExecutor(qryIdGen, busyLock);
mapQryExec.start(ctx, this);
rdcQryExec.start(ctx, this);
@@ -2247,6 +2285,37 @@ public class IgniteH2Indexing implements GridQueryIndexing {
return cols;
}
+
+ /** {@inheritDoc} */
+ @Override public Collection<GridRunningQueryInfo> runningQueries(long duration) {
+ Collection<GridRunningQueryInfo> res = new ArrayList<>();
+
+ res.addAll(runs.values());
+ res.addAll(rdcQryExec.longRunningQueries(duration));
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cancelQueries(Collection<Long> queries) {
+ if (!F.isEmpty(queries)) {
+ for (Long qryId : queries) {
+ GridRunningQueryInfo run = runs.get(qryId);
+
+ if (run != null)
+ run.cancel();
+ }
+
+ rdcQryExec.cancelQueries(queries);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cancelAllQueries() {
+ for (Connection conn : conns)
+ U.close(conn, log);
+ }
+
/**
* Wrapper to store connection and flag is schema set or not.
*/
@@ -3157,10 +3226,4 @@ public class IgniteH2Indexing implements GridQueryIndexing {
lastUsage = U.currentTimeMillis();
}
}
-
- /** {@inheritDoc} */
- @Override public void cancelAllQueries() {
- for (Connection conn : conns)
- U.close(conn, log);
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 09952cf..e164315 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -174,7 +174,7 @@ public class GridSqlQuerySplitter {
qry = collectAllTables(qry, schemas, tbls);
// Build resulting two step query.
- GridCacheTwoStepQuery res = new GridCacheTwoStepQuery(schemas, tbls);
+ GridCacheTwoStepQuery res = new GridCacheTwoStepQuery(qry.getSQL(), schemas, tbls);
// Map query will be direct reference to the original query AST.
// Thus all the modifications will be performed on the original AST, so we should be careful when
@@ -958,4 +958,4 @@ public class GridSqlQuerySplitter {
private static GridSqlFunction function(GridSqlFunctionType type) {
return new GridSqlFunction(type);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index cbe1599..f54fab6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -62,6 +62,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartit
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
@@ -98,6 +99,7 @@ import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL_FIELDS;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.REDUCE;
/**
@@ -120,7 +122,7 @@ public class GridReduceQueryExecutor {
private IgniteLogger log;
/** */
- private final AtomicLong reqIdGen = new AtomicLong();
+ private final AtomicLong qryIdGen;
/** */
private final ConcurrentMap<Long, QueryRun> runs = new ConcurrentHashMap8<>();
@@ -167,9 +169,11 @@ public class GridReduceQueryExecutor {
};
/**
+ * @param qryIdGen Query ID generator.
* @param busyLock Busy lock.
*/
- public GridReduceQueryExecutor(GridSpinBusyLock busyLock) {
+ public GridReduceQueryExecutor(AtomicLong qryIdGen, GridSpinBusyLock busyLock) {
+ this.qryIdGen = qryIdGen;
this.busyLock = busyLock;
}
@@ -493,11 +497,13 @@ public class GridReduceQueryExecutor {
}
}
- final long qryReqId = reqIdGen.incrementAndGet();
+ final long qryReqId = qryIdGen.incrementAndGet();
final String space = cctx.name();
- final QueryRun r = new QueryRun(h2.connectionForSpace(space), qry.mapQueries().size(), qry.pageSize());
+ final QueryRun r = new QueryRun(qryReqId, qry.originalSql(), space,
+ h2.connectionForSpace(space), qry.mapQueries().size(), qry.pageSize(),
+ U.currentTimeMillis(), cancel);
AffinityTopologyVersion topVer = h2.readyTopologyVersion();
@@ -1303,10 +1309,46 @@ public class GridReduceQueryExecutor {
}
/**
+ * Collect queries that already running more than specified duration.
+ *
+ * @param duration Duration to check.
+ * @return Collection of IDs and statements of long running queries.
+ */
+ public Collection<GridRunningQueryInfo> longRunningQueries(long duration) {
+ Collection<GridRunningQueryInfo> res = new ArrayList<>();
+
+ long curTime = U.currentTimeMillis();
+
+ for (QueryRun run : runs.values()) {
+ if (run.qry.longQuery(curTime, duration))
+ res.add(run.qry);
+ }
+
+ return res;
+ }
+
+ /**
+ * Cancel specified queries.
+ *
+ * @param queries Queries IDs to cancel.
+ */
+ public void cancelQueries(Collection<Long> queries) {
+ for (Long qryId : queries) {
+ QueryRun run = runs.get(qryId);
+
+ if (run != null)
+ run.qry.cancel();
+ }
+ }
+
+ /**
* Query run.
*/
private static class QueryRun {
/** */
+ private final GridRunningQueryInfo qry;
+
+ /** */
private final List<GridMergeIndex> idxs;
/** */
@@ -1322,11 +1364,17 @@ public class GridReduceQueryExecutor {
private final AtomicReference<Object> state = new AtomicReference<>();
/**
+ * @param id Query ID.
+ * @param qry Query text.
+ * @param cache Cache where query was executed.
* @param conn Connection.
* @param idxsCnt Number of indexes.
* @param pageSize Page size.
+ * @param startTime Start time.
+ * @param cancel Query cancel handler.
*/
- private QueryRun(Connection conn, int idxsCnt, int pageSize) {
+ private QueryRun(Long id, String qry, String cache, Connection conn, int idxsCnt, int pageSize, long startTime, GridQueryCancel cancel) {
+ this.qry = new GridRunningQueryInfo(id, qry, SQL_FIELDS, cache, startTime, cancel, false);
this.conn = (JdbcConnection)conn;
this.idxs = new ArrayList<>(idxsCnt);
this.pageSize = pageSize > 0 ? pageSize : GridCacheTwoStepQuery.DFLT_PAGE_SIZE;
@@ -1384,4 +1432,4 @@ public class GridReduceQueryExecutor {
return copy(msg, n, partsMap);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
index e47e893..66e7e4a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
@@ -17,15 +17,23 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -54,6 +62,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
cc.setCopyOnRead(true);
cc.setIndexedTypes(Integer.class, Value.class);
+ cc.setSqlFunctionClasses(TestSQLFunctions.class);
cfg.setCacheConfiguration(cc);
@@ -72,7 +81,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
IgniteCache<Integer, Value> cache = grid(0).cache(null);
for (int i = 0; i < KEYS; i++)
- cache.put(i, new Value("before"));
+ cache.put(i, new Value(i, "before-" + i));
}
/** {@inheritDoc} */
@@ -195,17 +204,148 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
check(cache);
}
- /** */
- private static class Value {
- /** */
- private String str;
+ /**
+ * Run specified query in separate thread.
+ *
+ * @param qry Query to execute.
+ */
+ private IgniteInternalFuture<?> runQueryAsync(final Query<?> qry) throws Exception {
+ return multithreadedAsync(new Runnable() {
+ @Override public void run() {
+ try {
+ log.info(">>> Query started");
+
+ grid(0).cache(null).query(qry).getAll();
+
+ log.info(">>> Query finished");
+ }
+ catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ }, 1, "run-query");
+ }
- /**
- * @param str String.
- */
- public Value(String str) {
- this.str = str;
+ /**
+ * Test collecting info about running.
+ *
+ * @throws Exception If failed.
+ */
+ public void testRunningSqlFieldsQuery() throws Exception {
+ IgniteInternalFuture<?> fut = runQueryAsync(new SqlFieldsQuery("select _val, sleep(1000) from Value limit 3"));
+
+ Thread.sleep(500);
+
+ GridQueryProcessor qryProc = grid(0).context().query();
+
+ Collection<GridRunningQueryInfo> queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ fut.get();
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select _val, sleep(1000) from Value limit 3");
+ qry.setLocal(true);
+
+ fut = runQueryAsync(qry);
+
+ Thread.sleep(500);
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ fut.get();
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
+ }
+
+ /**
+ * Test collecting info about running.
+ *
+ * @throws Exception If failed.
+ */
+ public void testRunningSqlQuery() throws Exception {
+ IgniteInternalFuture<?> fut = runQueryAsync(new SqlQuery<Integer, Value>(Value.class, "id > sleep(100)"));
+
+ Thread.sleep(500);
+
+ GridQueryProcessor qryProc = grid(0).context().query();
+
+ Collection<GridRunningQueryInfo> queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ fut.get();
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
+
+ SqlQuery<Integer, Value> qry = new SqlQuery<>(Value.class, "id > sleep(100)");
+ qry.setLocal(true);
+
+ fut = runQueryAsync(qry);
+
+ Thread.sleep(500);
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ fut.get();
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
+ }
+
+ /**
+ * Test collecting info about running.
+ *
+ * @throws Exception If failed.
+ */
+ public void testCancelingSqlFieldsQuery() throws Exception {
+ runQueryAsync(new SqlFieldsQuery("select * from (select _val, sleep(100) from Value limit 50)"));
+
+ Thread.sleep(500);
+
+ final GridQueryProcessor qryProc = grid(0).context().query();
+
+ Collection<GridRunningQueryInfo> queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ final Collection<GridRunningQueryInfo> finalQueries = queries;
+
+ for (GridRunningQueryInfo query : finalQueries)
+ qryProc.cancelQueries(Collections.singleton(query.id()));
+
+ int n = 100;
+
+ // Give cluster some time to cancel query and cleanup resources.
+ while (n > 0) {
+ Thread.sleep(100);
+
+ queries = qryProc.runningQueries(0);
+
+ if (queries.isEmpty())
+ break;
+
+ log.info(">>>> Wait for cancel: " + n);
+
+ n--;
}
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
}
/**
@@ -218,9 +358,53 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
for (Cache.Entry<Integer, Value> entry : cache) {
cnt++;
- assertEquals("before", entry.getValue().str);
+ assertEquals("before-" + entry.getKey(), entry.getValue().str);
}
assertEquals(KEYS, cnt);
}
-}
\ No newline at end of file
+
+ /** */
+ private static class Value {
+ /** */
+ @QuerySqlField
+ private int id;
+
+ /** */
+ @QuerySqlField
+ private String str;
+
+ /**
+ * @param id ID.
+ * @param str String.
+ */
+ public Value(int id, String str) {
+ this.id = id;
+ this.str = str;
+ }
+ }
+
+ /**
+ * Utility class with custom SQL functions.
+ */
+ public static class TestSQLFunctions {
+ /**
+ * Sleep function to simulate long running queries.
+ *
+ * @param x Time to sleep.
+ * @return Return specified argument.
+ */
+ @QuerySqlFunction
+ public static long sleep(long x) {
+ if (x >= 0)
+ try {
+ Thread.sleep(x);
+ }
+ catch (InterruptedException ignored) {
+ // No-op.
+ }
+
+ return x;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
index 1f10593..01fefa3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
@@ -477,4 +477,4 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest {
return storeId;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49237343/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 12da5f7..52084c7 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -106,6 +106,9 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
spi.registerCache(null, cacheCfg("B"));
}
+ /**
+ * @param name Name.
+ */
private CacheConfiguration cacheCfg(String name) {
CacheConfiguration<?,?> cfg = new CacheConfiguration<>();
@@ -114,6 +117,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
return cfg;
}
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
idx.stop();
@@ -182,6 +186,9 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
return idx;
}
+ /**
+ * @return {@code true} if OFF-HEAP mode should be tested.
+ */
protected boolean offheap() {
return false;
}
[09/50] [abbrv] ignite git commit: IGNITE-4363: SQL: fixed inner
property updates for DML operations.
Posted by yz...@apache.org.
IGNITE-4363: SQL: fixed inner property updates for DML operations.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/70cd8e45
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/70cd8e45
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/70cd8e45
Branch: refs/heads/ignite-comm-balance-master
Commit: 70cd8e452b94b806a2fe6fe00b4b67ce80eb4373
Parents: 0726d32
Author: Alexander Paschenko <al...@gmail.com>
Authored: Tue Feb 7 11:41:08 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Feb 7 11:41:08 2017 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 16 ++-
.../processors/query/GridQueryProcessor.java | 81 ++++++++++----
.../processors/query/GridQueryProperty.java | 21 ++--
.../query/h2/DmlStatementsProcessor.java | 69 ++++++------
.../query/h2/dml/UpdatePlanBuilder.java | 105 +++++++++++++------
...niteCacheAbstractInsertSqlQuerySelfTest.java | 4 +
.../IgniteCacheAbstractSqlDmlQuerySelfTest.java | 2 +-
.../IgniteCacheInsertSqlQuerySelfTest.java | 22 ++++
.../cache/IgniteCacheMergeSqlQuerySelfTest.java | 24 +++++
.../IgniteCacheUpdateSqlQuerySelfTest.java | 63 +++++++++--
.../h2/GridIndexingSpiAbstractSelfTest.java | 5 +
11 files changed, 301 insertions(+), 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/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 0656dda..f0179ca 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
@@ -2358,9 +2358,13 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
prop.parent(parent);
- processAnnotation(key, sqlAnn, txtAnn, field.getType(), prop, type);
-
+ // Add parent property before its possible nested properties so that
+ // resulting parent column comes before columns corresponding to those
+ // nested properties in the resulting table - that way nested
+ // properties override will happen properly (first parent, then children).
type.addProperty(prop, key, true);
+
+ processAnnotation(key, sqlAnn, txtAnn, field.getType(), prop, type);
}
}
@@ -2380,9 +2384,13 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
prop.parent(parent);
- processAnnotation(key, sqlAnn, txtAnn, mtd.getReturnType(), prop, type);
-
+ // Add parent property before its possible nested properties so that
+ // resulting parent column comes before columns corresponding to those
+ // nested properties in the resulting table - that way nested
+ // properties override will happen properly (first parent, then children).
type.addProperty(prop, key, true);
+
+ processAnnotation(key, sqlAnn, txtAnn, mtd.getReturnType(), prop, type);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index a239ee2..5bfdde8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -64,6 +64,7 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryObjectEx;
+import org.apache.ignite.internal.binary.BinaryObjectExImpl;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
@@ -1948,7 +1949,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/**
* Description of type property.
*/
- private static class ClassProperty extends GridQueryProperty {
+ private static class ClassProperty implements GridQueryProperty {
/** */
private final PropertyAccessor accessor;
@@ -2041,12 +2042,17 @@ public class GridQueryProcessor extends GridProcessorAdapter {
@Override public String toString() {
return S.toString(ClassProperty.class, this);
}
+
+ /** {@inheritDoc} */
+ @Override public GridQueryProperty parent() {
+ return parent;
+ }
}
/**
*
*/
- private class BinaryProperty extends GridQueryProperty {
+ private class BinaryProperty implements GridQueryProperty {
/** Property name. */
private String propName;
@@ -2130,11 +2136,17 @@ public class GridQueryProcessor extends GridProcessorAdapter {
obj = isKeyProp0 == 1 ? key : val;
}
- assert obj instanceof BinaryObject;
-
- BinaryObject obj0 = (BinaryObject)obj;
+ if (obj instanceof BinaryObject) {
+ BinaryObject obj0 = (BinaryObject) obj;
+ return fieldValue(obj0);
+ }
+ else if (obj instanceof BinaryObjectBuilder) {
+ BinaryObjectBuilder obj0 = (BinaryObjectBuilder)obj;
- return fieldValue(obj0);
+ return obj0.getField(name());
+ }
+ else
+ throw new IgniteCheckedException("Unexpected binary object class [type=" + obj.getClass() + ']');
}
/** {@inheritDoc} */
@@ -2144,10 +2156,38 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (obj == null)
return;
+ Object srcObj = obj;
+
+ if (!(srcObj instanceof BinaryObjectBuilder))
+ throw new UnsupportedOperationException("Individual properties can be set for binary builders only");
+
+ if (parent != null)
+ obj = parent.value(key, val);
+
+ boolean needsBuild = false;
+
+ if (obj instanceof BinaryObjectExImpl) {
+ if (parent == null)
+ throw new UnsupportedOperationException("Individual properties can be set for binary builders only");
+
+ needsBuild = true;
+
+ obj = ((BinaryObjectExImpl)obj).toBuilder();
+ }
+
if (!(obj instanceof BinaryObjectBuilder))
throw new UnsupportedOperationException("Individual properties can be set for binary builders only");
setValue0((BinaryObjectBuilder) obj, propName, propVal, type());
+
+ if (needsBuild) {
+ obj = ((BinaryObjectBuilder) obj).build();
+
+ assert parent != null;
+
+ // And now let's set this newly constructed object to parent
+ setValue0((BinaryObjectBuilder) srcObj, parent.propName, obj, obj.getClass());
+ }
}
/**
@@ -2224,6 +2264,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
return isKeyProp0 == 1;
}
+
+ /** {@inheritDoc} */
+ @Override public GridQueryProperty parent() {
+ return parent;
+ }
}
/**
@@ -2307,7 +2352,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public GridQueryProperty property(String name) {
- return getProperty(name);
+ GridQueryProperty res = props.get(name);
+
+ if (res == null)
+ res = uppercaseProps.get(name.toUpperCase());
+
+ return res;
}
/** {@inheritDoc} */
@@ -2315,7 +2365,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
@Override public <T> T value(String field, Object key, Object val) throws IgniteCheckedException {
assert field != null;
- GridQueryProperty prop = getProperty(field);
+ GridQueryProperty prop = property(field);
if (prop == null)
throw new IgniteCheckedException("Failed to find field '" + field + "' in type '" + name + "'.");
@@ -2329,7 +2379,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throws IgniteCheckedException {
assert field != null;
- GridQueryProperty prop = getProperty(field);
+ GridQueryProperty prop = property(field);
if (prop == null)
throw new IgniteCheckedException("Failed to find field '" + field + "' in type '" + name + "'.");
@@ -2469,19 +2519,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
fields.put(name, prop.type());
}
- /**
- * @param field Property name.
- * @return Property with given field name.
- */
- private GridQueryProperty getProperty(String field) {
- GridQueryProperty res = props.get(field);
-
- if (res == null)
- res = uppercaseProps.get(field.toUpperCase());
-
- return res;
- }
-
/** {@inheritDoc} */
@Override public boolean valueTextIndex() {
return valTextIdx;
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java
index 5d74a2e..fb4c037 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProperty.java
@@ -22,11 +22,7 @@ import org.apache.ignite.IgniteCheckedException;
/**
* Description and access method for query entity field.
*/
-public abstract class GridQueryProperty {
- /** */
- public GridQueryProperty() {
- }
-
+public interface GridQueryProperty {
/**
* Gets this property value from the given object.
*
@@ -35,7 +31,7 @@ public abstract class GridQueryProperty {
* @return Property value.
* @throws IgniteCheckedException If failed.
*/
- public abstract Object value(Object key, Object val) throws IgniteCheckedException;
+ public Object value(Object key, Object val) throws IgniteCheckedException;
/**
* Sets this property value for the given object.
@@ -45,21 +41,26 @@ public abstract class GridQueryProperty {
* @param propVal Property value.
* @throws IgniteCheckedException If failed.
*/
- public abstract void setValue(Object key, Object val, Object propVal) throws IgniteCheckedException;
+ public void setValue(Object key, Object val, Object propVal) throws IgniteCheckedException;
/**
* @return Property name.
*/
- public abstract String name();
+ public String name();
/**
* @return Class member type.
*/
- public abstract Class<?> type();
+ public Class<?> type();
/**
* Property ownership flag.
* @return {@code true} if this property belongs to key, {@code false} if it belongs to value.
*/
- public abstract boolean key();
+ public boolean key();
+
+ /**
+ * @return Parent property or {@code null} if this property is not nested.
+ */
+ public GridQueryProperty parent();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index 4030758..7995083 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -59,7 +59,6 @@ import org.apache.ignite.internal.processors.query.GridQueryProperty;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.h2.dml.FastUpdateArguments;
-import org.apache.ignite.internal.processors.query.h2.dml.KeyValueSupplier;
import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan;
import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
@@ -481,7 +480,6 @@ public class DmlStatementsProcessor {
while (it.hasNext()) {
List<?> e = it.next();
Object key = e.get(0);
- Object val = (hasNewVal ? e.get(valColIdx) : e.get(1));
Object newVal;
@@ -500,9 +498,6 @@ public class DmlStatementsProcessor {
if (newVal == null)
throw new IgniteSQLException("New value for UPDATE must not be null", IgniteQueryErrorCode.NULL_VALUE);
- if (bin && !(val instanceof BinaryObject))
- val = cctx.grid().binary().toBinary(val);
-
// Skip key and value - that's why we start off with 2nd column
for (int i = 0; i < plan.tbl.getColumns().length - 2; i++) {
Column c = plan.tbl.getColumn(i + 2);
@@ -514,13 +509,10 @@ public class DmlStatementsProcessor {
boolean hasNewColVal = newColVals.containsKey(c.getName());
- // Binary objects get old field values from the Builder, so we can skip what we're not updating
- if (bin && !hasNewColVal)
+ if (!hasNewColVal)
continue;
- // Column values that have been explicitly specified have priority over field values in old or new _val
- // If no value given for the column, then we expect to find it in value, and not in key - hence null arg.
- Object colVal = hasNewColVal ? newColVals.get(c.getName()) : prop.value(null, val);
+ Object colVal = newColVals.get(c.getName());
// UPDATE currently does not allow to modify key or its fields, so we must be safe to pass null as key.
desc.setColumnValue(null, newVal, colVal, i);
@@ -696,8 +688,8 @@ public class DmlStatementsProcessor {
// If we have just one item to put, just do so
if (plan.rowsNum == 1) {
- IgniteBiTuple t = rowToKeyValue(cctx, cursor.iterator().next().toArray(), plan.colNames, plan.colTypes, plan.keySupplier,
- plan.valSupplier, plan.keyColIdx, plan.valColIdx, desc);
+ IgniteBiTuple t = rowToKeyValue(cctx, cursor.iterator().next(),
+ plan);
cctx.cache().put(t.getKey(), t.getValue());
return 1;
@@ -709,8 +701,7 @@ public class DmlStatementsProcessor {
for (Iterator<List<?>> it = cursor.iterator(); it.hasNext();) {
List<?> row = it.next();
- IgniteBiTuple t = rowToKeyValue(cctx, row.toArray(), plan.colNames, plan.colTypes, plan.keySupplier, plan.valSupplier,
- plan.keyColIdx, plan.valColIdx, desc);
+ IgniteBiTuple t = rowToKeyValue(cctx, row, plan);
rows.put(t.getKey(), t.getValue());
@@ -742,8 +733,7 @@ public class DmlStatementsProcessor {
// If we have just one item to put, just do so
if (plan.rowsNum == 1) {
- IgniteBiTuple t = rowToKeyValue(cctx, cursor.iterator().next().toArray(), plan.colNames, plan.colTypes,
- plan.keySupplier, plan.valSupplier, plan.keyColIdx, plan.valColIdx, desc);
+ IgniteBiTuple t = rowToKeyValue(cctx, cursor.iterator().next(), plan);
if (cctx.cache().putIfAbsent(t.getKey(), t.getValue()))
return 1;
@@ -768,8 +758,7 @@ public class DmlStatementsProcessor {
while (it.hasNext()) {
List<?> row = it.next();
- final IgniteBiTuple t = rowToKeyValue(cctx, row.toArray(), plan.colNames, plan.colTypes, plan.keySupplier,
- plan.valSupplier, plan.keyColIdx, plan.valColIdx, desc);
+ final IgniteBiTuple t = rowToKeyValue(cctx, row, plan);
rows.put(t.getKey(), new InsertEntryProcessor(t.getValue()));
@@ -837,21 +826,14 @@ public class DmlStatementsProcessor {
* Convert row presented as an array of Objects into key-value pair to be inserted to cache.
* @param cctx Cache context.
* @param row Row to process.
- * @param cols Query cols.
- * @param colTypes Column types to convert data from {@code row} to.
- * @param keySupplier Key instantiation method.
- * @param valSupplier Key instantiation method.
- * @param keyColIdx Key column index, or {@code -1} if no key column is mentioned in {@code cols}.
- * @param valColIdx Value column index, or {@code -1} if no value column is mentioned in {@code cols}.
- * @param rowDesc Row descriptor.
+ * @param plan Update plan.
* @throws IgniteCheckedException if failed.
*/
@SuppressWarnings({"unchecked", "ConstantConditions", "ResultOfMethodCallIgnored"})
- private IgniteBiTuple<?, ?> rowToKeyValue(GridCacheContext cctx, Object[] row, String[] cols,
- int[] colTypes, KeyValueSupplier keySupplier, KeyValueSupplier valSupplier, int keyColIdx, int valColIdx,
- GridH2RowDescriptor rowDesc) throws IgniteCheckedException {
- Object key = keySupplier.apply(F.asList(row));
- Object val = valSupplier.apply(F.asList(row));
+ private IgniteBiTuple<?, ?> rowToKeyValue(GridCacheContext cctx, List<?> row, UpdatePlan plan)
+ throws IgniteCheckedException {
+ Object key = plan.keySupplier.apply(row);
+ Object val = plan.valSupplier.apply(row);
if (key == null)
throw new IgniteSQLException("Key for INSERT or MERGE must not be null", IgniteQueryErrorCode.NULL_KEY);
@@ -859,13 +841,32 @@ public class DmlStatementsProcessor {
if (val == null)
throw new IgniteSQLException("Value for INSERT or MERGE must not be null", IgniteQueryErrorCode.NULL_VALUE);
- GridQueryTypeDescriptor desc = rowDesc.type();
+ GridQueryTypeDescriptor desc = plan.tbl.rowDescriptor().type();
+
+ Map<String, Object> newColVals = new HashMap<>();
+
+ for (int i = 0; i < plan.colNames.length; i++) {
+ if (i == plan.keyColIdx || i == plan.valColIdx)
+ continue;
+
+ newColVals.put(plan.colNames[i], convert(row.get(i), plan.colNames[i],
+ plan.tbl.rowDescriptor(), plan.colTypes[i]));
+ }
+
+ // We update columns in the order specified by the table for a reason - table's
+ // column order preserves their precedence for correct update of nested properties.
+ Column[] cols = plan.tbl.getColumns();
- for (int i = 0; i < cols.length; i++) {
- if (i == keyColIdx || i == valColIdx)
+ // First 2 columns are _key and _val, skip 'em.
+ for (int i = 2; i < cols.length; i++) {
+ String colName = cols[i].getName();
+
+ if (!newColVals.containsKey(colName))
continue;
- desc.setValue(cols[i], key, val, convert(row[i], cols[i], rowDesc, colTypes[i]));
+ Object colVal = newColVals.get(colName);
+
+ desc.setValue(colName, key, val, colVal);
}
if (cctx.binaryMarshaller()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
index fdcd164..ce2971a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlTable;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlUnion;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlUpdate;
import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.h2.command.Prepared;
import org.h2.table.Column;
@@ -192,8 +193,8 @@ public final class UpdatePlanBuilder {
hasValProps = true;
}
- KeyValueSupplier keySupplier = createSupplier(cctx, desc.type(), keyColIdx, hasKeyProps, true);
- KeyValueSupplier valSupplier = createSupplier(cctx, desc.type(), valColIdx, hasValProps, false);
+ KeyValueSupplier keySupplier = createSupplier(cctx, desc.type(), keyColIdx, hasKeyProps, true, false);
+ KeyValueSupplier valSupplier = createSupplier(cctx, desc.type(), valColIdx, hasValProps, false, false);
if (stmt instanceof GridSqlMerge)
return UpdatePlan.forMerge(tbl.dataTable(), colNames, colTypes, keySupplier, valSupplier, keyColIdx,
@@ -253,8 +254,6 @@ public final class UpdatePlanBuilder {
GridSqlSelect sel;
if (stmt instanceof GridSqlUpdate) {
- boolean bin = desc.context().binaryMarshaller();
-
List<GridSqlColumn> updatedCols = ((GridSqlUpdate) stmt).cols();
int valColIdx = -1;
@@ -282,20 +281,10 @@ public final class UpdatePlanBuilder {
if (hasNewVal)
valColIdx += 2;
- int newValColIdx;
-
- if (!hasProps) // No distinct properties, only whole new value - let's take it
- newValColIdx = valColIdx;
- else if (bin) // We update distinct columns in binary mode - let's choose correct index for the builder
- newValColIdx = (hasNewVal ? valColIdx : 1);
- else // Distinct properties, non binary mode - let's instantiate.
- newValColIdx = -1;
+ int newValColIdx = (hasNewVal ? valColIdx : 1);
- // We want supplier to take present value only in case of binary mode as it will create
- // whole new object as a result anyway, so we don't need to copy previous property values explicitly.
- // Otherwise we always want it to instantiate new object whose properties we will later
- // set to current values.
- KeyValueSupplier newValSupplier = createSupplier(desc.context(), desc.type(), newValColIdx, hasProps, false);
+ KeyValueSupplier newValSupplier = createSupplier(desc.context(), desc.type(), newValColIdx, hasProps,
+ false, true);
sel = DmlAstUtils.selectForUpdate((GridSqlUpdate) stmt, errKeysPos);
@@ -319,11 +308,11 @@ public final class UpdatePlanBuilder {
* @param hasProps Whether column list affects individual properties of key or value.
* @param key Whether supplier should be created for key or for value.
* @return Closure returning key or value.
- * @throws IgniteCheckedException
+ * @throws IgniteCheckedException If failed.
*/
@SuppressWarnings({"ConstantConditions", "unchecked"})
private static KeyValueSupplier createSupplier(final GridCacheContext<?, ?> cctx, GridQueryTypeDescriptor desc,
- final int colIdx, boolean hasProps, final boolean key) throws IgniteCheckedException {
+ final int colIdx, boolean hasProps, final boolean key, boolean forUpdate) throws IgniteCheckedException {
final String typeName = key ? desc.keyTypeName() : desc.valueTypeName();
//Try to find class for the key locally.
@@ -332,15 +321,10 @@ public final class UpdatePlanBuilder {
boolean isSqlType = GridQueryProcessor.isSqlType(cls);
- // If we don't need to construct anything from scratch, just return value from array.
- if (isSqlType || !hasProps || !cctx.binaryMarshaller()) {
+ // If we don't need to construct anything from scratch, just return value from given list.
+ if (isSqlType || !hasProps) {
if (colIdx != -1)
- return new KeyValueSupplier() {
- /** {@inheritDoc} */
- @Override public Object apply(List<?> arg) throws IgniteCheckedException {
- return arg.get(colIdx);
- }
- };
+ return new PlainValueSupplier(colIdx);
else if (isSqlType)
// Non constructable keys and values (SQL types) must be present in the query explicitly.
throw new IgniteCheckedException((key ? "Key" : "Value") + " is missing from query");
@@ -352,7 +336,12 @@ public final class UpdatePlanBuilder {
return new KeyValueSupplier() {
/** {@inheritDoc} */
@Override public Object apply(List<?> arg) throws IgniteCheckedException {
- BinaryObject bin = cctx.grid().binary().toBinary(arg.get(colIdx));
+ Object obj = arg.get(colIdx);
+
+ if (obj == null)
+ return null;
+
+ BinaryObject bin = cctx.grid().binary().toBinary(obj);
return cctx.grid().binary().builder(bin);
}
@@ -369,6 +358,26 @@ public final class UpdatePlanBuilder {
}
}
else {
+ if (colIdx != -1) {
+ if (forUpdate && colIdx == 1) {
+ // It's the case when the old value has to be taken as the basis for the new one on UPDATE,
+ // so we have to clone it. And on UPDATE we don't expect any key supplier.
+ assert !key;
+
+ return new KeyValueSupplier() {
+ /** {@inheritDoc} */
+ @Override public Object apply(List<?> arg) throws IgniteCheckedException {
+ byte[] oldPropBytes = cctx.marshaller().marshal(arg.get(1));
+
+ // colVal is another object now, we can mutate it
+ return cctx.marshaller().unmarshal(oldPropBytes, U.resolveClassLoader(cctx.gridConfig()));
+ }
+ };
+ }
+ else // We either are not updating, or the new value is given explicitly, no cloning needed.
+ return new PlainValueSupplier(colIdx);
+ }
+
Constructor<?> ctor;
try {
@@ -390,8 +399,12 @@ public final class UpdatePlanBuilder {
return ctor0.newInstance();
}
catch (Exception e) {
- throw new IgniteCheckedException("Failed to invoke default ctor for " +
- (key ? "key" : "value"), e);
+ if (S.INCLUDE_SENSITIVE)
+ throw new IgniteCheckedException("Failed to instantiate " +
+ (key ? "key" : "value") + " [type=" + typeName + ']', e);
+ else
+ throw new IgniteCheckedException("Failed to instantiate " +
+ (key ? "key" : "value") + '.', e);
}
}
};
@@ -405,8 +418,12 @@ public final class UpdatePlanBuilder {
return GridUnsafe.allocateInstance(cls);
}
catch (InstantiationException e) {
- throw new IgniteCheckedException("Failed to invoke default ctor for " +
- (key ? "key" : "value"), e);
+ if (S.INCLUDE_SENSITIVE)
+ throw new IgniteCheckedException("Failed to instantiate " +
+ (key ? "key" : "value") + " [type=" + typeName + ']', e);
+ else
+ throw new IgniteCheckedException("Failed to instantiate " +
+ (key ? "key" : "value") + '.', e);
}
}
};
@@ -414,8 +431,6 @@ public final class UpdatePlanBuilder {
}
}
-
-
/**
* @param target Expression to extract the table from.
* @return Back end table for this element.
@@ -483,4 +498,26 @@ public final class UpdatePlanBuilder {
return false;
}
+
+ /**
+ * Simple supplier that just takes specified element of a given row.
+ */
+ private final static class PlainValueSupplier implements KeyValueSupplier {
+ /** Index of column to use. */
+ private final int colIdx;
+
+ /**
+ * Constructor.
+ *
+ * @param colIdx Column index.
+ */
+ private PlainValueSupplier(int colIdx) {
+ this.colIdx = colIdx;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object apply(List<?> arg) throws IgniteCheckedException {
+ return arg.get(colIdx);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
index 86d01c7..626846b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
@@ -46,6 +46,8 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import static org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes;
+
/**
*
*/
@@ -126,6 +128,8 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends GridComm
createCaches();
else
createBinaryCaches();
+
+ ignite(0).createCache(cacheConfig("I2AT", true, false, Integer.class, AllTypes.class));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
index 649012f..3c92fdf 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
@@ -65,7 +65,7 @@ public abstract class IgniteCacheAbstractSqlDmlQuerySelfTest extends GridCommonA
/**
* @return whether {@link #marsh} is an instance of {@link BinaryMarshaller} or not.
*/
- private boolean isBinaryMarshaller() {
+ protected boolean isBinaryMarshaller() {
return marsh instanceof BinaryMarshaller;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
index e9c21dc..f91f405 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.concurrent.Callable;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCache;
@@ -202,4 +204,24 @@ public class IgniteCacheInsertSqlQuerySelfTest extends IgniteCacheAbstractInsert
assertEquals(createPerson(2, "Alex"), p.get(new Key4(2)));
}
+
+ /**
+ *
+ */
+ public void testNestedFieldsHandling() {
+ IgniteCache<Integer, IgniteCacheUpdateSqlQuerySelfTest.AllTypes> p = ignite(0).cache("I2AT");
+
+ p.query(new SqlFieldsQuery("insert into AllTypes(_key, innerTypeCol, arrListCol, _val, innerStrCol) " +
+ "values (1, ?, ?, ?, 'sss')") .setArgs(new IgniteCacheUpdateSqlQuerySelfTest.AllTypes.InnerType(50L),
+ new ArrayList<>(Arrays.asList(3L, 2L, 1L)), new IgniteCacheUpdateSqlQuerySelfTest.AllTypes(1L)));
+
+ IgniteCacheUpdateSqlQuerySelfTest.AllTypes res = p.get(1);
+
+ IgniteCacheUpdateSqlQuerySelfTest.AllTypes.InnerType resInner = new IgniteCacheUpdateSqlQuerySelfTest.AllTypes.InnerType(50L);
+
+ resInner.innerStrCol = "sss";
+ resInner.arrListCol = new ArrayList<>(Arrays.asList(3L, 2L, 1L));
+
+ assertEquals(resInner, res.innerTypeCol);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java
index 32b7a12..d9a2d9e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMergeSqlQuerySelfTest.java
@@ -17,9 +17,13 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.ArrayList;
+import java.util.Arrays;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.SqlFieldsQuery;
+import static org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes;
+
/**
*
*/
@@ -149,4 +153,24 @@ public class IgniteCacheMergeSqlQuerySelfTest extends IgniteCacheAbstractInsertS
assertEquals(createPerson(2, "Alex"), p.get(new Key4(2)));
}
+
+ /**
+ *
+ */
+ public void testNestedFieldsHandling() {
+ IgniteCache<Integer, AllTypes> p = ignite(0).cache("I2AT");
+
+ p.query(new SqlFieldsQuery("merge into AllTypes(_key, innerTypeCol, arrListCol, _val, innerStrCol) " +
+ "values (1, ?, ?, ?, 'sss')") .setArgs(new AllTypes.InnerType(50L),
+ new ArrayList<>(Arrays.asList(3L, 2L, 1L)), new AllTypes(1L)));
+
+ AllTypes res = p.get(1);
+
+ AllTypes.InnerType resInner = new AllTypes.InnerType(50L);
+
+ resInner.innerStrCol = "sss";
+ resInner.arrListCol = new ArrayList<>(Arrays.asList(3L, 2L, 1L));
+
+ assertEquals(resInner, res.innerTypeCol);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
index 575f617..c3d9d8e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
@@ -44,6 +44,12 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
ignite(0).createCache(createAllTypesCacheConfig());
}
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+ ignite(0).cache("L2AT").clear();
+ }
+
/**
*
*/
@@ -182,17 +188,19 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
cache.query(new SqlFieldsQuery("insert into \"AllTypes\"(_key, _val, \"dateCol\", \"booleanCol\"," +
"\"tsCol\") values(2, ?, '2016-11-30 12:00:00', false, DATE '2016-12-01')").setArgs(new AllTypes(2L)));
- cache.query(new SqlFieldsQuery("select \"primitiveIntsCol\" from \"AllTypes\"")).getAll();
-
- cache.query(new SqlFieldsQuery("update \"AllTypes\" set \"doubleCol\" = CAST('50' as INT)," +
+ // Look ma, no hands: first we set value of inner object column (innerTypeCol), then update only one of its
+ // fields (innerLongCol), while leaving another inner property (innerStrCol) as specified by innerTypeCol.
+ cache.query(new SqlFieldsQuery("update \"AllTypes\" set \"innerLongCol\" = ?, \"doubleCol\" = CAST('50' as INT)," +
" \"booleanCol\" = 80, \"innerTypeCol\" = ?, \"strCol\" = PI(), \"shortCol\" = " +
"CAST(WEEK(PARSEDATETIME('2016-11-30', 'yyyy-MM-dd')) as VARCHAR), " +
"\"sqlDateCol\"=TIMESTAMP '2016-12-02 13:47:00', \"tsCol\"=TIMESTAMPADD('MI', 2, " +
"DATEADD('DAY', 2, \"tsCol\")), \"primitiveIntsCol\" = ?, \"bytesCol\" = ?")
- .setArgs(new AllTypes.InnerType(80L), new int[] {2, 3}, new Byte[] {4, 5, 6}));
+ .setArgs(5, new AllTypes.InnerType(80L), new int[] {2, 3}, new Byte[] {4, 5, 6}));
AllTypes res = (AllTypes) cache.get(2L);
+ assertNotNull(res);
+
assertEquals(new BigDecimal(301.0).doubleValue(), res.bigDecimalCol.doubleValue());
assertEquals(50.0, res.doubleCol);
assertEquals(2L, (long) res.longCol);
@@ -202,7 +210,11 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
assertTrue(Arrays.equals(new Byte[] {4, 5, 6}, res.bytesCol));
assertTrue(Arrays.deepEquals(new Integer[] {0, 1}, res.intsCol));
assertTrue(Arrays.equals(new int[] {2, 3}, res.primitiveIntsCol));
- assertEquals(new AllTypes.InnerType(80L), res.innerTypeCol);
+
+ AllTypes.InnerType expInnerType = new AllTypes.InnerType(80L);
+ expInnerType.innerLongCol = 5L;
+
+ assertEquals(expInnerType, res.innerTypeCol);
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm:SS").parse("2016-11-30 12:00:00"), res.dateCol);
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm:SS").parse("2016-12-03 00:02:00"), res.tsCol);
assertEquals(2, res.intCol);
@@ -213,6 +225,45 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
assertEquals(49, res.shortCol);
}
+ /** */
+ public void testSingleInnerFieldUpdate() throws ParseException {
+ IgniteCache cache = ignite(0).cache("L2AT");
+
+ cache.query(new SqlFieldsQuery("insert into \"AllTypes\"(_key, _val, \"dateCol\", \"booleanCol\") values(2, ?," +
+ "'2016-11-30 12:00:00', false)").setArgs(new AllTypes(2L)));
+
+ assertFalse(cache.query(new SqlFieldsQuery("select * from \"AllTypes\"")).getAll().isEmpty());
+
+ cache.query(new SqlFieldsQuery("update \"AllTypes\" set \"innerLongCol\" = 5"));
+
+ AllTypes res = (AllTypes) cache.get(2L);
+
+ assertNotNull(res);
+
+ assertEquals(new BigDecimal(301.0).doubleValue(), res.bigDecimalCol.doubleValue());
+ assertEquals(3.01, res.doubleCol);
+ assertEquals(2L, (long) res.longCol);
+ assertFalse(res.booleanCol);
+
+ assertEquals("2", res.strCol);
+ assertTrue(Arrays.equals(new byte[] {0, 1}, res.primitiveBytesCol));
+ assertTrue(Arrays.deepEquals(new Byte[] {0, 1}, res.bytesCol));
+ assertTrue(Arrays.deepEquals(new Integer[] {0, 1}, res.intsCol));
+ assertTrue(Arrays.equals(new int[] {0, 1}, res.primitiveIntsCol));
+
+ AllTypes.InnerType expInnerType = new AllTypes.InnerType(2L);
+ expInnerType.innerLongCol = 5L;
+
+ assertEquals(expInnerType, res.innerTypeCol);
+ assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm:SS").parse("2016-11-30 12:00:00"), res.dateCol);
+ assertNull(res.tsCol);
+ assertEquals(2, res.intCol);
+ assertEquals(AllTypes.EnumType.ENUMTRUE, res.enumCol);
+ assertNull(res.sqlDateCol);
+
+ assertEquals(-23000, res.shortCol);
+ }
+
/**
*
*/
@@ -308,7 +359,7 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
InnerType innerTypeCol;
/** */
- static final class InnerType implements Serializable {
+ static class InnerType implements Serializable {
/** */
@QuerySqlField
Long innerLongCol;
http://git-wip-us.apache.org/repos/asf/ignite/blob/70cd8e45/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index e412828..69285f1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -578,6 +578,11 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
@Override public boolean key() {
return false;
}
+
+ /** */
+ @Override public GridQueryProperty parent() {
+ return null;
+ }
};
}
[50/50] [abbrv] ignite git commit: Merge branches
'ignite-comm-balance-master' and 'master' of
https://git-wip-us.apache.org/repos/asf/ignite into
ignite-comm-balance-master-apache
Posted by yz...@apache.org.
Merge branches 'ignite-comm-balance-master' and 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-comm-balance-master-apache
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fb5ef696
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fb5ef696
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fb5ef696
Branch: refs/heads/ignite-comm-balance-master
Commit: fb5ef696bdd6e769677d8f7056fe0ff6065b105b
Parents: c57d72e 7f74458
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Feb 16 20:35:33 2017 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Feb 16 20:35:33 2017 +0300
----------------------------------------------------------------------
NOTICE | 2 +-
assembly/NOTICE_FABRIC | 2 +-
assembly/NOTICE_HADOOP | 2 +-
examples/config/spark/example-shared-rdd.xml | 83 +++
examples/pom.xml | 27 +-
.../examples/java8/spark/SharedRDDExample.java | 110 ++++
.../examples/spark/ScalarSharedRDDExample.scala | 89 +++
.../examples/SharedRDDExampleSelfTest.java | 36 ++
.../IgniteExamplesJ8SelfTestSuite.java | 3 +
.../tests/examples/ScalarExamplesSelfTest.scala | 6 +
modules/core/src/main/java/META-INF/NOTICE | 2 +-
.../java/org/apache/ignite/IgniteMessaging.java | 11 +-
.../apache/ignite/IgniteSystemProperties.java | 6 +
.../org/apache/ignite/cache/QueryEntity.java | 21 +
.../org/apache/ignite/cache/query/SqlQuery.java | 25 +
.../internal/GridEventConsumeHandler.java | 5 +
.../ignite/internal/GridKernalContext.java | 1 +
.../ignite/internal/GridKernalContextImpl.java | 1 +
.../internal/GridMessageListenHandler.java | 5 +
.../internal/GridPerformanceSuggestions.java | 92 ----
.../apache/ignite/internal/IgniteKernal.java | 57 +-
.../ignite/internal/IgniteMessagingImpl.java | 6 +-
.../ignite/internal/IgniteVersionUtils.java | 2 +-
.../internal/StripedExecutorMXBeanAdapter.java | 90 +++
.../internal/managers/GridManagerAdapter.java | 2 +-
.../managers/communication/GridIoManager.java | 55 +-
.../processors/cache/EntryGetResult.java | 65 +++
.../processors/cache/GridCacheAdapter.java | 125 +++--
.../processors/cache/GridCacheContext.java | 4 +-
.../processors/cache/GridCacheEntryEx.java | 42 +-
.../processors/cache/GridCacheMapEntry.java | 140 ++++-
.../processors/cache/GridCacheProcessor.java | 92 +++-
.../processors/cache/GridCacheUtils.java | 3 +
.../processors/cache/IgniteCacheProxy.java | 3 +
.../processors/cache/ReaderArguments.java | 74 +++
.../distributed/dht/GridDhtCacheAdapter.java | 19 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 83 ++-
.../distributed/dht/GridDhtGetSingleFuture.java | 75 +--
.../distributed/dht/GridDhtLocalPartition.java | 120 +++-
.../distributed/dht/GridDhtTxPrepareFuture.java | 35 +-
.../dht/GridPartitionedGetFuture.java | 10 +-
.../dht/GridPartitionedSingleGetFuture.java | 10 +-
.../dht/atomic/GridDhtAtomicCache.java | 12 +-
.../dht/colocated/GridDhtColocatedCache.java | 10 +-
.../distributed/near/GridNearGetFuture.java | 19 +-
.../local/atomic/GridLocalAtomicCache.java | 11 +-
.../cache/query/GridCacheQueryManager.java | 83 ++-
.../continuous/CacheContinuousQueryHandler.java | 97 +++-
.../cache/transactions/IgniteTxHandler.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 65 ++-
.../continuous/GridContinuousHandler.java | 5 +
.../continuous/GridContinuousProcessor.java | 3 +
.../internal/processors/job/GridJobWorker.java | 4 +
.../processors/query/GridQueryIndexing.java | 21 +-
.../processors/query/GridQueryProcessor.java | 120 ++--
.../query/GridQueryTypeDescriptor.java | 7 +
.../processors/query/GridRunningQueryInfo.java | 132 +++++
.../suggestions/GridPerformanceSuggestions.java | 105 ++++
.../JvmConfigurationSuggestions.java | 104 ++++
.../suggestions/OsConfigurationSuggestions.java | 127 +++++
.../internal/suggestions/package-info.java | 21 +
.../ignite/internal/util/IgniteUtils.java | 14 +
.../ignite/internal/util/StripedExecutor.java | 55 +-
.../internal/visor/VisorMultiNodeTask.java | 2 +-
.../visor/cache/VisorCacheTypeMetadata.java | 6 +
.../visor/query/VisorCancelQueriesTask.java | 72 +++
.../query/VisorCollectRunningQueriesTask.java | 96 ++++
.../internal/visor/query/VisorRunningQuery.java | 132 +++++
.../ignite/mxbean/StripedExecutorMXBean.java | 90 +++
.../communication/tcp/TcpCommunicationSpi.java | 16 +
.../ignite/spi/discovery/tcp/ClientImpl.java | 90 ++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 63 ++-
.../messages/TcpDiscoveryAbstractMessage.java | 21 +
modules/core/src/test/config/log4j-test.xml | 6 +
.../internal/GridContinuousTaskSelfTest.java | 79 +++
.../communication/GridIoManagerSelfTest.java | 6 +-
.../cache/CacheConcurrentReadThroughTest.java | 184 +++++++
.../cache/CacheDeferredDeleteQueueTest.java | 134 +++++
.../cache/GridCacheLifecycleAwareSelfTest.java | 33 ++
.../processors/cache/GridCacheTestEntryEx.java | 30 +-
...niteTopologyValidatorGridSplitCacheTest.java | 334 ++++++++++++
...CacheAtomicReferenceApiSelfAbstractTest.java | 60 +-
...idCacheAtomicStampedApiSelfAbstractTest.java | 59 ++
.../GridCacheQueueApiSelfAbstractTest.java | 58 ++
.../GridCacheSetAbstractSelfTest.java | 53 ++
.../IgniteAtomicLongApiAbstractSelfTest.java | 27 +
.../IgniteCountDownLatchAbstractSelfTest.java | 43 ++
.../IgniteLockAbstractSelfTest.java | 54 +-
.../IgniteSemaphoreAbstractSelfTest.java | 52 +-
.../near/GridNearCacheStoreUpdateTest.java | 466 ++++++++++++++++
.../GridNearOffheapCacheStoreUpdateTest.java | 35 ++
.../cache/query/IndexingSpiQuerySelfTest.java | 69 ++-
.../IndexingSpiQueryWithH2IndexingSelfTest.java | 36 ++
.../ClientReconnectContinuousQueryTest.java | 201 +++++++
...niteMessagingConfigVariationFullApiTest.java | 195 +++++--
.../internal/util/StripedExecutorTest.java | 168 ++++++
.../ignite/messaging/GridMessagingSelfTest.java | 114 +++-
.../messaging/IgniteMessagingSendAsyncTest.java | 544 +++++++++++++++++++
.../tcp/TcpCommunicationSpiDropNodesTest.java | 322 +++++++++++
.../TcpCommunicationSpiFaultyClientTest.java | 265 +++++++++
.../startup/GridRandomCommandLineLoader.java | 2 +-
.../ignite/testframework/GridTestNode.java | 1 +
.../testframework/junits/GridAbstractTest.java | 2 +
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../testsuites/IgniteCacheTestSuite2.java | 7 +
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
.../IgniteSpiCommunicationSelfTestSuite.java | 5 +
.../IgniteSpiDiscoverySelfTestSuite.java | 2 +-
.../IgniteTopologyValidatorTestSuit.java | 1 +
.../hadoop/shuffle/HadoopShuffle.java | 2 +-
.../cache/query/GridCacheTwoStepQuery.java | 18 +-
.../processors/query/h2/IgniteH2Indexing.java | 111 +++-
.../query/h2/sql/GridSqlQuerySplitter.java | 4 +-
.../h2/twostep/GridReduceQueryExecutor.java | 60 +-
...CacheScanPartitionQueryFallbackSelfTest.java | 2 +-
.../cache/CacheSqlQueryValueCopySelfTest.java | 208 ++++++-
.../cache/GridCacheCrossCacheQuerySelfTest.java | 2 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 294 ++++++++++
.../cache/QueryEntityCaseMismatchTest.java | 107 ++++
.../IgniteCachePartitionedQuerySelfTest.java | 85 +++
.../h2/GridIndexingSpiAbstractSelfTest.java | 36 +-
.../IgniteCacheQuerySelfTestSuite.java | 2 +
.../IgniteCacheQuerySelfTestSuite3.java | 2 +
modules/kubernetes/DEVNOTES.txt | 63 +++
modules/kubernetes/README.txt | 33 ++
modules/kubernetes/config/Dockerfile | 45 ++
modules/kubernetes/config/example-kube.xml | 44 ++
.../kubernetes/config/ignite-deployment.yaml | 26 +
modules/kubernetes/config/ignite-service.yaml | 14 +
modules/kubernetes/config/run.sh | 50 ++
modules/kubernetes/licenses/apache-2.0.txt | 202 +++++++
modules/kubernetes/pom.xml | 93 ++++
.../TcpDiscoveryKubernetesIpFinder.java | 317 +++++++++++
.../tcp/ipfinder/kubernetes/package-info.java | 22 +
.../TcpDiscoveryKubernetesIpFinderSelfTest.java | 93 ++++
.../tcp/ipfinder/kubernetes/package-info.java | 22 +
.../testsuites/IgniteKubernetesTestSuite.java | 41 ++
.../Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.AspNet.nuspec | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Cache/Query/CacheLinqTest.cs | 96 ++++
.../Cache/Store/CacheStoreTest.cs | 30 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.Core.Schema.nuspec | 2 +-
.../Apache.Ignite.Core.nuspec | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.EntityFramework.nuspec | 2 +-
.../Apache.Ignite.Linq.nuspec | 2 +-
.../Impl/CacheQueryExpressionVisitor.cs | 127 ++++-
.../Impl/CacheQueryModelVisitor.cs | 3 +
.../Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.Log4Net.nuspec | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.NLog.nuspec | 2 +-
.../Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite/Properties/AssemblyInfo.cs | 2 +-
.../Apache.Ignite.Examples.csproj | 1 +
.../Datagrid/TransactionExample.cs | 75 ++-
.../Properties/AssemblyInfo.cs | 2 +-
modules/scalar-2.10/pom.xml | 2 +-
modules/scalar/pom.xml | 2 +-
.../apache/ignite/spark/JavaIgniteContext.scala | 6 +
modules/web-console/backend/app/agent.js | 44 +-
modules/web-console/backend/app/browser.js | 26 +
modules/web-console/backend/app/mongo.js | 49 +-
modules/web-console/backend/app/routes.js | 5 +-
.../web-console/backend/routes/activities.js | 45 ++
modules/web-console/backend/routes/admin.js | 2 +-
modules/web-console/backend/routes/agent.js | 10 +-
modules/web-console/backend/routes/profile.js | 4 +-
modules/web-console/backend/routes/public.js | 1 -
.../web-console/backend/services/activities.js | 117 ++++
.../web-console/backend/services/sessions.js | 6 +-
modules/web-console/backend/services/users.js | 20 +-
.../backend/test/unit/ActivitiesService.test.js | 131 +++++
modules/web-console/frontend/app/app.config.js | 13 +
modules/web-console/frontend/app/app.js | 29 +-
.../activities-user-dialog.controller.js | 27 +
.../activities-user-dialog.jade | 36 ++
.../components/activities-user-dialog/index.js | 35 ++
.../form-field-datepicker.jade | 55 ++
.../form-field-datepicker.scss | 20 +
.../list-of-registered-users/index.js | 28 +
.../list-of-registered-users.categories.js | 30 +
.../list-of-registered-users.column-defs.js | 80 +++
.../list-of-registered-users.controller.js | 239 ++++++++
.../list-of-registered-users.jade | 58 ++
.../ui-grid-header/ui-grid-header.jade | 27 +
.../ui-grid-header/ui-grid-header.scss | 84 +++
.../ui-grid-settings/ui-grid-settings.jade | 33 ++
.../ui-grid-settings/ui-grid-settings.scss | 99 ++++
.../app/core/activities/Activities.data.js | 34 ++
.../frontend/app/core/admin/Admin.data.js | 77 +++
modules/web-console/frontend/app/core/index.js | 25 +
modules/web-console/frontend/app/data/i18n.js | 39 ++
.../ui-ace-pom/ui-ace-pom.controller.js | 4 +-
.../ui-grid-settings/ui-grid-settings.jade | 33 --
.../ui-grid-settings/ui-grid-settings.scss | 38 --
.../app/filters/uiGridSubcategories.filter.js | 24 +
.../frontend/app/modules/Demo/Demo.module.js | 166 ------
.../frontend/app/modules/agent/agent.module.js | 15 -
.../app/modules/branding/branding.provider.js | 2 +-
.../modules/configuration/Version.service.js | 35 +-
.../configuration/generator/Maven.service.js | 10 +-
.../frontend/app/modules/demo/Demo.module.js | 172 ++++++
.../frontend/app/modules/sql/sql.controller.js | 14 +-
.../frontend/app/modules/sql/sql.module.js | 2 +-
.../frontend/app/modules/states/admin.state.js | 2 +-
.../configuration/summary/summary.controller.js | 6 +-
.../configuration/summary/summary.worker.js | 6 +-
.../app/modules/user/AclRoute.provider.js | 31 +-
.../frontend/app/modules/user/Auth.service.js | 2 +-
.../frontend/app/modules/user/permissions.js | 2 +-
.../frontend/app/modules/user/user.module.js | 6 +-
modules/web-console/frontend/app/vendor.js | 1 +
.../frontend/controllers/admin-controller.js | 234 --------
.../frontend/controllers/domains-controller.js | 12 +-
modules/web-console/frontend/package.json | 181 +++---
.../stylesheets/_font-awesome-custom.scss | 28 +
.../frontend/public/stylesheets/style.scss | 31 +-
.../frontend/test/unit/Version.test.js | 26 +-
.../frontend/views/settings/admin.jade | 32 +-
modules/web-console/frontend/views/sql/sql.jade | 4 +-
.../views/templates/agent-download.jade | 10 +-
.../ignite/console/agent/AgentLauncher.java | 203 ++++---
.../apache/ignite/console/agent/AgentUtils.java | 80 +++
.../console/agent/handlers/AbstractHandler.java | 110 ----
.../agent/handlers/AbstractListener.java | 104 ++++
.../console/agent/handlers/DatabaseHandler.java | 298 ----------
.../agent/handlers/DatabaseListener.java | 316 +++++++++++
.../console/agent/handlers/RestHandler.java | 276 ----------
.../console/agent/handlers/RestListener.java | 280 ++++++++++
.../ignite/console/demo/AgentClusterDemo.java | 475 +---------------
.../ignite/console/demo/AgentDemoUtils.java | 79 +++
.../demo/service/DemoCachesLoadService.java | 456 ++++++++++++++++
.../service/DemoRandomCacheLoadService.java | 120 ++++
.../service/DemoServiceClusterSingleton.java | 41 ++
.../demo/service/DemoServiceKeyAffinity.java | 41 ++
.../service/DemoServiceMultipleInstances.java | 41 ++
.../demo/service/DemoServiceNodeSingleton.java | 41 ++
modules/yardstick/DEVNOTES-standalone.txt | 15 +
modules/yardstick/DEVNOTES.txt | 20 +-
modules/yardstick/README.txt | 119 ++--
.../config/benchmark-sample.properties | 62 +++
modules/yardstick/pom.xml | 4 +-
.../yardstick/IgniteBenchmarkArguments.java | 28 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 2 +-
.../cache/IgnitePutRemoveBenchmark.java | 42 ++
.../cache/IgnitePutRemoveTxBenchmark.java | 30 +
.../cache/IgnitePutValue8Benchmark.java | 42 ++
.../IgniteCacheRandomOperationBenchmark.java | 49 ++
parent/pom.xml | 2 +-
pom.xml | 2 +
257 files changed, 12602 insertions(+), 2710 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5ef696/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5ef696/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5ef696/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5ef696/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5ef696/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5ef696/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fb5ef696/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
[25/50] [abbrv] ignite git commit: .NET: Extract exceptions tests in
CacheStoreTest and ignore due to IGNITE-4657
Posted by yz...@apache.org.
.NET: Extract exceptions tests in CacheStoreTest and ignore due to IGNITE-4657
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/543a65fb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/543a65fb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/543a65fb
Branch: refs/heads/ignite-comm-balance-master
Commit: 543a65fbac20a6961f8d23baaeb6ff8c6c61f20d
Parents: a600caf
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Feb 6 18:07:28 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Feb 10 12:45:07 2017 +0300
----------------------------------------------------------------------
.../Cache/Store/CacheStoreTest.cs | 30 ++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/543a65fb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index 869336c..a66aea8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -208,12 +208,38 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual("val", cache.Get(1));
Assert.AreEqual(1, cache.GetSize());
+ }
+
+ [Test]
+ public void TestExceptions()
+ {
+ var cache = GetCache();
+
+ cache.Put(1, "val");
- // Test errors
CacheTestStore.ThrowError = true;
CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Put(-2, "fail")).InnerException);
- cache.LocalEvict(new[] { 1 });
+ cache.LocalEvict(new[] {1});
+ CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Get(1)).InnerException);
+
+ CacheTestStore.ThrowError = false;
+
+ cache.Remove(1);
+ }
+
+ [Test]
+ [Ignore("IGNITE-4657")]
+ public void TestExceptionsNoRemove()
+ {
+ var cache = GetCache();
+
+ cache.Put(1, "val");
+
+ CacheTestStore.ThrowError = true;
+ CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Put(-2, "fail")).InnerException);
+
+ cache.LocalEvict(new[] {1});
CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Get(1)).InnerException);
}
[22/50] [abbrv] ignite git commit: Merge branch 'ignite-1.7.6'
Posted by yz...@apache.org.
Merge branch 'ignite-1.7.6'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/aaeda721
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/aaeda721
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/aaeda721
Branch: refs/heads/ignite-comm-balance-master
Commit: aaeda7214f738dff2fbd865e83250413a9b7cc0f
Parents: e1c3dda f350578
Author: agura <ag...@apache.org>
Authored: Thu Feb 9 20:29:48 2017 +0300
Committer: agura <ag...@apache.org>
Committed: Thu Feb 9 20:29:48 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../org/apache/ignite/cache/QueryEntity.java | 21 +
.../org/apache/ignite/cache/query/SqlQuery.java | 25 +
.../processors/cache/EntryGetResult.java | 65 +++
.../processors/cache/GridCacheAdapter.java | 125 +++--
.../processors/cache/GridCacheContext.java | 4 +-
.../processors/cache/GridCacheEntryEx.java | 42 +-
.../processors/cache/GridCacheMapEntry.java | 140 +++++-
.../processors/cache/GridCacheUtils.java | 3 +
.../processors/cache/IgniteCacheProxy.java | 3 +
.../processors/cache/ReaderArguments.java | 74 +++
.../distributed/dht/GridDhtCacheAdapter.java | 9 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 83 ++--
.../distributed/dht/GridDhtGetSingleFuture.java | 75 ++-
.../dht/GridPartitionedGetFuture.java | 10 +-
.../dht/GridPartitionedSingleGetFuture.java | 10 +-
.../dht/atomic/GridDhtAtomicCache.java | 12 +-
.../dht/colocated/GridDhtColocatedCache.java | 10 +-
.../distributed/near/GridNearGetFuture.java | 19 +-
.../local/atomic/GridLocalAtomicCache.java | 11 +-
.../cache/query/GridCacheQueryManager.java | 83 +++-
.../continuous/CacheContinuousQueryHandler.java | 81 +++-
.../cache/transactions/IgniteTxHandler.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 65 +--
.../processors/query/GridQueryIndexing.java | 4 +-
.../processors/query/GridQueryProcessor.java | 79 ++--
.../query/GridQueryTypeDescriptor.java | 7 +
.../communication/tcp/TcpCommunicationSpi.java | 16 +
.../ignite/spi/discovery/tcp/ClientImpl.java | 90 +++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 63 ++-
.../messages/TcpDiscoveryAbstractMessage.java | 21 +
modules/core/src/test/config/log4j-test.xml | 6 +
.../cache/CacheConcurrentReadThroughTest.java | 184 ++++++++
.../processors/cache/GridCacheTestEntryEx.java | 30 +-
.../near/GridNearCacheStoreUpdateTest.java | 466 +++++++++++++++++++
.../GridNearOffheapCacheStoreUpdateTest.java | 35 ++
.../cache/query/IndexingSpiQuerySelfTest.java | 69 ++-
.../IndexingSpiQueryWithH2IndexingSelfTest.java | 36 ++
.../tcp/TcpCommunicationSpiDropNodesTest.java | 322 +++++++++++++
.../TcpCommunicationSpiFaultyClientTest.java | 265 +++++++++++
.../ignite/testframework/GridTestNode.java | 1 +
.../testframework/junits/GridAbstractTest.java | 2 +
.../testsuites/IgniteCacheTestSuite2.java | 7 +
.../IgniteSpiCommunicationSelfTestSuite.java | 5 +
.../IgniteSpiDiscoverySelfTestSuite.java | 2 +-
.../processors/query/h2/IgniteH2Indexing.java | 30 +-
...CacheScanPartitionQueryFallbackSelfTest.java | 2 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 294 ++++++++++++
.../IgniteCachePartitionedQuerySelfTest.java | 85 ++++
.../h2/GridIndexingSpiAbstractSelfTest.java | 29 +-
50 files changed, 2719 insertions(+), 406 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 8d0a962,59665bb..264fa14
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@@ -1995,12 -2023,11 +2016,12 @@@ public abstract class GridCacheAdapter<
GridCacheEntryEx entry = entryEx(key);
try {
- GridCacheVersion verSet = entry.versionedValue(cacheVal,
- ver,
+ T2<CacheObject, GridCacheVersion> verVal = entry.versionedValue(
+ cacheVal,
+ res.version(),
null,
- expiry);
-
- boolean set = verSet != null;
++ expiry,
+ readerArgs);
if (log.isDebugEnabled())
log.debug("Set value loaded from store into entry [" +
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 9e9b496,51f423a..f26288f
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@@ -725,15 -755,15 +755,17 @@@ public interface GridCacheEntryEx
* @param val New value.
* @param curVer Version to match or {@code null} if match is not required.
* @param newVer Version to set.
+ * @param loadExpiryPlc Expiry policy if entry is loaded from store.
- * @return Non null version if value was set.
+ * @param readerArgs Reader will be added if not null.
+ * @return Current version and value.
* @throws IgniteCheckedException If index could not be updated.
* @throws GridCacheEntryRemovedException If entry was removed.
*/
- public GridCacheVersion versionedValue(CacheObject val,
+ public T2<CacheObject, GridCacheVersion> versionedValue(CacheObject val,
@Nullable GridCacheVersion curVer,
@Nullable GridCacheVersion newVer,
- @Nullable IgniteCacheExpiryPolicy loadExpiryPlc)
++ @Nullable IgniteCacheExpiryPolicy loadExpiryPlc,
+ @Nullable ReaderArguments readerArgs)
throws IgniteCheckedException, GridCacheEntryRemovedException;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 52b779d,59e4181..942ae21
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@@ -3549,14 -3609,28 +3609,29 @@@ public abstract class GridCacheMapEntr
}
/** {@inheritDoc} */
- @Override public synchronized GridCacheVersion versionedValue(CacheObject val,
+ @Override public synchronized void clearReserveForLoad(GridCacheVersion ver) throws IgniteCheckedException {
+ if (obsoleteVersionExtras() != null)
+ return;
+
+ if (ver.equals(this.ver)) {
+ assert evictionDisabled() : this;
+
+ flags &= ~IS_EVICT_DISABLED;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized T2<CacheObject, GridCacheVersion> versionedValue(CacheObject val,
GridCacheVersion curVer,
GridCacheVersion newVer,
- @Nullable IgniteCacheExpiryPolicy loadExpiryPlc)
++ @Nullable IgniteCacheExpiryPolicy loadExpiryPlc,
+ @Nullable ReaderArguments readerArgs)
- throws IgniteCheckedException, GridCacheEntryRemovedException
- {
+ throws IgniteCheckedException, GridCacheEntryRemovedException {
+
checkObsolete();
+ addReaderIfNeed(readerArgs);
+
if (curVer == null || curVer.equals(ver)) {
if (val != this.val) {
GridCacheMvcc mvcc = mvccExtras();
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index e657f32,f601e0a..1b6179e
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@@ -2381,7 -2293,7 +2383,7 @@@ public class GridDhtAtomicCache<K, V> e
try {
GridCacheVersion ver = entry.version();
-- entry.versionedValue(ctx.toCacheObject(v), null, ver, null);
++ entry.versionedValue(ctx.toCacheObject(v), null, ver, null, null);
}
catch (GridCacheEntryRemovedException e) {
assert false : "Entry should not get obsolete while holding lock [entry=" + entry +
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 63b0717,83edab4..a9a7d7c
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@@ -1253,8 -1312,8 +1312,8 @@@ public class CacheContinuousQueryHandle
try {
cctx.io().send(node, msg, GridIoPolicy.SYSTEM_POOL);
}
- catch (ClusterTopologyCheckedException e) {
+ catch (ClusterTopologyCheckedException ignored) {
- IgniteLogger log = ctx.log(getClass());
+ IgniteLogger log = ctx.log(CU.CONTINUOUS_QRY_LOG_CATEGORY);
if (log.isDebugEnabled())
log.debug("Failed to send acknowledge message, node left " +
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 7ceb701,f05d90d..cd4c55c
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@@ -439,8 -437,9 +440,9 @@@ public abstract class IgniteTxLocalAdap
CU.subjectId(this, cctx),
null,
resolveTaskName(),
- expiryPlc,
+ expiryPlc0,
- txEntry == null ? keepBinary : txEntry.keepBinary());
+ txEntry == null ? keepBinary : txEntry.keepBinary(),
+ null);
if (res == null) {
if (misses == null)
@@@ -476,20 -475,22 +478,23 @@@
CacheObject cacheVal = cacheCtx.toCacheObject(val);
while (true) {
- GridCacheEntryEx entry = cacheCtx.cache().entryEx(key);
+ GridCacheEntryEx entry = cacheCtx.cache().entryEx(key, topVer);
try {
- GridCacheVersion setVer = entry.versionedValue(cacheVal, ver, null, null);
-
- boolean set = setVer != null;
+ T2<CacheObject, GridCacheVersion> verVal = entry.versionedValue(cacheVal,
+ ver,
+ null,
++ null,
+ null);
- if (set)
- ver = setVer;
+ if (log.isDebugEnabled()) {
+ log.debug("Set value loaded from store into entry [" +
+ "oldVer=" + ver +
+ ", newVer=" + verVal.get2() +
+ ", entry=" + entry + ']');
+ }
- if (log.isDebugEnabled())
- log.debug("Set value loaded from store into entry [set=" + set +
- ", curVer=" + ver + ", newVer=" + setVer + ", " +
- "entry=" + entry + ']');
+ ver = verVal.get2();
break;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index 9fdadf3,8db68b4..e76ab40
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@@ -664,10 -686,10 +685,11 @@@ public class GridCacheTestEntryEx exten
}
/** @inheritDoc */
- @Override public GridCacheVersion versionedValue(CacheObject val,
+ @Override public T2<CacheObject, GridCacheVersion> versionedValue(CacheObject val,
GridCacheVersion curVer,
GridCacheVersion newVer,
- IgniteCacheExpiryPolicy loadExpiryPlc) {
++ @Nullable IgniteCacheExpiryPolicy loadExpiryPlc,
+ @Nullable ReaderArguments readerArgs) {
assert false;
return null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
index 0000000,d29231e..b530e36
mode 000000,100644..100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiDropNodesTest.java
@@@ -1,0 -1,322 +1,322 @@@
+ /*
+ * 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.spi.communication.tcp;
+
+ import java.util.Collections;
+ import java.util.HashMap;
+ import java.util.Map;
+ import java.util.concurrent.Callable;
+ import java.util.concurrent.CountDownLatch;
+ import java.util.concurrent.CyclicBarrier;
+ import java.util.concurrent.TimeUnit;
+ import org.apache.ignite.IgniteCheckedException;
+ import org.apache.ignite.cluster.ClusterNode;
+ import org.apache.ignite.configuration.IgniteConfiguration;
+ import org.apache.ignite.events.Event;
+ import org.apache.ignite.internal.IgniteEx;
+ import org.apache.ignite.internal.IgniteInternalFuture;
+ import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+ import org.apache.ignite.internal.util.nio.GridCommunicationClient;
+ import org.apache.ignite.internal.util.typedef.internal.U;
+ import org.apache.ignite.lang.IgniteBiPredicate;
+ import org.apache.ignite.lang.IgnitePredicate;
+ import org.apache.ignite.lang.IgniteRunnable;
+ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+ import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+ import org.apache.ignite.testframework.GridTestUtils;
+ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+ import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+
+ /**
+ *
+ */
+ public class TcpCommunicationSpiDropNodesTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Nodes count. */
+ private static final int NODES_CNT = 4;
+
+ /** Block. */
+ private static volatile boolean block;
+
+ /** Predicate. */
+ private static IgniteBiPredicate<ClusterNode, ClusterNode> pred;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setClockSyncFrequency(300000);
+ cfg.setFailureDetectionTimeout(1000);
+
+ TestCommunicationSpi spi = new TestCommunicationSpi();
+
+ spi.setIdleConnectionTimeout(100);
+ spi.setSharedMemoryPort(-1);
+
+ TcpDiscoverySpi discoSpi = (TcpDiscoverySpi) cfg.getDiscoverySpi();
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setCommunicationSpi(spi);
+ cfg.setDiscoverySpi(discoSpi);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ block = false;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testOneNode() throws Exception {
+ pred = new IgniteBiPredicate<ClusterNode, ClusterNode>() {
+ @Override public boolean apply(ClusterNode locNode, ClusterNode rmtNode) {
+ return block && rmtNode.order() == 3;
+ }
+ };
+
+ startGrids(NODES_CNT);
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ grid(0).events().localListen(new IgnitePredicate<Event>() {
+ @Override
+ public boolean apply(Event event) {
+ latch.countDown();
+
+ return true;
+ }
+ }, EVT_NODE_FAILED);
+
+ U.sleep(1000); // Wait for write timeout and closing idle connections.
+
+ block = true;
+
+ grid(0).compute().broadcast(new IgniteRunnable() {
+ @Override public void run() {
+ // No-op.
+ }
+ });
+
+ assertTrue(latch.await(15, TimeUnit.SECONDS));
+
+ assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return grid(3).cluster().topologyVersion() == NODES_CNT + 1;
+ }
+ }, 5000));
+
+ for (int i = 0; i < 10; i++) {
+ U.sleep(1000);
+
+ assertEquals(NODES_CNT - 1, grid(0).cluster().nodes().size());
+
+ int liveNodesCnt = 0;
+
+ for (int j = 0; j < NODES_CNT; j++) {
+ IgniteEx ignite;
+
+ try {
+ ignite = grid(j);
+
+ log.info("Checking topology for grid(" + j + "): " + ignite.cluster().nodes());
+
+ ClusterNode locNode = ignite.localNode();
+
+ if (locNode.order() != 3) {
+ assertEquals(NODES_CNT - 1, ignite.cluster().nodes().size());
+
+ for (ClusterNode node : ignite.cluster().nodes())
+ assertTrue(node.order() != 3);
+
+ liveNodesCnt++;
+ }
+ }
+ catch (Exception e) {
+ log.info("Checking topology for grid(" + j + "): no grid in topology.");
+ }
+ }
+
+ assertEquals(NODES_CNT - 1, liveNodesCnt);
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTwoNodesEachOther() throws Exception {
+ pred = new IgniteBiPredicate<ClusterNode, ClusterNode>() {
+ @Override public boolean apply(ClusterNode locNode, ClusterNode rmtNode) {
+ return block && (locNode.order() == 2 || locNode.order() == 4) &&
+ (rmtNode.order() == 2 || rmtNode.order() == 4);
+ }
+ };
+
+ startGrids(NODES_CNT);
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ grid(0).events().localListen(new IgnitePredicate<Event>() {
+ @Override
+ public boolean apply(Event event) {
+ latch.countDown();
+
+ return true;
+ }
+ }, EVT_NODE_FAILED);
+
+ U.sleep(1000); // Wait for write timeout and closing idle connections.
+
+ block = true;
+
+ final CyclicBarrier barrier = new CyclicBarrier(2);
+
+ IgniteInternalFuture<Void> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ grid(1).compute().withNoFailover().broadcast(new IgniteRunnable() {
+ @Override public void run() {
+ // No-op.
+ }
+ });
+
+ return null;
+ }
+ });
+
+ IgniteInternalFuture<Void> fut2 = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ grid(3).compute().withNoFailover().broadcast(new IgniteRunnable() {
+ @Override public void run() {
+ // No-op.
+ }
+ });
+
+ return null;
+ }
+ });
+
+ assertTrue(latch.await(5, TimeUnit.SECONDS));
+
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return grid(2).cluster().nodes().size() == NODES_CNT - 1;
+ }
+ }, 5000);
+
+ try {
+ fut1.get();
+ }
+ catch (IgniteCheckedException e) {
+ // No-op.
+ }
+
+ try {
+ fut2.get();
+ }
+ catch (IgniteCheckedException e) {
+ // No-op.
+ }
+
+ long failedNodeOrder = 1 + 2 + 3 + 4;
+
+ for (ClusterNode node : grid(0).cluster().nodes())
+ failedNodeOrder -= node.order();
+
+ for (int i = 0; i < 10; i++) {
+ U.sleep(1000);
+
+ assertEquals(NODES_CNT - 1, grid(0).cluster().nodes().size());
+
+ int liveNodesCnt = 0;
+
+ for (int j = 0; j < NODES_CNT; j++) {
+ IgniteEx ignite;
+
+ try {
+ ignite = grid(j);
+
+ log.info("Checking topology for grid(" + j + "): " + ignite.cluster().nodes());
+
+ ClusterNode locNode = ignite.localNode();
+
+ if (locNode.order() != failedNodeOrder) {
+ assertEquals(NODES_CNT - 1, ignite.cluster().nodes().size());
+
+ for (ClusterNode node : ignite.cluster().nodes())
+ assertTrue(node.order() != failedNodeOrder);
+
+ liveNodesCnt++;
+ }
+ }
+ catch (Exception e) {
+ log.info("Checking topology for grid(" + j + "): no grid in topology.");
+ }
+ }
+
+ assertEquals(NODES_CNT - 1, liveNodesCnt);
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCommunicationSpi extends TcpCommunicationSpi {
+ /** {@inheritDoc} */
- @Override protected GridCommunicationClient createTcpClient(ClusterNode node) throws IgniteCheckedException {
++ @Override protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx) throws IgniteCheckedException {
+ if (pred.apply(getLocalNode(), node)) {
+ Map<String, Object> attrs = new HashMap<>(node.attributes());
+
+ attrs.put(createAttributeName(ATTR_ADDRS), Collections.singleton("127.0.0.1"));
+ attrs.put(createAttributeName(ATTR_PORT), 47200);
+ attrs.put(createAttributeName(ATTR_EXT_ADDRS), Collections.emptyList());
+ attrs.put(createAttributeName(ATTR_HOST_NAMES), Collections.emptyList());
+
+ ((TcpDiscoveryNode)node).setAttributes(attrs);
+ }
+
- return super.createTcpClient(node);
++ return super.createTcpClient(node, connIdx);
+ }
+
+ /**
+ * @param name Name.
+ */
+ private String createAttributeName(String name) {
+ return getClass().getSimpleName() + '.' + name;
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
index 0000000,6e99487..c21e6ce
mode 000000,100644..100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiFaultyClientTest.java
@@@ -1,0 -1,270 +1,265 @@@
+ /*
+ * 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.spi.communication.tcp;
+
+ import java.io.IOException;
-import java.io.OutputStream;
+ import java.net.InetAddress;
+ import java.net.ServerSocket;
-import java.net.Socket;
+ import java.util.Collections;
+ import java.util.HashMap;
+ import java.util.Map;
+ import java.util.concurrent.CountDownLatch;
+ import java.util.concurrent.TimeUnit;
-import org.apache.ignite.Ignite;
+ import org.apache.ignite.IgniteCheckedException;
+ import org.apache.ignite.IgniteException;
+ import org.apache.ignite.cluster.ClusterNode;
+ import org.apache.ignite.configuration.IgniteConfiguration;
+ import org.apache.ignite.events.Event;
+ import org.apache.ignite.internal.IgniteInternalFuture;
+ import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+ import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+ import org.apache.ignite.internal.util.nio.GridCommunicationClient;
+ import org.apache.ignite.internal.util.typedef.internal.U;
+ import org.apache.ignite.lang.IgnitePredicate;
+ import org.apache.ignite.lang.IgniteRunnable;
+ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+ import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage;
+ import org.apache.ignite.testframework.GridTestUtils;
+ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+ import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+
+ /**
+ * Tests that faulty client will be failed if connection can't be established.
+ */
+ public class TcpCommunicationSpiFaultyClientTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Predicate. */
+ private static final IgnitePredicate<ClusterNode> PRED = new IgnitePredicate<ClusterNode>() {
+ @Override public boolean apply(ClusterNode node) {
+ return block && node.order() == 3;
+ }
+ };
+
+ /** Client mode. */
+ private static boolean clientMode;
+
+ /** Block. */
+ private static volatile boolean block;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setClockSyncFrequency(300000);
+ cfg.setFailureDetectionTimeout(1000);
+ cfg.setClientMode(clientMode);
+
+ TestCommunicationSpi spi = new TestCommunicationSpi();
+
+ spi.setIdleConnectionTimeout(100);
+ spi.setSharedMemoryPort(-1);
+
+ TcpDiscoverySpi discoSpi = (TcpDiscoverySpi) cfg.getDiscoverySpi();
+
+ discoSpi.setIpFinder(IP_FINDER);
+ discoSpi.setClientReconnectDisabled(true);
+
+ cfg.setCommunicationSpi(spi);
+ cfg.setDiscoverySpi(discoSpi);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ block = false;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNoServerOnHost() throws Exception {
+ testFailClient(null);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNotAcceptedConnection() throws Exception {
+ testFailClient(new FakeServer());
+ }
+
+ /**
+ * @param srv Server.
+ * @throws Exception If failed.
+ */
+ private void testFailClient(FakeServer srv) throws Exception {
+ IgniteInternalFuture<Long> fut = null;
+
+ try {
+ if (srv != null)
+ fut = GridTestUtils.runMultiThreadedAsync(srv, 1, "fake-server");
+
+ clientMode = false;
+
+ startGrids(2);
+
+ clientMode = true;
+
+ startGrid(2);
+ startGrid(3);
+
+ U.sleep(1000); // Wait for write timeout and closing idle connections.
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ grid(0).events().localListen(new IgnitePredicate<Event>() {
+ @Override
+ public boolean apply(Event event) {
+ latch.countDown();
+
+ return true;
+ }
+ }, EVT_NODE_FAILED);
+
+ block = true;
+
+ try {
+ grid(0).compute(grid(0).cluster().forClients()).withNoFailover().broadcast(new IgniteRunnable() {
+ @Override public void run() {
+ // No-op.
+ }
+ });
+ }
+ catch (IgniteException e) {
+ // No-op.
+ }
+
+ assertTrue(latch.await(3, TimeUnit.SECONDS));
+
+ assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return grid(0).cluster().forClients().nodes().size() == 1;
+ }
+ }, 5000));
+
+ for (int i = 0; i < 5; i++) {
+ U.sleep(1000);
+
+ log.info("Check topology (" + (i + 1) + "): " + grid(0).cluster().nodes());
+
+ assertEquals(1, grid(0).cluster().forClients().nodes().size());
+ }
+ }
+ finally {
+ if (srv != null) {
+ srv.stop();
+
+ assert fut != null;
+
+ fut.get();
+ }
+
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * Server that emulates connection troubles.
+ */
+ private static class FakeServer implements Runnable {
+ /** Server. */
+ private final ServerSocket srv;
+
+ /** Stop. */
+ private volatile boolean stop;
+
+ /**
+ * Default constructor.
+ */
+ FakeServer() throws IOException {
+ this.srv = new ServerSocket(47200, 50, InetAddress.getByName("127.0.0.1"));
+ }
+
+ /**
+ *
+ */
+ public void stop() {
+ stop = true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ try {
+ while (!stop) {
+ try {
+ U.sleep(10);
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ // No-op.
+ }
+ }
+ }
+ finally {
+ U.closeQuiet(srv);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCommunicationSpi extends TcpCommunicationSpi {
+ /** {@inheritDoc} */
- @Override protected GridCommunicationClient createTcpClient(ClusterNode node) throws IgniteCheckedException {
++ @Override protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx) throws IgniteCheckedException {
+ if (PRED.apply(node)) {
+ Map<String, Object> attrs = new HashMap<>(node.attributes());
+
+ attrs.put(createAttributeName(ATTR_ADDRS), Collections.singleton("127.0.0.1"));
+ attrs.put(createAttributeName(ATTR_PORT), 47200);
+ attrs.put(createAttributeName(ATTR_EXT_ADDRS), Collections.emptyList());
+ attrs.put(createAttributeName(ATTR_HOST_NAMES), Collections.emptyList());
+
+ ((TcpDiscoveryNode)node).setAttributes(attrs);
+ }
+
- return super.createTcpClient(node);
++ return super.createTcpClient(node, connIdx);
+ }
+
+ /**
+ * @param name Name.
+ */
+ private String createAttributeName(String name) {
+ return getClass().getSimpleName() + '.' + name;
+ }
+ }
+ }
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 69a65fe,cbf2ebd..9416621
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@@ -1077,10 -1051,9 +1077,10 @@@ public class IgniteH2Indexing implement
final TableDescriptor tbl = tableDescriptor(spaceName, type);
if (tbl == null)
- throw new CacheException("Failed to find SQL table for type: " + type.name());
+ throw new IgniteSQLException("Failed to find SQL table for type: " + type.name(),
+ IgniteQueryErrorCode.TABLE_NOT_FOUND);
- String sql = generateQuery(qry, tbl);
+ String sql = generateQuery(qry, alias, tbl);
Connection conn = connectionForThread(tbl.schemaName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/aaeda721/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
[30/50] [abbrv] ignite git commit: IGNITE-4688: Changed copyrights to
2017.
Posted by yz...@apache.org.
IGNITE-4688: Changed copyrights to 2017.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0ace63c6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0ace63c6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0ace63c6
Branch: refs/heads/ignite-comm-balance-master
Commit: 0ace63c6c02656802b30d59bb51a0e4da84dbe1b
Parents: cff20e7
Author: devozerov <vo...@gridgain.com>
Authored: Mon Feb 13 13:19:56 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Feb 13 13:22:04 2017 +0300
----------------------------------------------------------------------
NOTICE | 2 +-
assembly/NOTICE_FABRIC | 2 +-
assembly/NOTICE_HADOOP | 2 +-
modules/core/src/main/java/META-INF/NOTICE | 2 +-
.../examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs | 2 +-
modules/scalar-2.10/pom.xml | 2 +-
modules/scalar/pom.xml | 2 +-
parent/pom.xml | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ace63c6/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index 5ec3b0e..33e2479 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache Ignite
-Copyright 2015 The Apache Software Foundation
+Copyright 2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ace63c6/assembly/NOTICE_FABRIC
----------------------------------------------------------------------
diff --git a/assembly/NOTICE_FABRIC b/assembly/NOTICE_FABRIC
index 2e55768..c5e6f02 100644
--- a/assembly/NOTICE_FABRIC
+++ b/assembly/NOTICE_FABRIC
@@ -1,5 +1,5 @@
Apache Ignite
-Copyright 2015 The Apache Software Foundation
+Copyright 2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ace63c6/assembly/NOTICE_HADOOP
----------------------------------------------------------------------
diff --git a/assembly/NOTICE_HADOOP b/assembly/NOTICE_HADOOP
index 5ec3b0e..33e2479 100644
--- a/assembly/NOTICE_HADOOP
+++ b/assembly/NOTICE_HADOOP
@@ -1,5 +1,5 @@
Apache Ignite
-Copyright 2015 The Apache Software Foundation
+Copyright 2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ace63c6/modules/core/src/main/java/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/META-INF/NOTICE b/modules/core/src/main/java/META-INF/NOTICE
index 5ec3b0e..33e2479 100644
--- a/modules/core/src/main/java/META-INF/NOTICE
+++ b/modules/core/src/main/java/META-INF/NOTICE
@@ -1,5 +1,5 @@
Apache Ignite
-Copyright 2015 The Apache Software Foundation
+Copyright 2017 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ace63c6/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
index 6d28b2b..cc78a5c 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Apache Software Foundation")]
[assembly: AssemblyProduct("Apache Ignite.NET")]
-[assembly: AssemblyCopyright("Copyright 2017")]
+[assembly: AssemblyCopyright("Copyright 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ace63c6/modules/scalar-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar-2.10/pom.xml b/modules/scalar-2.10/pom.xml
index 569c13d..8d3d86d 100644
--- a/modules/scalar-2.10/pom.xml
+++ b/modules/scalar-2.10/pom.xml
@@ -158,7 +158,7 @@
<!--<td>-->
<!--<nobr>Ignite™ - Scalar DSL, ver. <strong>${project.version}</strong></nobr>-->
<!--<br>-->
- <!--<a target=_blank href="https://ignite.apache.org"><nobr>2015 Copyright © Apache Software Foundation</nobr></a>-->
+ <!--<a target=_blank href="https://ignite.apache.org"><nobr>2017 Copyright © Apache Software Foundation</nobr></a>-->
<!--</td>-->
<!--</tr>-->
<!--</table>-->
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ace63c6/modules/scalar/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar/pom.xml b/modules/scalar/pom.xml
index c8d12ff..2bb114f 100644
--- a/modules/scalar/pom.xml
+++ b/modules/scalar/pom.xml
@@ -143,7 +143,7 @@
<td>
<nobr>Ignite™ - Scalar DSL, ver. <strong>${project.version}</strong></nobr>
<br>
- <a target=_blank href="https://ignite.apache.org"><nobr>2015 Copyright © Apache Software Foundation</nobr></a>
+ <a target=_blank href="https://ignite.apache.org"><nobr>2017 Copyright © Apache Software Foundation</nobr></a>
</td>
</tr>
</table>
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ace63c6/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 2cb88b0..759e744 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -462,7 +462,7 @@
<tbody style="padding: 0; margin: 0">
<tr style="padding: 0; margin: 0">
<td>
- <a target=_blank href="https://ignite.apache.org"><nobr>2015 Copyright © Apache Software Foundation</nobr></a>
+ <a target=_blank href="https://ignite.apache.org"><nobr>2017 Copyright © Apache Software Foundation</nobr></a>
</td>
</tr>
</tbody>
[48/50] [abbrv] ignite git commit: ignite-4656 Added dynamic cache
start for IgniteCacheRandomOperationBenchmark.
Posted by yz...@apache.org.
ignite-4656 Added dynamic cache start for IgniteCacheRandomOperationBenchmark.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d3ccaf6d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d3ccaf6d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d3ccaf6d
Branch: refs/heads/ignite-comm-balance-master
Commit: d3ccaf6d911ebf88b0abfc5e2495d1d1fe24fc55
Parents: d4efbf3
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Thu Feb 16 16:51:08 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Feb 16 16:51:08 2017 +0300
----------------------------------------------------------------------
.../yardstick/IgniteBenchmarkArguments.java | 28 +++++++++--
.../org/apache/ignite/yardstick/IgniteNode.java | 2 +-
.../IgniteCacheRandomOperationBenchmark.java | 49 ++++++++++++++++++++
3 files changed, 75 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d3ccaf6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 2d2da5a..6ccd04c 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -153,6 +153,14 @@ public class IgniteBenchmarkArguments {
private boolean keysPerThread;
/** */
+ @Parameter(names = {"-ac", "--additionalCachesNumber"}, description = "Number of additional caches")
+ private int additionalCachesNum;
+
+ /** */
+ @Parameter(names = {"-acn", "--additionalCachesName"}, description = "Template cache name for additional caches")
+ private String additionalCachesName;
+
+ /** */
@Parameter(names = {"-pp", "--printPartitionStats"}, description = "Print partition statistics")
private boolean printPartStats;
@@ -296,9 +304,9 @@ public class IgniteBenchmarkArguments {
/**
* @return Preload log printing interval in seconds.
*/
- public long preloadLogsInterval() {
- return preloadLogsInterval;
- }
+ public long preloadLogsInterval() {
+ return preloadLogsInterval;
+ }
/**
* @return Configuration file.
@@ -392,6 +400,20 @@ public class IgniteBenchmarkArguments {
}
/**
+ * @return Number of additional caches.
+ */
+ public int additionalCachesNumber() {
+ return additionalCachesNum;
+ }
+
+ /**
+ * @return Name of cache which will be taken as base for additional caches.
+ */
+ public String additionalCachesName() {
+ return additionalCachesName;
+ }
+
+ /**
* @return Description.
*/
public String description() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d3ccaf6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index a261b98..404bd68 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -168,7 +168,7 @@ public class IgniteNode implements BenchmarkServer {
* @return Tuple with grid configuration and Spring application context.
* @throws Exception If failed.
*/
- private static IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext> loadConfiguration(String springCfgPath)
+ public static IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext> loadConfiguration(String springCfgPath)
throws Exception {
URL url;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d3ccaf6d/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
index 590b64f..c85595d 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
@@ -33,6 +33,7 @@ import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
+import javax.cache.CacheException;
import javax.cache.configuration.FactoryBuilder;
import javax.cache.event.CacheEntryEvent;
import javax.cache.event.CacheEntryListenerException;
@@ -69,8 +70,10 @@ import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
import org.apache.ignite.yardstick.IgniteBenchmarkUtils;
+import org.apache.ignite.yardstick.IgniteNode;
import org.apache.ignite.yardstick.cache.load.model.ModelUtil;
import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.BeansException;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.yardstickframework.BenchmarkConfiguration;
@@ -135,14 +138,60 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
@Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
super.setUp(cfg);
+ if (args.additionalCachesNumber() > 0)
+ createAdditionalCaches();
+
searchCache();
preLoading();
}
+ /**
+ * Creates additional caches.
+ *
+ * @throws Exception If failed.
+ */
+ private void createAdditionalCaches() throws Exception {
+ Map<String, CacheConfiguration> cfgMap;
+
+ try {
+ // Loading spring application context and getting all of the caches configurations in the map.
+ cfgMap = IgniteNode.loadConfiguration(args.configuration()).get2().getBeansOfType(CacheConfiguration.class);
+ }
+ catch (BeansException e) {
+ throw new Exception("Failed to instantiate bean [type=" + CacheConfiguration.class + ", err=" +
+ e.getMessage() + ']', e);
+ }
+
+ if (cfgMap == null || cfgMap.isEmpty())
+ throw new Exception("Failed to find cache configurations in: " + args.configuration());
+
+ // Getting cache configuration from the map using name specified in property file.
+ CacheConfiguration<Object, Object> ccfg = cfgMap.get(args.additionalCachesName());
+
+ if (ccfg == null)
+ throw new Exception("Failed to find cache configuration [cache=" + args.additionalCachesName() +
+ ", cfg=" + args.configuration() + ']');
+
+ for (int i = 0; i < args.additionalCachesNumber(); i++) {
+ CacheConfiguration<Object, Object> newCfg = new CacheConfiguration<>(ccfg);
+
+ newCfg.setName("additional_" + args.additionalCachesName() + "_cache_" + i);
+
+ try {
+ ignite().createCache(newCfg);
+ }
+ catch (CacheException e) {
+ BenchmarkUtils.error("Failed to create additional cache [ name = " + args.additionalCachesName() +
+ ", err" + e.getMessage() + ']', e);
+ }
+ }
+ }
+
/** {@inheritDoc} */
@Override public void onException(Throwable e) {
BenchmarkUtils.error("The benchmark of random operation failed.", e);
+
super.onException(e);
}
[31/50] [abbrv] ignite git commit: IGNITE-4687 Added pool to process
REST request in Web Agent.
Posted by yz...@apache.org.
IGNITE-4687 Added pool to process REST request in Web Agent.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/262a3410
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/262a3410
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/262a3410
Branch: refs/heads/ignite-comm-balance-master
Commit: 262a3410802de790b75de9b94fea9599b30171bd
Parents: 0ace63c
Author: Andrey Novikov <an...@gridgain.com>
Authored: Mon Feb 13 17:35:29 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Mon Feb 13 17:35:29 2017 +0700
----------------------------------------------------------------------
.../ignite/console/agent/AgentLauncher.java | 203 ++++++------
.../apache/ignite/console/agent/AgentUtils.java | 80 +++++
.../console/agent/handlers/AbstractHandler.java | 110 -------
.../agent/handlers/AbstractListener.java | 104 ++++++
.../console/agent/handlers/DatabaseHandler.java | 298 -----------------
.../agent/handlers/DatabaseListener.java | 316 +++++++++++++++++++
.../console/agent/handlers/RestHandler.java | 276 ----------------
.../console/agent/handlers/RestListener.java | 280 ++++++++++++++++
8 files changed, 880 insertions(+), 787 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/262a3410/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentLauncher.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentLauncher.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentLauncher.java
index 049791f..a3d609f 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentLauncher.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentLauncher.java
@@ -41,8 +41,8 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
-import org.apache.ignite.console.agent.handlers.DatabaseHandler;
-import org.apache.ignite.console.agent.handlers.RestHandler;
+import org.apache.ignite.console.agent.handlers.DatabaseListener;
+import org.apache.ignite.console.agent.handlers.RestListener;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.log4j.Logger;
import org.json.JSONException;
@@ -278,141 +278,138 @@ public class AgentLauncher {
cfg.tokens(Arrays.asList(tokens.trim().split(",")));
}
- final RestHandler restHnd = new RestHandler(cfg);
+ URI uri = URI.create(cfg.serverUri());
- try {
- restHnd.start();
+ // Create proxy authenticator using passed properties.
+ switch (uri.getScheme()) {
+ case "http":
+ case "https":
+ final String username = System.getProperty(uri.getScheme() + ".proxyUsername");
+ final char[] pwd = System.getProperty(uri.getScheme() + ".proxyPassword", "").toCharArray();
- URI uri = URI.create(cfg.serverUri());
+ Authenticator.setDefault(new Authenticator() {
+ @Override protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(username, pwd);
+ }
+ });
- // Create proxy authenticator using passed properties.
- switch (uri.getScheme()) {
- case "http":
- case "https":
- final String username = System.getProperty(uri.getScheme() + ".proxyUsername");
- final char[] pwd = System.getProperty(uri.getScheme() + ".proxyPassword", "").toCharArray();
+ break;
- Authenticator.setDefault(new Authenticator() {
- @Override protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(username, pwd);
- }
- });
-
- break;
+ default:
+ // No-op.
+ }
- default:
- // No-op.
- }
+ IO.Options opts = new IO.Options();
- IO.Options opts = new IO.Options();
+ opts.path = "/agents";
- opts.path = "/agents";
+ // Workaround for use self-signed certificate
+ if (Boolean.getBoolean("trust.all")) {
+ SSLContext ctx = SSLContext.getInstance("TLS");
- // Workaround for use self-signed certificate
- if (Boolean.getBoolean("trust.all")) {
- SSLContext ctx = SSLContext.getInstance("TLS");
+ // Create an SSLContext that uses our TrustManager
+ ctx.init(null, getTrustManagers(), null);
- // Create an SSLContext that uses our TrustManager
- ctx.init(null, getTrustManagers(), null);
+ opts.sslContext = ctx;
+ }
- opts.sslContext = ctx;
- }
+ final Socket client = IO.socket(uri, opts);
- final Socket client = IO.socket(uri, opts);
+ final RestListener restHnd = new RestListener(cfg);
- try {
- Emitter.Listener onConnecting = new Emitter.Listener() {
- @Override public void call(Object... args) {
- log.info("Connecting to: " + cfg.serverUri());
- }
- };
+ final DatabaseListener dbHnd = new DatabaseListener(cfg);
- Emitter.Listener onConnect = new Emitter.Listener() {
- @Override public void call(Object... args) {
- log.info("Connection established.");
+ try {
+ Emitter.Listener onConnecting = new Emitter.Listener() {
+ @Override public void call(Object... args) {
+ log.info("Connecting to: " + cfg.serverUri());
+ }
+ };
- JSONObject authMsg = new JSONObject();
+ Emitter.Listener onConnect = new Emitter.Listener() {
+ @Override public void call(Object... args) {
+ log.info("Connection established.");
- try {
- authMsg.put("tokens", cfg.tokens());
+ JSONObject authMsg = new JSONObject();
- String clsName = AgentLauncher.class.getSimpleName() + ".class";
+ try {
+ authMsg.put("tokens", cfg.tokens());
- String clsPath = AgentLauncher.class.getResource(clsName).toString();
+ String clsName = AgentLauncher.class.getSimpleName() + ".class";
- if (clsPath.startsWith("jar")) {
- String manifestPath = clsPath.substring(0, clsPath.lastIndexOf('!') + 1) +
- "/META-INF/MANIFEST.MF";
+ String clsPath = AgentLauncher.class.getResource(clsName).toString();
- Manifest manifest = new Manifest(new URL(manifestPath).openStream());
+ if (clsPath.startsWith("jar")) {
+ String manifestPath = clsPath.substring(0, clsPath.lastIndexOf('!') + 1) +
+ "/META-INF/MANIFEST.MF";
- Attributes attr = manifest.getMainAttributes();
+ Manifest manifest = new Manifest(new URL(manifestPath).openStream());
- authMsg.put("ver", attr.getValue("Implementation-Version"));
- authMsg.put("bt", attr.getValue("Build-Time"));
- }
+ Attributes attr = manifest.getMainAttributes();
- client.emit("agent:auth", authMsg, new Ack() {
- @Override public void call(Object... args) {
- // Authentication failed if response contains args.
- if (args != null && args.length > 0) {
- onDisconnect.call(args);
+ authMsg.put("ver", attr.getValue("Implementation-Version"));
+ authMsg.put("bt", attr.getValue("Build-Time"));
+ }
- System.exit(1);
- }
+ client.emit("agent:auth", authMsg, new Ack() {
+ @Override public void call(Object... args) {
+ // Authentication failed if response contains args.
+ if (args != null && args.length > 0) {
+ onDisconnect.call(args);
- log.info("Authentication success.");
+ System.exit(1);
}
- });
- }
- catch (JSONException | IOException e) {
- log.error("Failed to construct authentication message", e);
- client.close();
- }
+ log.info("Authentication success.");
+ }
+ });
}
- };
-
- DatabaseHandler dbHnd = new DatabaseHandler(cfg);
-
- final CountDownLatch latch = new CountDownLatch(1);
-
- client
- .on(EVENT_CONNECTING, onConnecting)
- .on(EVENT_CONNECT, onConnect)
- .on(EVENT_CONNECT_ERROR, onError)
- .on(EVENT_RECONNECTING, onConnecting)
- .on(EVENT_NODE_REST, restHnd)
- .on(EVENT_SCHEMA_IMPORT_DRIVERS, dbHnd.availableDriversListener())
- .on(EVENT_SCHEMA_IMPORT_SCHEMAS, dbHnd.schemasListener())
- .on(EVENT_SCHEMA_IMPORT_METADATA, dbHnd.metadataListener())
- .on(EVENT_ERROR, onError)
- .on(EVENT_DISCONNECT, onDisconnect)
- .on(EVENT_AGENT_WARNING, new Emitter.Listener() {
- @Override public void call(Object... args) {
- log.warn(args[0]);
- }
- })
- .on(EVENT_AGENT_CLOSE, new Emitter.Listener() {
- @Override public void call(Object... args) {
- onDisconnect.call(args);
+ catch (JSONException | IOException e) {
+ log.error("Failed to construct authentication message", e);
+
+ client.close();
+ }
+ }
+ };
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ client
+ .on(EVENT_CONNECTING, onConnecting)
+ .on(EVENT_CONNECT, onConnect)
+ .on(EVENT_CONNECT_ERROR, onError)
+ .on(EVENT_RECONNECTING, onConnecting)
+ .on(EVENT_NODE_REST, restHnd)
+ .on(EVENT_SCHEMA_IMPORT_DRIVERS, dbHnd.availableDriversListener())
+ .on(EVENT_SCHEMA_IMPORT_SCHEMAS, dbHnd.schemasListener())
+ .on(EVENT_SCHEMA_IMPORT_METADATA, dbHnd.metadataListener())
+ .on(EVENT_ERROR, onError)
+ .on(EVENT_DISCONNECT, onDisconnect)
+ .on(EVENT_AGENT_WARNING, new Emitter.Listener() {
+ @Override public void call(Object... args) {
+ log.warn(args[0]);
+ }
+ })
+ .on(EVENT_AGENT_CLOSE, new Emitter.Listener() {
+ @Override public void call(Object... args) {
+ onDisconnect.call(args);
- client.off();
+ client.off();
- latch.countDown();
- }
- });
+ latch.countDown();
+ }
+ });
- client.connect();
+ client.connect();
- latch.await();
- }
- finally {
- client.close();
- }
+ latch.await();
}
finally {
+ client.close();
+
restHnd.stop();
+
+ dbHnd.stop();
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262a3410/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
index 50a849a..cb22651 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
@@ -17,11 +17,19 @@
package org.apache.ignite.console.agent;
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule;
+import io.socket.client.Ack;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.ProtectionDomain;
+import java.util.Arrays;
import org.apache.log4j.Logger;
+import org.json.JSONArray;
+import org.json.JSONObject;
/**
* Utility methods.
@@ -30,6 +38,28 @@ public class AgentUtils {
/** */
private static final Logger log = Logger.getLogger(AgentUtils.class.getName());
+ /** JSON object mapper. */
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ /** */
+ private static final Ack NOOP_CB = new Ack() {
+ @Override public void call(Object... args) {
+ if (args != null && args.length > 0 && args[0] instanceof Throwable)
+ log.error("Failed to execute request on agent.", (Throwable) args[0]);
+ else
+ log.info("Request on agent successfully executed " + Arrays.toString(args));
+ }
+ };
+
+ static {
+ JsonOrgModule module = new JsonOrgModule();
+
+ mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
+ mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
+
+ mapper.registerModule(module);
+ }
+
/**
* Default constructor.
*/
@@ -108,4 +138,54 @@ public class AgentUtils {
return null;
}
+
+ /**
+ * Get callback from handler arguments.
+ *
+ * @param args Arguments.
+ * @return Callback or noop callback.
+ */
+ public static Ack safeCallback(Object[] args) {
+ boolean hasCb = args != null && args.length > 0 && args[args.length - 1] instanceof Ack;
+
+ return hasCb ? (Ack)args[args.length - 1] : NOOP_CB;
+ }
+
+ /**
+ * Remove callback from handler arguments.
+ *
+ * @param args Arguments.
+ * @return Arguments without callback.
+ */
+ public static Object[] removeCallback(Object[] args) {
+ boolean hasCb = args != null && args.length > 0 && args[args.length - 1] instanceof Ack;
+
+ return hasCb ? Arrays.copyOf(args, args.length - 1) : args;
+ }
+
+ /**
+ * Map java object to JSON object.
+ *
+ * @param obj Java object.
+ * @return {@link JSONObject} or {@link JSONArray}.
+ * @throws IllegalArgumentException If conversion fails due to incompatible type.
+ */
+ public static Object toJSON(Object obj) {
+ if (obj instanceof Iterable)
+ return mapper.convertValue(obj, JSONArray.class);
+
+ return mapper.convertValue(obj, JSONObject.class);
+ }
+
+ /**
+ * Map JSON object to java object.
+ *
+ * @param obj {@link JSONObject} or {@link JSONArray}.
+ * @param toValType Expected value type.
+ * @return Mapped object type of {@link T}.
+ * @throws IllegalArgumentException If conversion fails due to incompatible type.
+ */
+ public static <T> T fromJSON(Object obj, Class<T> toValType) throws IllegalArgumentException {
+ return mapper.convertValue(obj, toValType);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262a3410/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractHandler.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractHandler.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractHandler.java
deleted file mode 100644
index 7e4e320..0000000
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractHandler.java
+++ /dev/null
@@ -1,110 +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.console.agent.handlers;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule;
-import io.socket.client.Ack;
-import io.socket.emitter.Emitter;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Map;
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-/**
- * Base class for web socket handlers.
- */
-abstract class AbstractHandler implements Emitter.Listener {
- /** JSON object mapper. */
- private static final ObjectMapper mapper = new ObjectMapper();
-
- static {
- JsonOrgModule module = new JsonOrgModule();
-
- mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
- mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
-
- mapper.registerModule(module);
- }
-
- /**
- * @param obj Object.
- * @return {@link JSONObject} or {@link JSONArray}.
- */
- private Object toJSON(Object obj) {
- if (obj instanceof Iterable)
- return mapper.convertValue(obj, JSONArray.class);
-
- return mapper.convertValue(obj, JSONObject.class);
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override public final void call(Object... args) {
- Ack cb = null;
-
- try {
- if (args == null || args.length == 0)
- throw new IllegalArgumentException("Missing arguments.");
-
- if (args.length > 2)
- throw new IllegalArgumentException("Wrong arguments count, must be <= 2: " + Arrays.toString(args));
-
- JSONObject lsnrArgs = null;
-
- if (args.length == 1) {
- if (args[0] instanceof JSONObject)
- lsnrArgs = (JSONObject)args[0];
- else if (args[0] instanceof Ack)
- cb = (Ack)args[0];
- else
- throw new IllegalArgumentException("Wrong type of argument, must be JSONObject or Ack: " + args[0]);
- }
- else {
- if (args[0] != null && !(args[0] instanceof JSONObject))
- throw new IllegalArgumentException("Wrong type of argument, must be JSONObject: " + args[0]);
-
- if (!(args[1] instanceof Ack))
- throw new IllegalArgumentException("Wrong type of argument, must be Ack: " + args[1]);
-
- lsnrArgs = (JSONObject)args[0];
-
- cb = (Ack)args[1];
- }
-
- Object res = execute(lsnrArgs == null ? Collections.emptyMap() : mapper.convertValue(lsnrArgs, Map.class));
-
- if (cb != null)
- cb.call(null, toJSON(res));
- }
- catch (Exception e) {
- if (cb != null)
- cb.call(e, null);
- }
- }
-
- /**
- * Execute command with specified arguments.
- *
- * @param args Map with method args.
- */
- public abstract Object execute(Map<String, Object> args) throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262a3410/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java
new file mode 100644
index 0000000..987dac9
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java
@@ -0,0 +1,104 @@
+/*
+ * 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.console.agent.handlers;
+
+import io.socket.client.Ack;
+import io.socket.emitter.Emitter;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import org.apache.log4j.Logger;
+
+import static org.apache.ignite.console.agent.AgentUtils.removeCallback;
+import static org.apache.ignite.console.agent.AgentUtils.fromJSON;
+import static org.apache.ignite.console.agent.AgentUtils.safeCallback;
+import static org.apache.ignite.console.agent.AgentUtils.toJSON;
+
+/**
+ * Base class for web socket handlers.
+ */
+abstract class AbstractListener implements Emitter.Listener {
+ /** */
+ private ExecutorService pool;
+
+ /** */
+ final Logger log = Logger.getLogger(this.getClass().getName());
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public final void call(Object... args) {
+ final Ack cb = safeCallback(args);
+
+ args = removeCallback(args);
+
+ try {
+ final Map<String, Object> params;
+
+ if (args == null || args.length == 0)
+ params = Collections.emptyMap();
+ else if (args.length == 1)
+ params = fromJSON(args[0], Map.class);
+ else
+ throw new IllegalArgumentException("Wrong arguments count, must be <= 1: " + Arrays.toString(args));
+
+ if (pool == null)
+ pool = newThreadPool();
+
+ pool.submit(new Runnable() {
+ @Override public void run() {
+ try {
+ Object res = execute(params);
+
+ cb.call(null, toJSON(res));
+ } catch (Exception e) {
+ cb.call(e, null);
+ }
+ }
+ });
+ }
+ catch (Exception e) {
+ cb.call(e, null);
+ }
+ }
+
+ /**
+ * Stop handler.
+ */
+ public void stop() {
+ if (pool != null)
+ pool.shutdownNow();
+ }
+
+ /**
+ * Creates a thread pool that can schedule commands to run after a given delay, or to execute periodically.
+ *
+ * @return Newly created thread pool.
+ */
+ protected ExecutorService newThreadPool() {
+ return Executors.newSingleThreadExecutor();
+ }
+
+ /**
+ * Execute command with specified arguments.
+ *
+ * @param args Map with method args.
+ */
+ public abstract Object execute(Map<String, Object> args) throws Exception;
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262a3410/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseHandler.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseHandler.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseHandler.java
deleted file mode 100644
index 02146d9..0000000
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseHandler.java
+++ /dev/null
@@ -1,298 +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.console.agent.handlers;
-
-import io.socket.emitter.Emitter;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.ignite.console.agent.AgentConfiguration;
-import org.apache.ignite.console.demo.AgentMetadataDemo;
-import org.apache.ignite.schema.parser.DbMetadataReader;
-import org.apache.ignite.schema.parser.DbTable;
-import org.apache.log4j.Logger;
-
-import static org.apache.ignite.console.agent.AgentUtils.resolvePath;
-
-/**
- * API to extract database metadata.
- */
-public class DatabaseHandler {
- /** */
- private static final Logger log = Logger.getLogger(DatabaseHandler.class.getName());
-
- /** */
- private final File driversFolder;
-
- /**
- * @param cfg Config.
- */
- public DatabaseHandler(AgentConfiguration cfg) {
- driversFolder = resolvePath(cfg.driversFolder() == null ? "jdbc-drivers" : cfg.driversFolder());
- }
-
- /**
- * @param jdbcDriverJarPath JDBC driver JAR path.
- * @param jdbcDriverCls JDBC driver class.
- * @param jdbcUrl JDBC URL.
- * @param jdbcInfo Properties to connect to database.
- * @return Connection to database.
- * @throws SQLException
- */
- private Connection connect(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
- Properties jdbcInfo) throws SQLException {
- if (AgentMetadataDemo.isTestDriveUrl(jdbcUrl))
- return AgentMetadataDemo.testDrive();
-
- if (!new File(jdbcDriverJarPath).isAbsolute() && driversFolder != null)
- jdbcDriverJarPath = new File(driversFolder, jdbcDriverJarPath).getPath();
-
- return DbMetadataReader.getInstance().connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo);
- }
-
- /**
- * @param jdbcDriverJarPath JDBC driver JAR path.
- * @param jdbcDriverCls JDBC driver class.
- * @param jdbcUrl JDBC URL.
- * @param jdbcInfo Properties to connect to database.
- * @return Collection of schema names.
- * @throws SQLException
- */
- protected Collection<String> schemas(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
- Properties jdbcInfo) throws SQLException {
- if (log.isDebugEnabled())
- log.debug("Start collecting database schemas [drvJar=" + jdbcDriverJarPath +
- ", drvCls=" + jdbcDriverCls + ", jdbcUrl=" + jdbcUrl + "]");
-
- try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo)) {
- Collection<String> schemas = DbMetadataReader.getInstance().schemas(conn);
-
- if (log.isDebugEnabled())
- log.debug("Finished collection of schemas [jdbcUrl=" + jdbcUrl + ", count=" + schemas.size() + "]");
-
- return schemas;
- }
- catch (Throwable e) {
- log.error("Failed to collect schemas", e);
-
- throw new SQLException("Failed to collect schemas", e);
- }
- }
-
- /**
- * Listener for schema names.
- *
- * @return Collection of schema names.
- */
- public Emitter.Listener schemasListener() {
- return new AbstractHandler() {
- @Override public Object execute(Map<String, Object> args) throws Exception {
- String driverPath = null;
-
- if (args.containsKey("driverPath"))
- driverPath = args.get("driverPath").toString();
-
- if (!args.containsKey("driverClass"))
- throw new IllegalArgumentException("Missing driverClass in arguments: " + args);
-
- String driverCls = args.get("driverClass").toString();
-
- if (!args.containsKey("url"))
- throw new IllegalArgumentException("Missing url in arguments: " + args);
-
- String url = args.get("url").toString();
-
- if (!args.containsKey("info"))
- throw new IllegalArgumentException("Missing info in arguments: " + args);
-
- Properties info = new Properties();
-
- info.putAll((Map)args.get("info"));
-
- return schemas(driverPath, driverCls, url, info);
- }
- };
- }
-
- /**
- * @param jdbcDriverJarPath JDBC driver JAR path.
- * @param jdbcDriverCls JDBC driver class.
- * @param jdbcUrl JDBC URL.
- * @param jdbcInfo Properties to connect to database.
- * @param schemas List of schema names to process.
- * @param tblsOnly If {@code true} then only tables will be processed otherwise views also will be processed.
- * @return Collection of tables.
- */
- protected Collection<DbTable> metadata(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
- Properties jdbcInfo, List<String> schemas, boolean tblsOnly) throws SQLException {
- if (log.isDebugEnabled())
- log.debug("Start collecting database metadata [drvJar=" + jdbcDriverJarPath +
- ", drvCls=" + jdbcDriverCls + ", jdbcUrl=" + jdbcUrl + "]");
-
- try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo)) {
- Collection<DbTable> metadata = DbMetadataReader.getInstance().metadata(conn, schemas, tblsOnly);
-
- if (log.isDebugEnabled())
- log.debug("Finished collection of metadata [jdbcUrl=" + jdbcUrl + ", count=" + metadata.size() + "]");
-
- return metadata;
- }
- catch (Throwable e) {
- log.error("Failed to collect metadata", e);
-
- throw new SQLException("Failed to collect metadata", e);
- }
- }
-
- /**
- * Listener for tables.
- *
- * @return Collection of tables.
- */
- public Emitter.Listener metadataListener() {
- return new AbstractHandler() {
- @SuppressWarnings("unchecked")
- @Override public Object execute(Map<String, Object> args) throws Exception {
- String driverPath = null;
-
- if (args.containsKey("driverPath"))
- driverPath = args.get("driverPath").toString();
-
- if (!args.containsKey("driverClass"))
- throw new IllegalArgumentException("Missing driverClass in arguments: " + args);
-
- String driverCls = args.get("driverClass").toString();
-
- if (!args.containsKey("url"))
- throw new IllegalArgumentException("Missing url in arguments: " + args);
-
- String url = args.get("url").toString();
-
- if (!args.containsKey("info"))
- throw new IllegalArgumentException("Missing info in arguments: " + args);
-
- Properties info = new Properties();
-
- info.putAll((Map)args.get("info"));
-
- if (!args.containsKey("schemas"))
- throw new IllegalArgumentException("Missing schemas in arguments: " + args);
-
- List<String> schemas = (List<String>)args.get("schemas");
-
- if (!args.containsKey("tablesOnly"))
- throw new IllegalArgumentException("Missing tablesOnly in arguments: " + args);
-
- boolean tblsOnly = (boolean)args.get("tablesOnly");
-
- return metadata(driverPath, driverCls, url, info, schemas, tblsOnly);
- }
- };
- }
-
- /**
- * Listener for drivers.
- *
- * @return Drivers in drivers folder
- * @see AgentConfiguration#driversFolder
- */
- public Emitter.Listener availableDriversListener() {
- return new AbstractHandler() {
- @Override public Object execute(Map<String, Object> args) throws Exception {
- if (driversFolder == null) {
- log.info("JDBC drivers folder not specified, returning empty list");
-
- return Collections.emptyList();
- }
-
- if (log.isDebugEnabled())
- log.debug("Collecting JDBC drivers in folder: " + driversFolder.getPath());
-
- File[] list = driversFolder.listFiles(new FilenameFilter() {
- @Override public boolean accept(File dir, String name) {
- return name.endsWith(".jar");
- }
- });
-
- if (list == null) {
- log.info("JDBC drivers folder has no files, returning empty list");
-
- return Collections.emptyList();
- }
-
- List<JdbcDriver> res = new ArrayList<>();
-
- for (File file : list) {
- try {
- boolean win = System.getProperty("os.name").contains("win");
-
- URL url = new URL("jar", null,
- "file:" + (win ? "/" : "") + file.getPath() + "!/META-INF/services/java.sql.Driver");
-
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
- String jdbcDriverCls = reader.readLine();
-
- res.add(new JdbcDriver(file.getName(), jdbcDriverCls));
-
- if (log.isDebugEnabled())
- log.debug("Found: [driver=" + file + ", class=" + jdbcDriverCls + "]");
- }
- }
- catch (IOException e) {
- res.add(new JdbcDriver(file.getName(), null));
-
- log.info("Found: [driver=" + file + "]");
- log.info("Failed to detect driver class: " + e.getMessage());
- }
- }
-
- return res;
- }
- };
- }
-
- /**
- * Wrapper class for later to be transformed to JSON and send to Web Console.
- */
- private static class JdbcDriver {
- /** */
- public final String jdbcDriverJar;
- /** */
- public final String jdbcDriverCls;
-
- /**
- * @param jdbcDriverJar File name of driver jar file.
- * @param jdbcDriverCls Optional JDBC driver class.
- */
- public JdbcDriver(String jdbcDriverJar, String jdbcDriverCls) {
- this.jdbcDriverJar = jdbcDriverJar;
- this.jdbcDriverCls = jdbcDriverCls;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262a3410/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
new file mode 100644
index 0000000..4577228
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
@@ -0,0 +1,316 @@
+/*
+ * 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.console.agent.handlers;
+
+import io.socket.emitter.Emitter;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.ignite.console.agent.AgentConfiguration;
+import org.apache.ignite.console.demo.AgentMetadataDemo;
+import org.apache.ignite.schema.parser.DbMetadataReader;
+import org.apache.ignite.schema.parser.DbTable;
+import org.apache.log4j.Logger;
+
+import static org.apache.ignite.console.agent.AgentUtils.resolvePath;
+
+/**
+ * API to extract database metadata.
+ */
+public class DatabaseListener {
+ /** */
+ private static final Logger log = Logger.getLogger(DatabaseListener.class.getName());
+
+ /** */
+ private final File driversFolder;
+
+ /** */
+ private final AbstractListener schemasLsnr = new AbstractListener() {
+ @Override public Object execute(Map<String, Object> args) throws Exception {
+ String driverPath = null;
+
+ if (args.containsKey("driverPath"))
+ driverPath = args.get("driverPath").toString();
+
+ if (!args.containsKey("driverClass"))
+ throw new IllegalArgumentException("Missing driverClass in arguments: " + args);
+
+ String driverCls = args.get("driverClass").toString();
+
+ if (!args.containsKey("url"))
+ throw new IllegalArgumentException("Missing url in arguments: " + args);
+
+ String url = args.get("url").toString();
+
+ if (!args.containsKey("info"))
+ throw new IllegalArgumentException("Missing info in arguments: " + args);
+
+ Properties info = new Properties();
+
+ info.putAll((Map)args.get("info"));
+
+ return schemas(driverPath, driverCls, url, info);
+ }
+ };
+
+ private final AbstractListener metadataLsnr = new AbstractListener() {
+ @SuppressWarnings("unchecked")
+ @Override public Object execute(Map<String, Object> args) throws Exception {
+ String driverPath = null;
+
+ if (args.containsKey("driverPath"))
+ driverPath = args.get("driverPath").toString();
+
+ if (!args.containsKey("driverClass"))
+ throw new IllegalArgumentException("Missing driverClass in arguments: " + args);
+
+ String driverCls = args.get("driverClass").toString();
+
+ if (!args.containsKey("url"))
+ throw new IllegalArgumentException("Missing url in arguments: " + args);
+
+ String url = args.get("url").toString();
+
+ if (!args.containsKey("info"))
+ throw new IllegalArgumentException("Missing info in arguments: " + args);
+
+ Properties info = new Properties();
+
+ info.putAll((Map)args.get("info"));
+
+ if (!args.containsKey("schemas"))
+ throw new IllegalArgumentException("Missing schemas in arguments: " + args);
+
+ List<String> schemas = (List<String>)args.get("schemas");
+
+ if (!args.containsKey("tablesOnly"))
+ throw new IllegalArgumentException("Missing tablesOnly in arguments: " + args);
+
+ boolean tblsOnly = (boolean)args.get("tablesOnly");
+
+ return metadata(driverPath, driverCls, url, info, schemas, tblsOnly);
+ }
+ };
+
+ private final AbstractListener availableDriversLsnr = new AbstractListener() {
+ @Override public Object execute(Map<String, Object> args) throws Exception {
+ if (driversFolder == null) {
+ log.info("JDBC drivers folder not specified, returning empty list");
+
+ return Collections.emptyList();
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Collecting JDBC drivers in folder: " + driversFolder.getPath());
+
+ File[] list = driversFolder.listFiles(new FilenameFilter() {
+ @Override public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }
+ });
+
+ if (list == null) {
+ log.info("JDBC drivers folder has no files, returning empty list");
+
+ return Collections.emptyList();
+ }
+
+ List<JdbcDriver> res = new ArrayList<>();
+
+ for (File file : list) {
+ try {
+ boolean win = System.getProperty("os.name").contains("win");
+
+ URL url = new URL("jar", null,
+ "file:" + (win ? "/" : "") + file.getPath() + "!/META-INF/services/java.sql.Driver");
+
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
+ String jdbcDriverCls = reader.readLine();
+
+ res.add(new JdbcDriver(file.getName(), jdbcDriverCls));
+
+ if (log.isDebugEnabled())
+ log.debug("Found: [driver=" + file + ", class=" + jdbcDriverCls + "]");
+ }
+ }
+ catch (IOException e) {
+ res.add(new JdbcDriver(file.getName(), null));
+
+ log.info("Found: [driver=" + file + "]");
+ log.info("Failed to detect driver class: " + e.getMessage());
+ }
+ }
+
+ return res;
+ }
+ };
+
+ /**
+ * @param cfg Config.
+ */
+ public DatabaseListener(AgentConfiguration cfg) {
+ driversFolder = resolvePath(cfg.driversFolder() == null ? "jdbc-drivers" : cfg.driversFolder());
+ }
+
+ /**
+ * @param jdbcDriverJarPath JDBC driver JAR path.
+ * @param jdbcDriverCls JDBC driver class.
+ * @param jdbcUrl JDBC URL.
+ * @param jdbcInfo Properties to connect to database.
+ * @return Connection to database.
+ * @throws SQLException
+ */
+ private Connection connect(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
+ Properties jdbcInfo) throws SQLException {
+ if (AgentMetadataDemo.isTestDriveUrl(jdbcUrl))
+ return AgentMetadataDemo.testDrive();
+
+ if (!new File(jdbcDriverJarPath).isAbsolute() && driversFolder != null)
+ jdbcDriverJarPath = new File(driversFolder, jdbcDriverJarPath).getPath();
+
+ return DbMetadataReader.getInstance().connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo);
+ }
+
+ /**
+ * @param jdbcDriverJarPath JDBC driver JAR path.
+ * @param jdbcDriverCls JDBC driver class.
+ * @param jdbcUrl JDBC URL.
+ * @param jdbcInfo Properties to connect to database.
+ * @return Collection of schema names.
+ * @throws SQLException
+ */
+ protected Collection<String> schemas(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
+ Properties jdbcInfo) throws SQLException {
+ if (log.isDebugEnabled())
+ log.debug("Start collecting database schemas [drvJar=" + jdbcDriverJarPath +
+ ", drvCls=" + jdbcDriverCls + ", jdbcUrl=" + jdbcUrl + "]");
+
+ try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo)) {
+ Collection<String> schemas = DbMetadataReader.getInstance().schemas(conn);
+
+ if (log.isDebugEnabled())
+ log.debug("Finished collection of schemas [jdbcUrl=" + jdbcUrl + ", count=" + schemas.size() + "]");
+
+ return schemas;
+ }
+ catch (Throwable e) {
+ log.error("Failed to collect schemas", e);
+
+ throw new SQLException("Failed to collect schemas", e);
+ }
+ }
+
+ /**
+ * Listener for drivers.
+ *
+ * @return Drivers in drivers folder
+ * @see AgentConfiguration#driversFolder
+ */
+ public Emitter.Listener availableDriversListener() {
+ return availableDriversLsnr;
+ }
+
+ /**
+ * Listener for schema names.
+ *
+ * @return Collection of schema names.
+ */
+ public Emitter.Listener schemasListener() {
+ return schemasLsnr;
+ }
+
+ /**
+ * @param jdbcDriverJarPath JDBC driver JAR path.
+ * @param jdbcDriverCls JDBC driver class.
+ * @param jdbcUrl JDBC URL.
+ * @param jdbcInfo Properties to connect to database.
+ * @param schemas List of schema names to process.
+ * @param tblsOnly If {@code true} then only tables will be processed otherwise views also will be processed.
+ * @return Collection of tables.
+ */
+ protected Collection<DbTable> metadata(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
+ Properties jdbcInfo, List<String> schemas, boolean tblsOnly) throws SQLException {
+ if (log.isDebugEnabled())
+ log.debug("Start collecting database metadata [drvJar=" + jdbcDriverJarPath +
+ ", drvCls=" + jdbcDriverCls + ", jdbcUrl=" + jdbcUrl + "]");
+
+ try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo)) {
+ Collection<DbTable> metadata = DbMetadataReader.getInstance().metadata(conn, schemas, tblsOnly);
+
+ if (log.isDebugEnabled())
+ log.debug("Finished collection of metadata [jdbcUrl=" + jdbcUrl + ", count=" + metadata.size() + "]");
+
+ return metadata;
+ }
+ catch (Throwable e) {
+ log.error("Failed to collect metadata", e);
+
+ throw new SQLException("Failed to collect metadata", e);
+ }
+ }
+
+ /**
+ * Listener for tables.
+ *
+ * @return Collection of tables.
+ */
+ public Emitter.Listener metadataListener() {
+ return metadataLsnr;
+ }
+
+ /**
+ * Stop handler.
+ */
+ public void stop() {
+ availableDriversLsnr.stop();
+
+ schemasLsnr.stop();
+
+ metadataLsnr.stop();
+ }
+
+ /**
+ * Wrapper class for later to be transformed to JSON and send to Web Console.
+ */
+ private static class JdbcDriver {
+ /** */
+ public final String jdbcDriverJar;
+ /** */
+ public final String jdbcDriverCls;
+
+ /**
+ * @param jdbcDriverJar File name of driver jar file.
+ * @param jdbcDriverCls Optional JDBC driver class.
+ */
+ public JdbcDriver(String jdbcDriverJar, String jdbcDriverCls) {
+ this.jdbcDriverJar = jdbcDriverJar;
+ this.jdbcDriverCls = jdbcDriverCls;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262a3410/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestHandler.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestHandler.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestHandler.java
deleted file mode 100644
index 1b4b565..0000000
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestHandler.java
+++ /dev/null
@@ -1,276 +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.console.agent.handlers;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.ConnectException;
-import java.net.URISyntaxException;
-import java.nio.charset.Charset;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.codec.Charsets;
-import org.apache.http.Header;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpRequestBase;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.ignite.console.agent.AgentConfiguration;
-import org.apache.ignite.console.demo.AgentClusterDemo;
-import org.apache.log4j.Logger;
-
-import static org.apache.ignite.console.agent.AgentConfiguration.DFLT_NODE_PORT;
-
-/**
- * API to translate REST requests to Ignite cluster.
- */
-public class RestHandler extends AbstractHandler {
- /** */
- private static final Logger log = Logger.getLogger(RestHandler.class.getName());
-
- /** */
- private final AgentConfiguration cfg;
-
- /** */
- private CloseableHttpClient httpClient;
-
- /**
- * @param cfg Config.
- */
- public RestHandler(AgentConfiguration cfg) {
- this.cfg = cfg;
- }
-
- /**
- * Start HTTP client for communication with node via REST.
- */
- public void start() {
- httpClient = HttpClientBuilder.create().build();
- }
-
- /**
- * Stop HTTP client.
- */
- public void stop() {
- if (httpClient != null) {
- try {
- httpClient.close();
- }
- catch (IOException ignore) {
- // No-op.
- }
- }
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override public Object execute(Map<String, Object> args) throws Exception {
- if (log.isDebugEnabled())
- log.debug("Start parse REST command args: " + args);
-
- String uri = null;
-
- if (args.containsKey("uri"))
- uri = args.get("uri").toString();
-
- Map<String, Object> params = null;
-
- if (args.containsKey("params"))
- params = (Map<String, Object>)args.get("params");
-
- if (!args.containsKey("demo"))
- throw new IllegalArgumentException("Missing demo flag in arguments: " + args);
-
- boolean demo = (boolean)args.get("demo");
-
- if (!args.containsKey("method"))
- throw new IllegalArgumentException("Missing method in arguments: " + args);
-
- String mtd = args.get("method").toString();
-
- Map<String, Object> headers = null;
-
- if (args.containsKey("headers"))
- headers = (Map<String, Object>)args.get("headers");
-
- String body = null;
-
- if (args.containsKey("body"))
- body = args.get("body").toString();
-
- return executeRest(uri, params, demo, mtd, headers, body);
- }
-
- /**
- * @param uri Url.
- * @param params Params.
- * @param demo Use demo node.
- * @param mtd Method.
- * @param headers Headers.
- * @param body Body.
- */
- protected RestResult executeRest(String uri, Map<String, Object> params, boolean demo,
- String mtd, Map<String, Object> headers, String body) throws IOException, URISyntaxException {
- if (log.isDebugEnabled())
- log.debug("Start execute REST command [method=" + mtd + ", uri=/" + (uri == null ? "" : uri) +
- ", parameters=" + params + "]");
-
- final URIBuilder builder;
-
- if (demo) {
- // try start demo if needed.
- AgentClusterDemo.testDrive(cfg);
-
- // null if demo node not started yet.
- if (cfg.demoNodeUri() == null)
- return RestResult.fail("Demo node is not started yet.", 404);
-
- builder = new URIBuilder(cfg.demoNodeUri());
- }
- else
- builder = new URIBuilder(cfg.nodeUri());
-
- if (builder.getPort() == -1)
- builder.setPort(DFLT_NODE_PORT);
-
- if (uri != null) {
- if (!uri.startsWith("/") && !cfg.nodeUri().endsWith("/"))
- uri = '/' + uri;
-
- builder.setPath(uri);
- }
-
- if (params != null) {
- for (Map.Entry<String, Object> entry : params.entrySet()) {
- if (entry.getValue() != null)
- builder.addParameter(entry.getKey(), entry.getValue().toString());
- }
- }
-
- HttpRequestBase httpReq = null;
-
- try {
- if ("GET".equalsIgnoreCase(mtd))
- httpReq = new HttpGet(builder.build());
- else if ("POST".equalsIgnoreCase(mtd)) {
- HttpPost post;
-
- if (body == null) {
- List<NameValuePair> nvps = builder.getQueryParams();
-
- builder.clearParameters();
-
- post = new HttpPost(builder.build());
-
- if (!nvps.isEmpty())
- post.setEntity(new UrlEncodedFormEntity(nvps));
- }
- else {
- post = new HttpPost(builder.build());
-
- post.setEntity(new StringEntity(body));
- }
-
- httpReq = post;
- }
- else
- throw new IOException("Unknown HTTP-method: " + mtd);
-
- if (headers != null) {
- for (Map.Entry<String, Object> entry : headers.entrySet())
- httpReq.addHeader(entry.getKey(), entry.getValue() == null ? null : entry.getValue().toString());
- }
-
- try (CloseableHttpResponse resp = httpClient.execute(httpReq)) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- resp.getEntity().writeTo(out);
-
- Charset charset = Charsets.UTF_8;
-
- Header encodingHdr = resp.getEntity().getContentEncoding();
-
- if (encodingHdr != null) {
- String encoding = encodingHdr.getValue();
-
- charset = Charsets.toCharset(encoding);
- }
-
- return RestResult.success(resp.getStatusLine().getStatusCode(), new String(out.toByteArray(), charset));
- }
- catch (ConnectException e) {
- log.info("Failed connect to node and execute REST command [uri=" + builder.build() + "]");
-
- return RestResult.fail("Failed connect to node and execute REST command.", 404);
- }
- }
- finally {
- if (httpReq != null)
- httpReq.reset();
- }
- }
-
- /**
- * Request result.
- */
- public static class RestResult {
- /** The field contains description of error if server could not handle the request. */
- public final String error;
-
- /** REST http code. */
- public final int code;
-
- /** The field contains result of command. */
- public final String data;
-
- /**
- * @param error The field contains description of error if server could not handle the request.
- * @param resCode REST http code.
- * @param res The field contains result of command.
- */
- private RestResult(String error, int resCode, String res) {
- this.error = error;
- this.code = resCode;
- this.data = res;
- }
-
- /**
- * @param error The field contains description of error if server could not handle the request.
- * @param restCode REST http code.
- * @return Request result.
- */
- public static RestResult fail(String error, int restCode) {
- return new RestResult(error, restCode, null);
- }
-
- /**
- * @param code REST http code.
- * @param data The field contains result of command.
- * @return Request result.
- */
- public static RestResult success(int code, String data) {
- return new RestResult(null, code, data);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/262a3410/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java
new file mode 100644
index 0000000..1e86549
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java
@@ -0,0 +1,280 @@
+/*
+ * 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.console.agent.handlers;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.net.URISyntaxException;
+import java.nio.charset.Charset;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import org.apache.commons.codec.Charsets;
+import org.apache.http.Header;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.ignite.console.agent.AgentConfiguration;
+import org.apache.ignite.console.demo.AgentClusterDemo;
+import org.apache.log4j.Logger;
+
+import static org.apache.ignite.console.agent.AgentConfiguration.DFLT_NODE_PORT;
+
+/**
+ * API to translate REST requests to Ignite cluster.
+ */
+public class RestListener extends AbstractListener {
+ /** */
+ private static final Logger log = Logger.getLogger(RestListener.class.getName());
+
+ /** */
+ private final AgentConfiguration cfg;
+
+ /** */
+ private CloseableHttpClient httpClient;
+
+ /**
+ * @param cfg Config.
+ */
+ public RestListener(AgentConfiguration cfg) {
+ super();
+
+ this.cfg = cfg;
+
+ httpClient = HttpClientBuilder.create().build();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stop() {
+ super.stop();
+
+ if (httpClient != null) {
+ try {
+ httpClient.close();
+ }
+ catch (IOException ignore) {
+ // No-op.
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected ExecutorService newThreadPool() {
+ return Executors.newCachedThreadPool();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public Object execute(Map<String, Object> args) throws Exception {
+ if (log.isDebugEnabled())
+ log.debug("Start parse REST command args: " + args);
+
+ String uri = null;
+
+ if (args.containsKey("uri"))
+ uri = args.get("uri").toString();
+
+ Map<String, Object> params = null;
+
+ if (args.containsKey("params"))
+ params = (Map<String, Object>)args.get("params");
+
+ if (!args.containsKey("demo"))
+ throw new IllegalArgumentException("Missing demo flag in arguments: " + args);
+
+ boolean demo = (boolean)args.get("demo");
+
+ if (!args.containsKey("method"))
+ throw new IllegalArgumentException("Missing method in arguments: " + args);
+
+ String mtd = args.get("method").toString();
+
+ Map<String, Object> headers = null;
+
+ if (args.containsKey("headers"))
+ headers = (Map<String, Object>)args.get("headers");
+
+ String body = null;
+
+ if (args.containsKey("body"))
+ body = args.get("body").toString();
+
+ return executeRest(uri, params, demo, mtd, headers, body);
+ }
+
+ /**
+ * @param uri Url.
+ * @param params Params.
+ * @param demo Use demo node.
+ * @param mtd Method.
+ * @param headers Headers.
+ * @param body Body.
+ */
+ protected RestResult executeRest(String uri, Map<String, Object> params, boolean demo,
+ String mtd, Map<String, Object> headers, String body) throws IOException, URISyntaxException {
+ if (log.isDebugEnabled())
+ log.debug("Start execute REST command [method=" + mtd + ", uri=/" + (uri == null ? "" : uri) +
+ ", parameters=" + params + "]");
+
+ final URIBuilder builder;
+
+ if (demo) {
+ // try start demo if needed.
+ AgentClusterDemo.testDrive(cfg);
+
+ // null if demo node not started yet.
+ if (cfg.demoNodeUri() == null)
+ return RestResult.fail("Demo node is not started yet.", 404);
+
+ builder = new URIBuilder(cfg.demoNodeUri());
+ }
+ else
+ builder = new URIBuilder(cfg.nodeUri());
+
+ if (builder.getPort() == -1)
+ builder.setPort(DFLT_NODE_PORT);
+
+ if (uri != null) {
+ if (!uri.startsWith("/") && !cfg.nodeUri().endsWith("/"))
+ uri = '/' + uri;
+
+ builder.setPath(uri);
+ }
+
+ if (params != null) {
+ for (Map.Entry<String, Object> entry : params.entrySet()) {
+ if (entry.getValue() != null)
+ builder.addParameter(entry.getKey(), entry.getValue().toString());
+ }
+ }
+
+ HttpRequestBase httpReq = null;
+
+ try {
+ if ("GET".equalsIgnoreCase(mtd))
+ httpReq = new HttpGet(builder.build());
+ else if ("POST".equalsIgnoreCase(mtd)) {
+ HttpPost post;
+
+ if (body == null) {
+ List<NameValuePair> nvps = builder.getQueryParams();
+
+ builder.clearParameters();
+
+ post = new HttpPost(builder.build());
+
+ if (!nvps.isEmpty())
+ post.setEntity(new UrlEncodedFormEntity(nvps));
+ }
+ else {
+ post = new HttpPost(builder.build());
+
+ post.setEntity(new StringEntity(body));
+ }
+
+ httpReq = post;
+ }
+ else
+ throw new IOException("Unknown HTTP-method: " + mtd);
+
+ if (headers != null) {
+ for (Map.Entry<String, Object> entry : headers.entrySet())
+ httpReq.addHeader(entry.getKey(), entry.getValue() == null ? null : entry.getValue().toString());
+ }
+
+ try (CloseableHttpResponse resp = httpClient.execute(httpReq)) {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ resp.getEntity().writeTo(out);
+
+ Charset charset = Charsets.UTF_8;
+
+ Header encodingHdr = resp.getEntity().getContentEncoding();
+
+ if (encodingHdr != null) {
+ String encoding = encodingHdr.getValue();
+
+ charset = Charsets.toCharset(encoding);
+ }
+
+ return RestResult.success(resp.getStatusLine().getStatusCode(), new String(out.toByteArray(), charset));
+ }
+ catch (ConnectException e) {
+ log.info("Failed connect to node and execute REST command [uri=" + builder.build() + "]");
+
+ return RestResult.fail("Failed connect to node and execute REST command.", 404);
+ }
+ }
+ finally {
+ if (httpReq != null)
+ httpReq.reset();
+ }
+ }
+
+ /**
+ * Request result.
+ */
+ public static class RestResult {
+ /** The field contains description of error if server could not handle the request. */
+ public final String error;
+
+ /** REST http code. */
+ public final int code;
+
+ /** The field contains result of command. */
+ public final String data;
+
+ /**
+ * @param error The field contains description of error if server could not handle the request.
+ * @param resCode REST http code.
+ * @param res The field contains result of command.
+ */
+ private RestResult(String error, int resCode, String res) {
+ this.error = error;
+ this.code = resCode;
+ this.data = res;
+ }
+
+ /**
+ * @param error The field contains description of error if server could not handle the request.
+ * @param restCode REST http code.
+ * @return Request result.
+ */
+ public static RestResult fail(String error, int restCode) {
+ return new RestResult(error, restCode, null);
+ }
+
+ /**
+ * @param code REST http code.
+ * @param data The field contains result of command.
+ * @return Request result.
+ */
+ public static RestResult success(int code, String data) {
+ return new RestResult(null, code, data);
+ }
+ }
+}
[05/50] [abbrv] ignite git commit: Throw CacheException from queries
API.
Posted by yz...@apache.org.
Throw CacheException from queries API.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/51e1f874
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/51e1f874
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/51e1f874
Branch: refs/heads/ignite-comm-balance-master
Commit: 51e1f874624c428cc93e9c16407ec5a8b4cf8420
Parents: d396398
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jan 19 10:52:42 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jan 19 10:52:42 2017 +0300
----------------------------------------------------------------------
.../internal/processors/query/GridQueryProcessor.java | 2 +-
.../cache/query/IndexingSpiQuerySelfTest.java | 3 +--
.../cache/IgniteCacheAbstractQuerySelfTest.java | 2 --
.../near/IgniteCachePartitionedQuerySelfTest.java | 12 +++++-------
4 files changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/51e1f874/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 48ca2b5..c2e5717 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -905,7 +905,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}, true);
}
catch (IgniteCheckedException e) {
- throw new IgniteException(e);
+ throw new CacheException(e);
}
finally {
busyLock.leaveBusy();
http://git-wip-us.apache.org/repos/asf/ignite/blob/51e1f874/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
index 84a13df..e780fdc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
@@ -328,8 +328,7 @@ public class IndexingSpiQuerySelfTest extends TestCase {
}
/** {@inheritDoc} */
- @Override
- public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException {
+ @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException {
assertTrue(key instanceof BinaryObject);
assertTrue(val instanceof BinaryObject);
http://git-wip-us.apache.org/repos/asf/ignite/blob/51e1f874/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index 9f56877..751d954 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -46,7 +46,6 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteBinary;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
@@ -264,7 +263,6 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
stopAllGrids();
-
store.reset();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/51e1f874/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
index b9f21da..d5a9faf 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
@@ -39,7 +39,6 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.communication.CommunicationSpi;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
@@ -185,9 +184,8 @@ public class IgniteCachePartitionedQuerySelfTest extends IgniteCacheAbstractQuer
pages.incrementAndGet();
}
- else if (msg0 instanceof GridCacheQueryResponse) {
+ else if (msg0 instanceof GridCacheQueryResponse)
assertTrue(((GridCacheQueryResponse)msg0).data().size() <= pageSize);
- }
}
};
@@ -211,15 +209,15 @@ public class IgniteCachePartitionedQuerySelfTest extends IgniteCacheAbstractQuer
*
*/
private static class TestTcpCommunicationSpi extends TcpCommunicationSpi {
+ /** */
volatile IgniteInClosure<Message> filter;
/** {@inheritDoc} */
- @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure)
- throws IgniteSpiException {
- if(filter != null)
+ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) {
+ if (filter != null)
filter.apply(msg);
- super.sendMessage(node, msg, ackClosure);
+ super.sendMessage(node, msg, ackC);
}
}
}
\ No newline at end of file