You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vk...@apache.org on 2015/04/08 23:26:35 UTC
[01/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-639' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-471 3a1582a50 -> f825ed08b
Merge branches 'ignite-639' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b1898776
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b1898776
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b1898776
Branch: refs/heads/ignite-471
Commit: b1898776bac93ea164db6d06780f0eb84c6b1e2d
Parents: fdf56a5 5a2b46c
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 09:15:09 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 09:15:09 2015 +0700
----------------------------------------------------------------------
assembly/release-fabric.xml | 5 -
modules/clients/readme.md | 2 -
.../cache/eviction/fifo/FifoEvictionPolicy.java | 58 ++-
.../eviction/fifo/FifoEvictionPolicyMBean.java | 16 +
.../apache/ignite/internal/GridComponent.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +-
.../ignite/internal/GridPluginComponent.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 7 -
.../apache/ignite/internal/IgniteKernal.java | 27 +-
.../ignite/internal/IgniteNodeAttributes.java | 3 -
.../internal/managers/GridManagerAdapter.java | 6 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../processors/cache/CacheDistributionMode.java | 67 ----
.../internal/processors/cache/CacheType.java | 77 ++++
.../cache/DynamicCacheChangeRequest.java | 17 +
.../cache/DynamicCacheDescriptor.java | 15 +-
.../processors/cache/GridCacheAdapter.java | 6 +-
.../processors/cache/GridCacheContext.java | 26 +-
.../cache/GridCacheDeploymentManager.java | 2 +-
.../processors/cache/GridCacheEventManager.java | 4 +-
.../processors/cache/GridCacheProcessor.java | 139 ++++---
.../cache/GridCacheSharedContext.java | 4 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 4 +-
.../near/GridNearTransactionalCache.java | 2 +-
.../continuous/CacheContinuousQueryManager.java | 2 +-
.../transactions/IgniteTransactionsImpl.java | 19 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../cache/transactions/IgniteTxManager.java | 8 +-
.../DiscoveryNodeValidationProcessor.java | 27 ++
.../OsDiscoveryNodeValidationProcessor.java | 72 ++++
.../processors/query/GridQueryProcessor.java | 8 +-
.../processors/task/GridTaskProcessor.java | 24 +-
.../ignite/internal/util/IgniteUtils.java | 46 ++-
.../internal/visor/util/VisorTaskUtils.java | 18 +-
.../ignite/spi/IgniteNodeValidationResult.java | 66 ++++
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 2 +-
.../spi/IgniteSpiNodeValidationResult.java | 66 ----
.../spi/discovery/tcp/TcpDiscoverySpi.java | 106 +----
.../org/apache/ignite/stream/StreamVisitor.java | 2 +-
.../cache/IgniteDynamicCacheStartSelfTest.java | 47 +--
.../cache/IgniteInternalCacheTypesTest.java | 159 ++++++++
.../IgniteCollectionAbstractTest.java | 23 --
.../IgniteCacheSystemTransactionsSelfTest.java | 3 +-
...GridCacheDhtEvictionNearReadersSelfTest.java | 2 +-
.../near/GridCacheNearEvictionSelfTest.java | 2 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 8 +-
...NearDisabledBasicStoreMultiNodeSelfTest.java | 8 +-
.../eviction/GridCacheEvictionAbstractTest.java | 5 +-
...ridCacheFifoBatchEvictionPolicySelfTest.java | 385 +++++++++++++++++++
.../processors/igfs/IgfsStartCacheTest.java | 158 ++++++++
.../processors/igfs/IgsfStartCacheTest.java | 115 ------
.../loadtests/hashmap/GridCacheTestContext.java | 1 +
.../testframework/GridSpiTestContext.java | 2 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../ignite/testsuites/IgniteIgfsTestSuite.java | 2 +
.../HadoopDefaultMapReducePlannerSelfTest.java | 5 -
.../query/h2/sql/GridSqlQuerySplitter.java | 22 +-
.../h2/twostep/GridReduceQueryExecutor.java | 13 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
...niteCacheAtomicNearEnabledQuerySelfTest.java | 7 +-
.../near/IgniteCacheAtomicQuerySelfTest.java | 7 +-
.../query/h2/sql/GridQueryParsingTest.java | 1 +
.../query/h2/sql/IgniteVsH2QueryTest.java | 7 +
modules/schedule/pom.xml | 20 +
modules/yardstick/README.md | 3 +-
.../yardstick/IgniteAbstractBenchmark.java | 5 +-
.../yardstick/IgniteBenchmarkArguments.java | 22 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 11 +-
parent/pom.xml | 49 +--
pom.xml | 143 ++++++-
71 files changed, 1578 insertions(+), 633 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1898776/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1898776/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
[19/50] [abbrv] incubator-ignite git commit: ignite-624 - fix
Posted by vk...@apache.org.
ignite-624 - fix
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cf1cf9d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cf1cf9d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cf1cf9d0
Branch: refs/heads/ignite-471
Commit: cf1cf9d00788482abe89feeb39746f24035fc53b
Parents: 3daa0b6
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 8 01:20:07 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 8 01:20:07 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/lang/GridFunc.java | 14 ++++
.../processors/query/h2/sql/GridSqlElement.java | 8 ---
.../processors/query/h2/sql/GridSqlQuery.java | 26 +++++--
.../query/h2/sql/GridSqlQueryParser.java | 7 +-
.../query/h2/sql/GridSqlQuerySplitter.java | 25 ++++---
.../processors/query/h2/sql/GridSqlSelect.java | 73 +++++++++++++-------
.../processors/query/h2/sql/GridSqlUnion.java | 10 +++
.../query/h2/sql/GridQueryParsingTest.java | 6 +-
.../query/h2/sql/IgniteVsH2QueryTest.java | 17 ++++-
9 files changed, 131 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index edd66d7..773b9ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -5429,6 +5429,20 @@ public class GridFunc {
}
/**
+ * @param c Target collection.
+ * @param it Iterator to fetch.
+ * @return Modified target collection.
+ */
+ public static <T, C extends Collection<T>> C addAll(C c, Iterator<? extends T> it) {
+ if (it != null) {
+ while (it.hasNext())
+ c.add(it.next());
+ }
+
+ return c;
+ }
+
+ /**
* Gets the value with given key. If that value does not exist, calls given
* closure to get the default value, puts it into the map and returns it. If
* closure is {@code null} return {@code null}.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
index 7ebdba1..a1c91ff 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlElement.java
@@ -51,14 +51,6 @@ public abstract class GridSqlElement implements Cloneable, Iterable<GridSqlEleme
public abstract String getSQL();
/**
- * Clears all children.
- */
- public void clearChildren() {
- if (size() != 0)
- children = new ArrayList<>();
- }
-
- /**
* @param expr Expr.
* @return {@code this}.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
index 5953d5e..c40632f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.query.h2.sql;
-import org.apache.ignite.*;
import org.h2.util.*;
import java.util.*;
@@ -107,12 +106,25 @@ public abstract class GridSqlQuery implements Cloneable {
}
/**
+ * @return Number of visible columns.
+ */
+ protected abstract int visibleColumns();
+
+ /**
+ * @param col Column index.
+ * @return Expression for column index.
+ */
+ protected abstract GridSqlElement expression(int col);
+
+ /**
* @param buff Statement builder.
*/
protected void getSortLimitSQL(StatementBuilder buff) {
if (!sort.isEmpty()) {
buff.append("\nORDER BY ");
+ int visibleCols = visibleColumns();
+
boolean first = true;
for (GridSqlSortColumn col : sort) {
@@ -123,11 +135,17 @@ public abstract class GridSqlQuery implements Cloneable {
int idx = col.column();
- if (idx >= 0)
+ assert idx >= 0 : idx;
+
+ if (idx < visibleCols)
buff.append(idx + 1);
else {
- throw new IgniteException("Failed to generate query: " + buff);
-// buff.append('=').append(StringUtils.unEnclose(entry.getKey().getSQL()));
+ GridSqlElement expr = expression(idx);
+
+ if (expr == null) // For plain select should never be null, for union H2 itself can't parse query.
+ throw new IllegalStateException("Failed to build query: " + buff.toString());
+
+ buff.append('=').append(StringUtils.unEnclose(expr.getSQL()));
}
if (!col.asc())
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index ea3628f..b174d71 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -270,8 +270,8 @@ public class GridSqlQueryParser {
ArrayList<Expression> expressions = select.getExpressions();
- for (Expression exp : expressions)
- res.addExpression(parseExpression(exp));
+ for (int i = 0; i < expressions.size(); i++)
+ res.addSelectExpression(parseExpression(expressions.get(i)), i < select.getColumnCount());
int[] grpIdx = GROUP_INDEXES.get(select);
@@ -290,9 +290,6 @@ public class GridSqlQueryParser {
res.having(parseExpression(expressions.get(havingIdx)));
}
- for (int i = 0; i < select.getColumnCount(); i++)
- res.addSelectExpression(parseExpression(expressions.get(i)));
-
processSortOrder(select.getSortOrder(), res);
res.limit(parseExpression(select.getLimit()));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/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 05928c2..b84084b 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
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.query.h2.sql;
import org.apache.ignite.*;
import org.apache.ignite.internal.processors.cache.query.*;
+import org.apache.ignite.internal.util.typedef.*;
import org.h2.jdbc.*;
import org.h2.value.*;
import org.jetbrains.annotations.*;
@@ -89,7 +90,7 @@ public class GridSqlQuerySplitter {
int c = 0;
- for (GridSqlElement expr : left.select()) {
+ for (GridSqlElement expr : left.select(true)) {
String colName;
if (expr instanceof GridSqlAlias)
@@ -102,11 +103,12 @@ public class GridSqlQuerySplitter {
expr = alias(colName, expr);
// Set generated alias to the expression.
- left.select().set(c, expr);
- left.allExpressions().set(c, expr);
+ left.setSelectExpression(c, expr);
}
- srcQry.addSelectExpression(column(colName));
+ GridSqlColumn col = column(colName);
+
+ srcQry.addSelectExpression(col, true);
qry0.sort();
@@ -126,8 +128,8 @@ public class GridSqlQuerySplitter {
GridSqlSelect rdcQry = new GridSqlSelect().from(new GridSqlFunction("PUBLIC", TABLE_FUNC_NAME)); // table(mergeTable)); TODO
// Split all select expressions into map-reduce parts.
- List<GridSqlElement> mapExps = new ArrayList<>(srcQry.allExpressions());
- GridSqlElement[] rdcExps = new GridSqlElement[srcQry.select().size()];
+ List<GridSqlElement> mapExps = F.addAll(new ArrayList<GridSqlElement>(), srcQry.select(false).iterator());
+ GridSqlElement[] rdcExps = new GridSqlElement[srcQry.visibleColumns()];
Set<String> colNames = new HashSet<>();
@@ -140,13 +142,13 @@ public class GridSqlQuerySplitter {
mapQry.clearSelect();
for (GridSqlElement exp : mapExps)
- mapQry.addSelectExpression(exp);
+ mapQry.addSelectExpression(exp, true);
for (GridSqlElement rdcExp : rdcExps)
- rdcQry.addSelectExpression(rdcExp);
+ rdcQry.addSelectExpression(rdcExp, true);
// -- GROUP BY
- if (!srcQry.groups().isEmpty()) {
+ if (srcQry.hasGroupBy()) {
mapQry.clearGroups();
for (int col : srcQry.groupColumns())
@@ -219,6 +221,9 @@ public class GridSqlQuerySplitter {
findParams(union.left(), params, target);
findParams(union.right(), params, target);
+ findParams(qry.limit(), params, target);
+ findParams(qry.offset(), params, target);
+
return target;
}
@@ -232,7 +237,7 @@ public class GridSqlQuerySplitter {
if (params.length == 0)
return target;
- for (GridSqlElement el : qry.allExpressions())
+ for (GridSqlElement el : qry.select(false))
findParams(el, params, target);
findParams(qry.from(), params, target);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
index 154659b..398ae10 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
@@ -26,7 +26,7 @@ import java.util.*;
*/
public class GridSqlSelect extends GridSqlQuery {
/** */
- private List<GridSqlElement> allExprs;
+ private List<GridSqlElement> allExprs = new ArrayList<>();
/** */
private List<GridSqlElement> select = new ArrayList<>();
@@ -50,6 +50,16 @@ public class GridSqlSelect extends GridSqlQuery {
private int havingCol = -1;
/** {@inheritDoc} */
+ @Override public int visibleColumns() {
+ return select.size();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected GridSqlElement expression(int col) {
+ return allExprs.get(col);
+ }
+
+ /** {@inheritDoc} */
@Override public String getSQL() {
StatementBuilder buff = new StatementBuilder("SELECT");
@@ -91,27 +101,11 @@ public class GridSqlSelect extends GridSqlQuery {
}
/**
- * @param expression Expression.
- */
- public void addExpression(GridSqlElement expression) {
- if (allExprs == null)
- allExprs = new ArrayList<>();
-
- allExprs.add(expression);
- }
-
- /**
- * @return All expressions in select, group by, order by.
- */
- public List<GridSqlElement> allExpressions() {
- return allExprs;
- }
-
- /**
- * @return Expressions.
+ * @param visibleOnly If only visible expressions needed.
+ * @return Select phrase expressions.
*/
- public List<GridSqlElement> select() {
- return select;
+ public Iterable<GridSqlElement> select(boolean visibleOnly) {
+ return visibleOnly ? select : allExprs;
}
/**
@@ -119,26 +113,55 @@ public class GridSqlSelect extends GridSqlQuery {
*/
public void clearSelect() {
select = new ArrayList<>();
+ allExprs = new ArrayList<>();
}
/**
* @param expression Expression.
+ * @param visible Expression is visible in select phrase.
*/
- public void addSelectExpression(GridSqlElement expression) {
+ public void addSelectExpression(GridSqlElement expression, boolean visible) {
if (expression == null)
throw new NullPointerException();
- select.add(expression);
+ if (visible) {
+ if (select.size() != allExprs.size())
+ throw new IllegalStateException("Already started adding invisible columns.");
+
+ select.add(expression);
+ }
+ else if (select.isEmpty())
+ throw new IllegalStateException("No visible columns.");
+
+ allExprs.add(expression);
+ }
+
+ /**
+ * @param colIdx Column index.
+ * @param expression Expression.
+ */
+ public void setSelectExpression(int colIdx, GridSqlElement expression) {
+ if (colIdx < select.size()) // Assuming that all the needed expressions were already added.
+ select.set(colIdx, expression);
+
+ allExprs.set(colIdx, expression);
}
/**
* @return Expressions.
*/
- public List<GridSqlElement> groups() {
+ public Iterable<GridSqlElement> groups() {
return groups;
}
/**
+ * @return {@code true} If the select has group by expression.
+ */
+ public boolean hasGroupBy() {
+ return !groups.isEmpty();
+ }
+
+ /**
*
*/
public void clearGroups() {
@@ -252,7 +275,7 @@ public class GridSqlSelect extends GridSqlQuery {
res.groups = new ArrayList<>(groups);
res.grpCols = grpCols == null ? null : grpCols.clone();
res.select = new ArrayList<>(select);
- res.allExprs = null;
+ res.allExprs = new ArrayList<>(allExprs);
return res;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
index 6fe3f19..90d9e41 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
@@ -36,6 +36,16 @@ public class GridSqlUnion extends GridSqlQuery {
private GridSqlQuery left;
/** {@inheritDoc} */
+ @Override protected int visibleColumns() {
+ return left.visibleColumns();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected GridSqlElement expression(int col) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
@Override public String getSQL() {
StatementBuilder buff = new StatementBuilder();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index 83162f0..66ba6ac 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -208,6 +208,8 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
checkQuery("select name from Person UNION select street from Address limit ?");
checkQuery("select name from Person UNION select street from Address limit ? offset ?");
checkQuery("(select name from Person limit 4) UNION (select street from Address limit 1) limit ? offset ?");
+ checkQuery("(select 2 a) union all (select 1) order by 1");
+ checkQuery("(select 2 a) union all (select 1) order by a desc nulls first limit ? offset ?");
}
/**
@@ -282,9 +284,9 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
else
throw new UnsupportedOperationException();
- assertSqlEquals(prepared.getPlanSQL(), res);
-
System.out.println(normalizeSql(res));
+
+ assertSqlEquals(prepared.getPlanSQL(), res);
}
@QuerySqlFunction
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cf1cf9d0/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
index 1f4771a..5da72b4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
@@ -526,7 +526,7 @@ public class IgniteVsH2QueryTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
- public void testSimpleReplSelect() throws Exception {
+ public void _testSimpleReplSelect() throws Exception {
compareQueryRes0("select id, name, price from \"repl\".Product");
}
@@ -555,6 +555,21 @@ public class IgniteVsH2QueryTest extends GridCommonAbstractTest {
}
/**
+ *
+ */
+ public void testUnion() throws SQLException {
+ String base = "select _val v from \"part\".Person";
+
+ compareQueryRes0(base + " union all " + base);
+ compareQueryRes0(base + " union " + base);
+
+ base = "select firstName||lastName name, salary from \"part\".Person";
+
+ assertEquals(10, compareOrderedQueryRes0(base + " union all " + base + " order by salary desc").size());
+ assertEquals(5, compareOrderedQueryRes0(base + " union " + base + " order by salary desc").size());
+ }
+
+ /**
* @throws Exception If failed.
*/
public void testEmptyResult() throws Exception {
[20/50] [abbrv] incubator-ignite git commit: Merge branch
'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-624
Posted by vk...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-624
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/58f49139
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/58f49139
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/58f49139
Branch: refs/heads/ignite-471
Commit: 58f4913905c3dccc2fe87da2a58f73da5416955e
Parents: cf1cf9d beedb17
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 8 01:25:24 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 8 01:25:24 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 24 +++-
.../communication/tcp/TcpCommunicationSpi.java | 14 +--
.../discovery/tcp/TcpClientDiscoverySpi.java | 47 ++++----
.../spi/discovery/tcp/TcpDiscoverySpi.java | 78 ++++++-------
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 8 +-
.../spi/swapspace/file/FileSwapSpaceSpi.java | 4 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 110 ++-----------------
...ridCacheFifoBatchEvictionPolicySelfTest.java | 3 +-
.../GridAbstractCommunicationSelfTest.java | 3 +-
.../GridTcpCommunicationSpiAbstractTest.java | 5 +-
...mmunicationSpiConcurrentConnectSelfTest.java | 3 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 3 +-
...dTcpCommunicationSpiRecoveryAckSelfTest.java | 3 +-
...GridTcpCommunicationSpiRecoverySelfTest.java | 2 +-
.../IgniteCacheEvictionSelfTestSuite.java | 1 +
parent/pom.xml | 2 +-
pom.xml | 1 +
17 files changed, 121 insertions(+), 190 deletions(-)
----------------------------------------------------------------------
[45/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-30' into ignite-sprint-3
Posted by vk...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-30' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/382229c5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/382229c5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/382229c5
Branch: refs/heads/ignite-471
Commit: 382229c51c7b869778e8dce846c111f51f70c699
Parents: 2f458d2 c31dbd2
Author: sevdokimov <se...@gridgain.com>
Authored: Wed Apr 8 19:48:05 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed Apr 8 19:48:05 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/ClusterMetricsSnapshot.java | 384 ++++++-------------
.../messages/TcpDiscoveryAbstractMessage.java | 24 +-
.../messages/TcpDiscoveryAuthFailedMessage.java | 25 +-
.../TcpDiscoveryCheckFailedMessage.java | 24 +-
.../TcpDiscoveryClientReconnectMessage.java | 30 +-
.../TcpDiscoveryCustomEventMessage.java | 23 +-
.../messages/TcpDiscoveryDiscardMessage.java | 24 +-
.../TcpDiscoveryDuplicateIdMessage.java | 24 +-
.../messages/TcpDiscoveryHandshakeRequest.java | 8 -
.../messages/TcpDiscoveryHandshakeResponse.java | 22 --
.../messages/TcpDiscoveryHeartbeatMessage.java | 44 +--
.../TcpDiscoveryJoinRequestMessage.java | 28 +-
.../TcpDiscoveryLoopbackProblemMessage.java | 28 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 24 +-
.../messages/TcpDiscoveryNodeAddedMessage.java | 60 +--
.../messages/TcpDiscoveryNodeFailedMessage.java | 28 +-
.../messages/TcpDiscoveryNodeLeftMessage.java | 8 -
.../tcp/messages/TcpDiscoveryPingRequest.java | 25 +-
.../tcp/messages/TcpDiscoveryPingResponse.java | 14 -
.../TcpDiscoveryStatusCheckMessage.java | 30 +-
20 files changed, 148 insertions(+), 729 deletions(-)
----------------------------------------------------------------------
[22/50] [abbrv] incubator-ignite git commit: Merge branch ignite-477
into ignite-sprint-3
Posted by vk...@apache.org.
Merge branch ignite-477 into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/21cfc8da
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/21cfc8da
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/21cfc8da
Branch: refs/heads/ignite-471
Commit: 21cfc8da70bf745b1cd9a7ac7d26ff75e063f41d
Parents: fd011e2 dc8c4a9
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Tue Apr 7 19:11:45 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Tue Apr 7 19:11:45 2015 -0700
----------------------------------------------------------------------
.../distributed/dht/GridDhtLockFuture.java | 10 +++-
.../distributed/dht/GridDhtTxLocalAdapter.java | 49 +++++++++++---------
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 3 +-
4 files changed, 39 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
[46/50] [abbrv] incubator-ignite git commit: ignite-437: test for
bigQuery sql
Posted by vk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe743909/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
deleted file mode 100644
index 5845a2e..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
+++ /dev/null
@@ -1,875 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.sql;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.affinity.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.cache.query.annotations.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.marshaller.optimized.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.sql.*;
-import java.util.*;
-
-/**
- * Test to compare query results from h2 database instance and mixed ignite caches (replicated and partitioned)
- * which have the same data models and data content.
- */
-public class IgniteVsH2QueryTest extends GridCommonAbstractTest {
- /** */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** Partitioned cache. */
- private static IgniteCache pCache;
-
- /** Replicated cache. */
- private static IgniteCache rCache;
-
- /** H2 db connection. */
- private static Connection conn;
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(gridName);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(IP_FINDER);
-
- c.setDiscoverySpi(disco);
-
- c.setMarshaller(new OptimizedMarshaller(true));
-
- c.setCacheConfiguration(createCache("part", CacheMode.PARTITIONED),
- createCache("repl", CacheMode.REPLICATED)
- );
-
- return c;
- }
-
- /**
- * Creates new cache configuration.
- *
- * @param name Cache name.
- * @param mode Cache mode.
- * @return Cache configuration.
- */
- private static CacheConfiguration createCache(String name, CacheMode mode) {
- CacheConfiguration<?,?> cc = defaultCacheConfiguration();
-
- cc.setName(name);
- cc.setCacheMode(mode);
- cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
- cc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
-
- if (mode == CacheMode.PARTITIONED)
- cc.setIndexedTypes(
- Integer.class, Organization.class,
- AffinityKey.class, Person.class,
- AffinityKey.class, Purchase.class
- );
- else if (mode == CacheMode.REPLICATED)
- cc.setIndexedTypes(
- Integer.class, Product.class
- );
- else
- throw new IllegalStateException("mode: " + mode);
-
- return cc;
- }
-
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- super.beforeTestsStarted();
-
- Ignite ignite = startGrids(4);
-
- pCache = ignite.cache("part");
-
- rCache = ignite.cache("repl");
-
- awaitPartitionMapExchange();
-
- conn = openH2Connection(false);
-
- initializeH2Schema();
-
- initCacheAndDbData();
-
- checkAllDataEquals();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- super.afterTestsStopped();
-
- conn.close();
-
- stopAllGrids();
- }
-
- /**
- * Populate cache and h2 database with test data.
- */
- @SuppressWarnings("unchecked")
- private void initCacheAndDbData() throws SQLException {
- int idGen = 0;
-
- // Organizations.
- List<Organization> organizations = new ArrayList<>();
-
- for (int i = 0; i < 3; i++) {
- int id = idGen++;
-
- Organization org = new Organization(id, "Org" + id);
-
- organizations.add(org);
-
- pCache.put(org.id, org);
-
- insertInDb(org);
- }
-
- // Persons.
- List<Person> persons = new ArrayList<>();
-
- for (int i = 0; i < 5; i++) {
- int id = idGen++;
-
- Person person = new Person(id, organizations.get(i % organizations.size()),
- "name" + id, "lastName" + id, id * 100.0);
-
- // Add a Person without lastname.
- if (id == organizations.size() + 1)
- person.lastName = null;
-
- persons.add(person);
-
- pCache.put(person.key(), person);
-
- insertInDb(person);
- }
-
- // Products.
- List<Product> products = new ArrayList<>();
-
- for (int i = 0; i < 10; i++) {
- int id = idGen++;
-
- Product product = new Product(id, "Product" + id, id*1000);
-
- products.add(product);
-
- rCache.put(product.id, product);
-
- insertInDb(product);
- }
-
- // Purchases.
- for (int i = 0; i < products.size() * 2; i++) {
- int id = idGen++;
-
- Purchase purchase = new Purchase(id, products.get(i % products.size()), persons.get(i % persons.size()));
-
- pCache.put(purchase.key(), purchase);
-
- insertInDb(purchase);
- }
- }
-
- /**
- * Insert {@link Organization} at h2 database.
- *
- * @param org Organization.
- * @throws SQLException If exception.
- */
- private void insertInDb(Organization org) throws SQLException {
- try(PreparedStatement st = conn.prepareStatement(
- "insert into \"part\".ORGANIZATION (_key, _val, id, name) values(?, ?, ?, ?)")) {
- st.setObject(1, org.id);
- st.setObject(2, org);
- st.setObject(3, org.id);
- st.setObject(4, org.name);
-
- st.executeUpdate();
- }
- }
-
- /**
- * Insert {@link Person} at h2 database.
- *
- * @param p Person.
- * @throws SQLException If exception.
- */
- private void insertInDb(Person p) throws SQLException {
- try(PreparedStatement st = conn.prepareStatement("insert into \"part\".PERSON " +
- "(_key, _val, id, firstName, lastName, orgId, salary) values(?, ?, ?, ?, ?, ?, ?)")) {
- st.setObject(1, p.key());
- st.setObject(2, p);
- st.setObject(3, p.id);
- st.setObject(4, p.firstName);
- st.setObject(5, p.lastName);
- st.setObject(6, p.orgId);
- st.setObject(7, p.salary);
-
- st.executeUpdate();
- }
- }
-
- /**
- * Insert {@link Product} at h2 database.
- *
- * @param p Product.
- * @throws SQLException If exception.
- */
- private void insertInDb(Product p) throws SQLException {
- try(PreparedStatement st = conn.prepareStatement(
- "insert into \"repl\".PRODUCT (_key, _val, id, name, price) values(?, ?, ?, ?, ?)")) {
- st.setObject(1, p.id);
- st.setObject(2, p);
- st.setObject(3, p.id);
- st.setObject(4, p.name);
- st.setObject(5, p.price);
-
- st.executeUpdate();
- }
- }
-
- /**
- * Insert {@link Purchase} at h2 database.
- *
- * @param p Purchase.
- * @throws SQLException If exception.
- */
- private void insertInDb(Purchase p) throws SQLException {
- try(PreparedStatement st = conn.prepareStatement(
- "insert into \"part\".PURCHASE (_key, _val, id, personId, productId) values(?, ?, ?, ?, ?)")) {
- st.setObject(1, p.key());
- st.setObject(2, p);
- st.setObject(3, p.id);
- st.setObject(4, p.personId);
- st.setObject(5, p.productId);
-
- st.executeUpdate();
- }
- }
-
- /**
- * Initialize h2 database schema.
- *
- * @throws SQLException If exception.
- */
- private void initializeH2Schema() throws SQLException {
- Statement st = conn.createStatement();
-
- st.execute("CREATE SCHEMA \"part\"");
- st.execute("CREATE SCHEMA \"repl\"");
-
- st.execute("create table \"part\".ORGANIZATION" +
- " (_key int not null," +
- " _val other not null," +
- " id int unique," +
- " name varchar(255))");
-
- st.execute("create table \"part\".PERSON" +
- " (_key other not null ," +
- " _val other not null ," +
- " id int unique, " +
- " firstName varchar(255), " +
- " lastName varchar(255)," +
- " orgId int not null," +
- " salary double )");
-
- st.execute("create table \"repl\".PRODUCT" +
- " (_key int not null ," +
- " _val other not null ," +
- " id int unique, " +
- " name varchar(255), " +
- " price int)");
-
- st.execute("create table \"part\".PURCHASE" +
- " (_key other not null ," +
- " _val other not null ," +
- " id int unique, " +
- " personId int, " +
- " productId int)");
-
- conn.commit();
- }
-
- /**
- * Gets connection from a pool.
- *
- * @param autocommit {@code true} If connection should use autocommit mode.
- * @return Pooled connection.
- * @throws SQLException In case of error.
- */
- private Connection openH2Connection(boolean autocommit) throws SQLException {
- System.setProperty("h2.serializeJavaObject", "false");
-
- String dbName = "test";
-
- Connection conn = DriverManager.getConnection("jdbc:h2:mem:" + dbName + ";DB_CLOSE_DELAY=-1");
-
- conn.setAutoCommit(autocommit);
-
- return conn;
- }
-
- /**
- * Execute given sql query on h2 database and on partitioned ignite cache and compare results.
- *
- * @param sql SQL query.
- * @param args SQL arguments.
- * then results will compare as ordered queries.
- * @return Result set after SQL query execution.
- * @throws SQLException If exception.
- */
- private List<List<?>> compareQueryRes0(String sql, @Nullable Object... args) throws SQLException {
- return compareQueryRes0(pCache, sql, args, Order.RANDOM);
- }
-
- /**
- * Execute given sql query on h2 database and on ignite cache and compare results.
- * Expected that results are not ordered.
- *
- * @param cache Ignite cache.
- * @param sql SQL query.
- * @param args SQL arguments.
- * then results will compare as ordered queries.
- * @return Result set after SQL query execution.
- * @throws SQLException If exception.
- */
- private List<List<?>> compareQueryRes0(IgniteCache cache, String sql, @Nullable Object... args) throws SQLException {
- return compareQueryRes0(cache, sql, args, Order.RANDOM);
- }
-
- /**
- * Execute given sql query on h2 database and on partitioned ignite cache and compare results.
- * Expected that results are ordered.
- *
- * @param sql SQL query.
- * @param args SQL arguments.
- * then results will compare as ordered queries.
- * @return Result set after SQL query execution.
- * @throws SQLException If exception.
- */
- private List<List<?>> compareOrderedQueryRes0(String sql, @Nullable Object... args) throws SQLException {
- return compareQueryRes0(pCache, sql, args, Order.ORDERED);
- }
-
- /**
- * Execute given sql query on h2 database and on ignite cache and compare results.
- *
- * @param cache Ignite cache.
- * @param sql SQL query.
- * @param args SQL arguments.
- * @param order Expected ordering of SQL results. If {@link Order#ORDERED}
- * then results will compare as ordered queries.
- * @return Result set after SQL query execution.
- * @throws SQLException If exception.
- */
- @SuppressWarnings("unchecked")
- private List<List<?>> compareQueryRes0(IgniteCache cache, String sql, @Nullable Object[] args, Order order) throws SQLException {
- if (args == null)
- args = new Object[] {null};
-
- log.info("Sql=\"" + sql + "\", args=" + Arrays.toString(args));
-
- List<List<?>> h2Res = executeH2Query(sql, args);
-
- List<List<?>> cacheRes = cache.query(new SqlFieldsQuery(sql).setArgs(args)).getAll();
-
- assertRsEquals(h2Res, cacheRes, order);
-
- return cacheRes;
- }
-
- /**
- * Execute SQL query on h2 database.
- *
- * @param sql SQL query.
- * @param args SQL arguments.
- * @return Result of SQL query on h2 database.
- * @throws SQLException If exception.
- */
- private List<List<?>> executeH2Query(String sql, Object[] args) throws SQLException {
- List<List<?>> res = new ArrayList<>();
- ResultSet rs = null;
-
- try(PreparedStatement st = conn.prepareStatement(sql)) {
- for (int idx = 0; idx < args.length; idx++)
- st.setObject(idx + 1, args[idx]);
-
- rs = st.executeQuery();
-
- int colCnt = rs.getMetaData().getColumnCount();
-
- while (rs.next()) {
- List<Object> row = new ArrayList<>(colCnt);
-
- for (int i = 1; i <= colCnt; i++)
- row.add(rs.getObject(i));
-
- res.add(row);
- }
- }
- finally {
- U.closeQuiet(rs);
- }
-
- return res;
- }
-
- /**
- * Assert equals of result sets according to expected ordering.
- *
- * @param rs1 Expected result set.
- * @param rs2 Actual result set.
- * @param order Expected ordering of SQL results. If {@link Order#ORDERED}
- * then results will compare as ordered queries.
- */
- private void assertRsEquals(List<List<?>> rs1, List<List<?>> rs2, Order order) {
- assertEquals("Rows count has to be equal.", rs1.size(), rs2.size());
-
- switch (order){
- case ORDERED:
- for (int rowNum = 0; rowNum < rs1.size(); rowNum++) {
- List<?> row1 = rs1.get(rowNum);
- List<?> row2 = rs2.get(rowNum);
-
- assertEquals("Columns count have to be equal.", row1.size(), row2.size());
-
- for (int colNum = 0; colNum < row1.size(); colNum++)
- assertEquals("Row=" + rowNum + ", column=" + colNum, row1.get(colNum), row2.get(colNum));
- }
-
- break;
- case RANDOM:
- Map<List<?>, Integer> rowsWithCnt1 = extractUniqueRowsWithCounts(rs1);
- Map<List<?>, Integer> rowsWithCnt2 = extractUniqueRowsWithCounts(rs2);
-
- assertEquals("Unique rows count has to be equal.", rowsWithCnt1.size(), rowsWithCnt2.size());
-
- for (Map.Entry<List<?>, Integer> entry1 : rowsWithCnt1.entrySet()) {
- List<?> row = entry1.getKey();
- Integer cnt1 = entry1.getValue();
-
- Integer cnt2 = rowsWithCnt2.get(row);
-
- assertEquals("Row has different occurance number.\nRow=" + row, cnt1, cnt2);
- }
-
- break;
- default:
- throw new IllegalStateException();
- }
- }
-
- /**
- * @param rs Result set.
- * @return Map of unique rows at the result set to number of occuriances at the result set.
- */
- private Map<List<?>, Integer> extractUniqueRowsWithCounts(Iterable<List<?>> rs) {
- Map<List<?>, Integer> res = new HashMap<>();
-
- for (List<?> row : rs) {
- Integer cnt = res.get(row);
-
- if (cnt == null)
- cnt = 0;
-
- res.put(row, cnt + 1);
- }
- return res;
- }
-
- /**
- * @throws Exception If failed.
- */
- private void checkAllDataEquals() throws Exception {
- compareQueryRes0("select _key, _val, id, name from \"part\".Organization");
-
- compareQueryRes0("select _key, _val, id, firstName, lastName, orgId, salary from \"part\".Person");
-
- compareQueryRes0("select _key, _val, id, personId, productId from \"part\".Purchase");
-
- compareQueryRes0(rCache, "select _key, _val, id, name, price from \"repl\".Product");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void _testSimpleReplSelect() throws Exception {
- compareQueryRes0("select id, name, price from \"repl\".Product");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testParamSubstitution() throws Exception {
- compareQueryRes0("select ? from \"part\".Person", "Some arg");
- }
-
- /**
- * @throws SQLException If failed.
- */
- public void testAggregateOrderBy() throws SQLException {
- compareOrderedQueryRes0("select firstName name, count(*) cnt from \"part\".Person group by name order by cnt desc");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testNullParamSubstitution() throws Exception {
- List<List<?>> rs1 = compareQueryRes0("select id from \"part\".Person where lastname is ?", null);
-
- // Ensure we find something.
- assertNotSame(0, rs1.size());
- }
-
- /**
- *
- */
- public void testUnion() throws SQLException {
- String base = "select _val v from \"part\".Person";
-
- compareQueryRes0(base + " union all " + base);
- compareQueryRes0(base + " union " + base);
-
- base = "select firstName||lastName name, salary from \"part\".Person";
-
- assertEquals(10, compareOrderedQueryRes0(base + " union all " + base + " order by salary desc").size());
- assertEquals(5, compareOrderedQueryRes0(base + " union " + base + " order by salary desc").size());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testEmptyResult() throws Exception {
- compareQueryRes0("select id from \"part\".Person where 0 = 1");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSqlQueryWithAggregation() throws Exception {
- compareQueryRes0("select avg(salary) from \"part\".Person, \"part\".Organization where Person.orgId = Organization.id and "
- + "lower(Organization.name) = lower(?)", "Org1");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSqlFieldsQuery() throws Exception {
- compareQueryRes0("select concat(firstName, ' ', lastName) from \"part\".Person");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSqlFieldsQueryWithJoin() throws Exception {
- compareQueryRes0("select concat(firstName, ' ', lastName), "
- + "Organization.name from \"part\".Person, \"part\".Organization where "
- + "Person.orgId = Organization.id");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testOrdered() throws Exception {
- compareOrderedQueryRes0("select firstName, lastName" +
- " from \"part\".Person" +
- " order by lastName, firstName"
- );
- }
-
- /**
- * //TODO Investigate.
- *
- * @throws Exception If failed.
- */
- public void _testSimpleJoin() throws Exception {
- // Have expected results.
- compareQueryRes0("select id, firstName, lastName" +
- " from \"part\".Person" +
- " where Person.id = ?", 3);
-
- // Ignite cache return 0 results...
- compareQueryRes0("select pe.firstName" +
- " from \"part\".Person pe join \"part\".Purchase pu on pe.id = pu.personId " +
- " where pe.id = ?", 3);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSimpleReplicatedSelect() throws Exception {
- compareQueryRes0(rCache, "select id, name from \"repl\".Product");
- }
-
- /**
- * @throws Exception If failed.
- */
- public void _testCrossCache() throws Exception {
- //TODO Investigate (should be 20 results instead of 0).
- compareQueryRes0("select firstName, lastName" +
- " from \"part\".Person, \"part\".Purchase" +
- " where Person.id = Purchase.personId");
-
- //TODO Investigate.
- compareQueryRes0("select concat(firstName, ' ', lastName), Product.name " +
- " from \"part\".Person, \"part\".Purchase, \"repl\".Product " +
- " where Person.id = Purchase.personId and Purchase.productId = Product.id" +
- " group by Product.id");
-
- //TODO Investigate.
- compareQueryRes0("select concat(firstName, ' ', lastName), count (Product.id) " +
- " from \"part\".Person, \"part\".Purchase, \"repl\".Product " +
- " where Person.id = Purchase.personId and Purchase.productId = Product.id" +
- " group by Product.id");
- }
-
- /**
- * Person class. Stored at partitioned cache.
- */
- private static class Person implements Serializable {
- /** Person ID (indexed). */
- @QuerySqlField(index = true)
- private int id;
-
- /** Organization ID (indexed). */
- @QuerySqlField(index = true)
- private int orgId;
-
- /** First name (not-indexed). */
- @QuerySqlField
- private String firstName;
-
- /** Last name (not indexed). */
- @QuerySqlField
- private String lastName;
-
- /** Salary (indexed). */
- @QuerySqlField(index = true)
- private double salary;
-
- /**
- * Constructs person record.
- *
- * @param org Organization.
- * @param firstName First name.
- * @param lastName Last name.
- * @param salary Salary.
- */
- Person(int id, Organization org, String firstName, String lastName, double salary) {
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.salary = salary;
- orgId = org.id;
- }
-
- /**
- * @return Custom affinity key to guarantee that person is always collocated with organization.
- */
- public AffinityKey<Integer> key() {
- return new AffinityKey<>(id, orgId);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- return this == o || o instanceof Person && id == ((Person)o).id;
-
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return id;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Person [firstName=" + firstName +
- ", lastName=" + lastName +
- ", id=" + id +
- ", orgId=" + orgId +
- ", salary=" + salary + ']';
- }
- }
-
- /**
- * Organization class. Stored at partitioned cache.
- */
- private static class Organization implements Serializable {
- /** Organization ID (indexed). */
- @QuerySqlField(index = true)
- private int id;
-
- /** Organization name (indexed). */
- @QuerySqlField(index = true)
- private String name;
-
- /**
- * Create Organization.
- *
- * @param id Organization ID.
- * @param name Organization name.
- */
- Organization(int id, String name) {
- this.id = id;
- this.name = name;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- return this == o || o instanceof Organization && id == ((Organization)o).id;
-
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return id;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Organization [id=" + id + ", name=" + name + ']';
- }
- }
-
- /**
- * Product class. Stored at replicated cache.
- */
- private static class Product implements Serializable {
- /** Primary key. */
- @QuerySqlField(index = true)
- private int id;
-
- /** Product name. */
- @QuerySqlField
- private String name;
-
- /** Product price */
- @QuerySqlField
- private int price;
-
- /**
- * Create Product.
- *
- * @param id Product ID.
- * @param name Product name.
- * @param price Product price.
- */
- Product(int id, String name, int price) {
- this.id = id;
- this.name = name;
- this.price = price;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- return this == o || o instanceof Product && id == ((Product)o).id;
-
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return id;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Product [id=" + id + ", name=" + name + ", price=" + price + ']';
- }
- }
-
- /**
- * Purchase class. Stored at partitioned cache.
- */
- private static class Purchase implements Serializable {
- /** Primary key. */
- @QuerySqlField(index = true)
- private int id;
-
- /** Product ID. */
- @QuerySqlField
- private int productId;
-
- /** Person ID. */
- @QuerySqlField
- private int personId;
-
- /**
- * Create Purchase.
- *
- * @param id Purchase ID.
- * @param product Purchase product.
- * @param person Purchase person.
- */
- Purchase(int id, Product product, Person person) {
- this.id = id;
- productId = product.id;
- personId = person.id;
- }
-
- /**
- * @return Custom affinity key to guarantee that purchase is always collocated with person.
- */
- public AffinityKey<Integer> key() {
- return new AffinityKey<>(id, personId);
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- return this == o || o instanceof Purchase && id == ((Purchase)o).id;
-
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return id;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Purchase [id=" + id + ", productId=" + productId + ", personId=" + personId + ']';
- }
- }
-
- /**
- * Order type.
- */
- private enum Order {
- /** Random. */
- RANDOM,
- /** Ordered. */
- ORDERED
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe743909/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 43e54fe..552205a 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
@@ -100,8 +100,9 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(GridOrderedMessageCancelSelfTest.class);
- // H2 comparison.
- suite.addTestSuite(IgniteVsH2QueryTest.class);
+ // Ignite cache and H2 comparison.
+ suite.addTestSuite(BaseH2CompareQueryTest.class);
+ suite.addTestSuite(H2CompareBigQueryTest.class);
return suite;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe743909/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql b/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
new file mode 100644
index 0000000..5f5cb74
--- /dev/null
+++ b/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
@@ -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.
+--
+
+select *
+from (
+ select rootOrderId as custOrderId, co.date, co.orderId, replace(co.alias,'_ALGO','') as alias, op.parentAlgo
+ from (
+ select date, orderId, rootOrderId, origOrderId, archSeq, alias
+ from "part".CustOrder where alias='CUSTOM'
+
+ union all
+
+ select date, orderId, rootOrderId, refOrderId as origOrderId, archSeq, alias
+ from "part".ReplaceOrder where alias='CUSTOM'
+ ) co, "part".OrderParams op
+ where co.date = op.date and co.orderId = op.orderId and co.archSeq = -- TODO: replace with 'dateToLong(co.date)+archSeq'.
+ (
+ select max(archSeq) -- TODO: replace with 'dateToLong(co.date)+archSeq'.
+ from (
+ select date, orderId, rootOrderId, origOrderId, archSeq, alias
+ from "part".CustOrder where alias='CUSTOM'
+
+ union all
+
+ select date, orderId, rootOrderId, refOrderId as origOrderId, archSeq, alias
+ from "part".ReplaceOrder where alias='CUSTOM'
+ )
+ where origOrderId = co.origOrderId and date = co.date
+ ) and co.alias='CUSTOM'
+) cop
+inner join (
+ select e.date, e.rootOrderId as eRootOrderId, e.rootOrderId, sum(e.execShares) as execShares,
+ sum(e.execShares*e.price)/sum(e.execShares) as price,
+ case when min(e.lastMkt) = max(e.lastMkt) then min(e.lastMkt) else min('XOFF') end as execMeet
+ from "repl".Exec e
+ group by e.date, e.rootOrderId
+) oep on (cop.date = oep.date and cop.custOrderId = oep.eRootOrderId)
+left outer join (
+ select top 1 refOrderId, date from "part".Cancel
+) cc on (cc.refOrderId = cop.orderId and cc.date = cop.date)
+where cop.alias='CUSTOM'
[28/50] [abbrv] incubator-ignite git commit: # ignite-680 added test
Posted by vk...@apache.org.
# ignite-680 added test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7e9f22ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7e9f22ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7e9f22ed
Branch: refs/heads/ignite-471
Commit: 7e9f22ed4c80ecd3850accf0451c354e3ee687e8
Parents: b05c14f
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 8 11:32:03 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 8 11:32:03 2015 +0300
----------------------------------------------------------------------
.../IgniteCacheConfigurationTemplateTest.java | 53 ++++++++++++++++++++
1 file changed, 53 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7e9f22ed/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
index 9dfa913..d0ffab2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
+import org.apache.ignite.events.*;
+import org.apache.ignite.lang.*;
import org.apache.ignite.spi.discovery.tcp.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
@@ -79,6 +81,8 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
cfg.setClientMode(clientMode);
+ cfg.setIncludeEventTypes(EventType.EVT_CACHE_REBALANCE_STARTED, EventType.EVT_CACHE_REBALANCE_STOPPED);
+
return cfg;
}
@@ -253,6 +257,55 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
}
/**
+ * @throws Exception If failed.
+ */
+ public void testNoPartitionExchangeForTemplate() throws Exception{
+ final int GRID_CNT = 3;
+
+ startGridsMultiThreaded(GRID_CNT);
+
+ final CountDownLatch evtLatch = new CountDownLatch(1);
+
+ log.info("Add templates.");
+
+ for (int i = 0; i < GRID_CNT; i++) {
+ Ignite ignite = ignite(i);
+
+ ignite.events().localListen(new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ log.info("Event: " + evt);
+
+ evtLatch.countDown();
+
+ return true;
+ }
+ }, EventType.EVT_CACHE_REBALANCE_STARTED, EventType.EVT_CACHE_REBALANCE_STOPPED);
+ }
+
+ for (int i = 0; i < GRID_CNT; i++) {
+ Ignite ignite = ignite(i);
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName("cfg-" + i);
+
+ ignite.addCacheConfiguration(ccfg);
+ }
+
+ boolean evt = evtLatch.await(3000, TimeUnit.MILLISECONDS);
+
+ assertFalse(evt);
+
+ log.info("Start cache.");
+
+ checkGetOrCreate(ignite(0), "cfg-0", 0);
+
+ evt = evtLatch.await(3000, TimeUnit.MILLISECONDS);
+
+ assertTrue(evt);
+ }
+
+ /**
* @param ignite Ignite.
* @param name Cache name.
* @param expBackups Expected number of backups.
[35/50] [abbrv] incubator-ignite git commit: # IGNITE-685 Fix issue
found on the review.
Posted by vk...@apache.org.
# IGNITE-685 Fix issue found on the review.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fa552bc0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fa552bc0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fa552bc0
Branch: refs/heads/ignite-471
Commit: fa552bc08f2835eaa9d7f91ef88e1ac43201a363
Parents: 654b4e9
Author: sevdokimov <se...@gridgain.com>
Authored: Wed Apr 8 13:26:16 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed Apr 8 13:29:06 2015 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/internal/IgnitionEx.java | 5 -----
1 file changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fa552bc0/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index a4aea66..c7dfd19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1716,11 +1716,6 @@ public class IgnitionEx {
if (CU.isMarshallerCache(ccfg.getName()))
throw new IgniteCheckedException("Cache name cannot be \"" + CU.MARSH_CACHE_NAME +
"\" because it is reserved for internal purposes.");
- }
-
- for (CacheConfiguration ccfg : userCaches) {
- if (ccfg == null)
- throw new NullPointerException("Cache configuration list must not contains null element");
cacheCfgs.add(ccfg);
}
[44/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2f458d28
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2f458d28
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2f458d28
Branch: refs/heads/ignite-471
Commit: 2f458d28ac965da64ec6e30918bba3541cde9bc1
Parents: 7f4c5ee 7eef373
Author: Artem Shutak <as...@gridgain.com>
Authored: Wed Apr 8 18:27:39 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Wed Apr 8 18:27:39 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/IgniteKernal.java | 11 ++++++++++-
.../internal/processors/cache/GridCacheProcessor.java | 11 ++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
[48/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9d183c50
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9d183c50
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9d183c50
Branch: refs/heads/ignite-471
Commit: 9d183c50c1bab91f0fd03a10a588e7c7a63731a7
Parents: fe74390 382229c
Author: Artem Shutak <as...@gridgain.com>
Authored: Wed Apr 8 19:55:42 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Wed Apr 8 19:55:42 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/ClusterMetricsSnapshot.java | 384 ++++++-------------
.../messages/TcpDiscoveryAbstractMessage.java | 24 +-
.../messages/TcpDiscoveryAuthFailedMessage.java | 25 +-
.../TcpDiscoveryCheckFailedMessage.java | 24 +-
.../TcpDiscoveryClientReconnectMessage.java | 30 +-
.../TcpDiscoveryCustomEventMessage.java | 23 +-
.../messages/TcpDiscoveryDiscardMessage.java | 24 +-
.../TcpDiscoveryDuplicateIdMessage.java | 24 +-
.../messages/TcpDiscoveryHandshakeRequest.java | 8 -
.../messages/TcpDiscoveryHandshakeResponse.java | 22 --
.../messages/TcpDiscoveryHeartbeatMessage.java | 44 +--
.../TcpDiscoveryJoinRequestMessage.java | 28 +-
.../TcpDiscoveryLoopbackProblemMessage.java | 28 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 24 +-
.../messages/TcpDiscoveryNodeAddedMessage.java | 60 +--
.../messages/TcpDiscoveryNodeFailedMessage.java | 28 +-
.../messages/TcpDiscoveryNodeLeftMessage.java | 8 -
.../tcp/messages/TcpDiscoveryPingRequest.java | 25 +-
.../tcp/messages/TcpDiscoveryPingResponse.java | 14 -
.../TcpDiscoveryStatusCheckMessage.java | 30 +-
20 files changed, 148 insertions(+), 729 deletions(-)
----------------------------------------------------------------------
[27/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/080376af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/080376af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/080376af
Branch: refs/heads/ignite-471
Commit: 080376afa04e2c4be07371518d44e5b02c87d088
Parents: 76f8049 3f6beb3
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Apr 8 14:38:27 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Apr 8 14:38:27 2015 +0700
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheIoManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[25/50] [abbrv] incubator-ignite git commit: # ignite-sprint-3 more
info in error message
Posted by vk...@apache.org.
# ignite-sprint-3 more info in error message
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3f6beb36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3f6beb36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3f6beb36
Branch: refs/heads/ignite-471
Commit: 3f6beb36e207c76244dee7a6696d9414a65e7a24
Parents: cbab850
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 8 10:16:10 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 8 10:16:10 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheIoManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3f6beb36/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 7bd6726..d0cceab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -302,7 +302,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
log.debug("Finished processing cache communication message [nodeId=" + nodeId + ", msg=" + msg + ']');
}
catch (Throwable e) {
- U.error(log, "Failed processing message [senderId=" + nodeId + ']', e);
+ U.error(log, "Failed processing message [senderId=" + nodeId + ", msg=" + msg + ']', e);
}
finally {
// Reset thread local context.
[29/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-680' into ignite-sprint-3
Posted by vk...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-680' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/682dcd14
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/682dcd14
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/682dcd14
Branch: refs/heads/ignite-471
Commit: 682dcd143da345cbba7eeab8e2068fbe04cc4900
Parents: 080376a 7e9f22e
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 8 11:32:55 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 8 11:32:55 2015 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/Ignite.java | 15 +
.../apache/ignite/internal/IgniteKernal.java | 37 ++
.../internal/managers/GridManagerAdapter.java | 34 +-
.../cache/DynamicCacheChangeRequest.java | 17 +
.../cache/DynamicCacheDescriptor.java | 17 +-
.../processors/cache/GridCacheProcessor.java | 349 +++++++++++++++---
.../GridDhtPartitionsExchangeFuture.java | 1 +
...eCacheConfigurationTemplateNotFoundTest.java | 114 ++++++
.../IgniteCacheConfigurationTemplateTest.java | 364 +++++++++++++++++++
.../ignite/testframework/junits/IgniteMock.java | 10 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../org/apache/ignite/IgniteSpringBean.java | 14 +
12 files changed, 920 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
[43/50] [abbrv] incubator-ignite git commit: ignite-635:
IgniteCluster # startNodes return ClusterStartNodeResult-s instead of
Tuple3-s
Posted by vk...@apache.org.
ignite-635: IgniteCluster # startNodes return ClusterStartNodeResult-s instead of Tuple3-s
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7f4c5eed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7f4c5eed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7f4c5eed
Branch: refs/heads/ignite-471
Commit: 7f4c5eed0af2b56b1dd671cbe76a4224b72f5045
Parents: 71439bc
Author: Artem Shutak <as...@gridgain.com>
Authored: Wed Apr 8 18:27:23 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Wed Apr 8 18:27:23 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteCluster.java | 9 +-
.../ignite/cluster/ClusterStartNodeResult.java | 46 +++
.../cluster/ClusterStartNodeResultImpl.java | 87 ++++++
.../cluster/IgniteClusterAsyncImpl.java | 5 +-
.../internal/cluster/IgniteClusterImpl.java | 37 +--
.../util/nodestart/IgniteNodeCallable.java | 30 --
.../util/nodestart/IgniteSshHelper.java | 2 +-
.../util/nodestart/StartNodeCallable.java | 30 ++
.../util/nodestart/IgniteNodeCallableImpl.java | 308 ------------------
.../util/nodestart/IgniteSshHelperImpl.java | 4 +-
.../util/nodestart/StartNodeCallableImpl.java | 309 +++++++++++++++++++
...gniteProjectionStartStopRestartSelfTest.java | 261 ++++++++--------
.../IgniteStartStopRestartTestSuite.java | 1 +
.../commands/start/VisorStartCommand.scala | 4 +-
14 files changed, 631 insertions(+), 502 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java b/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
index 7d7d2fb..02fea14 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
@@ -19,7 +19,6 @@ package org.apache.ignite;
import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.lang.*;
import org.jetbrains.annotations.*;
@@ -170,12 +169,12 @@ public interface IgniteCluster extends ClusterGroup, IgniteAsyncSupport {
* nodes on the host than expected.
* @param timeout Connection timeout.
* @param maxConn Number of parallel SSH connections to one host.
- * @return Collection of tuples, each containing host name, result (success of failure)
+ * @return Collection of start node results, each containing host name, result (success or failure)
* and error message (if any).
* @throws IgniteException In case of error.
*/
@IgniteAsyncSupported
- public Collection<GridTuple3<String, Boolean, String>> startNodes(File file, boolean restart, int timeout,
+ public Collection<ClusterStartNodeResult> startNodes(File file, boolean restart, int timeout,
int maxConn) throws IgniteException;
/**
@@ -272,12 +271,12 @@ public interface IgniteCluster extends ClusterGroup, IgniteAsyncSupport {
* nodes on the host than expected.
* @param timeout Connection timeout in milliseconds.
* @param maxConn Number of parallel SSH connections to one host.
- * @return Collection of tuples, each containing host name, result (success of failure)
+ * @return Collection of start node results, each containing host name, result (success or failure)
* and error message (if any).
* @throws IgniteException In case of error.
*/
@IgniteAsyncSupported
- public Collection<GridTuple3<String, Boolean, String>> startNodes(Collection<Map<String, Object>> hosts,
+ public Collection<ClusterStartNodeResult> startNodes(Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts, boolean restart, int timeout, int maxConn) throws IgniteException;
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/core/src/main/java/org/apache/ignite/cluster/ClusterStartNodeResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterStartNodeResult.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterStartNodeResult.java
new file mode 100644
index 0000000..b6c3619
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterStartNodeResult.java
@@ -0,0 +1,46 @@
+/*
+ * 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.cluster;
+
+import org.jetbrains.annotations.*;
+
+/**
+ * Cluster start node result information.
+ */
+public interface ClusterStartNodeResult {
+ /**
+ * Gets host name.
+ *
+ * @return Host name.
+ */
+ public String getHostName();
+
+ /**
+ * Gets result of success or failure.
+ *
+ * @return Success or failure. <code>True</code> if success.
+ */
+ public boolean isSuccess();
+
+ /**
+ * Gets error message if any.
+ *
+ * @return Error massage.
+ */
+ @Nullable public String getError();
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterStartNodeResultImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterStartNodeResultImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterStartNodeResultImpl.java
new file mode 100644
index 0000000..39301b3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterStartNodeResultImpl.java
@@ -0,0 +1,87 @@
+/*
+ * 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.cluster;
+
+import org.apache.ignite.cluster.*;
+
+/**
+ * Implementation for cluster start node result.
+ */
+public class ClusterStartNodeResultImpl implements ClusterStartNodeResult {
+ /** Host name. */
+ private String hostName;
+
+ /** Result (success or failure). */
+ private boolean success;
+
+ /** Error message (if any) */
+ private String error;
+
+ /**
+ * @param hostName Host name.
+ * @param success Success or not.
+ * @param error Error message.
+ */
+ public ClusterStartNodeResultImpl(String hostName, boolean success, String error) {
+ this.hostName = hostName;
+ this.success = success;
+ this.error = error;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getHostName() {
+ return hostName;
+ }
+
+ /**
+ * Sets host name.
+ *
+ * @param hostName Host name.
+ */
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isSuccess() {
+ return success;
+ }
+
+ /**
+ * Sets success result.
+ *
+ * @param success Success result.
+ */
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getError() {
+ return error;
+ }
+
+ /**
+ * Sets error message.
+ *
+ * @param error Error message.
+ */
+ public void setError(String error) {
+ this.error = error;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
index 5a5daab..7f67b4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.cluster;
import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
import org.jetbrains.annotations.*;
@@ -98,7 +97,7 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
}
/** {@inheritDoc} */
- @Override public Collection<GridTuple3<String, Boolean, String>> startNodes(File file,
+ @Override public Collection<ClusterStartNodeResult> startNodes(File file,
boolean restart,
int timeout,
int maxConn)
@@ -112,7 +111,7 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
}
/** {@inheritDoc} */
- @Override public Collection<GridTuple3<String, Boolean, String>> startNodes(
+ @Override public Collection<ClusterStartNodeResult> startNodes(
Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts,
boolean restart,
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
index 76a49dd..3c937b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
@@ -22,7 +22,6 @@ import org.apache.ignite.cluster.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.util.future.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.nodestart.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
@@ -189,7 +188,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
}
/** {@inheritDoc} */
- @Override public Collection<GridTuple3<String, Boolean, String>> startNodes(File file,
+ @Override public Collection<ClusterStartNodeResult> startNodes(File file,
boolean restart,
int timeout,
int maxConn)
@@ -204,7 +203,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
}
/** {@inheritDoc} */
- @Override public Collection<GridTuple3<String, Boolean, String>> startNodes(Collection<Map<String, Object>> hosts,
+ @Override public Collection<ClusterStartNodeResult> startNodes(Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts,
boolean restart,
int timeout,
@@ -304,7 +303,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
* @return Future with results.
* @see IgniteCluster#startNodes(java.io.File, boolean, int, int)
*/
- IgniteInternalFuture<Collection<GridTuple3<String, Boolean, String>>> startNodesAsync(File file,
+ IgniteInternalFuture<Collection<ClusterStartNodeResult>> startNodesAsync(File file,
boolean restart,
int timeout,
int maxConn)
@@ -332,7 +331,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
* @return Future with results.
* @see IgniteCluster#startNodes(java.util.Collection, java.util.Map, boolean, int, int)
*/
- IgniteInternalFuture<Collection<GridTuple3<String, Boolean, String>>> startNodesAsync(
+ IgniteInternalFuture<Collection<ClusterStartNodeResult>> startNodesAsync(
Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts,
boolean restart,
@@ -348,7 +347,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
Map<String, Collection<IgniteRemoteStartSpecification>> specsMap = specifications(hosts, dflts);
- Map<String, ConcurrentLinkedQueue<IgniteNodeCallable>> runMap = new HashMap<>();
+ Map<String, ConcurrentLinkedQueue<StartNodeCallable>> runMap = new HashMap<>();
int nodeCallCnt = 0;
@@ -393,7 +392,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
startIdx = neighbors.size() + 1;
}
- ConcurrentLinkedQueue<IgniteNodeCallable> nodeRuns = new ConcurrentLinkedQueue<>();
+ ConcurrentLinkedQueue<StartNodeCallable> nodeRuns = new ConcurrentLinkedQueue<>();
runMap.put(host, nodeRuns);
@@ -410,19 +409,17 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
// If there is nothing to start, return finished future with empty result.
if (nodeCallCnt == 0)
- return new GridFinishedFuture<Collection<GridTuple3<String, Boolean, String>>>(
- Collections.<GridTuple3<String, Boolean, String>>emptyList());
+ return new GridFinishedFuture<Collection<ClusterStartNodeResult>>(
+ Collections.<ClusterStartNodeResult>emptyList());
// Exceeding max line width for readability.
- GridCompoundFuture<GridTuple3<String, Boolean, String>, Collection<GridTuple3<String, Boolean, String>>>
- fut = new GridCompoundFuture<>(
- CU.<GridTuple3<String, Boolean, String>>objectsReducer()
- );
+ GridCompoundFuture<ClusterStartNodeResult, Collection<ClusterStartNodeResult>> fut =
+ new GridCompoundFuture<>(CU.<ClusterStartNodeResult>objectsReducer());
AtomicInteger cnt = new AtomicInteger(nodeCallCnt);
// Limit maximum simultaneous connection number per host.
- for (ConcurrentLinkedQueue<IgniteNodeCallable> queue : runMap.values()) {
+ for (ConcurrentLinkedQueue<StartNodeCallable> queue : runMap.values()) {
for (int i = 0; i < maxConn; i++) {
if (!runNextNodeCallable(queue, fut, cnt))
break;
@@ -471,25 +468,25 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements IgniteClus
* @param cnt Atomic counter to check if all futures are added to compound future.
* @return {@code True} if task was started, {@code false} if queue was empty.
*/
- private boolean runNextNodeCallable(final ConcurrentLinkedQueue<IgniteNodeCallable> queue,
- final GridCompoundFuture<GridTuple3<String, Boolean, String>, Collection<GridTuple3<String, Boolean, String>>>
+ private boolean runNextNodeCallable(final ConcurrentLinkedQueue<StartNodeCallable> queue,
+ final GridCompoundFuture<ClusterStartNodeResult, Collection<ClusterStartNodeResult>>
comp,
final AtomicInteger cnt)
{
- IgniteNodeCallable call = queue.poll();
+ StartNodeCallable call = queue.poll();
if (call == null)
return false;
- IgniteInternalFuture<GridTuple3<String, Boolean, String>> fut = ctx.closure().callLocalSafe(call, true);
+ IgniteInternalFuture<ClusterStartNodeResult> fut = ctx.closure().callLocalSafe(call, true);
comp.add(fut);
if (cnt.decrementAndGet() == 0)
comp.markInitialized();
- fut.listen(new CI1<IgniteInternalFuture<GridTuple3<String, Boolean, String>>>() {
- @Override public void apply(IgniteInternalFuture<GridTuple3<String, Boolean, String>> f) {
+ fut.listen(new CI1<IgniteInternalFuture<ClusterStartNodeResult>>() {
+ @Override public void apply(IgniteInternalFuture<ClusterStartNodeResult> f) {
runNextNodeCallable(queue, comp, cnt);
}
});
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallable.java
deleted file mode 100644
index 6c34efb..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallable.java
+++ /dev/null
@@ -1,30 +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.util.nodestart;
-
-import org.apache.ignite.internal.util.lang.*;
-
-import java.util.concurrent.*;
-
-/**
- * SSH-based node starter, returns tuple which contains hostname, success flag and error message
- * if attempt was not successful.
- */
-public interface IgniteNodeCallable extends Callable<GridTuple3<String, Boolean, String>> {
- // No-op.
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelper.java
index 2cb620f..14a35b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelper.java
@@ -30,5 +30,5 @@ public interface IgniteSshHelper {
* @param timeout Connection timeout.
* @return {@link Callable} starting node using SSH.
*/
- public IgniteNodeCallable nodeStartCallable(IgniteRemoteStartSpecification spec, int timeout);
+ public StartNodeCallable nodeStartCallable(IgniteRemoteStartSpecification spec, int timeout);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/StartNodeCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/StartNodeCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/StartNodeCallable.java
new file mode 100644
index 0000000..a1a2046
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/StartNodeCallable.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.internal.util.nodestart;
+
+import org.apache.ignite.cluster.*;
+
+import java.util.concurrent.*;
+
+/**
+ * SSH-based node starter, returns tuple which contains hostname, success flag and error message
+ * if attempt was not successful.
+ */
+public interface StartNodeCallable extends Callable<ClusterStartNodeResult> {
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
----------------------------------------------------------------------
diff --git a/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java b/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
deleted file mode 100644
index 9b873bf..0000000
--- a/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeCallableImpl.java
+++ /dev/null
@@ -1,308 +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.util.nodestart;
-
-import com.jcraft.jsch.*;
-import org.apache.ignite.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.lang.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.resources.*;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import static org.apache.ignite.IgniteSystemProperties.*;
-
-/**
- * SSH-based node starter.
- */
-public class IgniteNodeCallableImpl implements IgniteNodeCallable {
- /** Default Ignite home path for Windows (taken from environment variable). */
- private static final String DFLT_IGNITE_HOME_WIN = "%IGNITE_HOME%";
-
- /** Default Ignite home path for Linux (taken from environment variable). */
- private static final String DFLT_IGNITE_HOME_LINUX = "$IGNITE_HOME";
-
- /** Default start script path for Linux. */
- private static final String DFLT_SCRIPT_LINUX = "bin/ignite.sh -v";
-
- /** Date format for log file name. */
- private static final SimpleDateFormat FILE_NAME_DATE_FORMAT = new SimpleDateFormat("MM-dd-yyyy--HH-mm-ss");
-
- /** Specification. */
- private final IgniteRemoteStartSpecification spec;
-
- /** Connection timeout. */
- private final int timeout;
-
- /** Logger. */
- @LoggerResource
- private IgniteLogger log;
-
- /**
- * Required by Externalizable.
- */
- public IgniteNodeCallableImpl() {
- spec = null;
- timeout = 0;
-
- assert false;
- }
-
- /**
- * Constructor.
- *
- * @param spec Specification.
- * @param timeout Connection timeout.
- */
- public IgniteNodeCallableImpl(IgniteRemoteStartSpecification spec, int timeout) {
- assert spec != null;
-
- this.spec = spec;
- this.timeout = timeout;
- }
-
- /** {@inheritDoc} */
- @Override public GridTuple3<String, Boolean, String> call() {
- JSch ssh = new JSch();
-
- Session ses = null;
-
- try {
- if (spec.key() != null)
- ssh.addIdentity(spec.key().getAbsolutePath());
-
- ses = ssh.getSession(spec.username(), spec.host(), spec.port());
-
- if (spec.password() != null)
- ses.setPassword(spec.password());
-
- ses.setConfig("StrictHostKeyChecking", "no");
-
- ses.connect(timeout);
-
- boolean win = isWindows(ses);
-
- char separator = win ? '\\' : '/';
-
- spec.fixPaths(separator);
-
- String igniteHome = spec.igniteHome();
-
- if (igniteHome == null)
- igniteHome = win ? DFLT_IGNITE_HOME_WIN : DFLT_IGNITE_HOME_LINUX;
-
- String script = spec.script();
-
- if (script == null)
- script = DFLT_SCRIPT_LINUX;
-
- String cfg = spec.configuration();
-
- if (cfg == null)
- cfg = "";
-
- String startNodeCmd;
- String scriptOutputFileName = FILE_NAME_DATE_FORMAT.format(new Date()) + '-'
- + UUID.randomUUID().toString().substring(0, 8) + ".log";
-
- if (win)
- throw new UnsupportedOperationException("Apache Ignite cannot be auto-started on Windows from IgniteCluster.startNodes(…) API.");
- else { // Assume Unix.
- int spaceIdx = script.indexOf(' ');
-
- String scriptPath = spaceIdx > -1 ? script.substring(0, spaceIdx) : script;
- String scriptArgs = spaceIdx > -1 ? script.substring(spaceIdx + 1) : "";
- String rmtLogArgs = buildRemoteLogArguments(spec.username(), spec.host());
- String tmpDir = env(ses, "$TMPDIR", "/tmp/");
- String scriptOutputDir = tmpDir + "ignite-startNodes";
-
- shell(ses, "mkdir " + scriptOutputDir);
-
- // Mac os don't support ~ in double quotes. Trying get home path from remote system.
- if (igniteHome.startsWith("~")) {
- String homeDir = env(ses, "$HOME", "~");
-
- igniteHome = igniteHome.replaceFirst("~", homeDir);
- }
-
- startNodeCmd = new SB().
- // Console output is consumed, started nodes must use Ignite file appenders for log.
- a("nohup ").
- a("\"").a(igniteHome).a('/').a(scriptPath).a("\"").
- a(" ").a(scriptArgs).
- a(!cfg.isEmpty() ? " \"" : "").a(cfg).a(!cfg.isEmpty() ? "\"" : "").
- a(rmtLogArgs).
- a(" > ").a(scriptOutputDir).a("/").a(scriptOutputFileName).a(" 2>& 1 &").
- toString();
- }
-
- info("Starting remote node with SSH command: " + startNodeCmd, spec.logger(), log);
-
- shell(ses, startNodeCmd);
-
- return new GridTuple3<>(spec.host(), true, null);
- }
- catch (IgniteInterruptedCheckedException e) {
- return new GridTuple3<>(spec.host(), false, e.getMessage());
- }
- catch (Exception e) {
- return new GridTuple3<>(spec.host(), false, X.getFullStackTrace(e));
- }
- finally {
- if (ses != null && ses.isConnected())
- ses.disconnect();
- }
- }
-
- /**
- * Executes command using {@code shell} channel.
- *
- * @param ses SSH session.
- * @param cmd Command.
- * @throws JSchException In case of SSH error.
- * @throws IOException If IO error occurs.
- * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread was interrupted while waiting.
- */
- private void shell(Session ses, String cmd) throws JSchException, IOException, IgniteInterruptedCheckedException {
- ChannelShell ch = null;
-
- try {
- ch = (ChannelShell)ses.openChannel("shell");
-
- ch.connect();
-
- try (PrintStream out = new PrintStream(ch.getOutputStream(), true)) {
- out.println(cmd);
-
- U.sleep(1000);
- }
- }
- finally {
- if (ch != null && ch.isConnected())
- ch.disconnect();
- }
- }
-
- /**
- * Checks whether host is running Windows OS.
- *
- * @param ses SSH session.
- * @return Whether host is running Windows OS.
- * @throws JSchException In case of SSH error.
- */
- private boolean isWindows(Session ses) throws JSchException {
- try {
- return exec(ses, "cmd.exe") != null;
- }
- catch (IOException ignored) {
- return false;
- }
- }
-
- /**
- * Gets the value of the specified environment variable.
- *
- * @param ses SSH session.
- * @param name environment variable name.
- * @param dflt default value.
- * @return environment variable value.
- * @throws JSchException In case of SSH error.
- */
- private String env(Session ses, String name, String dflt) throws JSchException {
- try {
- return exec(ses, "echo " + name);
- }
- catch (IOException ignored) {
- return dflt;
- }
- }
-
- /**
- * Gets the value of the specified environment variable.
- *
- * @param ses SSH session.
- * @param cmd environment variable name.
- * @return environment variable value.
- * @throws JSchException In case of SSH error.
- * @throws IOException If failed.
- */
- private String exec(Session ses, String cmd) throws JSchException, IOException {
- ChannelExec ch = null;
-
- try {
- ch = (ChannelExec)ses.openChannel("exec");
-
- ch.setCommand(cmd);
-
- ch.connect();
-
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(ch.getInputStream()))) {
- return reader.readLine();
- }
- }
- finally {
- if (ch != null && ch.isConnected())
- ch.disconnect();
- }
- }
-
- /**
- * Builds ignite.sh attributes to set up SSH username and password and log directory for started node.
- *
- * @param username SSH user name.
- * @param host Host.
- * @return {@code ignite.sh} script arguments.
- */
- private String buildRemoteLogArguments(String username, String host) {
- assert username != null;
- assert host != null;
-
- SB sb = new SB();
-
- sb.a(" -J-D").a(IGNITE_SSH_HOST).a("=\"").a(host).a("\"").
- a(" -J-D").a(IGNITE_SSH_USER_NAME).a("=\"").a(username).a("\"");
-
- return sb.toString();
- }
-
- /**
- * @param log Logger.
- * @return This callable for chaining method calls.
- */
- public IgniteNodeCallable setLogger(IgniteLogger log) {
- this.log = log;
-
- return this;
- }
-
- /**
- * Log info message to loggers.
- *
- * @param msg Message text.
- * @param loggers Loggers.
- */
- private void info(String msg, IgniteLogger... loggers) {
- for (IgniteLogger logger : loggers)
- if (logger != null && logger.isInfoEnabled())
- logger.info(msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelperImpl.java
----------------------------------------------------------------------
diff --git a/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelperImpl.java b/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelperImpl.java
index cccf678..c2370b6 100644
--- a/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelperImpl.java
+++ b/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteSshHelperImpl.java
@@ -22,7 +22,7 @@ package org.apache.ignite.internal.util.nodestart;
*/
public class IgniteSshHelperImpl implements IgniteSshHelper {
/** {@inheritDoc} */
- @Override public IgniteNodeCallable nodeStartCallable(IgniteRemoteStartSpecification spec, int timeout) {
- return new IgniteNodeCallableImpl(spec, timeout);
+ @Override public StartNodeCallable nodeStartCallable(IgniteRemoteStartSpecification spec, int timeout) {
+ return new StartNodeCallableImpl(spec, timeout);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/StartNodeCallableImpl.java
----------------------------------------------------------------------
diff --git a/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/StartNodeCallableImpl.java b/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/StartNodeCallableImpl.java
new file mode 100644
index 0000000..7c6010f
--- /dev/null
+++ b/modules/ssh/src/main/java/org/apache/ignite/internal/util/nodestart/StartNodeCallableImpl.java
@@ -0,0 +1,309 @@
+/*
+ * 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.nodestart;
+
+import com.jcraft.jsch.*;
+import org.apache.ignite.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.cluster.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.resources.*;
+
+import java.io.*;
+import java.text.*;
+import java.util.*;
+
+import static org.apache.ignite.IgniteSystemProperties.*;
+
+/**
+ * SSH-based node starter.
+ */
+public class StartNodeCallableImpl implements StartNodeCallable {
+ /** Default Ignite home path for Windows (taken from environment variable). */
+ private static final String DFLT_IGNITE_HOME_WIN = "%IGNITE_HOME%";
+
+ /** Default Ignite home path for Linux (taken from environment variable). */
+ private static final String DFLT_IGNITE_HOME_LINUX = "$IGNITE_HOME";
+
+ /** Default start script path for Linux. */
+ private static final String DFLT_SCRIPT_LINUX = "bin/ignite.sh -v";
+
+ /** Date format for log file name. */
+ private static final SimpleDateFormat FILE_NAME_DATE_FORMAT = new SimpleDateFormat("MM-dd-yyyy--HH-mm-ss");
+
+ /** Specification. */
+ private final IgniteRemoteStartSpecification spec;
+
+ /** Connection timeout. */
+ private final int timeout;
+
+ /** Logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /**
+ * Required by Externalizable.
+ */
+ public StartNodeCallableImpl() {
+ spec = null;
+ timeout = 0;
+
+ assert false;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param spec Specification.
+ * @param timeout Connection timeout.
+ */
+ public StartNodeCallableImpl(IgniteRemoteStartSpecification spec, int timeout) {
+ assert spec != null;
+
+ this.spec = spec;
+ this.timeout = timeout;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClusterStartNodeResult call() {
+ JSch ssh = new JSch();
+
+ Session ses = null;
+
+ try {
+ if (spec.key() != null)
+ ssh.addIdentity(spec.key().getAbsolutePath());
+
+ ses = ssh.getSession(spec.username(), spec.host(), spec.port());
+
+ if (spec.password() != null)
+ ses.setPassword(spec.password());
+
+ ses.setConfig("StrictHostKeyChecking", "no");
+
+ ses.connect(timeout);
+
+ boolean win = isWindows(ses);
+
+ char separator = win ? '\\' : '/';
+
+ spec.fixPaths(separator);
+
+ String igniteHome = spec.igniteHome();
+
+ if (igniteHome == null)
+ igniteHome = win ? DFLT_IGNITE_HOME_WIN : DFLT_IGNITE_HOME_LINUX;
+
+ String script = spec.script();
+
+ if (script == null)
+ script = DFLT_SCRIPT_LINUX;
+
+ String cfg = spec.configuration();
+
+ if (cfg == null)
+ cfg = "";
+
+ String startNodeCmd;
+ String scriptOutputFileName = FILE_NAME_DATE_FORMAT.format(new Date()) + '-'
+ + UUID.randomUUID().toString().substring(0, 8) + ".log";
+
+ if (win)
+ throw new UnsupportedOperationException("Apache Ignite cannot be auto-started on Windows from IgniteCluster.startNodes(…) API.");
+ else { // Assume Unix.
+ int spaceIdx = script.indexOf(' ');
+
+ String scriptPath = spaceIdx > -1 ? script.substring(0, spaceIdx) : script;
+ String scriptArgs = spaceIdx > -1 ? script.substring(spaceIdx + 1) : "";
+ String rmtLogArgs = buildRemoteLogArguments(spec.username(), spec.host());
+ String tmpDir = env(ses, "$TMPDIR", "/tmp/");
+ String scriptOutputDir = tmpDir + "ignite-startNodes";
+
+ shell(ses, "mkdir " + scriptOutputDir);
+
+ // Mac os don't support ~ in double quotes. Trying get home path from remote system.
+ if (igniteHome.startsWith("~")) {
+ String homeDir = env(ses, "$HOME", "~");
+
+ igniteHome = igniteHome.replaceFirst("~", homeDir);
+ }
+
+ startNodeCmd = new SB().
+ // Console output is consumed, started nodes must use Ignite file appenders for log.
+ a("nohup ").
+ a("\"").a(igniteHome).a('/').a(scriptPath).a("\"").
+ a(" ").a(scriptArgs).
+ a(!cfg.isEmpty() ? " \"" : "").a(cfg).a(!cfg.isEmpty() ? "\"" : "").
+ a(rmtLogArgs).
+ a(" > ").a(scriptOutputDir).a("/").a(scriptOutputFileName).a(" 2>& 1 &").
+ toString();
+ }
+
+ info("Starting remote node with SSH command: " + startNodeCmd, spec.logger(), log);
+
+ shell(ses, startNodeCmd);
+
+ return new ClusterStartNodeResultImpl(spec.host(), true, null);
+ }
+ catch (IgniteInterruptedCheckedException e) {
+ return new ClusterStartNodeResultImpl(spec.host(), false, e.getMessage());
+ }
+ catch (Exception e) {
+ return new ClusterStartNodeResultImpl(spec.host(), false, X.getFullStackTrace(e));
+ }
+ finally {
+ if (ses != null && ses.isConnected())
+ ses.disconnect();
+ }
+ }
+
+ /**
+ * Executes command using {@code shell} channel.
+ *
+ * @param ses SSH session.
+ * @param cmd Command.
+ * @throws JSchException In case of SSH error.
+ * @throws IOException If IO error occurs.
+ * @throws IgniteInterruptedCheckedException If thread was interrupted while waiting.
+ */
+ private void shell(Session ses, String cmd) throws JSchException, IOException, IgniteInterruptedCheckedException {
+ ChannelShell ch = null;
+
+ try {
+ ch = (ChannelShell)ses.openChannel("shell");
+
+ ch.connect();
+
+ try (PrintStream out = new PrintStream(ch.getOutputStream(), true)) {
+ out.println(cmd);
+
+ U.sleep(1000);
+ }
+ }
+ finally {
+ if (ch != null && ch.isConnected())
+ ch.disconnect();
+ }
+ }
+
+ /**
+ * Checks whether host is running Windows OS.
+ *
+ * @param ses SSH session.
+ * @return Whether host is running Windows OS.
+ * @throws JSchException In case of SSH error.
+ */
+ private boolean isWindows(Session ses) throws JSchException {
+ try {
+ return exec(ses, "cmd.exe") != null;
+ }
+ catch (IOException ignored) {
+ return false;
+ }
+ }
+
+ /**
+ * Gets the value of the specified environment variable.
+ *
+ * @param ses SSH session.
+ * @param name environment variable name.
+ * @param dflt default value.
+ * @return environment variable value.
+ * @throws JSchException In case of SSH error.
+ */
+ private String env(Session ses, String name, String dflt) throws JSchException {
+ try {
+ return exec(ses, "echo " + name);
+ }
+ catch (IOException ignored) {
+ return dflt;
+ }
+ }
+
+ /**
+ * Gets the value of the specified environment variable.
+ *
+ * @param ses SSH session.
+ * @param cmd environment variable name.
+ * @return environment variable value.
+ * @throws JSchException In case of SSH error.
+ * @throws IOException If failed.
+ */
+ private String exec(Session ses, String cmd) throws JSchException, IOException {
+ ChannelExec ch = null;
+
+ try {
+ ch = (ChannelExec)ses.openChannel("exec");
+
+ ch.setCommand(cmd);
+
+ ch.connect();
+
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(ch.getInputStream()))) {
+ return reader.readLine();
+ }
+ }
+ finally {
+ if (ch != null && ch.isConnected())
+ ch.disconnect();
+ }
+ }
+
+ /**
+ * Builds ignite.sh attributes to set up SSH username and password and log directory for started node.
+ *
+ * @param username SSH user name.
+ * @param host Host.
+ * @return {@code ignite.sh} script arguments.
+ */
+ private String buildRemoteLogArguments(String username, String host) {
+ assert username != null;
+ assert host != null;
+
+ SB sb = new SB();
+
+ sb.a(" -J-D").a(IGNITE_SSH_HOST).a("=\"").a(host).a("\"").
+ a(" -J-D").a(IGNITE_SSH_USER_NAME).a("=\"").a(username).a("\"");
+
+ return sb.toString();
+ }
+
+ /**
+ * @param log Logger.
+ * @return This callable for chaining method calls.
+ */
+ public StartNodeCallable setLogger(IgniteLogger log) {
+ this.log = log;
+
+ return this;
+ }
+
+ /**
+ * Log info message to loggers.
+ *
+ * @param msg Message text.
+ * @param loggers Loggers.
+ */
+ private void info(String msg, IgniteLogger... loggers) {
+ for (IgniteLogger logger : loggers)
+ if (logger != null && logger.isInfoEnabled())
+ logger.info(msg);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
index d4c5fc5..7fa5b4b 100644
--- a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
+++ b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal;
import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.events.*;
-import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.nodestart.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
@@ -178,19 +177,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStartOneNode() throws Exception {
joinedLatch = new CountDownLatch(1);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 1;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -208,19 +207,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStartThreeNodes() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, DFLT_TIMEOUT, 1);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -238,19 +237,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStartThreeNodesAndDoEmptyCall() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -279,19 +278,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStartThreeNodesAndTryToStartOneNode() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -320,19 +319,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStartFiveNodesInTwoCalls() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -351,12 +350,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
assert res.size() == 2;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -374,7 +373,7 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStartFiveWithTwoSpecs() throws Exception {
joinedLatch = new CountDownLatch(5);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
F.asList(map(HOST, SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_NO_ATTR, null),
map(HOST, SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null)),
@@ -382,12 +381,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
assert res.size() == 5;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -405,19 +404,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStartThreeNodesAndRestart() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -437,12 +436,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -465,19 +464,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
script = Paths.get(U.getIgniteHome()).relativize(U.resolveIgnitePath(script).toPath()).toString();
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), null, script),
null, false, 0, 16);
assert res.size() == 1;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -497,19 +496,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStopNodes() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, null, 3, U.getIgniteHome(), CFG_NO_ATTR,
null), null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -532,19 +531,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStopNodesFiltered() throws Exception {
joinedLatch = new CountDownLatch(2);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_ATTR, null),
null, false, 0, 16);
assert res.size() == 2;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -558,12 +557,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
assert res.size() == 1;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -595,19 +594,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStopNodeById() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -630,19 +629,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStopNodesByIds() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -672,19 +671,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testStopNodesByIdsC() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -709,19 +708,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testRestartNodes() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -746,19 +745,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testRestartNodesFiltered() throws Exception {
joinedLatch = new CountDownLatch(2);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_ATTR, null),
null, false, 0, 16);
assert res.size() == 2;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -772,12 +771,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
assert res.size() == 1;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -812,19 +811,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testRestartNodeById() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -849,19 +848,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testRestartNodesByIds() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -888,19 +887,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
public void testRestartNodesByIdsC() throws Exception {
joinedLatch = new CountDownLatch(3);
- Collection<GridTuple3<String, Boolean, String>> res =
+ Collection<ClusterStartNodeResult> res =
startNodes(ignite.cluster(),
maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null),
null, false, 0, 16);
assert res.size() == 3;
- F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() {
- @Override public void apply(GridTuple3<String, Boolean, String> t) {
- assert t.get1().equals(HOST);
+ F.forEach(res, new CI1<ClusterStartNodeResult>() {
+ @Override public void apply(ClusterStartNodeResult t) {
+ assert t.getHostName().equals(HOST);
- if (!t.get2())
- throw new IgniteException(t.get3());
+ if (!t.isSuccess())
+ throw new IgniteException(t.getError());
}
});
@@ -1016,7 +1015,7 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
* @param maxConn Maximum connections.
* @return Results collection.
*/
- private Collection<GridTuple3<String, Boolean, String>> startNodes(IgniteCluster cluster,
+ private Collection<ClusterStartNodeResult> startNodes(IgniteCluster cluster,
Collection<Map<String, Object>> hosts,
@Nullable Map<String, Object> dflts,
boolean restart,
@@ -1026,6 +1025,6 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract
assertNull(cluster.startNodes(hosts, dflts, restart, timeout, maxConn));
- return cluster.<Collection<GridTuple3<String, Boolean, String>>>future().get(WAIT_TIMEOUT);
+ return cluster.<Collection<ClusterStartNodeResult>>future().get(WAIT_TIMEOUT);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteStartStopRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteStartStopRestartTestSuite.java b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteStartStopRestartTestSuite.java
index 65fcb44..6d09eb2 100644
--- a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteStartStopRestartTestSuite.java
+++ b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteStartStopRestartTestSuite.java
@@ -37,3 +37,4 @@ public class IgniteStartStopRestartTestSuite {
return suite;
}
}
+
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7f4c5eed/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
index 5342fc1..a6de108 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala
@@ -228,7 +228,7 @@ class VisorStartCommand {
try
res = ignite.cluster.startNodes(file, restart, timeout, maxConn).map(t => {
- Result(t.get1, t.get2, t.get3)
+ Result(t.getHostName, t.isSuccess, t.getError)
}).toSeq
catch {
case e: IgniteException => scold(e.getMessage).^^
@@ -284,7 +284,7 @@ class VisorStartCommand {
try
res = ignite.cluster.startNodes(asJavaCollection(Seq(params)), null, restart, timeout, maxConn).
- map(t => Result(t.get1, t.get2, t.get3)).toSeq
+ map(t => Result(t.getHostName, t.isSuccess, t.getError)).toSeq
catch {
case e: IgniteException => scold(e.getMessage).^^
case _: RejectedExecutionException => scold("Failed due to system error.").^^
[36/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-639' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Posted by vk...@apache.org.
Merge branches 'ignite-639' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4d44e610
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4d44e610
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4d44e610
Branch: refs/heads/ignite-471
Commit: 4d44e6106666c57870938b4c1699249c8d68beca
Parents: 36c330a fa552bc
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Apr 8 17:55:20 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Apr 8 17:55:20 2015 +0700
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/Ignite.java | 15 +
.../apache/ignite/internal/IgniteKernal.java | 37 ++
.../org/apache/ignite/internal/IgnitionEx.java | 171 ++++-----
.../internal/managers/GridManagerAdapter.java | 34 +-
.../cache/DynamicCacheChangeRequest.java | 17 +
.../cache/DynamicCacheDescriptor.java | 17 +-
.../processors/cache/GridCacheIoManager.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 349 +++++++++++++++---
.../dht/GridClientPartitionTopology.java | 6 +-
.../distributed/dht/GridDhtLockFuture.java | 10 +-
.../dht/GridDhtPartitionTopologyImpl.java | 6 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 49 +--
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../GridDhtPartitionsExchangeFuture.java | 1 +
.../cache/transactions/IgniteTxManager.java | 6 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 24 +-
.../communication/tcp/TcpCommunicationSpi.java | 14 +-
.../discovery/tcp/TcpClientDiscoverySpi.java | 47 ++-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 78 ++--
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 8 +-
.../spi/swapspace/file/FileSwapSpaceSpi.java | 4 +-
.../resources/META-INF/classnames.properties | 19 +-
...eCacheConfigurationTemplateNotFoundTest.java | 114 ++++++
.../IgniteCacheConfigurationTemplateTest.java | 364 +++++++++++++++++++
.../cache/IgniteDynamicCacheStartSelfTest.java | 23 ++
...ePartitionedBasicStoreMultiNodeSelfTest.java | 110 +-----
.../GridAbstractCommunicationSelfTest.java | 3 +-
.../GridTcpCommunicationSpiAbstractTest.java | 5 +-
...mmunicationSpiConcurrentConnectSelfTest.java | 3 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 3 +-
...dTcpCommunicationSpiRecoveryAckSelfTest.java | 3 +-
...GridTcpCommunicationSpiRecoverySelfTest.java | 2 +-
.../ignite/testframework/junits/IgniteMock.java | 10 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 5 +-
.../org/apache/ignite/IgniteSpringBean.java | 14 +
.../commands/cache/VisorCacheClearCommand.scala | 3 +-
.../scala/org/apache/ignite/visor/visor.scala | 12 +-
parent/pom.xml | 2 +-
pom.xml | 1 +
39 files changed, 1192 insertions(+), 401 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d44e610/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
[42/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-sprint-3' into ignite-30
Posted by vk...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-30
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c31dbd2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c31dbd2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c31dbd2a
Branch: refs/heads/ignite-471
Commit: c31dbd2a20f0a2715dfa158102e1b879bfee657b
Parents: cb21533 7eef373
Author: sevdokimov <se...@gridgain.com>
Authored: Wed Apr 8 18:25:27 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed Apr 8 18:25:27 2015 +0300
----------------------------------------------------------------------
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/include/service.sh | 8 +-
config/hadoop/default-config.xml | 15 +-
.../streaming/StreamTransformerExample.java | 3 +-
.../src/main/java/org/apache/ignite/Ignite.java | 15 +
.../apache/ignite/internal/IgniteKernal.java | 55 ++-
.../org/apache/ignite/internal/IgnitionEx.java | 171 +++-----
.../internal/managers/GridManagerAdapter.java | 34 +-
.../cache/DynamicCacheChangeRequest.java | 17 +
.../cache/DynamicCacheDescriptor.java | 17 +-
.../processors/cache/GridCacheIoManager.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 350 +++++++++++++--
.../dht/GridClientPartitionTopology.java | 6 +-
.../distributed/dht/GridDhtLockFuture.java | 10 +-
.../dht/GridDhtPartitionTopologyImpl.java | 6 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 49 ++-
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../GridDhtPartitionsExchangeFuture.java | 1 +
.../cache/transactions/IgniteTxManager.java | 6 +-
.../ipc/shmem/IpcSharedMemoryNativeLoader.java | 48 ++-
.../ignite/internal/util/lang/GridFunc.java | 33 ++
.../ignite/internal/visor/cache/VisorCache.java | 2 +-
.../cache/VisorCacheAggregatedMetrics.java | 38 +-
.../visor/cache/VisorCacheConfiguration.java | 17 +-
.../internal/visor/cache/VisorCacheMetrics.java | 53 ++-
.../cache/VisorCacheMetricsCollectorTask.java | 59 ++-
.../visor/cache/VisorCacheStopTask.java | 69 +++
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 24 +-
.../communication/tcp/TcpCommunicationSpi.java | 14 +-
.../discovery/tcp/TcpClientDiscoverySpi.java | 47 +--
.../spi/discovery/tcp/TcpDiscoverySpi.java | 78 ++--
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 8 +-
.../spi/swapspace/file/FileSwapSpaceSpi.java | 4 +-
.../resources/META-INF/classnames.properties | 19 +-
...eCacheConfigurationTemplateNotFoundTest.java | 114 +++++
.../IgniteCacheConfigurationTemplateTest.java | 364 ++++++++++++++++
.../cache/IgniteDynamicCacheStartSelfTest.java | 23 +
...ePartitionedBasicStoreMultiNodeSelfTest.java | 110 +----
...ridCacheFifoBatchEvictionPolicySelfTest.java | 3 +-
.../GridAbstractCommunicationSelfTest.java | 3 +-
.../GridTcpCommunicationSpiAbstractTest.java | 5 +-
...mmunicationSpiConcurrentConnectSelfTest.java | 3 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 3 +-
...dTcpCommunicationSpiRecoveryAckSelfTest.java | 3 +-
...GridTcpCommunicationSpiRecoverySelfTest.java | 2 +-
.../ignite/testframework/junits/IgniteMock.java | 10 +
.../IgniteCacheEvictionSelfTestSuite.java | 1 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 5 +-
.../processors/query/h2/sql/GridSqlElement.java | 8 -
.../processors/query/h2/sql/GridSqlQuery.java | 183 ++++++++
.../query/h2/sql/GridSqlQueryParser.java | 97 +++--
.../query/h2/sql/GridSqlQuerySplitter.java | 111 ++++-
.../processors/query/h2/sql/GridSqlSelect.java | 209 +++------
.../query/h2/sql/GridSqlSubquery.java | 8 +-
.../processors/query/h2/sql/GridSqlUnion.java | 134 ++++++
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../query/h2/sql/GridQueryParsingTest.java | 26 +-
.../query/h2/sql/IgniteVsH2QueryTest.java | 27 +-
.../org/apache/ignite/IgniteSpringBean.java | 14 +
.../commands/cache/VisorCacheClearCommand.scala | 3 +-
.../commands/cache/VisorCacheCommand.scala | 423 +++++++++++--------
.../commands/cache/VisorCacheStopCommand.scala | 145 +++++++
.../scala/org/apache/ignite/visor/visor.scala | 12 +-
parent/pom.xml | 2 +-
pom.xml | 2 +
66 files changed, 2474 insertions(+), 865 deletions(-)
----------------------------------------------------------------------
[09/50] [abbrv] incubator-ignite git commit: ignite-624
Posted by vk...@apache.org.
ignite-624
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/25f900ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/25f900ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/25f900ed
Branch: refs/heads/ignite-471
Commit: 25f900edac7d3a213ec30de673251777739848a5
Parents: 71fa3a2
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Apr 7 09:54:56 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Apr 7 09:54:56 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/sql/GridSqlQuery.java | 103 +++++++++----------
.../query/h2/sql/GridSqlQueryParser.java | 41 +++++---
.../query/h2/sql/GridSqlQuerySplitter.java | 96 ++++++++++++-----
.../processors/query/h2/sql/GridSqlSelect.java | 72 ++++++++-----
.../processors/query/h2/sql/GridSqlUnion.java | 42 +-------
5 files changed, 192 insertions(+), 162 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25f900ed/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
index db1dcbf..5953d5e 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuery.java
@@ -17,6 +17,9 @@
package org.apache.ignite.internal.processors.query.h2.sql;
+import org.apache.ignite.*;
+import org.h2.util.*;
+
import java.util.*;
/**
@@ -27,13 +30,7 @@ public abstract class GridSqlQuery implements Cloneable {
protected boolean distinct;
/** */
- protected List<GridSqlElement> allExprs;
-
- /** */
- protected List<GridSqlElement> select = new ArrayList<>();
-
- /** */
- protected Map<GridSqlElement,GridSqlSortColumn> sort = new LinkedHashMap<>();
+ protected List<GridSqlSortColumn> sort = new ArrayList<>();
/** */
protected GridSqlElement offset;
@@ -89,66 +86,66 @@ public abstract class GridSqlQuery implements Cloneable {
public abstract String getSQL();
/**
- * @param expression Expression.
- */
- public void addExpression(GridSqlElement expression) {
- if (allExprs == null)
- allExprs = new ArrayList<>();
-
- allExprs.add(expression);
- }
-
- /**
- * @return All expressions in select, group by, order by.
+ * @return Sort.
*/
- public List<GridSqlElement> allExpressions() {
- return allExprs;
+ public List<GridSqlSortColumn> sort() {
+ return sort;
}
/**
- * @return Expressions.
+ *
*/
- public List<GridSqlElement> select() {
- return select;
+ public void clearSort() {
+ sort = new ArrayList<>();
}
/**
- * Clears select list.
+ * @param sortCol The sort column.
*/
- public void clearSelect() {
- select = new ArrayList<>();
+ public void addSort(GridSqlSortColumn sortCol) {
+ sort.add(sortCol);
}
/**
- * @param expression Expression.
+ * @param buff Statement builder.
*/
- public void addSelectExpression(GridSqlElement expression) {
- if (expression == null)
- throw new NullPointerException();
-
- select.add(expression);
- }
+ protected void getSortLimitSQL(StatementBuilder buff) {
+ if (!sort.isEmpty()) {
+ buff.append("\nORDER BY ");
+
+ boolean first = true;
+
+ for (GridSqlSortColumn col : sort) {
+ if (first)
+ first = false;
+ else
+ buff.append(", ");
+
+ int idx = col.column();
+
+ if (idx >= 0)
+ buff.append(idx + 1);
+ else {
+ throw new IgniteException("Failed to generate query: " + buff);
+// buff.append('=').append(StringUtils.unEnclose(entry.getKey().getSQL()));
+ }
+
+ if (!col.asc())
+ buff.append(" DESC");
+
+ if (col.nullsFirst())
+ buff.append(" NULLS FIRST");
+ else if (col.nullsLast())
+ buff.append(" NULLS LAST");
+ }
+ }
- /**
- * @return Sort.
- */
- public Map<GridSqlElement,GridSqlSortColumn> sort() {
- return sort;
- }
+ if (limit != null)
+ buff.append(" LIMIT ").append(StringUtils.unEnclose(limit.getSQL()));
- /**
- *
- */
- public void clearSort() {
- sort = new LinkedHashMap<>();
- }
+ if (offset != null)
+ buff.append(" OFFSET ").append(StringUtils.unEnclose(offset.getSQL()));
- /**
- * @param expression Expression.
- * @param sortType The sort type bit mask (SortOrder.DESCENDING, SortOrder.NULLS_FIRST, SortOrder.NULLS_LAST).
- */
- public void addSort(GridSqlElement expression, GridSqlSortColumn sortType) {
- sort.put(expression, sortType);
}
/** {@inheritDoc} */
@@ -157,9 +154,7 @@ public abstract class GridSqlQuery implements Cloneable {
try {
GridSqlQuery res = (GridSqlQuery)super.clone();
- res.select = new ArrayList<>(select);
- res.sort = new LinkedHashMap<>(sort);
- res.allExprs = null;
+ res.sort = new ArrayList<>(sort);
return res;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25f900ed/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index fb341c1..ea3628f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -293,22 +293,7 @@ public class GridSqlQueryParser {
for (int i = 0; i < select.getColumnCount(); i++)
res.addSelectExpression(parseExpression(expressions.get(i)));
- SortOrder sortOrder = select.getSortOrder();
-
- if (sortOrder != null) {
- int[] indexes = sortOrder.getQueryColumnIndexes();
- int[] sortTypes = sortOrder.getSortTypes();
-
- for (int i = 0; i < indexes.length; i++) {
- int colIdx = indexes[i];
- int type = sortTypes[i];
-
- res.addSort(parseExpression(expressions.get(colIdx)), new GridSqlSortColumn(colIdx,
- (type & SortOrder.DESCENDING) == 0,
- (type & SortOrder.NULLS_FIRST) != 0,
- (type & SortOrder.NULLS_LAST) != 0));
- }
- }
+ processSortOrder(select.getSortOrder(), res);
res.limit(parseExpression(select.getLimit()));
res.offset(parseExpression(select.getOffset()));
@@ -317,6 +302,28 @@ public class GridSqlQueryParser {
}
/**
+ * @param sortOrder Sort order.
+ * @param qry Query.
+ */
+ private void processSortOrder(SortOrder sortOrder, GridSqlQuery qry) {
+ if (sortOrder == null)
+ return;
+
+ int[] indexes = sortOrder.getQueryColumnIndexes();
+ int[] sortTypes = sortOrder.getSortTypes();
+
+ for (int i = 0; i < indexes.length; i++) {
+ int colIdx = indexes[i];
+ int type = sortTypes[i];
+
+ qry.addSort(new GridSqlSortColumn(colIdx,
+ (type & SortOrder.DESCENDING) == 0,
+ (type & SortOrder.NULLS_FIRST) != 0,
+ (type & SortOrder.NULLS_LAST) != 0));
+ }
+ }
+
+ /**
* @param qry Select.
*/
public GridSqlQuery parse(Query qry) {
@@ -348,7 +355,7 @@ public class GridSqlQueryParser {
res.limit(parseExpression(union.getLimit()));
res.offset(parseExpression(union.getOffset()));
- assert UNION_SORT.get(union) == null; // todo IGNITE-624
+ processSortOrder(UNION_SORT.get(union), res);
h2ObjToGridObj.put(union, res);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25f900ed/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 f343b01..05928c2 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
@@ -57,6 +57,17 @@ public class GridSqlQuerySplitter {
}
/**
+ * @param qry Query.
+ * @return Leftest simple query if this is UNION.
+ */
+ private static GridSqlSelect leftest(GridSqlQuery qry) {
+ if (qry instanceof GridSqlUnion)
+ return leftest(((GridSqlUnion)qry).left());
+
+ return (GridSqlSelect)qry;
+ }
+
+ /**
* @param stmt Prepared statement.
* @param params Parameters.
* @return Two step query.
@@ -65,21 +76,58 @@ public class GridSqlQuerySplitter {
if (params == null)
params = GridCacheSqlQuery.EMPTY_PARAMS;
- GridSqlQuery srcQry = GridSqlQueryParser.parse(stmt);
+ GridSqlQuery qry0 = GridSqlQueryParser.parse(stmt);
+
+ GridSqlSelect srcQry;
+
+ if (qry0 instanceof GridSqlSelect)
+ srcQry = (GridSqlSelect)qry0;
+ else {
+ srcQry = new GridSqlSelect().from(new GridSqlSubquery(qry0));
+
+ GridSqlSelect left = leftest(qry0);
+
+ int c = 0;
+
+ for (GridSqlElement expr : left.select()) {
+ String colName;
+
+ if (expr instanceof GridSqlAlias)
+ colName = ((GridSqlAlias)expr).alias();
+ else if (expr instanceof GridSqlColumn)
+ colName = ((GridSqlColumn)expr).columnName();
+ else {
+ colName = columnName(c);
- if (!(srcQry instanceof GridSqlSelect))
- throw new UnsupportedOperationException(); // todo IGNITE-624 Support UNION,
+ expr = alias(colName, expr);
- GridSqlSelect srcSelect = (GridSqlSelect)srcQry;
+ // Set generated alias to the expression.
+ left.select().set(c, expr);
+ left.allExpressions().set(c, expr);
+ }
+
+ srcQry.addSelectExpression(column(colName));
+
+ qry0.sort();
+
+ c++;
+ }
+
+ // ORDER BY
+ if (!qry0.sort().isEmpty()) {
+ for (GridSqlSortColumn col : qry0.sort())
+ srcQry.addSort(col);
+ }
+ }
final String mergeTable = TABLE_FUNC_NAME + "()"; // table(0); TODO
- GridSqlSelect mapQry = srcSelect.clone();
+ GridSqlSelect mapQry = srcQry.clone();
GridSqlSelect rdcQry = new GridSqlSelect().from(new GridSqlFunction("PUBLIC", TABLE_FUNC_NAME)); // table(mergeTable)); TODO
// Split all select expressions into map-reduce parts.
- List<GridSqlElement> mapExps = new ArrayList<>(srcSelect.allExpressions());
- GridSqlElement[] rdcExps = new GridSqlElement[srcSelect.select().size()];
+ List<GridSqlElement> mapExps = new ArrayList<>(srcQry.allExpressions());
+ GridSqlElement[] rdcExps = new GridSqlElement[srcQry.select().size()];
Set<String> colNames = new HashSet<>();
@@ -98,31 +146,31 @@ public class GridSqlQuerySplitter {
rdcQry.addSelectExpression(rdcExp);
// -- GROUP BY
- if (!srcSelect.groups().isEmpty()) {
+ if (!srcQry.groups().isEmpty()) {
mapQry.clearGroups();
- for (int col : srcSelect.groupColumns())
+ for (int col : srcQry.groupColumns())
mapQry.addGroupExpression(column(((GridSqlAlias)mapExps.get(col)).alias()));
- for (int col : srcSelect.groupColumns())
+ for (int col : srcQry.groupColumns())
rdcQry.addGroupExpression(column(((GridSqlAlias)mapExps.get(col)).alias()));
}
// -- HAVING
- if (srcSelect.having() != null) {
+ if (srcQry.having() != null) {
// TODO Find aggregate functions in HAVING clause.
- rdcQry.whereAnd(column(columnName(srcSelect.havingColumn())));
+ rdcQry.whereAnd(column(columnName(srcQry.havingColumn())));
mapQry.having(null);
}
// -- ORDER BY
- if (!srcSelect.sort().isEmpty()) {
+ if (!srcQry.sort().isEmpty()) {
if (aggregateFound) // Ordering over aggregates does not make sense.
mapQry.clearSort(); // Otherwise map sort will be used by offset-limit.
- for (GridSqlSortColumn sortCol : srcSelect.sort().values())
- rdcQry.addSort(column(((GridSqlAlias)mapExps.get(sortCol.column())).alias()), sortCol);
+ for (GridSqlSortColumn sortCol : srcQry.sort())
+ rdcQry.addSort(sortCol);
}
// -- LIMIT
@@ -134,14 +182,14 @@ public class GridSqlQuerySplitter {
}
// -- OFFSET
- if (srcSelect.offset() != null) {
+ if (srcQry.offset() != null) {
mapQry.offset(null);
- rdcQry.offset(srcSelect.offset());
+ rdcQry.offset(srcQry.offset());
}
// -- DISTINCT
- if (srcSelect.distinct()) {
+ if (srcQry.distinct()) {
mapQry.distinct(false);
rdcQry.distinct(true);
}
@@ -166,7 +214,12 @@ public class GridSqlQuerySplitter {
if (qry instanceof GridSqlSelect)
return findParams((GridSqlSelect)qry, params, target);
- throw new UnsupportedOperationException(); // todo IGNITE-624
+ GridSqlUnion union = (GridSqlUnion)qry;
+
+ findParams(union.left(), params, target);
+ findParams(union.right(), params, target);
+
+ return target;
}
/**
@@ -179,7 +232,7 @@ public class GridSqlQuerySplitter {
if (params.length == 0)
return target;
- for (GridSqlElement el : qry.select())
+ for (GridSqlElement el : qry.allExpressions())
findParams(el, params, target);
findParams(qry.from(), params, target);
@@ -190,9 +243,6 @@ public class GridSqlQuerySplitter {
findParams(qry.having(), params, target);
- for (GridSqlElement el : qry.sort().keySet())
- findParams(el, params, target);
-
findParams(qry.limit(), params, target);
findParams(qry.offset(), params, target);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25f900ed/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
index 272f8b4..154659b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
@@ -26,6 +26,12 @@ import java.util.*;
*/
public class GridSqlSelect extends GridSqlQuery {
/** */
+ private List<GridSqlElement> allExprs;
+
+ /** */
+ private List<GridSqlElement> select = new ArrayList<>();
+
+ /** */
private List<GridSqlElement> groups = new ArrayList<>();
/** */
@@ -79,42 +85,50 @@ public class GridSqlSelect extends GridSqlQuery {
if (having != null)
buff.append("\nHAVING ").append(StringUtils.unEnclose(having.getSQL()));
- if (!sort.isEmpty()) {
- buff.append("\nORDER BY ");
-
- buff.resetCount();
-
- for (Map.Entry<GridSqlElement,GridSqlSortColumn> entry : sort.entrySet()) {
- buff.appendExceptFirst(", ");
-
- GridSqlElement expression = entry.getKey();
+ getSortLimitSQL(buff);
- int idx = select.indexOf(expression);
+ return buff.toString();
+ }
- if (idx >= 0)
- buff.append(idx + 1);
- else
- buff.append('=').append(StringUtils.unEnclose(expression.getSQL()));
+ /**
+ * @param expression Expression.
+ */
+ public void addExpression(GridSqlElement expression) {
+ if (allExprs == null)
+ allExprs = new ArrayList<>();
- GridSqlSortColumn type = entry.getValue();
+ allExprs.add(expression);
+ }
- if (!type.asc())
- buff.append(" DESC");
+ /**
+ * @return All expressions in select, group by, order by.
+ */
+ public List<GridSqlElement> allExpressions() {
+ return allExprs;
+ }
- if (type.nullsFirst())
- buff.append(" NULLS FIRST");
- else if (type.nullsLast())
- buff.append(" NULLS LAST");
- }
- }
+ /**
+ * @return Expressions.
+ */
+ public List<GridSqlElement> select() {
+ return select;
+ }
- if (limit != null)
- buff.append(" LIMIT ").append(StringUtils.unEnclose(limit.getSQL()));
+ /**
+ * Clears select list.
+ */
+ public void clearSelect() {
+ select = new ArrayList<>();
+ }
- if (offset != null)
- buff.append(" OFFSET ").append(StringUtils.unEnclose(offset.getSQL()));
+ /**
+ * @param expression Expression.
+ */
+ public void addSelectExpression(GridSqlElement expression) {
+ if (expression == null)
+ throw new NullPointerException();
- return buff.toString();
+ select.add(expression);
}
/**
@@ -237,6 +251,8 @@ public class GridSqlSelect extends GridSqlQuery {
res.groups = new ArrayList<>(groups);
res.grpCols = grpCols == null ? null : grpCols.clone();
+ res.select = new ArrayList<>(select);
+ res.allExprs = null;
return res;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25f900ed/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
index 1eae1ef..6fe3f19 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
@@ -18,11 +18,9 @@
package org.apache.ignite.internal.processors.query.h2.sql;
import org.h2.command.dml.*;
-import org.h2.message.*;
import org.h2.util.*;
import javax.cache.*;
-import java.util.*;
/**
*
@@ -39,7 +37,7 @@ public class GridSqlUnion extends GridSqlQuery {
/** {@inheritDoc} */
@Override public String getSQL() {
- StringBuilder buff = new StringBuilder();
+ StatementBuilder buff = new StatementBuilder();
buff.append('(').append(left.getSQL()).append(')');
@@ -66,43 +64,7 @@ public class GridSqlUnion extends GridSqlQuery {
buff.append('(').append(right.getSQL()).append(')');
- if (!sort.isEmpty()) {
- buff.append("\nORDER BY ");
-
- boolean first = true;
-
- for (Map.Entry<GridSqlElement, GridSqlSortColumn> entry : sort.entrySet()) {
- if (first)
- first = false;
- else
- buff.append(", ");
-
- GridSqlElement expression = entry.getKey();
-
- int idx = select.indexOf(expression);
-
- if (idx >= 0)
- buff.append(idx + 1);
- else
- buff.append('=').append(StringUtils.unEnclose(expression.getSQL()));
-
- GridSqlSortColumn type = entry.getValue();
-
- if (!type.asc())
- buff.append(" DESC");
-
- if (type.nullsFirst())
- buff.append(" NULLS FIRST");
- else if (type.nullsLast())
- buff.append(" NULLS LAST");
- }
- }
-
- if (limit != null)
- buff.append(" LIMIT ").append(StringUtils.unEnclose(limit.getSQL()));
-
- if (offset != null)
- buff.append(" OFFSET ").append(StringUtils.unEnclose(offset.getSQL()));
+ getSortLimitSQL(buff);
return buff.toString();
}
[13/50] [abbrv] incubator-ignite git commit: Merge branch
'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-624
Posted by vk...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-624
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5edf4d98
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5edf4d98
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5edf4d98
Branch: refs/heads/ignite-471
Commit: 5edf4d9849ad5ba21a35fa10e309d3b1dbae899e
Parents: 25f900e 5f2d8c2
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Apr 7 13:47:28 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Apr 7 13:47:28 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
examples/README.txt | 11 +-
examples/config/example-ignite.xml | 2 +-
.../streaming/StreamTransformerExample.java | 101 +
.../streaming/StreamVisitorExample.java | 171 +
.../streaming/marketdata/CacheConfig.java | 44 -
.../streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 103 -
.../examples/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 78 -
.../streaming/wordcount/CacheConfig.java | 48 +
.../streaming/wordcount/QueryWords.java | 77 +
.../streaming/wordcount/StreamWords.java | 68 +
.../streaming/wordcount/alice-in-wonderland.txt | 3735 ++++++++++++++++++
.../streaming/wordcount/package-info.java | 22 +
.../streaming/StreamTransformerExample.java | 97 +
.../java8/streaming/StreamVisitorExample.java | 168 +
.../java8/streaming/marketdata/CacheConfig.java | 44 -
.../java8/streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 101 -
.../java8/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 74 -
.../ignite/cache/affinity/AffinityUuid.java | 50 +
.../store/jdbc/CacheAbstractJdbcStore.java | 104 +-
.../configuration/CacheConfiguration.java | 3 -
.../processors/cache/CacheLazyEntry.java | 10 +-
.../processors/cache/KeyCacheObjectImpl.java | 13 +-
.../cacheobject/IgniteCacheObjectProcessor.java | 3 +-
.../IgniteCacheObjectProcessorImpl.java | 28 +-
.../ignite/internal/visor/cache/VisorCache.java | 19 +-
.../VisorCacheConfigurationCollectorJob.java | 76 +
.../VisorCacheConfigurationCollectorTask.java | 39 +
.../VisorIgfsProfilerUniformityCounters.java | 6 +-
.../internal/visor/log/VisorLogSearchTask.java | 3 +-
.../visor/node/VisorGridConfiguration.java | 38 -
.../visor/node/VisorIgfsConfiguration.java | 2 +-
.../visor/node/VisorRestConfiguration.java | 1 +
.../visor/query/VisorQueryNextPageTask.java | 5 +-
.../internal/visor/util/VisorTaskUtils.java | 3 +-
.../org/apache/ignite/lang/IgniteImmutable.java | 49 -
.../ignite/IgniteCacheAffinitySelfTest.java | 5 +
.../GridCacheOnCopyFlagAbstractSelfTest.java | 112 +-
.../GridCacheReturnValueTransferSelfTest.java | 1 -
.../IgniteCacheStoreValueAbstractTest.java | 186 +-
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../commands/cache/VisorCacheCommand.scala | 26 +-
.../config/VisorConfigurationCommand.scala | 15 +-
.../visor/commands/gc/VisorGcCommand.scala | 15 +-
.../scala/org/apache/ignite/visor/visor.scala | 34 +-
.../yardstick/config/benchmark-store.properties | 5 +-
parent/pom.xml | 1 +
pom.xml | 12 +-
56 files changed, 5039 insertions(+), 1371 deletions(-)
----------------------------------------------------------------------
[17/50] [abbrv] incubator-ignite git commit: # Ignite-639 Fixed Visor
console cache command.
Posted by vk...@apache.org.
# Ignite-639 Fixed Visor console cache command.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/36c330a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/36c330a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/36c330a6
Branch: refs/heads/ignite-471
Commit: 36c330a6ab0f8bff24ef05933dd079f11d76b63a
Parents: c6de5e1
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 21:38:09 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 21:38:09 2015 +0700
----------------------------------------------------------------------
.../cache/VisorCacheMetricsCollectorTask.java | 10 +++++--
.../commands/cache/VisorCacheCommand.scala | 29 +++++++++++++-------
2 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36c330a6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index b4b850b..ee0b962 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -46,7 +46,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
Map<String, VisorCacheAggregatedMetrics> grpAggrMetrics = U.newHashMap(results.size());
for (ComputeJobResult res : results) {
- if (res.getException() == null && res.getData() instanceof Map<?, ?>) {
+ if (res.getException() == null) {
Collection<VisorCacheMetrics> cms = res.getData();
for (VisorCacheMetrics cm : cms) {
@@ -109,7 +109,13 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
if (ca.context().started()) {
VisorCacheMetrics cm = VisorCacheMetrics.from(ignite, ca);
- if ((showSysCaches && cm.system()) || allCaches || cacheNames.contains(ca.name()))
+ boolean addCache = allCaches || cacheNames.contains(ca.name());
+
+ if (showSysCaches) {
+ if (cm.system() && addCache)
+ res.add(cm);
+ }
+ else if (!cm.system() && addCache)
res.add(cm);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36c330a6/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index df3007c..b8f2a35 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -221,9 +221,9 @@ class VisorCacheCommand {
if (hasArgFlag("i", argLst)) {
askForNode("Select node from:") match {
case Some(nid) => ask("Detailed statistics (y/n) [n]: ", "n") match {
- case "n" | "N" => nl(); cache("-id=" + nid).^^
- case "y" | "Y" => nl(); cache("-a -id=" + nid).^^
- case x => nl(); warn("Invalid answer: " + x).^^
+ case "n" | "N" => nl(); cache("-id=" + nid); return;
+ case "y" | "Y" => nl(); cache("-a -id=" + nid); return;
+ case x => nl(); warn("Invalid answer: " + x); return;
}
case None => return
}
@@ -302,11 +302,17 @@ class VisorCacheCommand {
val sortType = argValue("s", argLst)
val reversed = hasArgName("r", argLst)
- if (sortType.isDefined && !isValidSortType(sortType.get))
- scold("Invalid '-s' argument in: " + args).^^
+ if (sortType.isDefined && !isValidSortType(sortType.get)) {
+ scold("Invalid '-s' argument in: " + args)
- if (aggrData.isEmpty)
- scold("No caches found.").^^
+ return
+ }
+
+ if (aggrData.isEmpty) {
+ scold("No caches found.")
+
+ return
+ }
println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis))
@@ -493,7 +499,7 @@ class VisorCacheCommand {
val nids = prj.nodes().map(_.id())
- val caches: JavaCollection[String] = new JavaList[String](1)
+ val caches: JavaCollection[String] = new JavaList[String]()
name.foreach(caches.add)
ignite.compute(prj).execute(classOf[VisorCacheMetricsCollectorTask], toTaskArgument(nids,
@@ -602,8 +608,11 @@ class VisorCacheCommand {
assert(title != null)
assert(visor.visor.isConnected)
- if (aggrData.isEmpty)
- scold("No caches found.").^^
+ if (aggrData.isEmpty) {
+ scold("No caches found.")
+
+ return None
+ }
val sortedAggrData = sortAggregatedData(aggrData, "cn", false)
[07/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-639' and 'ignite-sprint-3'
Posted by vk...@apache.org.
Merge branches 'ignite-639' and 'ignite-sprint-3'
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0c836dbe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0c836dbe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0c836dbe
Branch: refs/heads/ignite-471
Commit: 0c836dbeb4c02e834ec7e26f5757cb631f569011
Parents: f600e7e
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 11:30:32 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 11:30:32 2015 +0700
----------------------------------------------------------------------
.../processors/query/h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../ignite/visor/commands/cache/VisorCacheCommand.scala | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c836dbe/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 984e2c0..02c7c55 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
@@ -47,7 +47,7 @@ import org.h2.value.*;
import org.jsr166.*;
import javax.cache.*;
-import java.lang.reflect.Constructor;
+import java.lang.reflect.*;
import java.sql.*;
import java.util.*;
import java.util.concurrent.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0c836dbe/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 055931b..df3007c 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -32,7 +32,6 @@ import java.lang.{Boolean => JavaBoolean}
import java.util.{ArrayList => JavaList, Collection => JavaCollection, UUID}
import org.apache.ignite.internal.visor.cache._
-import org.apache.ignite.internal.visor.node.{VisorGridConfiguration, VisorNodeConfigurationCollectorTask}
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
import scala.collection.JavaConversions._
@@ -494,11 +493,11 @@ class VisorCacheCommand {
val nids = prj.nodes().map(_.id())
- val caches = new JavaList[String](1)
+ val caches: JavaCollection[String] = new JavaList[String](1)
name.foreach(caches.add)
ignite.compute(prj).execute(classOf[VisorCacheMetricsCollectorTask], toTaskArgument(nids,
- new IgniteBiTuple(JavaBoolean.valueOf(systemCaches), caches.asInstanceOf[JavaCollection[String]]))).toList
+ new IgniteBiTuple(JavaBoolean.valueOf(systemCaches), caches))).toList
}
catch {
case e: IgniteException => Nil
@@ -519,7 +518,7 @@ class VisorCacheCommand {
case e: IgniteException =>
scold(e.getMessage)
- Collections.emptyList()
+ null
}
}
[34/50] [abbrv] incubator-ignite git commit: # IGNITE-685 NPE on node
start if client discovery is used.
Posted by vk...@apache.org.
# IGNITE-685 NPE on node start if client discovery is used.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/654b4e98
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/654b4e98
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/654b4e98
Branch: refs/heads/ignite-471
Commit: 654b4e98f2f618e4ffffad6486d13f883a1a5d7d
Parents: 0cf79e4
Author: sevdokimov <se...@gridgain.com>
Authored: Wed Apr 8 13:03:01 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Wed Apr 8 13:29:06 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/IgnitionEx.java | 172 +++++++------------
1 file changed, 65 insertions(+), 107 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/654b4e98/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index fe81006..a4aea66 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1675,23 +1675,32 @@ public class IgnitionEx {
*/
@SuppressWarnings("unchecked")
public void initializeDefaultCacheConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException {
- CacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration();
+ List<CacheConfiguration> cacheCfgs = new ArrayList<>();
- final boolean hasHadoop = IgniteComponentType.HADOOP.inClassPath();
+ boolean clientDisco = cfg.getDiscoverySpi() instanceof TcpClientDiscoverySpi;
- final boolean hasAtomics = cfg.getAtomicConfiguration() != null;
+ // Add marshaller and utility caches.
+ if (!clientDisco) {
+ cacheCfgs.add(marshallerSystemCache());
- final boolean clientDisco = cfg.getDiscoverySpi() instanceof TcpClientDiscoverySpi;
+ cacheCfgs.add(utilitySystemCache());
+ }
+
+ if (IgniteComponentType.HADOOP.inClassPath())
+ cacheCfgs.add(CU.hadoopSystemCache());
- CacheConfiguration[] copies;
+ if (cfg.getAtomicConfiguration() != null && !clientDisco)
+ cacheCfgs.add(atomicsSystemCache(cfg.getAtomicConfiguration()));
- if (cacheCfgs != null && cacheCfgs.length > 0) {
+ CacheConfiguration[] userCaches = cfg.getCacheConfiguration();
+
+ if (userCaches != null && userCaches.length > 0) {
if (!U.discoOrdered(cfg.getDiscoverySpi()) && !U.relaxDiscoveryOrdered())
throw new IgniteCheckedException("Discovery SPI implementation does not support node ordering and " +
"cannot be used with cache (use SPI with @GridDiscoverySpiOrderSupport annotation, " +
"like GridTcpDiscoverySpi)");
- for (CacheConfiguration ccfg : cacheCfgs) {
+ for (CacheConfiguration ccfg : userCaches) {
if (CU.isHadoopSystemCache(ccfg.getName()))
throw new IgniteCheckedException("Cache name cannot be \"" + CU.SYS_CACHE_HADOOP_MR +
"\" because it is reserved for internal purposes.");
@@ -1709,52 +1718,15 @@ public class IgnitionEx {
"\" because it is reserved for internal purposes.");
}
- int addCacheCnt = 2; // Always add marshaller and utility caches.
-
- if (hasHadoop)
- addCacheCnt++;
-
- if (hasAtomics)
- addCacheCnt++;
-
- copies = new CacheConfiguration[cacheCfgs.length + addCacheCnt];
-
- int cloneIdx = 2;
-
- if (hasHadoop)
- copies[cloneIdx++] = CU.hadoopSystemCache();
-
- if (hasAtomics)
- copies[cloneIdx++] = atomicsSystemCache(cfg.getAtomicConfiguration(), clientDisco);
-
- for (CacheConfiguration ccfg : cacheCfgs)
- copies[cloneIdx++] = new CacheConfiguration(ccfg);
- }
- else {
- int cacheCnt = 2; // Always add marshaller and utility caches.
-
- if (hasHadoop)
- cacheCnt++;
-
- if (hasAtomics)
- cacheCnt++;
+ for (CacheConfiguration ccfg : userCaches) {
+ if (ccfg == null)
+ throw new NullPointerException("Cache configuration list must not contains null element");
- copies = new CacheConfiguration[cacheCnt];
-
- int cacheIdx = 2;
-
- if (hasHadoop)
- copies[cacheIdx++] = CU.hadoopSystemCache();
-
- if (hasAtomics)
- copies[cacheIdx] = atomicsSystemCache(cfg.getAtomicConfiguration(), clientDisco);
+ cacheCfgs.add(ccfg);
+ }
}
- // Always add marshaller and utility caches.
- copies[0] = marshallerSystemCache(clientDisco);
- copies[1] = utilitySystemCache(clientDisco);
-
- cfg.setCacheConfiguration(copies);
+ cfg.setCacheConfiguration(cacheCfgs.toArray(new CacheConfiguration[cacheCfgs.size()]));
}
/**
@@ -1899,78 +1871,64 @@ public class IgnitionEx {
*
* @return Marshaller system cache configuration.
*/
- private static CacheConfiguration marshallerSystemCache(boolean client) {
- if (!client) {
- CacheConfiguration cache = new CacheConfiguration();
-
- cache.setName(CU.MARSH_CACHE_NAME);
- cache.setCacheMode(REPLICATED);
- cache.setAtomicityMode(ATOMIC);
- cache.setSwapEnabled(false);
- cache.setRebalanceMode(SYNC);
- cache.setWriteSynchronizationMode(FULL_SYNC);
- cache.setAffinity(new RendezvousAffinityFunction(false, 20));
- cache.setNodeFilter(CacheConfiguration.ALL_NODES);
- cache.setStartSize(300);
-
- return cache;
- }
-
- return null;
+ private static CacheConfiguration marshallerSystemCache() {
+ CacheConfiguration cache = new CacheConfiguration();
+
+ cache.setName(CU.MARSH_CACHE_NAME);
+ cache.setCacheMode(REPLICATED);
+ cache.setAtomicityMode(ATOMIC);
+ cache.setSwapEnabled(false);
+ cache.setRebalanceMode(SYNC);
+ cache.setWriteSynchronizationMode(FULL_SYNC);
+ cache.setAffinity(new RendezvousAffinityFunction(false, 20));
+ cache.setNodeFilter(CacheConfiguration.ALL_NODES);
+ cache.setStartSize(300);
+
+ return cache;
}
/**
* Creates utility system cache configuration.
*
- * @param client If {@code true} creates client-only cache configuration.
* @return Utility system cache configuration.
*/
- private static CacheConfiguration utilitySystemCache(boolean client) {
- if (!client) {
- CacheConfiguration cache = new CacheConfiguration();
-
- cache.setName(CU.UTILITY_CACHE_NAME);
- cache.setCacheMode(REPLICATED);
- cache.setAtomicityMode(TRANSACTIONAL);
- cache.setSwapEnabled(false);
- cache.setRebalanceMode(SYNC);
- cache.setWriteSynchronizationMode(FULL_SYNC);
- cache.setAffinity(new RendezvousAffinityFunction(false, 100));
- cache.setNodeFilter(CacheConfiguration.ALL_NODES);
-
- return cache;
- }
-
- return null;
+ private static CacheConfiguration utilitySystemCache() {
+ CacheConfiguration cache = new CacheConfiguration();
+
+ cache.setName(CU.UTILITY_CACHE_NAME);
+ cache.setCacheMode(REPLICATED);
+ cache.setAtomicityMode(TRANSACTIONAL);
+ cache.setSwapEnabled(false);
+ cache.setRebalanceMode(SYNC);
+ cache.setWriteSynchronizationMode(FULL_SYNC);
+ cache.setAffinity(new RendezvousAffinityFunction(false, 100));
+ cache.setNodeFilter(CacheConfiguration.ALL_NODES);
+
+ return cache;
}
/**
* Creates cache configuration for atomic data structures.
*
* @param cfg Atomic configuration.
- * @param client If {@code true} creates client-only cache configuration.
* @return Cache configuration for atomic data structures.
*/
- private static CacheConfiguration atomicsSystemCache(AtomicConfiguration cfg, boolean client) {
- if (!client) {
- CacheConfiguration ccfg = new CacheConfiguration();
-
- ccfg.setName(CU.ATOMICS_CACHE_NAME);
- ccfg.setAtomicityMode(TRANSACTIONAL);
- ccfg.setSwapEnabled(false);
- ccfg.setRebalanceMode(SYNC);
- ccfg.setWriteSynchronizationMode(FULL_SYNC);
- ccfg.setCacheMode(cfg.getCacheMode());
- ccfg.setNodeFilter(CacheConfiguration.ALL_NODES);
- ccfg.setNearConfiguration(new NearCacheConfiguration());
-
- if (cfg.getCacheMode() == PARTITIONED)
- ccfg.setBackups(cfg.getBackups());
-
- return ccfg;
- }
-
- return null;
+ private static CacheConfiguration atomicsSystemCache(AtomicConfiguration cfg) {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(CU.ATOMICS_CACHE_NAME);
+ ccfg.setAtomicityMode(TRANSACTIONAL);
+ ccfg.setSwapEnabled(false);
+ ccfg.setRebalanceMode(SYNC);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setCacheMode(cfg.getCacheMode());
+ ccfg.setNodeFilter(CacheConfiguration.ALL_NODES);
+ ccfg.setNearConfiguration(new NearCacheConfiguration());
+
+ if (cfg.getCacheMode() == PARTITIONED)
+ ccfg.setBackups(cfg.getBackups());
+
+ return ccfg;
}
/**
[04/50] [abbrv] incubator-ignite git commit: # IGNITE-639 Review.
Posted by vk...@apache.org.
# IGNITE-639 Review.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/43fa7148
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/43fa7148
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/43fa7148
Branch: refs/heads/ignite-471
Commit: 43fa7148b37bbd3cdd0c4b406075d98491072b8a
Parents: 349c200
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 10:26:43 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 10:26:43 2015 +0700
----------------------------------------------------------------------
.../ignite/internal/visor/cache/VisorCache.java | 6 +--
.../cache/VisorCacheAggregatedMetrics.java | 35 +++++++------
.../internal/visor/cache/VisorCacheMetrics.java | 53 ++++++++++++++++++--
.../cache/VisorCacheMetricsCollectorTask.java | 33 +++++-------
.../commands/cache/VisorCacheCommand.scala | 29 ++++++-----
5 files changed, 99 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43fa7148/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index 98f602f..d57d19a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -97,9 +97,9 @@ public class VisorCache implements Serializable {
* @param cacheName Cache name.
* @param sample Sample size.
* @return Data transfer object for given cache.
- * @throws IgniteCheckedException
+ * @throws IgniteCheckedException If failed collect metrics.
*/
- public static VisorCache from(Ignite ignite, String cacheName, int sample) throws IgniteCheckedException {
+ public static VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException {
assert ignite != null;
GridCacheAdapter ca = ((IgniteKernal)ignite).internalCache(cacheName);
@@ -226,7 +226,7 @@ public class VisorCache implements Serializable {
cache.partitions = ca.affinity().partitions();
cache.primaryPartitions = pps;
cache.backupPartitions = bps;
- cache.metrics = VisorCacheMetrics.from(ca);
+ cache.metrics = VisorCacheMetrics.from(ignite, ca);
cache.partitionsMap = partsMap;
return cache;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43fa7148/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
index c8d3a8d..af68e9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
@@ -31,13 +31,13 @@ public class VisorCacheAggregatedMetrics implements Serializable {
private static final long serialVersionUID = 0L;
/** Cache name. */
- private final String cacheName;
+ private String name;
/** Cache mode. */
- private final CacheMode cacheMode;
+ private CacheMode mode;
/** Cache system state. */
- private final Boolean system;
+ private boolean sys;
/** Node IDs with cache metrics. */
private final Map<UUID, VisorCacheMetrics> metrics = new HashMap<>();
@@ -106,31 +106,36 @@ public class VisorCacheAggregatedMetrics implements Serializable {
private transient Integer failsQry;
/**
- * Create data transfer object with given parameters.
+ * Create data transfer object for aggregated cache metrics.
*
- * @param cacheName Cache name.
+ * @param cm Source cache metrics.
+ * @return Data transfer object for aggregated cache metrics.
*/
- public VisorCacheAggregatedMetrics(String cacheName, CacheMode cacheMode, Boolean system) {
- this.cacheName = cacheName;
- this.cacheMode = cacheMode;
- this.system = system;
+ public static VisorCacheAggregatedMetrics from(VisorCacheMetrics cm) {
+ VisorCacheAggregatedMetrics acm = new VisorCacheAggregatedMetrics();
+
+ acm.name = cm.name();
+ acm.mode = cm.mode();
+ acm.sys = cm.system();
+
+ return acm;
}
/**
* @return Cache name.
*/
- public String cacheName() {
- return cacheName;
+ public String name() {
+ return name;
}
/** @return Cache mode. */
- public CacheMode cacheMode() {
- return cacheMode;
+ public CacheMode mode() {
+ return mode;
}
/** @return Cache system state. */
- public Boolean system() {
- return system;
+ public boolean system() {
+ return sys;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43fa7148/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index 77db2f4..fc30392 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -18,13 +18,14 @@
package org.apache.ignite.internal.visor.cache;
import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import java.io.*;
/**
- * Data transfer object for {@link org.apache.ignite.cache.CacheMetrics}.
+ * Data transfer object for {@link CacheMetrics}.
*/
public class VisorCacheMetrics implements Serializable {
/** */
@@ -33,6 +34,15 @@ public class VisorCacheMetrics implements Serializable {
/** */
private static final long serialVersionUID = 0L;
+ /** Cache name. */
+ private String name;
+
+ /** Cache mode. */
+ private CacheMode mode;
+
+ /** Cache system state. */
+ private boolean sys;
+
/** Number of non-{@code null} values in the cache. */
private int size;
@@ -147,7 +157,14 @@ public class VisorCacheMetrics implements Serializable {
/** Number of cached rolled back DHT transaction IDs. */
private int txDhtRolledbackVersionsSize;
- /** Calculate rate of metric per second. */
+ /**
+ * Calculate rate of metric per second.
+ *
+ * @param metric Metric value.
+ * @param time Metric finish time.
+ * @param createTime Metric start time.
+ * @return Metric per second.
+ */
private static int perSecond(int metric, long time, long createTime) {
long seconds = (time - createTime) / 1000;
@@ -155,14 +172,21 @@ public class VisorCacheMetrics implements Serializable {
}
/**
+ * @param ignite Ignite.
* @param c Cache.
* @return Data transfer object for given cache metrics.
*/
- public static VisorCacheMetrics from(GridCache c) {
+ public static VisorCacheMetrics from(IgniteEx ignite, GridCache c) {
VisorCacheMetrics cm = new VisorCacheMetrics();
CacheMetrics m = c.metrics();
+ GridCacheProcessor cacheProcessor = ignite.context().cache();
+
+ cm.name = c.name();
+ cm.mode = cacheProcessor.cacheMode(c.name());
+ cm.sys = cacheProcessor.systemCache(c.name());
+
cm.size = m.getSize();
cm.keySize = m.getKeySize();
@@ -214,6 +238,27 @@ public class VisorCacheMetrics implements Serializable {
}
/**
+ * @return Cache name.
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * @return Cache mode.
+ */
+ public CacheMode mode() {
+ return mode;
+ }
+
+ /**
+ * @return Cache system state.
+ */
+ public boolean system() {
+ return sys;
+ }
+
+ /**
* @return Total number of reads of the owning entity (either cache or entry).
*/
public long reads() {
@@ -396,7 +441,7 @@ public class VisorCacheMetrics implements Serializable {
}
/**
- * Committed transaction queue size.
+ * @return Committed transaction queue size.
*/
public int txCommitQueueSize() {
return txCommitQueueSize;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43fa7148/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index 99b29c0..b4b850b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -32,7 +32,7 @@ import java.util.*;
*/
@GridInternal
public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiTuple<Boolean, Collection<String>>,
- Iterable<VisorCacheAggregatedMetrics>, Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>>> {
+ Iterable<VisorCacheAggregatedMetrics>, Collection<VisorCacheMetrics>> {
/** */
private static final long serialVersionUID = 0L;
@@ -47,23 +47,18 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
for (ComputeJobResult res : results) {
if (res.getException() == null && res.getData() instanceof Map<?, ?>) {
- Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>> cms = res.getData();
+ Collection<VisorCacheMetrics> cms = res.getData();
- for (Map.Entry<String, IgniteBiTuple<Boolean, VisorCacheMetrics>> entry : cms.entrySet()) {
- VisorCacheAggregatedMetrics am = grpAggrMetrics.get(entry.getKey());
+ for (VisorCacheMetrics cm : cms) {
+ VisorCacheAggregatedMetrics am = grpAggrMetrics.get(cm.name());
if (am == null) {
- String cacheName = entry.getKey();
+ am = VisorCacheAggregatedMetrics.from(cm);
- GridCacheProcessor proc = ignite.context().cache();
-
- am = new VisorCacheAggregatedMetrics(cacheName, proc.cacheMode(cacheName),
- entry.getValue().get1());
-
- grpAggrMetrics.put(entry.getKey(), am);
+ grpAggrMetrics.put(cm.name(), am);
}
- am.metrics().put(res.getNode().id(), entry.getValue().get2());
+ am.metrics().put(res.getNode().id(), cm);
}
}
}
@@ -76,7 +71,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
* Job that collect cache metrics from node.
*/
private static class VisorCacheMetricsCollectorJob
- extends VisorJob<IgniteBiTuple<Boolean, Collection<String>>, Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>>> {
+ extends VisorJob<IgniteBiTuple<Boolean, Collection<String>>, Collection<VisorCacheMetrics>> {
/** */
private static final long serialVersionUID = 0L;
@@ -91,8 +86,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
}
/** {@inheritDoc} */
- @Override protected Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>> run(
- final IgniteBiTuple<Boolean, Collection<String>> arg) {
+ @Override protected Collection<VisorCacheMetrics> run(final IgniteBiTuple<Boolean, Collection<String>> arg) {
assert arg != null;
Boolean showSysCaches = arg.get1();
@@ -107,17 +101,16 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
Collection<GridCacheAdapter<?, ?>> caches = cacheProcessor.internalCaches();
- Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>> res = U.newHashMap(caches.size());
+ Collection<VisorCacheMetrics> res = new ArrayList<>(caches.size());
boolean allCaches = cacheNames.isEmpty();
for (GridCacheAdapter ca : caches) {
if (ca.context().started()) {
- String name = ca.name();
+ VisorCacheMetrics cm = VisorCacheMetrics.from(ignite, ca);
- if ((showSysCaches && cacheProcessor.systemCache(name)) || allCaches || cacheNames.contains(name))
- res.put(name, new IgniteBiTuple<Boolean, VisorCacheMetrics>(
- ignite.context().cache().systemCache(name), VisorCacheMetrics.from(ca)));
+ if ((showSysCaches && cm.system()) || allCaches || cacheNames.contains(ca.name()))
+ res.add(cm);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43fa7148/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 33a2a16..4d35b35 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -19,7 +19,6 @@ package org.apache.ignite.visor.commands.cache
import org.apache.ignite._
import org.apache.ignite.cluster.ClusterNode
-import org.apache.ignite.internal.processors.cache.{GridCacheUtils => CU}
import org.apache.ignite.internal.util.typedef._
import org.apache.ignite.lang.IgniteBiTuple
import org.apache.ignite.visor.VisorTag
@@ -277,7 +276,7 @@ class VisorCacheCommand {
if (hasArgFlag("scan", argLst))
VisorCacheScanCommand().scan(argLst, node)
else {
- if (!aggrData.exists(cache => cache.cacheName() == name && cache.system())) {
+ if (!aggrData.exists(cache => safeEquals(cache.name(), name) && cache.system())) {
if (hasArgFlag("clear", argLst))
VisorCacheClearCommand().clear(argLst, node)
else if (hasArgFlag("swap", argLst))
@@ -319,11 +318,11 @@ class VisorCacheCommand {
sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach(
ad => {
// Add cache host as visor variable.
- registerCacheName(ad.cacheName)
+ registerCacheName(ad.name())
sumT += (
- mkCacheName(ad.cacheName),
- ad.cacheMode(),
+ mkCacheName(ad.name()),
+ ad.mode(),
ad.nodes,
(
"min: " + ad.minimumSize,
@@ -358,11 +357,11 @@ class VisorCacheCommand {
if (all) {
val sorted = aggrData.sortWith((k1, k2) => {
- if (k1.cacheName == null)
+ if (k1.name() == null)
true
- else if (k2.cacheName == null)
+ else if (k2.name() == null)
false
- else k1.cacheName.compareTo(k2.cacheName) < 0
+ else k1.name().compareTo(k2.name()) < 0
})
val gCfg = node.map(config).collect {
@@ -370,7 +369,7 @@ class VisorCacheCommand {
}
sorted.foreach(ad => {
- val cacheNameVar = mkCacheName(ad.cacheName)
+ val cacheNameVar = mkCacheName(ad.name())
println("\nCache '" + cacheNameVar + "':")
@@ -428,7 +427,7 @@ class VisorCacheCommand {
println(" Total number of executions: " + ad.execsQuery)
println(" Total number of failures: " + ad.failsQuery)
- gCfg.foreach(_.caches().find(_.name() == ad.cacheName()).foreach(cfg => {
+ gCfg.foreach(_.caches().find(_.name() == ad.name()).foreach(cfg => {
nl()
showCacheConfiguration("Cache configuration:", cfg)
@@ -580,7 +579,7 @@ class VisorCacheCommand {
case "rd" => data.toList.sortBy(_.averageReads)
case "wr" => data.toList.sortBy(_.averageWrites)
case "cn" => data.toList.sortWith((x, y) =>
- x.cacheName == null || (y.cacheName != null && x.cacheName.toLowerCase < y.cacheName.toLowerCase))
+ x.name() == null || (y.name() != null && x.name().toLowerCase < y.name().toLowerCase))
case _ =>
assert(false, "Unknown sorting type: " + arg)
@@ -619,12 +618,12 @@ class VisorCacheCommand {
val ad = sortedAggrData(i)
// Add cache host as visor variable.
- registerCacheName(ad.cacheName)
+ registerCacheName(ad.name())
sumT += (
i,
- mkCacheName(ad.cacheName),
- ad.cacheMode(),
+ mkCacheName(ad.name()),
+ ad.mode(),
ad.nodes,
(
"min: " + ad.minimumSize,
@@ -641,7 +640,7 @@ class VisorCacheCommand {
None
else {
try
- Some(sortedAggrData(a.toInt).cacheName)
+ Some(sortedAggrData(a.toInt).name())
catch {
case e: Throwable =>
warn("Invalid selection: " + a)
[24/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-sprint-3' into ignite-680
Posted by vk...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-680
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b05c14fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b05c14fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b05c14fa
Branch: refs/heads/ignite-471
Commit: b05c14fa8630062863b48c893c21a2aeb542c985
Parents: 68a99f1 cbab850
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 8 09:22:50 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 8 09:22:50 2015 +0300
----------------------------------------------------------------------
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/include/service.sh | 8 +-
config/hadoop/default-config.xml | 15 ++-
.../streaming/StreamTransformerExample.java | 3 +-
.../dht/GridClientPartitionTopology.java | 6 +-
.../distributed/dht/GridDhtLockFuture.java | 10 +-
.../dht/GridDhtPartitionTopologyImpl.java | 6 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 49 +++++----
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../ipc/shmem/IpcSharedMemoryNativeLoader.java | 48 +++++---
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 24 +++-
.../communication/tcp/TcpCommunicationSpi.java | 14 +--
.../discovery/tcp/TcpClientDiscoverySpi.java | 47 ++++----
.../spi/discovery/tcp/TcpDiscoverySpi.java | 78 ++++++-------
.../discovery/tcp/TcpDiscoverySpiAdapter.java | 8 +-
.../spi/swapspace/file/FileSwapSpaceSpi.java | 4 +-
.../resources/META-INF/classnames.properties | 19 ++--
.../cache/IgniteDynamicCacheStartSelfTest.java | 23 ++++
...ePartitionedBasicStoreMultiNodeSelfTest.java | 110 ++-----------------
...ridCacheFifoBatchEvictionPolicySelfTest.java | 3 +-
.../GridAbstractCommunicationSelfTest.java | 3 +-
.../GridTcpCommunicationSpiAbstractTest.java | 5 +-
...mmunicationSpiConcurrentConnectSelfTest.java | 3 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 3 +-
...dTcpCommunicationSpiRecoveryAckSelfTest.java | 3 +-
...GridTcpCommunicationSpiRecoverySelfTest.java | 2 +-
.../IgniteCacheEvictionSelfTestSuite.java | 1 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 3 +-
parent/pom.xml | 2 +-
pom.xml | 2 +
31 files changed, 254 insertions(+), 254 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b05c14fa/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
[39/50] [abbrv] incubator-ignite git commit: ignite-624 - minor2
Posted by vk...@apache.org.
ignite-624 - minor2
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c2c4da48
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c2c4da48
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c2c4da48
Branch: refs/heads/ignite-471
Commit: c2c4da48a9ebaf5d41e61bb006e9d590edcd5f8b
Parents: ab2fe77
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 8 14:33:23 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 8 14:33:23 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/query/h2/sql/GridSqlSelect.java | 3 +++
.../ignite/internal/processors/query/h2/sql/GridSqlUnion.java | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c4da48/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
index dadba7c..0786eac 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
@@ -148,6 +148,9 @@ public class GridSqlSelect extends GridSqlQuery {
* @param expression Expression.
*/
public void setSelectExpression(int colIdx, GridSqlElement expression) {
+ if (expression == null)
+ throw new NullPointerException();
+
if (colIdx < select.size()) // Assuming that all the needed expressions were already added.
select.set(colIdx, expression);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c2c4da48/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
index dcc2c84..23c18ed 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
@@ -42,7 +42,7 @@ public class GridSqlUnion extends GridSqlQuery {
/** {@inheritDoc} */
@Override protected GridSqlElement expression(int col) {
- return null;
+ throw new IllegalStateException();
}
/** {@inheritDoc} */
[50/50] [abbrv] incubator-ignite git commit: IGNITE-471 - Marshalling
refactoring
Posted by vk...@apache.org.
IGNITE-471 - Marshalling refactoring
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f825ed08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f825ed08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f825ed08
Branch: refs/heads/ignite-471
Commit: f825ed08b5eb37bd3a0e8f093944522dbfd83e5f
Parents: 28d4b7a
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Wed Apr 8 14:28:52 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Wed Apr 8 14:28:52 2015 -0700
----------------------------------------------------------------------
.../apache/ignite/internal/processors/cache/GridCacheAdapter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f825ed08/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git 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
index 30355b1..c55e666 100644
--- 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
@@ -3626,7 +3626,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>,
});
if (!col.isEmpty())
- ldr.addData(col);
+ ldr.addDataInternal(col);
}
}
[26/50] [abbrv] incubator-ignite git commit: # Minor code cleanup.
Posted by vk...@apache.org.
# Minor code cleanup.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/76f8049c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/76f8049c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/76f8049c
Branch: refs/heads/ignite-471
Commit: 76f8049c2124b965d142f8dc781fad2ff20419d1
Parents: cbab850
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Apr 8 14:38:10 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Apr 8 14:38:10 2015 +0700
----------------------------------------------------------------------
.../visor/commands/cache/VisorCacheClearCommand.scala | 3 +--
.../src/main/scala/org/apache/ignite/visor/visor.scala | 12 ++++++------
2 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76f8049c/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
index f012b19..379b566 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommand.scala
@@ -93,8 +93,7 @@ class VisorCacheClearCommand {
case Some(s) if s.startsWith("@") =>
warn("Can't find cache variable with specified name: " + s,
- "Type 'cache' to see available cache variables."
- )
+ "Type 'cache' to see available cache variables.")
break()
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76f8049c/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
index 5710458..33ba976 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
@@ -1820,23 +1820,23 @@ object visor extends VisorTag {
/**
* Guards against invalid percent readings.
*
- * @param v Value in '%' to guard. Any value below `0` and greater than `100`
- * will return `<n/a>` string.
+ * @param v Value in '%' to guard.
+ * @return Percent as string. Any value below `0` and greater than `100` will return `<n/a>` string.
*/
def safePercent(v: Double): String = if (v < 0 || v > 100) NA else formatDouble(v) + " %"
/** Convert to task argument. */
def emptyTaskArgument[A](nid: UUID): VisorTaskArgument[Void] = new VisorTaskArgument(nid, false)
- def emptyTaskArgument[A](nids: Iterable[UUID]): VisorTaskArgument[Void] = new VisorTaskArgument(new JavaHashSet(nids),
- false)
+ def emptyTaskArgument[A](nids: Iterable[UUID]): VisorTaskArgument[Void]
+ = new VisorTaskArgument(new JavaHashSet(nids), false)
/** Convert to task argument. */
def toTaskArgument[A](nid: UUID, arg: A): VisorTaskArgument[A] = new VisorTaskArgument(nid, arg, false)
/** Convert to task argument. */
- def toTaskArgument[A](nids: Iterable[UUID], arg: A): VisorTaskArgument[A] = new VisorTaskArgument(
- new JavaHashSet(nids), arg, false)
+ def toTaskArgument[A](nids: Iterable[UUID], arg: A): VisorTaskArgument[A]
+ = new VisorTaskArgument(new JavaHashSet(nids), arg, false)
def compute(nid: UUID): IgniteCompute = ignite.compute(ignite.cluster.forNodeId(nid)).withNoFailover()
[32/50] [abbrv] incubator-ignite git commit: ignite-624 - fix for
reduce invisible columns
Posted by vk...@apache.org.
ignite-624 - fix for reduce invisible columns
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d9e2a648
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d9e2a648
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d9e2a648
Branch: refs/heads/ignite-471
Commit: d9e2a648136b00cb688789a8216f0ae02c73bc93
Parents: bef34cd
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 8 13:12:23 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 8 13:12:23 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/util/lang/GridFunc.java | 9 +++++++++
.../query/h2/sql/GridSqlQuerySplitter.java | 15 +++++++++++----
.../processors/query/h2/sql/GridSqlSelect.java | 9 ++++++++-
.../processors/query/h2/sql/GridSqlUnion.java | 2 +-
4 files changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d9e2a648/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index 773b9ee..fee53ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -5430,6 +5430,15 @@ public class GridFunc {
/**
* @param c Target collection.
+ * @param it Iterable to fetch.
+ * @return Modified target collection.
+ */
+ public static <T, C extends Collection<T>> C addAll(C c, Iterable<? extends T> it) {
+ return it == null ? c : addAll(c, it.iterator());
+ }
+
+ /**
+ * @param c Target collection.
* @param it Iterator to fetch.
* @return Modified target collection.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d9e2a648/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 b84084b..79c73f0 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
@@ -83,7 +83,7 @@ public class GridSqlQuerySplitter {
if (qry0 instanceof GridSqlSelect)
srcQry = (GridSqlSelect)qry0;
- else {
+ else { // Handle UNION.
srcQry = new GridSqlSelect().from(new GridSqlSubquery(qry0));
GridSqlSelect left = leftest(qry0);
@@ -124,11 +124,15 @@ public class GridSqlQuerySplitter {
final String mergeTable = TABLE_FUNC_NAME + "()"; // table(0); TODO
+ // Create map and reduce queries.
GridSqlSelect mapQry = srcQry.clone();
GridSqlSelect rdcQry = new GridSqlSelect().from(new GridSqlFunction("PUBLIC", TABLE_FUNC_NAME)); // table(mergeTable)); TODO
// Split all select expressions into map-reduce parts.
- List<GridSqlElement> mapExps = F.addAll(new ArrayList<GridSqlElement>(), srcQry.select(false).iterator());
+ List<GridSqlElement> mapExps = F.addAll(
+ new ArrayList<GridSqlElement>(srcQry.allColumns()),
+ srcQry.select(false));
+
GridSqlElement[] rdcExps = new GridSqlElement[srcQry.visibleColumns()];
Set<String> colNames = new HashSet<>();
@@ -141,12 +145,15 @@ public class GridSqlQuerySplitter {
// Fill select expressions.
mapQry.clearSelect();
- for (GridSqlElement exp : mapExps)
+ for (GridSqlElement exp : mapExps) // Add all map expressions as visible.
mapQry.addSelectExpression(exp, true);
- for (GridSqlElement rdcExp : rdcExps)
+ for (GridSqlElement rdcExp : rdcExps) // Add corresponding visible reduce columns.
rdcQry.addSelectExpression(rdcExp, true);
+ for (int i = rdcExps.length; i < mapExps.size(); i++) // Add all extra map columns as invisible reduce columns.
+ rdcQry.addSelectExpression(column(((GridSqlAlias)mapExps.get(i)).alias()), false);
+
// -- GROUP BY
if (srcQry.hasGroupBy()) {
mapQry.clearGroups();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d9e2a648/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
index 398ae10..dadba7c 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
@@ -22,7 +22,7 @@ import org.h2.util.*;
import java.util.*;
/**
- *
+ * Plain SELECT query.
*/
public class GridSqlSelect extends GridSqlQuery {
/** */
@@ -54,6 +54,13 @@ public class GridSqlSelect extends GridSqlQuery {
return select.size();
}
+ /**
+ * @return Number of columns is select including invisible ones.
+ */
+ public int allColumns() {
+ return allExprs.size();
+ }
+
/** {@inheritDoc} */
@Override protected GridSqlElement expression(int col) {
return allExprs.get(col);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d9e2a648/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
index 90d9e41..dcc2c84 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlUnion.java
@@ -23,7 +23,7 @@ import org.h2.util.*;
import javax.cache.*;
/**
- *
+ * Select query with UNION.
*/
public class GridSqlUnion extends GridSqlQuery {
/** */
[21/50] [abbrv] incubator-ignite git commit: ignite-624 - disabled
failing tests because of wrong colocation
Posted by vk...@apache.org.
ignite-624 - disabled failing tests because of wrong colocation
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bef34cd8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bef34cd8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bef34cd8
Branch: refs/heads/ignite-471
Commit: bef34cd8e3fac1fe3b30301869a2ad42d5c7ea6e
Parents: 58f4913
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 8 01:54:34 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 8 01:54:34 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/sql/IgniteVsH2QueryTest.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bef34cd8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
index 5da72b4..5845a2e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/IgniteVsH2QueryTest.java
@@ -615,16 +615,16 @@ public class IgniteVsH2QueryTest extends GridCommonAbstractTest {
*
* @throws Exception If failed.
*/
- public void testSimpleJoin() throws Exception {
+ public void _testSimpleJoin() throws Exception {
// Have expected results.
compareQueryRes0("select id, firstName, lastName" +
" from \"part\".Person" +
" where Person.id = ?", 3);
// Ignite cache return 0 results...
- compareQueryRes0("select Person.firstName" +
- " from \"part\".Person, \"part\".Purchase" +
- " where Person.id = ?", 3);
+ compareQueryRes0("select pe.firstName" +
+ " from \"part\".Person pe join \"part\".Purchase pu on pe.id = pu.personId " +
+ " where pe.id = ?", 3);
}
/**
@@ -637,7 +637,7 @@ public class IgniteVsH2QueryTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
- public void testCrossCache() throws Exception {
+ public void _testCrossCache() throws Exception {
//TODO Investigate (should be 20 results instead of 0).
compareQueryRes0("select firstName, lastName" +
" from \"part\".Person, \"part\".Purchase" +
[02/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-639' and 'ignite-sprint-3' of https://github.com/ggprivate/ggprivate
into ignite-639
Posted by vk...@apache.org.
Merge branches 'ignite-639' and 'ignite-sprint-3' of https://github.com/ggprivate/ggprivate into ignite-639
Conflicts:
modules/visor-tester/src/main/scala/org/gridgain/visor/tester/VisorCmptbTesterLauncherBase.scala
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/349c200d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/349c200d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/349c200d
Branch: refs/heads/ignite-471
Commit: 349c200d11e2c961a503b368a566e6bd5345590a
Parents: b189877
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 09:17:16 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 09:17:16 2015 +0700
----------------------------------------------------------------------
.../cache/VisorCacheAggregatedMetrics.java | 21 +++++++++++-
.../cache/VisorCacheMetricsCollectorTask.java | 25 +++++++++-----
.../commands/cache/VisorCacheCommand.scala | 26 +++++++-------
.../commands/cache/VisorCacheStopCommand.scala | 36 +++++++++++++-------
4 files changed, 72 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/349c200d/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
index 076a19b..c8d3a8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.visor.cache;
+import org.apache.ignite.cache.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import java.io.*;
@@ -32,6 +33,12 @@ public class VisorCacheAggregatedMetrics implements Serializable {
/** Cache name. */
private final String cacheName;
+ /** Cache mode. */
+ private final CacheMode cacheMode;
+
+ /** Cache system state. */
+ private final Boolean system;
+
/** Node IDs with cache metrics. */
private final Map<UUID, VisorCacheMetrics> metrics = new HashMap<>();
@@ -103,8 +110,10 @@ public class VisorCacheAggregatedMetrics implements Serializable {
*
* @param cacheName Cache name.
*/
- public VisorCacheAggregatedMetrics(String cacheName) {
+ public VisorCacheAggregatedMetrics(String cacheName, CacheMode cacheMode, Boolean system) {
this.cacheName = cacheName;
+ this.cacheMode = cacheMode;
+ this.system = system;
}
/**
@@ -114,6 +123,16 @@ public class VisorCacheAggregatedMetrics implements Serializable {
return cacheName;
}
+ /** @return Cache mode. */
+ public CacheMode cacheMode() {
+ return cacheMode;
+ }
+
+ /** @return Cache system state. */
+ public Boolean system() {
+ return system;
+ }
+
/**
* @return Nodes.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/349c200d/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index 615935a..99b29c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -32,7 +32,7 @@ import java.util.*;
*/
@GridInternal
public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiTuple<Boolean, Collection<String>>,
- Iterable<VisorCacheAggregatedMetrics>, Map<String, VisorCacheMetrics>> {
+ Iterable<VisorCacheAggregatedMetrics>, Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>>> {
/** */
private static final long serialVersionUID = 0L;
@@ -47,18 +47,23 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
for (ComputeJobResult res : results) {
if (res.getException() == null && res.getData() instanceof Map<?, ?>) {
- Map<String, VisorCacheMetrics> cms = res.getData();
+ Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>> cms = res.getData();
- for (Map.Entry<String, VisorCacheMetrics> entry : cms.entrySet()) {
+ for (Map.Entry<String, IgniteBiTuple<Boolean, VisorCacheMetrics>> entry : cms.entrySet()) {
VisorCacheAggregatedMetrics am = grpAggrMetrics.get(entry.getKey());
if (am == null) {
- am = new VisorCacheAggregatedMetrics(entry.getKey());
+ String cacheName = entry.getKey();
+
+ GridCacheProcessor proc = ignite.context().cache();
+
+ am = new VisorCacheAggregatedMetrics(cacheName, proc.cacheMode(cacheName),
+ entry.getValue().get1());
grpAggrMetrics.put(entry.getKey(), am);
}
- am.metrics().put(res.getNode().id(), entry.getValue());
+ am.metrics().put(res.getNode().id(), entry.getValue().get2());
}
}
}
@@ -71,7 +76,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
* Job that collect cache metrics from node.
*/
private static class VisorCacheMetricsCollectorJob
- extends VisorJob<IgniteBiTuple<Boolean, Collection<String>>, Map<String, VisorCacheMetrics>> {
+ extends VisorJob<IgniteBiTuple<Boolean, Collection<String>>, Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>>> {
/** */
private static final long serialVersionUID = 0L;
@@ -86,7 +91,8 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
}
/** {@inheritDoc} */
- @Override protected Map<String, VisorCacheMetrics> run(final IgniteBiTuple<Boolean, Collection<String>> arg) {
+ @Override protected Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>> run(
+ final IgniteBiTuple<Boolean, Collection<String>> arg) {
assert arg != null;
Boolean showSysCaches = arg.get1();
@@ -101,7 +107,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
Collection<GridCacheAdapter<?, ?>> caches = cacheProcessor.internalCaches();
- Map<String, VisorCacheMetrics> res = U.newHashMap(caches.size());
+ Map<String, IgniteBiTuple<Boolean, VisorCacheMetrics>> res = U.newHashMap(caches.size());
boolean allCaches = cacheNames.isEmpty();
@@ -110,7 +116,8 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
String name = ca.name();
if ((showSysCaches && cacheProcessor.systemCache(name)) || allCaches || cacheNames.contains(name))
- res.put(name, VisorCacheMetrics.from(ca));
+ res.put(name, new IgniteBiTuple<Boolean, VisorCacheMetrics>(
+ ignite.context().cache().systemCache(name), VisorCacheMetrics.from(ca)));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/349c200d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index bd0d251..33a2a16 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -30,8 +30,7 @@ import org.apache.ignite.visor.visor._
import org.jetbrains.annotations._
import java.lang.{Boolean => JavaBoolean}
-import java.util.{ArrayList => JavaList, Collection => JavaCollection}
-import java.util.UUID
+import java.util.{ArrayList => JavaList, Collection => JavaCollection, UUID}
import org.apache.ignite.internal.visor.cache._
import org.apache.ignite.internal.visor.node.{VisorGridConfiguration, VisorNodeConfigurationCollectorTask}
@@ -259,9 +258,13 @@ class VisorCacheCommand {
flags.exists(hasArgFlag(_, argLst))
}
+ // Get cache stats data from all nodes.
+ val aggrData = cacheData(node, cacheName, showSystem)
+
if (hasArgFlagIn("clear", "swap", "scan", "stop")) {
if (cacheName.isEmpty)
- askForCache("Select cache from:", node, showSystem && !hasArgFlagIn("clear", "swap", "stop")) match {
+ askForCache("Select cache from:", node, showSystem && !hasArgFlagIn("clear", "swap", "stop"),
+ aggrData) match {
case Some(name) =>
argLst = argLst ++ Seq("c" -> name)
@@ -274,7 +277,7 @@ class VisorCacheCommand {
if (hasArgFlag("scan", argLst))
VisorCacheScanCommand().scan(argLst, node)
else {
- if (!CU.isSystemCache(name)) {
+ if (!aggrData.exists(cache => cache.cacheName() == name && cache.system())) {
if (hasArgFlag("clear", argLst))
VisorCacheClearCommand().clear(argLst, node)
else if (hasArgFlag("swap", argLst))
@@ -304,9 +307,6 @@ class VisorCacheCommand {
if (sortType.isDefined && !isValidSortType(sortType.get))
scold("Invalid '-s' argument in: " + args).^^
- // Get cache stats data from all nodes.
- val aggrData = cacheData(node, cacheName, showSystem)
-
if (aggrData.isEmpty)
scold("No caches found.").^^
@@ -314,7 +314,7 @@ class VisorCacheCommand {
val sumT = VisorTextTable()
- sumT #= ("Name(@)", "Nodes", "Entries", "Hits", "Misses", "Reads", "Writes")
+ sumT #= ("Name(@)", "Mode", "Nodes", "Entries", "Hits", "Misses", "Reads", "Writes")
sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach(
ad => {
@@ -323,6 +323,7 @@ class VisorCacheCommand {
sumT += (
mkCacheName(ad.cacheName),
+ ad.cacheMode(),
ad.nodes,
(
"min: " + ad.minimumSize,
@@ -598,13 +599,11 @@ class VisorCacheCommand {
* @param showSystem Allow selection of system caches.
* @return `Option` for ID of selected cache.
*/
- def askForCache(title: String, node: Option[ClusterNode], showSystem: Boolean = false): Option[String] = {
+ def askForCache(title: String, node: Option[ClusterNode], showSystem: Boolean = false,
+ aggrData: Seq[VisorCacheAggregatedMetrics]): Option[String] = {
assert(title != null)
assert(visor.visor.isConnected)
- // Get cache stats data from all nodes.
- val aggrData = cacheData(node, None, showSystem)
-
if (aggrData.isEmpty)
scold("No caches found.").^^
@@ -614,7 +613,7 @@ class VisorCacheCommand {
val sumT = VisorTextTable()
- sumT #= ("#", "Name(@)", "Nodes", "Size")
+ sumT #= ("#", "Name(@)", "Mode", "Nodes", "Size")
(0 until sortedAggrData.size) foreach (i => {
val ad = sortedAggrData(i)
@@ -625,6 +624,7 @@ class VisorCacheCommand {
sumT += (
i,
mkCacheName(ad.cacheName),
+ ad.cacheMode(),
ad.nodes,
(
"min: " + ad.minimumSize,
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/349c200d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala
index 4c1aa10..cf344e6 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheStopCommand.scala
@@ -19,9 +19,9 @@ package org.apache.ignite.visor.commands.cache
import org.apache.ignite.cluster.ClusterNode
import org.apache.ignite.visor.visor._
-import org.apache.ignite.internal.visor.util.VisorTaskUtils._
import org.apache.ignite.internal.visor.cache.VisorCacheStopTask
+import org.apache.ignite.internal.visor.util.VisorTaskUtils._
/**
* ==Overview==
@@ -105,21 +105,31 @@ class VisorCacheStopCommand {
return
}
- val stopPrj = cachePrj.forRandom()
+ ask(s"Are you sure you want to stop cache: ${escapeName(cacheName)}? (y/n) [n]: ", "n") match {
+ case "y" | "Y" =>
+ val stopPrj = cachePrj.forRandom()
- val nid = stopPrj.node().id()
+ val nid = stopPrj.node().id()
- try {
- ignite.compute(stopPrj)
- .withName("visor-cstop-task")
- .withNoFailover()
- .execute(classOf[VisorCacheStopTask], toTaskArgument(nid, cacheName))
+ try {
+ ignite.compute(stopPrj)
+ .withName("visor-cstop-task")
+ .withNoFailover()
+ .execute(classOf[VisorCacheStopTask], toTaskArgument(nid, cacheName))
- println("Visor successfully stop cache: " + escapeName(cacheName))
- }
- catch {
- case e: Exception =>
- error(e)
+ println("Visor successfully stop cache: " + escapeName(cacheName))
+ }
+ catch {
+ case e: Exception =>
+ error(e)
+ }
+
+ case "n" | "N" =>
+
+ case x =>
+ nl()
+
+ warn("Invalid answer: " + x)
}
}
}
[23/50] [abbrv] incubator-ignite git commit: # Updated classnames.
Posted by vk...@apache.org.
# Updated classnames.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cbab8503
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cbab8503
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cbab8503
Branch: refs/heads/ignite-471
Commit: cbab850301e0ee9b72371624fd6756e58ac06724
Parents: 21cfc8d
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Apr 8 10:51:51 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Apr 8 10:51:51 2015 +0700
----------------------------------------------------------------------
.../resources/META-INF/classnames.properties | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cbab8503/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 3be2564..a855e12 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -45,6 +45,7 @@ org.apache.ignite.cache.affinity.AffinityKeyMapper
org.apache.ignite.cache.affinity.AffinityNodeAddressHashResolver
org.apache.ignite.cache.affinity.AffinityNodeHashResolver
org.apache.ignite.cache.affinity.AffinityNodeIdHashResolver
+org.apache.ignite.cache.affinity.AffinityUuid
org.apache.ignite.cache.affinity.fair.FairAffinityFunction
org.apache.ignite.cache.affinity.fair.FairAffinityFunction$PartitionSetComparator
org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction
@@ -258,7 +259,6 @@ org.apache.ignite.internal.processors.affinity.GridAffinityAssignment
org.apache.ignite.internal.processors.affinity.GridAffinityMessage
org.apache.ignite.internal.processors.affinity.GridAffinityUtils$AffinityJob
org.apache.ignite.internal.processors.cache.CacheAtomicUpdateTimeoutCheckedException
-org.apache.ignite.internal.processors.cache.CacheDistributionMode
org.apache.ignite.internal.processors.cache.CacheEntryInfoCollection
org.apache.ignite.internal.processors.cache.CacheEntryPredicate
org.apache.ignite.internal.processors.cache.CacheEntryPredicateAdapter
@@ -276,6 +276,7 @@ org.apache.ignite.internal.processors.cache.CacheObjectByteArrayImpl
org.apache.ignite.internal.processors.cache.CacheObjectImpl
org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException
org.apache.ignite.internal.processors.cache.CacheStorePartialUpdateException
+org.apache.ignite.internal.processors.cache.CacheType
org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQueryFutureIterator
org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest
@@ -388,10 +389,6 @@ org.apache.ignite.internal.processors.cache.GridCacheProcessor$LocalAffinityFunc
org.apache.ignite.internal.processors.cache.GridCacheProjectionImpl
org.apache.ignite.internal.processors.cache.GridCacheProxyImpl
org.apache.ignite.internal.processors.cache.GridCacheReturn
-org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$1
-org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$2
-org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$3
-org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$4
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$10
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$12
org.apache.ignite.internal.processors.cache.GridCacheSwapManager$14
@@ -432,9 +429,6 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$8
org.apache.ignite.internal.processors.cache.GridCacheUtils$9
org.apache.ignite.internal.processors.cache.GridCacheValueCollection
org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
-org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StatefulValue
-org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StoreOperation
-org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$ValueStatus
org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2
@@ -706,6 +700,13 @@ org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask$Jd
org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask$JdbcDriverJob$1
org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcValidationTask
org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcValidationTask$1
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$1
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$2
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$3
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$4
+org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StatefulValue
+org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StoreOperation
+org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$ValueStatus
org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx$FinalizationStatus
org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry
@@ -1367,6 +1368,8 @@ org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearJob
org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheClearJob$1
org.apache.ignite.internal.visor.cache.VisorCacheClearTask$VisorCacheSizeCallable
org.apache.ignite.internal.visor.cache.VisorCacheConfiguration
+org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorJob
+org.apache.ignite.internal.visor.cache.VisorCacheConfigurationCollectorTask
org.apache.ignite.internal.visor.cache.VisorCacheDefaultConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheEvictionConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheLoadTask
[10/50] [abbrv] incubator-ignite git commit: # ignite-680
Posted by vk...@apache.org.
# ignite-680
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5832b3a9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5832b3a9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5832b3a9
Branch: refs/heads/ignite-471
Commit: 5832b3a99f61ef298f2d8c75ae0d208a2f58be72
Parents: 414882c
Author: sboikov <sb...@gridgain.com>
Authored: Tue Apr 7 11:50:45 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Apr 7 12:02:23 2015 +0300
----------------------------------------------------------------------
.../cache/CacheTemplateConfigurationKey.java | 53 --
.../cache/DynamicCacheChangeRequest.java | 17 +
.../cache/DynamicCacheDescriptor.java | 17 +-
.../processors/cache/GridCacheProcessor.java | 478 ++++++++-----------
.../GridDhtPartitionsExchangeFuture.java | 1 +
.../IgniteCacheConfigurationTemplateTest.java | 61 +++
6 files changed, 303 insertions(+), 324 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5832b3a9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheTemplateConfigurationKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheTemplateConfigurationKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheTemplateConfigurationKey.java
deleted file mode 100644
index 310fa74..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheTemplateConfigurationKey.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import java.io.*;
-
-/**
- *
- */
-public class CacheTemplateConfigurationKey implements GridCacheInternal, Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return getClass().getName().hashCode();
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return obj == this || (obj instanceof CacheTemplateConfigurationKey);
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "CacheTemplateConfigurationKey []";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5832b3a9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index f7c8769..bd53cdb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -60,6 +60,9 @@ public class DynamicCacheChangeRequest implements Serializable {
/** Fail if exists flag. */
private boolean failIfExists;
+ /** Template configuration flag. */
+ private boolean template;
+
/**
* Constructor creates cache stop request.
*
@@ -85,6 +88,20 @@ public class DynamicCacheChangeRequest implements Serializable {
}
/**
+ * @param template {@code True} if this is request for adding template configuration.
+ */
+ public void template(boolean template) {
+ this.template = template;
+ }
+
+ /**
+ * @return {@code True} if this is template configuration.
+ */
+ public boolean template() {
+ return template;
+ }
+
+ /**
* @return Deployment ID.
*/
public IgniteUuid deploymentId() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5832b3a9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
index 4f07658..d8da9ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
@@ -53,18 +53,33 @@ public class DynamicCacheDescriptor {
/** */
private volatile Map<UUID, CacheConfiguration> rmtCfgs;
+ /** Template configuration flag. */
+ private boolean template;
+
/**
* @param cacheCfg Cache configuration.
* @param cacheType Cache type.
+ * @param template {@code True} if this is template configuration.
* @param deploymentId Deployment ID.
*/
- public DynamicCacheDescriptor(CacheConfiguration cacheCfg, CacheType cacheType, IgniteUuid deploymentId) {
+ public DynamicCacheDescriptor(CacheConfiguration cacheCfg,
+ CacheType cacheType,
+ boolean template,
+ IgniteUuid deploymentId) {
this.cacheCfg = cacheCfg;
this.cacheType = cacheType;
+ this.template = template;
this.deploymentId = deploymentId;
}
/**
+ * @return {@code True} if this is template configuration.
+ */
+ public boolean template() {
+ return template;
+ }
+
+ /**
* @return Cache type.
*/
public CacheType cacheType() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5832b3a9/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 eb98b89..fcf65b9 100644
--- 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
@@ -110,9 +110,15 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** Pending cache starts. */
private ConcurrentMap<String, IgniteInternalFuture> pendingFuts = new ConcurrentHashMap<>();
+ /** Template configuration add futures. */
+ private ConcurrentMap<String, IgniteInternalFuture> pendingTemplateFuts = new ConcurrentHashMap<>();
+
/** Dynamic caches. */
private ConcurrentMap<String, DynamicCacheDescriptor> registeredCaches = new ConcurrentHashMap<>();
+ /** Cache templates. */
+ private ConcurrentMap<String, DynamicCacheDescriptor> registeredTemplates = new ConcurrentHashMap<>();
+
/** */
private IdentityHashMap<CacheStore, ThreadLocal> sesHolders = new IdentityHashMap<>();
@@ -438,7 +444,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (ctx.config().getCacheMode() == LOCAL || !isNearEnabled(ctx))
return Collections.emptyList();
else
- return F.asList((GridCacheManager)ctx.queries(), ctx.continuousQueries(), ctx.store());
+ return F.asList(ctx.queries(), ctx.continuousQueries(), ctx.store());
}
/**
@@ -576,9 +582,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cfgs[i] = cfg; // Replace original configuration value.
- if (cfg.getName() != null && cfg.getName().endsWith("*")) // Skip template configurations.
- continue;
-
String masked = maskNull(cfg.getName());
if (registeredCaches.containsKey(masked)) {
@@ -603,23 +606,43 @@ public class GridCacheProcessor extends GridProcessorAdapter {
else
cacheType = CacheType.USER;
- DynamicCacheDescriptor desc = new DynamicCacheDescriptor(cfg, cacheType, IgniteUuid.randomUuid());
+ boolean template = cfg.getName() != null && cfg.getName().endsWith("*");
+
+ DynamicCacheDescriptor desc = new DynamicCacheDescriptor(cfg, cacheType, template, IgniteUuid.randomUuid());
desc.locallyConfigured(true);
desc.staticallyConfigured(true);
- registeredCaches.put(masked, desc);
+ if (!template) {
+ registeredCaches.put(masked, desc);
- ctx.discovery().setCacheFilter(
- cfg.getName(),
- cfg.getNodeFilter(),
- cfg.getNearConfiguration() != null,
- cfg.getCacheMode() == LOCAL);
+ ctx.discovery().setCacheFilter(
+ cfg.getName(),
+ cfg.getNodeFilter(),
+ cfg.getNearConfiguration() != null,
+ cfg.getCacheMode() == LOCAL);
- if (!cacheType.userCache())
- stopSeq.addLast(cfg.getName());
- else
- stopSeq.addFirst(cfg.getName());
+ if (!cacheType.userCache())
+ stopSeq.addLast(cfg.getName());
+ else
+ stopSeq.addFirst(cfg.getName());
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Use cache configuration as template: " + cfg);
+
+ registeredTemplates.put(masked, desc);
+ }
+
+ if (cfg.getName() == null) { // Use cache configuration with null name as template.
+ DynamicCacheDescriptor desc0 =
+ new DynamicCacheDescriptor(cfg, cacheType, true, IgniteUuid.randomUuid());
+
+ desc0.locallyConfigured(true);
+ desc0.staticallyConfigured(true);
+
+ registeredTemplates.put(masked, desc0);
+ }
}
// Start shared managers.
@@ -770,20 +793,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
ctx.cacheObjects().onCacheProcessorStarted();
-
- List<CacheConfiguration> templateCfgs = null;
-
- for (CacheConfiguration cfg : ctx.config().getCacheConfiguration()) {
- if (cfg.getName() == null || cfg.getName().endsWith("*")) {
- if (templateCfgs == null)
- templateCfgs = new ArrayList<>();
-
- templateCfgs.add(cfg);
- }
- }
-
- if (templateCfgs != null)
- addCacheConfigurations(templateCfgs);
}
/** {@inheritDoc} */
@@ -942,7 +951,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
ctx.kernalContext().continuous().onCacheStop(ctx);
U.stopLifecycleAware(log, lifecycleAwares(cache.configuration(), ctx.jta().tmLookup(),
- ctx.store().configuredStore()));
+ ctx.store().configuredStore()));
if (log.isInfoEnabled())
log.info("Stopped cache: " + cache.name());
@@ -1295,7 +1304,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
- * Gets a collection of currentlty started caches.
+ * Gets a collection of currently started caches.
*
* @return Collection of started cache names.
*/
@@ -1581,7 +1590,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Nullable @Override public Object collectDiscoveryData(UUID nodeId) {
// Collect dynamically started caches to a single object.
- Collection<DynamicCacheChangeRequest> reqs = new ArrayList<>(registeredCaches.size());
+ Collection<DynamicCacheChangeRequest> reqs =
+ new ArrayList<>(registeredCaches.size() + registeredTemplates.size());
for (DynamicCacheDescriptor desc : registeredCaches.values()) {
if (!desc.cancelled()) {
@@ -1597,6 +1607,18 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
}
+ for (DynamicCacheDescriptor desc : registeredTemplates.values()) {
+ DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(desc.cacheConfiguration().getName(), null);
+
+ req.startCacheConfiguration(desc.cacheConfiguration());
+
+ req.template(true);
+
+ req.deploymentId(desc.deploymentId());
+
+ reqs.add(req);
+ }
+
DynamicCacheChangeBatch req = new DynamicCacheChangeBatch(reqs);
req.clientNodes(ctx.discovery().clientNodesMap());
@@ -1610,6 +1632,26 @@ public class GridCacheProcessor extends GridProcessorAdapter {
DynamicCacheChangeBatch batch = (DynamicCacheChangeBatch)data;
for (DynamicCacheChangeRequest req : batch.requests()) {
+ if (req.template()) {
+ CacheConfiguration ccfg = req.startCacheConfiguration();
+
+ assert ccfg != null : req;
+
+ DynamicCacheDescriptor existing = registeredTemplates.get(maskNull(req.cacheName()));
+
+ if (existing == null) {
+ DynamicCacheDescriptor desc = new DynamicCacheDescriptor(
+ ccfg,
+ req.cacheType(),
+ true,
+ req.deploymentId());
+
+ registeredTemplates.put(maskNull(req.cacheName()), desc);
+ }
+
+ continue;
+ }
+
DynamicCacheDescriptor existing = registeredCaches.get(maskNull(req.cacheName()));
if (req.start() && !req.clientStartOnly()) {
@@ -1634,6 +1676,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
DynamicCacheDescriptor desc = new DynamicCacheDescriptor(
ccfg,
req.cacheType(),
+ false,
req.deploymentId());
// Received statically configured cache.
@@ -1673,12 +1716,62 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (publicJCache(cacheName, false) != null) // Cache with given name already started.
return new GridFinishedFuture<>();
- GridCacheAdapter<CacheTemplateConfigurationKey, TemplateConfigurations> utilityCache = utilityCache();
+ CacheConfiguration cfgTemplate = null;
+
+ CacheConfiguration dfltCacheCfg = null;
+
+ List<CacheConfiguration> wildcardNameCfgs = null;
+
+ for (DynamicCacheDescriptor desc : registeredTemplates.values()) {
+ assert desc.template();
+
+ CacheConfiguration cfg = desc.cacheConfiguration();
+
+ assert cfg != null;
+
+ if (F.eq(cacheName, cfg.getName())) {
+ cfgTemplate = cfg;
+
+ break;
+ }
+
+ if (cfg.getName() != null ) {
+ if (cfg.getName().endsWith("*")) {
+ if (cfg.getName().length() > 1) {
+ if (wildcardNameCfgs == null)
+ wildcardNameCfgs = new ArrayList<>();
+
+ wildcardNameCfgs.add(cfg);
+ }
+ else
+ dfltCacheCfg = cfg; // Template with name '*'.
+ }
+ }
+ else if (dfltCacheCfg == null)
+ dfltCacheCfg = cfg;
+ }
+
+ if (cfgTemplate == null && cacheName != null && wildcardNameCfgs != null) {
+ Collections.sort(wildcardNameCfgs, new Comparator<CacheConfiguration>() {
+ @Override public int compare(CacheConfiguration cfg1, CacheConfiguration cfg2) {
+ Integer len1 = cfg1.getName() != null ? cfg1.getName().length() : 0;
+ Integer len2 = cfg2.getName() != null ? cfg2.getName().length() : 0;
+
+ return len2.compareTo(len1);
+ }
+ });
- TemplateConfigurations cfgs =
- utilityCache.localPeek(new CacheTemplateConfigurationKey(), CachePeekModes.ONHEAP_ONLY, null);
+ for (CacheConfiguration cfg : wildcardNameCfgs) {
+ if (cacheName.startsWith(cfg.getName().substring(0, cfg.getName().length() - 1))) {
+ cfgTemplate = cfg;
- CacheConfiguration cfgTemplate = cfgs != null ? cfgs.configuration(cacheName) : null;
+ break;
+ }
+ }
+ }
+
+ if (cfgTemplate == null)
+ cfgTemplate = dfltCacheCfg;
if (cfgTemplate == null)
throw new IllegalArgumentException("Failed to start cache " +
@@ -1880,6 +1973,32 @@ public class GridCacheProcessor extends GridProcessorAdapter {
*/
private void onCacheChangeRequested(DynamicCacheChangeBatch batch) {
for (DynamicCacheChangeRequest req : batch.requests()) {
+ if (req.template()) {
+ CacheConfiguration ccfg = req.startCacheConfiguration();
+
+ assert ccfg != null : req;
+
+ DynamicCacheDescriptor desc = registeredTemplates.get(maskNull(req.cacheName()));
+
+ if (desc == null) {
+ DynamicCacheDescriptor templateDesc =
+ new DynamicCacheDescriptor(ccfg, req.cacheType(), true, req.deploymentId());
+
+ DynamicCacheDescriptor old = registeredTemplates.put(maskNull(ccfg.getName()), templateDesc);
+
+ assert old == null :
+ "Dynamic cache map was concurrently modified [new=" + templateDesc + ", old=" + old + ']';
+ }
+
+ TemplateConfigurationFuture fut =
+ (TemplateConfigurationFuture)pendingTemplateFuts.get(maskNull(ccfg.getName()));
+
+ if (fut != null && fut.deploymentId().equals(req.deploymentId()))
+ fut.onDone();
+
+ continue;
+ }
+
DynamicCacheDescriptor desc = registeredCaches.get(maskNull(req.cacheName()));
if (req.start()) {
@@ -1917,7 +2036,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
assert req.cacheType() != null : req;
DynamicCacheDescriptor startDesc =
- new DynamicCacheDescriptor(ccfg, req.cacheType(), req.deploymentId());
+ new DynamicCacheDescriptor(ccfg, req.cacheType(), false, req.deploymentId());
DynamicCacheDescriptor old = registeredCaches.put(maskNull(ccfg.getName()), startDesc);
@@ -2432,44 +2551,34 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @throws IgniteCheckedException If failed.
*/
public void addCacheConfiguration(CacheConfiguration cacheCfg) throws IgniteCheckedException {
- addCacheConfigurations(Collections.singleton(cacheCfg));
- }
+ String masked = maskNull(cacheCfg.getName());
- /**
- * @param cfgs Cache configurations.
- * @throws IgniteCheckedException If failed.
- */
- private void addCacheConfigurations(Collection<CacheConfiguration> cfgs) throws IgniteCheckedException {
- GridCacheAdapter<CacheTemplateConfigurationKey, TemplateConfigurations> utilityCache = utilityCache();
+ DynamicCacheDescriptor desc = registeredTemplates.get(masked);
- TemplateConfigurations templates =
- utilityCache.localPeek(new CacheTemplateConfigurationKey(), CachePeekModes.ONHEAP_ONLY, null);
+ if (desc != null)
+ return;
- if (templates != null) {
- cfgs = templates.needAdd(cfgs);
+ DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(cacheCfg.getName(), ctx.localNodeId());
- if (cfgs == null)
- return;
- }
+ CacheConfiguration cfg = new CacheConfiguration(cacheCfg);
- final int RETRY_CNT = 5;
+ req.template(true);
- for (int i = 0; i < RETRY_CNT; i++) {
- try {
- utilityCache.invoke(
- new CacheTemplateConfigurationKey(), new AddCacheTemplateProcessor(cfgs));
+ req.startCacheConfiguration(cfg);
- break;
- }
- catch (IgniteCheckedException e) {
- if (i < RETRY_CNT - 1) {
- if (log.isDebugEnabled())
- log.debug("Failed to save cache template configuration, will retry: " + e);
- }
- else
- throw e;
- }
- }
+ req.deploymentId(IgniteUuid.randomUuid());
+
+ TemplateConfigurationFuture fut = new TemplateConfigurationFuture(req.cacheName(), req.deploymentId());
+
+ TemplateConfigurationFuture old =
+ (TemplateConfigurationFuture)pendingTemplateFuts.putIfAbsent(maskNull(cacheCfg.getName()), fut);
+
+ if (old != null)
+ fut = old;
+
+ ctx.discovery().sendCustomEvent(new DynamicCacheChangeBatch(Collections.singleton(req)));
+
+ fut.get();
}
/**
@@ -2719,213 +2828,55 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
*
*/
- private class AddCacheTemplateProcessor implements
- CacheEntryProcessor<CacheTemplateConfigurationKey, TemplateConfigurations, Void> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private Collection<CacheConfiguration> cfgs;
-
- /**
- * @param cfgs Cache configuration templates.
- */
- public AddCacheTemplateProcessor(Collection<CacheConfiguration> cfgs) {
- assert !F.isEmpty(cfgs);
-
- this.cfgs = cfgs;
- }
-
- /** {@inheritDoc} */
- @Override public Void process(MutableEntry<CacheTemplateConfigurationKey, TemplateConfigurations> entry,
- Object... args)
- {
- TemplateConfigurations cfgs0 = entry.getValue();
-
- if (cfgs0 == null)
- cfgs0 = new TemplateConfigurations();
-
- cfgs0.add(cfgs);
-
- entry.setValue(cfgs0);
-
- return null;
- }
- }
-
- /**
- *
- */
- private static class TemplateConfigurations implements Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
+ @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
+ private class DynamicCacheStartFuture extends GridFutureAdapter<Object> {
+ /** Start ID. */
@GridToStringInclude
- private List<CacheConfiguration> exactNameCfgs;
+ private IgniteUuid deploymentId;
- /** */
- @GridToStringInclude
- private List<CacheConfiguration> wildcardNameCfgs;
+ /** Cache name. */
+ private String cacheName;
- /**
- *
- */
- public TemplateConfigurations() {
- // No-op.
- }
+ /** Change request. */
+ @GridToStringInclude
+ private DynamicCacheChangeRequest req;
/**
- * Checks if need to add new templates.
- *
- * @param cfgs Templates to add.
- * @return Templates which should be added.
+ * @param cacheName Cache name.
+ * @param deploymentId Deployment ID.
+ * @param req Cache start request.
*/
- @Nullable Collection<CacheConfiguration> needAdd(Collection<CacheConfiguration> cfgs) {
- Collection<CacheConfiguration> res = null;
-
- for (CacheConfiguration cfg : cfgs) {
- boolean found = false;
-
- if (cfg.getName() != null && cfg.getName().endsWith("*")) {
- String name0 = cfg.getName().substring(0, cfg.getName().length() - 1);
-
- if (wildcardNameCfgs != null) {
- for (CacheConfiguration cfg0 : wildcardNameCfgs) {
- if (F.eq(cfg0.getName(), name0)) {
- found = true;
-
- break;
- }
- }
- }
- }
- else {
- if (exactNameCfgs != null) {
- for (CacheConfiguration cfg0 : exactNameCfgs) {
- if (F.eq(cfg0.getName(), cfg.getName())) {
- found = true;
-
- break;
- }
- }
- }
- }
-
- if (!found) {
- if (res == null)
- res = new ArrayList<>();
-
- System.out.println(Thread.currentThread().getName() + " need add: " + cfg + " " + exactNameCfgs);
-
-
- res.add(cfg);
- }
- }
-
- return res;
+ private DynamicCacheStartFuture(String cacheName, IgniteUuid deploymentId, DynamicCacheChangeRequest req) {
+ this.deploymentId = deploymentId;
+ this.cacheName = cacheName;
+ this.req = req;
}
/**
- * @param cfgs Configurations to add.
+ * @return Start ID.
*/
- void add(Collection<CacheConfiguration> cfgs) {
- for (CacheConfiguration cfg : cfgs) {
- CacheConfiguration template = new CacheConfiguration(cfg);
-
- if (cfg.getName() != null && cfg.getName().endsWith("*")) {
- template.setName(cfg.getName().substring(0, cfg.getName().length() - 1));
-
- boolean found = false;
-
- if (wildcardNameCfgs != null) {
- for (CacheConfiguration cfg0 : wildcardNameCfgs) {
- if (F.eq(cfg0.getName(), template.getName())) {
- found = true;
-
- break;
- }
- }
- }
- else
- wildcardNameCfgs = new ArrayList<>(cfgs.size());
-
- if (!found)
- wildcardNameCfgs.add(template);
- }
- else {
- boolean found = false;
-
- if (exactNameCfgs != null) {
- for (CacheConfiguration cfg0 : exactNameCfgs) {
- if (F.eq(cfg0.getName(), template.getName())) {
- found = true;
-
- break;
- }
- }
- }
- else
- exactNameCfgs = new ArrayList<>(cfgs.size());
-
- if (!found)
- exactNameCfgs.add(template);
- }
- }
-
- if (wildcardNameCfgs != null) {
- Collections.sort(wildcardNameCfgs, new Comparator<CacheConfiguration>() {
- @Override public int compare(CacheConfiguration cfg1, CacheConfiguration cfg2) {
- Integer len1 = cfg1.getName() != null ? cfg1.getName().length() : 0;
- Integer len2 = cfg2.getName() != null ? cfg2.getName().length() : 0;
-
- return len2.compareTo(len1);
- }
- });
- }
+ public IgniteUuid deploymentId() {
+ return deploymentId;
}
/**
- * @param name Cache name.
- * @return Cache configuration for given name or {@code null} if template not found.
+ * @return Request.
*/
- @Nullable CacheConfiguration configuration(String name) {
- CacheConfiguration dfltCfg = null;
-
- if (exactNameCfgs != null) {
- for (CacheConfiguration cfg : exactNameCfgs) {
- if (F.eq(name, cfg.getName()))
- return cfg;
- else if (cfg.getName() == null)
- dfltCfg = cfg;
- }
- }
-
- if (wildcardNameCfgs != null && name != null) {
- for (CacheConfiguration cfg : wildcardNameCfgs) {
- if (name.startsWith(cfg.getName()))
- return cfg;
- }
- }
-
- return dfltCfg;
+ public DynamicCacheChangeRequest request() {
+ return req;
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeCollection(out, exactNameCfgs);
- U.writeCollection(out, wildcardNameCfgs);
- }
+ @Override public boolean onDone(@Nullable Object res, @Nullable Throwable err) {
+ // Make sure to remove future before completion.
+ pendingFuts.remove(maskNull(cacheName), this);
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- exactNameCfgs = U.readList(in);
- wildcardNameCfgs = U.readList(in);
+ return super.onDone(res, err);
}
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(TemplateConfigurations.class, this);
+ return S.toString(DynamicCacheStartFuture.class, this);
}
}
@@ -2933,7 +2884,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
*
*/
@SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
- private class DynamicCacheStartFuture extends GridFutureAdapter<Object> {
+ private class TemplateConfigurationFuture extends GridFutureAdapter<Object> {
/** Start ID. */
@GridToStringInclude
private IgniteUuid deploymentId;
@@ -2941,19 +2892,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** Cache name. */
private String cacheName;
- /** Change request. */
- @GridToStringInclude
- private DynamicCacheChangeRequest req;
-
/**
* @param cacheName Cache name.
* @param deploymentId Deployment ID.
- * @param req Cache start request.
*/
- private DynamicCacheStartFuture(String cacheName, IgniteUuid deploymentId, DynamicCacheChangeRequest req) {
+ private TemplateConfigurationFuture(String cacheName, IgniteUuid deploymentId) {
this.deploymentId = deploymentId;
this.cacheName = cacheName;
- this.req = req;
}
/**
@@ -2963,24 +2908,17 @@ public class GridCacheProcessor extends GridProcessorAdapter {
return deploymentId;
}
- /**
- * @return Request.
- */
- public DynamicCacheChangeRequest request() {
- return req;
- }
-
/** {@inheritDoc} */
@Override public boolean onDone(@Nullable Object res, @Nullable Throwable err) {
// Make sure to remove future before completion.
- pendingFuts.remove(maskNull(cacheName), this);
+ pendingTemplateFuts.remove(maskNull(cacheName), this);
return super.onDone(res, err);
}
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(DynamicCacheStartFuture.class, this);
+ return S.toString(TemplateConfigurationFuture.class, this);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5832b3a9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index ddf0df1..f6a0763 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -679,6 +679,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
/**
* Starts dynamic caches.
+ * @throws IgniteCheckedException If failed.
*/
private void startCaches() throws IgniteCheckedException {
cctx.cache().prepareCachesStart(F.view(reqs, new IgnitePredicate<DynamicCacheChangeRequest>() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5832b3a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
index c32d54b..9dfa913 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.testframework.*;
import org.apache.ignite.testframework.junits.common.*;
import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
import static org.apache.ignite.cache.CacheAtomicityMode.*;
@@ -163,6 +164,19 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
checkGetOrCreate(ignite1, "org.apache.ignite", 6);
checkGetOrCreate(ignite2, "org.apache.ignite", 6);
checkGetOrCreate(ignite3, "org.apache.ignite", 6);
+
+ // Test name '*'.
+ CacheConfiguration template3 = new CacheConfiguration();
+
+ template3.setName("*");
+ template3.setBackups(7);
+
+ ignite1.addCacheConfiguration(template3);
+
+ checkGetOrCreate(ignite0, "x", 7);
+ checkGetOrCreate(ignite1, "x", 7);
+ checkGetOrCreate(ignite2, "x", 7);
+ checkGetOrCreate(ignite3, "x", 7);
}
/**
@@ -192,6 +206,53 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
}
/**
+ * @throws Exception If failed.
+ */
+ public void testAddCacheConfigurationMultinode() throws Exception {
+ addTemplate = true;
+
+ final int GRID_CNT = 3;
+
+ startGridsMultiThreaded(GRID_CNT);
+
+ for (int i = 0; i < 10; i++) {
+ log.info("Iteration: " + i);
+
+ final AtomicInteger idx = new AtomicInteger();
+
+ final int iter = i;
+
+ GridTestUtils.runMultiThreaded(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int node = idx.getAndIncrement() % GRID_CNT;
+
+ Ignite ignite = grid(node);
+
+ log.info("Add configuration using node: " + ignite.name());
+
+ CacheConfiguration cfg = new CacheConfiguration();
+
+ cfg.setName("org.apache.ignite" + iter + "*");
+
+ cfg.setBackups(iter);
+
+ for (int i = 0; i < 100; i++)
+ ignite.addCacheConfiguration(cfg);
+
+ return null;
+ }
+ }, 15, "add-configuration");
+
+ for (int grid = 0; grid < GRID_CNT; grid++)
+ checkGetOrCreate(grid(grid), "org.apache.ignite" + iter, iter);
+ }
+
+ Ignite ignite = startGrid(GRID_CNT);
+
+ checkGetOrCreate(ignite, "org.apache.ignite3", 3);
+ }
+
+ /**
* @param ignite Ignite.
* @param name Cache name.
* @param expBackups Expected number of backups.
[33/50] [abbrv] incubator-ignite git commit: Merge branch
'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-624
Posted by vk...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-624
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e0d88d3a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e0d88d3a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e0d88d3a
Branch: refs/heads/ignite-471
Commit: e0d88d3a0dc0f07316d9f48910203a8dd1428346
Parents: d9e2a64 0cf79e4
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 8 13:12:36 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 8 13:12:36 2015 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/Ignite.java | 15 +
.../apache/ignite/internal/IgniteKernal.java | 37 ++
.../internal/managers/GridManagerAdapter.java | 34 +-
.../cache/DynamicCacheChangeRequest.java | 17 +
.../cache/DynamicCacheDescriptor.java | 17 +-
.../processors/cache/GridCacheIoManager.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 349 +++++++++++++++---
.../dht/GridClientPartitionTopology.java | 6 +-
.../distributed/dht/GridDhtLockFuture.java | 10 +-
.../dht/GridDhtPartitionTopologyImpl.java | 6 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 49 +--
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../GridDhtPartitionsExchangeFuture.java | 1 +
.../cache/transactions/IgniteTxManager.java | 6 +-
.../resources/META-INF/classnames.properties | 19 +-
...eCacheConfigurationTemplateNotFoundTest.java | 114 ++++++
.../IgniteCacheConfigurationTemplateTest.java | 364 +++++++++++++++++++
.../cache/IgniteDynamicCacheStartSelfTest.java | 23 ++
.../ignite/testframework/junits/IgniteMock.java | 10 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 5 +-
.../org/apache/ignite/IgniteSpringBean.java | 14 +
.../commands/cache/VisorCacheClearCommand.scala | 3 +-
.../scala/org/apache/ignite/visor/visor.scala | 12 +-
23 files changed, 1011 insertions(+), 104 deletions(-)
----------------------------------------------------------------------
[16/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-639' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Posted by vk...@apache.org.
Merge branches 'ignite-639' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c6de5e1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c6de5e1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c6de5e1e
Branch: refs/heads/ignite-471
Commit: c6de5e1e0163f23fd551253d2950224ba7317b7c
Parents: 0c836db 2444811
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 20:34:29 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 20:34:29 2015 +0700
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/include/service.sh | 8 +-
config/hadoop/default-config.xml | 15 +-
examples/README.txt | 11 +-
examples/config/example-ignite.xml | 2 +-
.../streaming/StreamTransformerExample.java | 100 +
.../streaming/StreamVisitorExample.java | 171 +
.../streaming/marketdata/CacheConfig.java | 44 -
.../streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 103 -
.../examples/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 78 -
.../streaming/wordcount/CacheConfig.java | 48 +
.../streaming/wordcount/QueryWords.java | 77 +
.../streaming/wordcount/StreamWords.java | 68 +
.../streaming/wordcount/alice-in-wonderland.txt | 3735 ++++++++++++++++++
.../streaming/wordcount/package-info.java | 22 +
.../streaming/StreamTransformerExample.java | 97 +
.../java8/streaming/StreamVisitorExample.java | 168 +
.../java8/streaming/marketdata/CacheConfig.java | 44 -
.../java8/streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 101 -
.../java8/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 74 -
.../ignite/cache/affinity/AffinityUuid.java | 50 +
.../configuration/CacheConfiguration.java | 3 -
.../processors/cache/CacheLazyEntry.java | 10 +-
.../processors/cache/KeyCacheObjectImpl.java | 13 +-
.../cacheobject/IgniteCacheObjectProcessor.java | 3 +-
.../IgniteCacheObjectProcessorImpl.java | 28 +-
.../ipc/shmem/IpcSharedMemoryNativeLoader.java | 48 +-
.../internal/visor/log/VisorLogSearchTask.java | 3 +-
.../visor/query/VisorQueryNextPageTask.java | 5 +-
.../org/apache/ignite/lang/IgniteImmutable.java | 49 -
.../ignite/IgniteCacheAffinitySelfTest.java | 5 +
.../GridCacheOnCopyFlagAbstractSelfTest.java | 112 +-
.../GridCacheReturnValueTransferSelfTest.java | 1 -
.../IgniteCacheStoreValueAbstractTest.java | 186 +-
...ridCacheFifoBatchEvictionPolicySelfTest.java | 3 +-
.../IgniteCacheEvictionSelfTestSuite.java | 1 +
parent/pom.xml | 1 +
pom.xml | 13 +-
48 files changed, 4818 insertions(+), 1286 deletions(-)
----------------------------------------------------------------------
[14/50] [abbrv] incubator-ignite git commit: # IGNITE-30 Make
TcpDiscoveryAbstractMessage Serializable instead of Externalizable.
Posted by vk...@apache.org.
# IGNITE-30 Make TcpDiscoveryAbstractMessage Serializable instead of Externalizable.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1e55e2dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1e55e2dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1e55e2dc
Branch: refs/heads/ignite-471
Commit: 1e55e2dc1a7e5be44697f9c4c78d32e25de6928f
Parents: 5f2d8c2
Author: sevdokimov <se...@gridgain.com>
Authored: Tue Apr 7 14:41:49 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue Apr 7 14:41:49 2015 +0300
----------------------------------------------------------------------
.../messages/TcpDiscoveryAbstractMessage.java | 24 +-------
.../messages/TcpDiscoveryAuthFailedMessage.java | 25 ++++----
.../TcpDiscoveryCheckFailedMessage.java | 24 +-------
.../TcpDiscoveryClientReconnectMessage.java | 30 +---------
.../TcpDiscoveryCustomEventMessage.java | 23 +-------
.../messages/TcpDiscoveryDiscardMessage.java | 24 +-------
.../TcpDiscoveryDuplicateIdMessage.java | 24 +-------
.../messages/TcpDiscoveryHandshakeRequest.java | 8 ---
.../messages/TcpDiscoveryHandshakeResponse.java | 22 -------
.../messages/TcpDiscoveryHeartbeatMessage.java | 44 +-------------
.../TcpDiscoveryJoinRequestMessage.java | 28 +--------
.../TcpDiscoveryLoopbackProblemMessage.java | 28 +--------
.../TcpDiscoveryNodeAddFinishedMessage.java | 24 +-------
.../messages/TcpDiscoveryNodeAddedMessage.java | 60 +-------------------
.../messages/TcpDiscoveryNodeFailedMessage.java | 28 +--------
.../messages/TcpDiscoveryNodeLeftMessage.java | 8 ---
.../tcp/messages/TcpDiscoveryPingRequest.java | 25 +-------
.../tcp/messages/TcpDiscoveryPingResponse.java | 14 -----
.../TcpDiscoveryStatusCheckMessage.java | 30 +---------
19 files changed, 33 insertions(+), 460 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/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 09c7522..1a00359 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
@@ -27,7 +27,7 @@ import java.util.*;
/**
* Base class to implement discovery messages.
*/
-public abstract class TcpDiscoveryAbstractMessage implements Externalizable {
+public abstract class TcpDiscoveryAbstractMessage implements Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -41,7 +41,7 @@ public abstract class TcpDiscoveryAbstractMessage implements Externalizable {
protected static final int CLIENT_RECON_SUCCESS_FLAG_POS = 2;
/** Sender of the message (transient). */
- private UUID senderNodeId;
+ private transient UUID senderNodeId;
/** Message ID. */
private IgniteUuid id;
@@ -233,26 +233,6 @@ public abstract class TcpDiscoveryAbstractMessage implements Externalizable {
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeGridUuid(out, id);
- U.writeUuid(out, verifierNodeId);
- out.writeLong(topVer);
- U.writeUuid(out, destClientNodeId);
- out.writeInt(flags);
- out.writeShort(pendingIdx);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- id = U.readGridUuid(in);
- verifierNodeId = U.readUuid(in);
- topVer = in.readLong();
- destClientNodeId = U.readUuid(in);
- flags = in.readInt();
- pendingIdx = in.readShort();
- }
-
- /** {@inheritDoc} */
@Override public final boolean equals(Object obj) {
if (this == obj)
return true;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
index 2d20be9..0eb3df0 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAuthFailedMessage.java
@@ -31,14 +31,7 @@ public class TcpDiscoveryAuthFailedMessage extends TcpDiscoveryAbstractMessage {
private static final long serialVersionUID = 0L;
/** Coordinator address. */
- private InetAddress addr;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryAuthFailedMessage() {
- // No-op.
- }
+ private transient InetAddress addr;
/**
* Constructor.
@@ -59,16 +52,20 @@ public class TcpDiscoveryAuthFailedMessage extends TcpDiscoveryAbstractMessage {
return addr;
}
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
+ /**
+ * Serialize this message.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ out.defaultWriteObject();
U.writeByteArray(out, addr.getAddress());
}
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
+ /**
+ * Deserialize this message.
+ */
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
addr = InetAddress.getByAddress(U.readByteArray(in));
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java
index d35bffb..0905c58 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCheckFailedMessage.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -30,14 +29,7 @@ public class TcpDiscoveryCheckFailedMessage extends TcpDiscoveryAbstractMessage
private static final long serialVersionUID = 0L;
/** Coordinator version. */
- private String err;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryCheckFailedMessage() {
- // No-op.
- }
+ private final String err;
/**
* Constructor.
@@ -59,20 +51,6 @@ public class TcpDiscoveryCheckFailedMessage extends TcpDiscoveryAbstractMessage
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- U.writeString(out, err);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- err = U.readString(in);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryCheckFailedMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
index db68ae3..86aee1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientReconnectMessage.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
-import java.io.*;
import java.util.*;
/**
@@ -32,23 +31,16 @@ public class TcpDiscoveryClientReconnectMessage extends TcpDiscoveryAbstractMess
private static final long serialVersionUID = 0L;
/** New router nodeID. */
- private UUID routerNodeId;
+ private final UUID routerNodeId;
/** Last message ID. */
- private IgniteUuid lastMsgId;
+ private final IgniteUuid lastMsgId;
/** Pending messages. */
@GridToStringExclude
private Collection<TcpDiscoveryAbstractMessage> msgs;
/**
- * For {@link Externalizable}.
- */
- public TcpDiscoveryClientReconnectMessage() {
- // No-op.
- }
-
- /**
* @param creatorNodeId Creator node ID.
* @param routerNodeId New router node ID.
* @param lastMsgId Last message ID.
@@ -103,24 +95,6 @@ public class TcpDiscoveryClientReconnectMessage extends TcpDiscoveryAbstractMess
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- U.writeUuid(out, routerNodeId);
- U.writeGridUuid(out, lastMsgId);
- U.writeCollection(out, msgs);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- routerNodeId = U.readUuid(in);
- lastMsgId = U.readGridUuid(in);
- msgs = U.readCollection(in);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryClientReconnectMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
index b0c7400..234efaa 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
@@ -29,14 +29,7 @@ public class TcpDiscoveryCustomEventMessage extends TcpDiscoveryAbstractMessage
private static final long serialVersionUID = 0L;
/** */
- private Serializable msg;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryCustomEventMessage() {
- // No-op.
- }
+ private final Serializable msg;
/**
* @param creatorNodeId Creator node id.
@@ -53,18 +46,4 @@ public class TcpDiscoveryCustomEventMessage extends TcpDiscoveryAbstractMessage
public Serializable message() {
return msg;
}
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeObject(msg);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- msg = (Serializable)in.readObject();
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
index 1989038..9510b9e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
@@ -20,7 +20,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
-import java.io.*;
import java.util.*;
/**
@@ -32,14 +31,7 @@ public class TcpDiscoveryDiscardMessage extends TcpDiscoveryAbstractMessage {
private static final long serialVersionUID = 0L;
/** ID of the message to discard (this and all preceding). */
- private IgniteUuid msgId;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryDiscardMessage() {
- // No-op.
- }
+ private final IgniteUuid msgId;
/**
* Constructor.
@@ -63,20 +55,6 @@ public class TcpDiscoveryDiscardMessage extends TcpDiscoveryAbstractMessage {
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- U.writeGridUuid(out, msgId);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- msgId = U.readGridUuid(in);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryDiscardMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java
index fcf9f00..978acb2 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDuplicateIdMessage.java
@@ -20,7 +20,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.spi.discovery.tcp.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -32,14 +31,7 @@ public class TcpDiscoveryDuplicateIdMessage extends TcpDiscoveryAbstractMessage
private static final long serialVersionUID = 0L;
/** Node with duplicate ID. */
- private TcpDiscoveryNode node;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryDuplicateIdMessage() {
- // No-op.
- }
+ private final TcpDiscoveryNode node;
/**
* Constructor.
@@ -63,20 +55,6 @@ public class TcpDiscoveryDuplicateIdMessage extends TcpDiscoveryAbstractMessage
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeObject(node);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- node = (TcpDiscoveryNode)in.readObject();
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryDuplicateIdMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java
index 6debe77..99f919b 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeRequest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -30,13 +29,6 @@ public class TcpDiscoveryHandshakeRequest extends TcpDiscoveryAbstractMessage {
private static final long serialVersionUID = 0L;
/**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryHandshakeRequest() {
- // No-op.
- }
-
- /**
* Constructor.
*
* @param creatorNodeId Creator node ID.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java
index f110d06..5c2f798 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHandshakeResponse.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -33,13 +32,6 @@ public class TcpDiscoveryHandshakeResponse extends TcpDiscoveryAbstractMessage {
private long order;
/**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryHandshakeResponse() {
- // No-op.
- }
-
- /**
* Constructor.
*
* @param creatorNodeId Creator node ID.
@@ -70,20 +62,6 @@ public class TcpDiscoveryHandshakeResponse extends TcpDiscoveryAbstractMessage {
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeLong(order);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- order = in.readLong();
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryHandshakeResponse.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
index 65eea9f..8b07ba4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
@@ -47,17 +47,10 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
/** Map to store nodes metrics. */
@GridToStringExclude
- private Map<UUID, MetricsSet> metrics;
+ private final Map<UUID, MetricsSet> metrics = new HashMap<>();
/** Client node IDs. */
- private Collection<UUID> clientNodeIds;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryHeartbeatMessage() {
- // No-op.
- }
+ private final Collection<UUID> clientNodeIds = new HashSet<>();
/**
* Constructor.
@@ -66,9 +59,6 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
*/
public TcpDiscoveryHeartbeatMessage(UUID creatorNodeId) {
super(creatorNodeId);
-
- metrics = U.newHashMap(1);
- clientNodeIds = new HashSet<>();
}
/**
@@ -156,36 +146,6 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeInt(metrics.size());
-
- if (!metrics.isEmpty()) {
- for (Map.Entry<UUID, MetricsSet> e : metrics.entrySet()) {
- U.writeUuid(out, e.getKey());
- out.writeObject(e.getValue());
- }
- }
-
- U.writeCollection(out, clientNodeIds);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- int metricsSize = in.readInt();
-
- metrics = U.newHashMap(metricsSize);
-
- for (int i = 0; i < metricsSize; i++)
- metrics.put(U.readUuid(in), (MetricsSet)in.readObject());
-
- clientNodeIds = U.readCollection(in);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryHeartbeatMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java
index e267a29..5e6b892 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryJoinRequestMessage.java
@@ -20,7 +20,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.spi.discovery.tcp.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -32,17 +31,10 @@ public class TcpDiscoveryJoinRequestMessage extends TcpDiscoveryAbstractMessage
private static final long serialVersionUID = 0L;
/** New node that wants to join the topology. */
- private TcpDiscoveryNode node;
+ private final TcpDiscoveryNode node;
/** Discovery data. */
- private Map<Integer, Object> discoData;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryJoinRequestMessage() {
- // No-op.
- }
+ private final Map<Integer, Object> discoData;
/**
* Constructor.
@@ -88,22 +80,6 @@ public class TcpDiscoveryJoinRequestMessage extends TcpDiscoveryAbstractMessage
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeObject(node);
- U.writeMap(out, discoData);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- node = (TcpDiscoveryNode)in.readObject();
- discoData = U.readMap(in);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryJoinRequestMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryLoopbackProblemMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryLoopbackProblemMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryLoopbackProblemMessage.java
index fb2c2f3..c8bed37 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryLoopbackProblemMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryLoopbackProblemMessage.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -31,17 +30,10 @@ public class TcpDiscoveryLoopbackProblemMessage extends TcpDiscoveryAbstractMess
private static final long serialVersionUID = 0L;
/** Remote node addresses. */
- private Collection<String> addrs;
+ private final Collection<String> addrs;
/** Remote node host names. */
- private Collection<String> hostNames;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryLoopbackProblemMessage() {
- // No-op.
- }
+ private final Collection<String> hostNames;
/**
* Constructor.
@@ -73,22 +65,6 @@ public class TcpDiscoveryLoopbackProblemMessage extends TcpDiscoveryAbstractMess
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- U.writeCollection(out, addrs);
- U.writeCollection(out, hostNames);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- addrs = U.readCollection(in);
- hostNames = U.readCollection(in);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryLoopbackProblemMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
index f536b9e..5a71eb3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -32,14 +31,7 @@ public class TcpDiscoveryNodeAddFinishedMessage extends TcpDiscoveryAbstractMess
private static final long serialVersionUID = 0L;
/** Added node ID. */
- private UUID nodeId;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryNodeAddFinishedMessage() {
- // No-op.
- }
+ private final UUID nodeId;
/**
* Constructor.
@@ -63,20 +55,6 @@ public class TcpDiscoveryNodeAddFinishedMessage extends TcpDiscoveryAbstractMess
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- U.writeUuid(out, nodeId);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- nodeId = U.readUuid(in);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryNodeAddFinishedMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
index b870495..7b1704e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
@@ -24,7 +24,6 @@ import org.apache.ignite.lang.*;
import org.apache.ignite.spi.discovery.tcp.internal.*;
import org.jetbrains.annotations.*;
-import java.io.*;
import java.util.*;
/**
@@ -39,7 +38,7 @@ public class TcpDiscoveryNodeAddedMessage extends TcpDiscoveryAbstractMessage {
private static final long serialVersionUID = 0L;
/** Added node. */
- private TcpDiscoveryNode node;
+ private final TcpDiscoveryNode node;
/** Pending messages from previous node. */
private Collection<TcpDiscoveryAbstractMessage> msgs;
@@ -61,14 +60,7 @@ public class TcpDiscoveryNodeAddedMessage extends TcpDiscoveryAbstractMessage {
private Map<UUID, Map<Integer, Object>> oldNodesDiscoData;
/** Start time of the first grid node. */
- private long gridStartTime;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryNodeAddedMessage() {
- // No-op.
- }
+ private final long gridStartTime;
/**
* Constructor.
@@ -208,54 +200,6 @@ public class TcpDiscoveryNodeAddedMessage extends TcpDiscoveryAbstractMessage {
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeObject(node);
- U.writeCollection(out, msgs);
- U.writeGridUuid(out, discardMsgId);
- U.writeCollection(out, top);
- U.writeMap(out, topHist);
- out.writeLong(gridStartTime);
- U.writeMap(out, newNodeDiscoData);
-
- out.writeInt(oldNodesDiscoData != null ? oldNodesDiscoData.size() : -1);
-
- if (oldNodesDiscoData != null) {
- for (Map.Entry<UUID, Map<Integer, Object>> entry : oldNodesDiscoData.entrySet()) {
- U.writeUuid(out, entry.getKey());
-
- U.writeMap(out, entry.getValue());
- }
- }
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- node = (TcpDiscoveryNode)in.readObject();
- msgs = U.readCollection(in);
- discardMsgId = U.readGridUuid(in);
- top = U.readCollection(in);
- topHist = U.readTreeMap(in);
- gridStartTime = in.readLong();
- newNodeDiscoData = U.readMap(in);
-
- int oldNodesDiscoDataSize = in.readInt();
-
- if (oldNodesDiscoDataSize >= 0) {
- oldNodesDiscoData = new LinkedHashMap<>(oldNodesDiscoDataSize);
-
- for (int i = 0; i < oldNodesDiscoDataSize; i++) {
- UUID nodeId = U.readUuid(in);
-
- oldNodesDiscoData.put(nodeId, U.<Integer, Object>readMap(in));
- }
- }
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryNodeAddedMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
index 8fe7fbe..8cb8414 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeFailedMessage.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -33,17 +32,10 @@ public class TcpDiscoveryNodeFailedMessage extends TcpDiscoveryAbstractMessage {
private static final long serialVersionUID = 0L;
/** ID of the failed node. */
- private UUID failedNodeId;
+ private final UUID failedNodeId;
/** Internal order of the failed node. */
- private long order;
-
- /**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryNodeFailedMessage() {
- // No-op.
- }
+ private final long order;
/**
* Constructor.
@@ -79,22 +71,6 @@ public class TcpDiscoveryNodeFailedMessage extends TcpDiscoveryAbstractMessage {
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- U.writeUuid(out, failedNodeId);
- out.writeLong(order);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- failedNodeId = U.readUuid(in);
- order = in.readLong();
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryNodeFailedMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeLeftMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeLeftMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeLeftMessage.java
index 0217385..3c2a7ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeLeftMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeLeftMessage.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -33,13 +32,6 @@ public class TcpDiscoveryNodeLeftMessage extends TcpDiscoveryAbstractMessage {
private static final long serialVersionUID = 0L;
/**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryNodeLeftMessage() {
- // No-op.
- }
-
- /**
* Constructor.
*
* @param creatorNodeId ID of the node that is about to leave the topology.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingRequest.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingRequest.java
index c42a2ee..de5b0a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingRequest.java
@@ -17,10 +17,8 @@
package org.apache.ignite.spi.discovery.tcp.messages;
-import org.apache.ignite.internal.util.typedef.internal.*;
import org.jetbrains.annotations.*;
-import java.io.*;
import java.util.*;
/**
@@ -31,14 +29,7 @@ public class TcpDiscoveryPingRequest extends TcpDiscoveryAbstractMessage {
private static final long serialVersionUID = 0L;
/** Pinged client node ID. */
- private UUID clientNodeId;
-
- /**
- * For {@link Externalizable}.
- */
- public TcpDiscoveryPingRequest() {
- // No-op.
- }
+ private final UUID clientNodeId;
/**
* @param creatorNodeId Creator node ID.
@@ -56,18 +47,4 @@ public class TcpDiscoveryPingRequest extends TcpDiscoveryAbstractMessage {
@Nullable public UUID clientNodeId() {
return clientNodeId;
}
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- U.writeUuid(out, clientNodeId);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- clientNodeId = U.readUuid(in);
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingResponse.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingResponse.java
index 0f7713f..6396764 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryPingResponse.java
@@ -57,18 +57,4 @@ public class TcpDiscoveryPingResponse extends TcpDiscoveryAbstractMessage {
public boolean clientExists() {
return clientExists;
}
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeBoolean(clientExists);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- clientExists = in.readBoolean();
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1e55e2dc/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java
index 4c0db2f..bec7093 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryStatusCheckMessage.java
@@ -20,7 +20,6 @@ package org.apache.ignite.spi.discovery.tcp.messages;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.spi.discovery.tcp.internal.*;
-import java.io.*;
import java.util.*;
/**
@@ -42,22 +41,15 @@ public class TcpDiscoveryStatusCheckMessage extends TcpDiscoveryAbstractMessage
public static final int STATUS_RECON = 2;
/** Creator node. */
- private TcpDiscoveryNode creatorNode;
+ private final TcpDiscoveryNode creatorNode;
/** Failed node id. */
- private UUID failedNodeId;
+ private final UUID failedNodeId;
/** Creator node status (initialized by coordinator). */
private int status;
/**
- * Public default no-arg constructor for {@link Externalizable} interface.
- */
- public TcpDiscoveryStatusCheckMessage() {
- // No-op.
- }
-
- /**
* Constructor.
*
* @param creatorNode Creator node.
@@ -107,24 +99,6 @@ public class TcpDiscoveryStatusCheckMessage extends TcpDiscoveryAbstractMessage
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeObject(creatorNode);
- U.writeUuid(out, failedNodeId);
- out.writeInt(status);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- creatorNode = (TcpDiscoveryNode)in.readObject();
- failedNodeId = U.readUuid(in);
- status = in.readInt();
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryStatusCheckMessage.class, this, "super", super.toString());
}
[37/50] [abbrv] incubator-ignite git commit: # IGNITE-639 minor
changes.
Posted by vk...@apache.org.
# IGNITE-639 minor changes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5e9addb5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5e9addb5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5e9addb5
Branch: refs/heads/ignite-471
Commit: 5e9addb568125d8ce5b375c64169178e8fc85137
Parents: 4d44e61
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed Apr 8 18:05:42 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed Apr 8 18:05:42 2015 +0700
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/internal/IgniteEx.java | 2 +-
.../internal/visor/cache/VisorCacheMetricsCollectorTask.java | 8 +-------
2 files changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e9addb5/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index bea4ab5..867e26d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -117,7 +117,7 @@ public interface IgniteEx extends Ignite {
public Hadoop hadoop();
/** {@inheritDoc} */
- @Override public IgniteClusterEx cluster();
+ @Override IgniteClusterEx cluster();
/**
* Get latest version in string form.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e9addb5/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index ee0b962..8fd42a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -109,13 +109,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
if (ca.context().started()) {
VisorCacheMetrics cm = VisorCacheMetrics.from(ignite, ca);
- boolean addCache = allCaches || cacheNames.contains(ca.name());
-
- if (showSysCaches) {
- if (cm.system() && addCache)
- res.add(cm);
- }
- else if (!cm.system() && addCache)
+ if ((allCaches || cacheNames.contains(ca.name())) && (showSysCaches || !cm.system()))
res.add(cm);
}
}
[31/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'origin/ignite-sprint-3' into ignite-sprint-3
Posted by vk...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-3' into ignite-sprint-3
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0cf79e46
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0cf79e46
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0cf79e46
Branch: refs/heads/ignite-471
Commit: 0cf79e467ab532e21ccac9ee6d36f57145c457de
Parents: 21c8e89 682dcd1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Apr 8 13:00:10 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Apr 8 13:00:10 2015 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/Ignite.java | 15 +
.../apache/ignite/internal/IgniteKernal.java | 37 ++
.../internal/managers/GridManagerAdapter.java | 34 +-
.../cache/DynamicCacheChangeRequest.java | 17 +
.../cache/DynamicCacheDescriptor.java | 17 +-
.../processors/cache/GridCacheProcessor.java | 349 +++++++++++++++---
.../GridDhtPartitionsExchangeFuture.java | 1 +
...eCacheConfigurationTemplateNotFoundTest.java | 114 ++++++
.../IgniteCacheConfigurationTemplateTest.java | 364 +++++++++++++++++++
.../ignite/testframework/junits/IgniteMock.java | 10 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 2 +
.../org/apache/ignite/IgniteSpringBean.java | 14 +
12 files changed, 920 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
[05/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-639' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Posted by vk...@apache.org.
Merge branches 'ignite-639' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f1eaf292
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f1eaf292
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f1eaf292
Branch: refs/heads/ignite-471
Commit: f1eaf292921650e4ce44f61640fe7992ee14babb
Parents: 43fa714 3629cee
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 10:31:50 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 10:31:50 2015 +0700
----------------------------------------------------------------------
.../store/jdbc/CacheAbstractJdbcStore.java | 104 ++++++++++++++-----
.../yardstick/config/benchmark-store.properties | 5 +-
2 files changed, 80 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
[18/50] [abbrv] incubator-ignite git commit: # IGNITE-30 Use
ByteBuffer to serialize metrics.
Posted by vk...@apache.org.
# IGNITE-30 Use ByteBuffer to serialize metrics.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cb21533e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cb21533e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cb21533e
Branch: refs/heads/ignite-471
Commit: cb21533eb665776bcd11531f678b1e87b1d3951d
Parents: 1e55e2d
Author: sevdokimov <se...@gridgain.com>
Authored: Tue Apr 7 18:33:53 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Tue Apr 7 18:33:53 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/ClusterMetricsSnapshot.java | 384 ++++++-------------
1 file changed, 115 insertions(+), 269 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cb21533e/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
index 6e933ab..558b0c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.jetbrains.annotations.*;
+import java.nio.*;
import java.util.*;
import static java.lang.Math.*;
@@ -1252,63 +1253,63 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
* @return New offset.
*/
public static int serialize(byte[] data, int off, ClusterMetrics metrics) {
- int start = off;
-
- off = U.intToBytes(metrics.getMaximumActiveJobs(), data, off);
- off = U.intToBytes(metrics.getCurrentActiveJobs(), data, off);
- off = U.floatToBytes(metrics.getAverageActiveJobs(), data, off);
- off = U.intToBytes(metrics.getMaximumWaitingJobs(), data, off);
- off = U.intToBytes(metrics.getCurrentWaitingJobs(), data, off);
- off = U.floatToBytes(metrics.getAverageWaitingJobs(), data, off);
- off = U.intToBytes(metrics.getMaximumRejectedJobs(), data, off);
- off = U.intToBytes(metrics.getCurrentRejectedJobs(), data, off);
- off = U.floatToBytes(metrics.getAverageRejectedJobs(), data, off);
- off = U.intToBytes(metrics.getMaximumCancelledJobs(), data, off);
- off = U.intToBytes(metrics.getCurrentCancelledJobs(), data, off);
- off = U.floatToBytes(metrics.getAverageCancelledJobs(), data, off);
- off = U.intToBytes(metrics.getTotalRejectedJobs(), data, off);
- off = U.intToBytes(metrics.getTotalCancelledJobs(), data, off);
- off = U.intToBytes(metrics.getTotalExecutedJobs(), data, off);
- off = U.longToBytes(metrics.getMaximumJobWaitTime(), data, off);
- off = U.longToBytes(metrics.getCurrentJobWaitTime(), data, off);
- off = U.doubleToBytes(metrics.getAverageJobWaitTime(), data, off);
- off = U.longToBytes(metrics.getMaximumJobExecuteTime(), data, off);
- off = U.longToBytes(metrics.getCurrentJobExecuteTime(), data, off);
- off = U.doubleToBytes(metrics.getAverageJobExecuteTime(), data, off);
- off = U.intToBytes(metrics.getTotalExecutedTasks(), data, off);
- off = U.longToBytes(metrics.getCurrentIdleTime(), data, off);
- off = U.longToBytes(metrics.getTotalIdleTime(), data, off);
- off = U.intToBytes(metrics.getTotalCpus(), data, off);
- off = U.doubleToBytes(metrics.getCurrentCpuLoad(), data, off);
- off = U.doubleToBytes(metrics.getAverageCpuLoad(), data, off);
- off = U.doubleToBytes(metrics.getCurrentGcCpuLoad(), data, off);
- off = U.longToBytes(metrics.getHeapMemoryInitialized(), data, off);
- off = U.longToBytes(metrics.getHeapMemoryUsed(), data, off);
- off = U.longToBytes(metrics.getHeapMemoryCommitted(), data, off);
- off = U.longToBytes(metrics.getHeapMemoryMaximum(), data, off);
- off = U.longToBytes(metrics.getHeapMemoryTotal(), data, off);
- off = U.longToBytes(metrics.getNonHeapMemoryInitialized(), data, off);
- off = U.longToBytes(metrics.getNonHeapMemoryUsed(), data, off);
- off = U.longToBytes(metrics.getNonHeapMemoryCommitted(), data, off);
- off = U.longToBytes(metrics.getNonHeapMemoryMaximum(), data, off);
- off = U.longToBytes(metrics.getNonHeapMemoryTotal(), data, off);
- off = U.longToBytes(metrics.getStartTime(), data, off);
- off = U.longToBytes(metrics.getNodeStartTime(), data, off);
- off = U.longToBytes(metrics.getUpTime(), data, off);
- off = U.intToBytes(metrics.getCurrentThreadCount(), data, off);
- off = U.intToBytes(metrics.getMaximumThreadCount(), data, off);
- off = U.longToBytes(metrics.getTotalStartedThreadCount(), data, off);
- off = U.intToBytes(metrics.getCurrentDaemonThreadCount(), data, off);
- off = U.longToBytes(metrics.getLastDataVersion(), data, off);
- off = U.intToBytes(metrics.getSentMessagesCount(), data, off);
- off = U.longToBytes(metrics.getSentBytesCount(), data, off);
- off = U.intToBytes(metrics.getReceivedMessagesCount(), data, off);
- off = U.longToBytes(metrics.getReceivedBytesCount(), data, off);
- off = U.intToBytes(metrics.getOutboundMessagesQueueSize(), data, off);
- off = U.intToBytes(metrics.getTotalNodes(), data, off);
-
- assert off - start == METRICS_SIZE : "Invalid metrics size [expected=" + METRICS_SIZE + ", actual=" +
- (off - start) + ']';
+ ByteBuffer buf = ByteBuffer.wrap(data, off, METRICS_SIZE);
+
+ buf.putInt(metrics.getMaximumActiveJobs());
+ buf.putInt(metrics.getCurrentActiveJobs());
+ buf.putFloat(metrics.getAverageActiveJobs());
+ buf.putInt(metrics.getMaximumWaitingJobs());
+ buf.putInt(metrics.getCurrentWaitingJobs());
+ buf.putFloat(metrics.getAverageWaitingJobs());
+ buf.putInt(metrics.getMaximumRejectedJobs());
+ buf.putInt(metrics.getCurrentRejectedJobs());
+ buf.putFloat(metrics.getAverageRejectedJobs());
+ buf.putInt(metrics.getMaximumCancelledJobs());
+ buf.putInt(metrics.getCurrentCancelledJobs());
+ buf.putFloat(metrics.getAverageCancelledJobs());
+ buf.putInt(metrics.getTotalRejectedJobs());
+ buf.putInt(metrics.getTotalCancelledJobs());
+ buf.putInt(metrics.getTotalExecutedJobs());
+ buf.putLong(metrics.getMaximumJobWaitTime());
+ buf.putLong(metrics.getCurrentJobWaitTime());
+ buf.putDouble(metrics.getAverageJobWaitTime());
+ buf.putLong(metrics.getMaximumJobExecuteTime());
+ buf.putLong(metrics.getCurrentJobExecuteTime());
+ buf.putDouble(metrics.getAverageJobExecuteTime());
+ buf.putInt(metrics.getTotalExecutedTasks());
+ buf.putLong(metrics.getCurrentIdleTime());
+ buf.putLong(metrics.getTotalIdleTime());
+ buf.putInt(metrics.getTotalCpus());
+ buf.putDouble(metrics.getCurrentCpuLoad());
+ buf.putDouble(metrics.getAverageCpuLoad());
+ buf.putDouble(metrics.getCurrentGcCpuLoad());
+ buf.putLong(metrics.getHeapMemoryInitialized());
+ buf.putLong(metrics.getHeapMemoryUsed());
+ buf.putLong(metrics.getHeapMemoryCommitted());
+ buf.putLong(metrics.getHeapMemoryMaximum());
+ buf.putLong(metrics.getHeapMemoryTotal());
+ buf.putLong(metrics.getNonHeapMemoryInitialized());
+ buf.putLong(metrics.getNonHeapMemoryUsed());
+ buf.putLong(metrics.getNonHeapMemoryCommitted());
+ buf.putLong(metrics.getNonHeapMemoryMaximum());
+ buf.putLong(metrics.getNonHeapMemoryTotal());
+ buf.putLong(metrics.getStartTime());
+ buf.putLong(metrics.getNodeStartTime());
+ buf.putLong(metrics.getUpTime());
+ buf.putInt(metrics.getCurrentThreadCount());
+ buf.putInt(metrics.getMaximumThreadCount());
+ buf.putLong(metrics.getTotalStartedThreadCount());
+ buf.putInt(metrics.getCurrentDaemonThreadCount());
+ buf.putLong(metrics.getLastDataVersion());
+ buf.putInt(metrics.getSentMessagesCount());
+ buf.putLong(metrics.getSentBytesCount());
+ buf.putInt(metrics.getReceivedMessagesCount());
+ buf.putLong(metrics.getReceivedBytesCount());
+ buf.putInt(metrics.getOutboundMessagesQueueSize());
+ buf.putInt(metrics.getTotalNodes());
+
+ assert !buf.hasRemaining() : "Invalid metrics size [expected=" + METRICS_SIZE + ", actual="
+ + (buf.position() - off) + ']';
return off;
}
@@ -1321,222 +1322,67 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
* @return Deserialized node metrics.
*/
public static ClusterMetrics deserialize(byte[] data, int off) {
- int start = off;
-
ClusterMetricsSnapshot metrics = new ClusterMetricsSnapshot();
- metrics.setLastUpdateTime(U.currentTimeMillis());
-
- metrics.setMaximumActiveJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setCurrentActiveJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setAverageActiveJobs(U.bytesToFloat(data, off));
-
- off += 4;
-
- metrics.setMaximumWaitingJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setCurrentWaitingJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setAverageWaitingJobs(U.bytesToFloat(data, off));
-
- off += 4;
-
- metrics.setMaximumRejectedJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setCurrentRejectedJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setAverageRejectedJobs(U.bytesToFloat(data, off));
-
- off += 4;
-
- metrics.setMaximumCancelledJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setCurrentCancelledJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setAverageCancelledJobs(U.bytesToFloat(data, off));
-
- off += 4;
-
- metrics.setTotalRejectedJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setTotalCancelledJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setTotalExecutedJobs(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setMaximumJobWaitTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setCurrentJobWaitTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setAverageJobWaitTime(U.bytesToDouble(data, off));
-
- off += 8;
-
- metrics.setMaximumJobExecuteTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setCurrentJobExecuteTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setAverageJobExecuteTime(U.bytesToDouble(data, off));
-
- off += 8;
-
- metrics.setTotalExecutedTasks(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setCurrentIdleTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setTotalIdleTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setAvailableProcessors(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setCurrentCpuLoad(U.bytesToDouble(data, off));
+ ByteBuffer buf = ByteBuffer.wrap(data, off, METRICS_SIZE);
- off += 8;
-
- metrics.setAverageCpuLoad(U.bytesToDouble(data, off));
-
- off += 8;
-
- metrics.setCurrentGcCpuLoad(U.bytesToDouble(data, off));
-
- off += 8;
-
- metrics.setHeapMemoryInitialized(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setHeapMemoryUsed(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setHeapMemoryCommitted(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setHeapMemoryMaximum(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setHeapMemoryTotal(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setNonHeapMemoryInitialized(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setNonHeapMemoryUsed(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setNonHeapMemoryCommitted(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setNonHeapMemoryMaximum(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setNonHeapMemoryTotal(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setStartTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setNodeStartTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setUpTime(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setCurrentThreadCount(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setMaximumThreadCount(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setTotalStartedThreadCount(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setCurrentDaemonThreadCount(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setLastDataVersion(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setSentMessagesCount(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setSentBytesCount(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setReceivedMessagesCount(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setReceivedBytesCount(U.bytesToLong(data, off));
-
- off += 8;
-
- metrics.setOutboundMessagesQueueSize(U.bytesToInt(data, off));
-
- off += 4;
-
- metrics.setTotalNodes(U.bytesToInt(data, off));
-
- off += 4;
+ metrics.setLastUpdateTime(U.currentTimeMillis());
- assert off - start == METRICS_SIZE : "Invalid metrics size [expected=" + METRICS_SIZE + ", actual=" +
- (off - start) + ']';
+ metrics.setMaximumActiveJobs(buf.getInt());
+ metrics.setCurrentActiveJobs(buf.getInt());
+ metrics.setAverageActiveJobs(buf.getFloat());
+ metrics.setMaximumWaitingJobs(buf.getInt());
+ metrics.setCurrentWaitingJobs(buf.getInt());
+ metrics.setAverageWaitingJobs(buf.getFloat());
+ metrics.setMaximumRejectedJobs(buf.getInt());
+ metrics.setCurrentRejectedJobs(buf.getInt());
+ metrics.setAverageRejectedJobs(buf.getFloat());
+ metrics.setMaximumCancelledJobs(buf.getInt());
+ metrics.setCurrentCancelledJobs(buf.getInt());
+ metrics.setAverageCancelledJobs(buf.getFloat());
+ metrics.setTotalRejectedJobs(buf.getInt());
+ metrics.setTotalCancelledJobs(buf.getInt());
+ metrics.setTotalExecutedJobs(buf.getInt());
+ metrics.setMaximumJobWaitTime(buf.getLong());
+ metrics.setCurrentJobWaitTime(buf.getLong());
+ metrics.setAverageJobWaitTime(buf.getDouble());
+ metrics.setMaximumJobExecuteTime(buf.getLong());
+ metrics.setCurrentJobExecuteTime(buf.getLong());
+ metrics.setAverageJobExecuteTime(buf.getDouble());
+ metrics.setTotalExecutedTasks(buf.getInt());
+ metrics.setCurrentIdleTime(buf.getLong());
+ metrics.setTotalIdleTime(buf.getLong());
+ metrics.setAvailableProcessors(buf.getInt());
+ metrics.setCurrentCpuLoad(buf.getDouble());
+ metrics.setAverageCpuLoad(buf.getDouble());
+ metrics.setCurrentGcCpuLoad(buf.getDouble());
+ metrics.setHeapMemoryInitialized(buf.getLong());
+ metrics.setHeapMemoryUsed(buf.getLong());
+ metrics.setHeapMemoryCommitted(buf.getLong());
+ metrics.setHeapMemoryMaximum(buf.getLong());
+ metrics.setHeapMemoryTotal(buf.getLong());
+ metrics.setNonHeapMemoryInitialized(buf.getLong());
+ metrics.setNonHeapMemoryUsed(buf.getLong());
+ metrics.setNonHeapMemoryCommitted(buf.getLong());
+ metrics.setNonHeapMemoryMaximum(buf.getLong());
+ metrics.setNonHeapMemoryTotal(buf.getLong());
+ metrics.setStartTime(buf.getLong());
+ metrics.setNodeStartTime(buf.getLong());
+ metrics.setUpTime(buf.getLong());
+ metrics.setCurrentThreadCount(buf.getInt());
+ metrics.setMaximumThreadCount(buf.getInt());
+ metrics.setTotalStartedThreadCount(buf.getLong());
+ metrics.setCurrentDaemonThreadCount(buf.getInt());
+ metrics.setLastDataVersion(buf.getLong());
+ metrics.setSentMessagesCount(buf.getInt());
+ metrics.setSentBytesCount(buf.getLong());
+ metrics.setReceivedMessagesCount(buf.getInt());
+ metrics.setReceivedBytesCount(buf.getLong());
+ metrics.setOutboundMessagesQueueSize(buf.getInt());
+ metrics.setTotalNodes(buf.getInt());
+
+ assert !buf.hasRemaining() : "Invalid metrics size [expected=" + METRICS_SIZE + ", actual="
+ + (buf.position() - off) + ']';
return metrics;
}
[49/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-471' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-471
Posted by vk...@apache.org.
Merge branches 'ignite-471' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-471
Conflicts:
modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/28d4b7a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/28d4b7a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/28d4b7a5
Branch: refs/heads/ignite-471
Commit: 28d4b7a5af3b6c5937a444994e342c632e6ef89c
Parents: 3a1582a 9d183c5
Author: Valentin Kulichenko <vk...@gridgain.com>
Authored: Wed Apr 8 10:54:20 2015 -0700
Committer: Valentin Kulichenko <vk...@gridgain.com>
Committed: Wed Apr 8 10:54:20 2015 -0700
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/Ignite.java | 15 +
.../java/org/apache/ignite/IgniteCluster.java | 9 +-
.../ignite/cluster/ClusterStartNodeResult.java | 46 +
.../ignite/internal/ClusterMetricsSnapshot.java | 384 +++------
.../apache/ignite/internal/IgniteKernal.java | 55 +-
.../org/apache/ignite/internal/IgnitionEx.java | 171 ++--
.../cluster/ClusterStartNodeResultImpl.java | 87 ++
.../cluster/IgniteClusterAsyncImpl.java | 5 +-
.../internal/cluster/IgniteClusterImpl.java | 37 +-
.../internal/managers/GridManagerAdapter.java | 34 +-
.../cache/DynamicCacheChangeRequest.java | 17 +
.../cache/DynamicCacheDescriptor.java | 17 +-
.../processors/cache/GridCacheIoManager.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 350 +++++++-
.../distributed/dht/GridDhtLockFuture.java | 10 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 49 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../GridDhtPartitionsExchangeFuture.java | 1 +
.../cache/transactions/IgniteTxManager.java | 6 +-
.../ignite/internal/util/lang/GridFunc.java | 33 +
.../util/nodestart/IgniteNodeCallable.java | 30 -
.../util/nodestart/IgniteSshHelper.java | 2 +-
.../util/nodestart/StartNodeCallable.java | 30 +
.../ignite/internal/visor/cache/VisorCache.java | 2 +-
.../cache/VisorCacheAggregatedMetrics.java | 38 +-
.../visor/cache/VisorCacheConfiguration.java | 17 +-
.../internal/visor/cache/VisorCacheMetrics.java | 53 +-
.../cache/VisorCacheMetricsCollectorTask.java | 59 +-
.../visor/cache/VisorCacheStopTask.java | 69 ++
.../messages/TcpDiscoveryAbstractMessage.java | 24 +-
.../messages/TcpDiscoveryAuthFailedMessage.java | 25 +-
.../TcpDiscoveryCheckFailedMessage.java | 24 +-
.../TcpDiscoveryClientReconnectMessage.java | 30 +-
.../TcpDiscoveryCustomEventMessage.java | 23 +-
.../messages/TcpDiscoveryDiscardMessage.java | 24 +-
.../TcpDiscoveryDuplicateIdMessage.java | 24 +-
.../messages/TcpDiscoveryHandshakeRequest.java | 8 -
.../messages/TcpDiscoveryHandshakeResponse.java | 22 -
.../messages/TcpDiscoveryHeartbeatMessage.java | 44 +-
.../TcpDiscoveryJoinRequestMessage.java | 28 +-
.../TcpDiscoveryLoopbackProblemMessage.java | 28 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 24 +-
.../messages/TcpDiscoveryNodeAddedMessage.java | 60 +-
.../messages/TcpDiscoveryNodeFailedMessage.java | 28 +-
.../messages/TcpDiscoveryNodeLeftMessage.java | 8 -
.../tcp/messages/TcpDiscoveryPingRequest.java | 25 +-
.../tcp/messages/TcpDiscoveryPingResponse.java | 14 -
.../TcpDiscoveryStatusCheckMessage.java | 30 +-
.../resources/META-INF/classnames.properties | 19 +-
...eCacheConfigurationTemplateNotFoundTest.java | 114 +++
.../IgniteCacheConfigurationTemplateTest.java | 364 ++++++++
.../ignite/testframework/junits/IgniteMock.java | 10 +
.../ignite/testsuites/IgniteCacheTestSuite.java | 5 +-
.../processors/query/h2/sql/GridSqlElement.java | 8 -
.../processors/query/h2/sql/GridSqlQuery.java | 183 ++++
.../query/h2/sql/GridSqlQueryParser.java | 97 ++-
.../query/h2/sql/GridSqlQuerySplitter.java | 111 ++-
.../processors/query/h2/sql/GridSqlSelect.java | 209 ++---
.../query/h2/sql/GridSqlSubquery.java | 8 +-
.../processors/query/h2/sql/GridSqlUnion.java | 134 +++
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../h2/sql/AbstractH2CompareQueryTest.java | 341 ++++++++
.../query/h2/sql/BaseH2CompareQueryTest.java | 823 ++++++++++++++++++
.../query/h2/sql/GridQueryParsingTest.java | 26 +-
.../query/h2/sql/H2CompareBigQueryTest.java | 707 +++++++++++++++
.../query/h2/sql/IgniteVsH2QueryTest.java | 857 -------------------
.../IgniteCacheQuerySelfTestSuite.java | 5 +-
.../processors/query/h2/sql/bigQuery.sql | 55 ++
.../org/apache/ignite/IgniteSpringBean.java | 14 +
.../util/nodestart/IgniteNodeCallableImpl.java | 308 -------
.../util/nodestart/IgniteSshHelperImpl.java | 4 +-
.../util/nodestart/StartNodeCallableImpl.java | 309 +++++++
...gniteProjectionStartStopRestartSelfTest.java | 261 +++---
.../IgniteStartStopRestartTestSuite.java | 1 +
.../commands/cache/VisorCacheClearCommand.scala | 3 +-
.../commands/cache/VisorCacheCommand.scala | 423 +++++----
.../commands/cache/VisorCacheStopCommand.scala | 145 ++++
.../commands/start/VisorStartCommand.scala | 4 +-
.../scala/org/apache/ignite/visor/visor.scala | 12 +-
79 files changed, 4957 insertions(+), 2728 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/28d4b7a5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 1efe91f,35cfd0c..8ed2660
--- 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
@@@ -60,9 -60,9 +60,10 @@@ import org.jetbrains.annotations.*
import javax.cache.configuration.*;
import javax.cache.integration.*;
+ import javax.cache.processor.*;
import javax.management.*;
import java.io.*;
+import java.nio.*;
import java.util.*;
import java.util.concurrent.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/28d4b7a5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
[03/50] [abbrv] incubator-ignite git commit: # ignite-680
Posted by vk...@apache.org.
# ignite-680
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/86f23de5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/86f23de5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/86f23de5
Branch: refs/heads/ignite-471
Commit: 86f23de5cf8b308c25072e46cd3efdc31e9eb545
Parents: bf7fdb2
Author: sboikov <se...@inria.fr>
Authored: Tue Apr 7 06:14:46 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Tue Apr 7 06:14:46 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 63 +++++++++++++++++++-
1 file changed, 62 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86f23de5/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 7deb9fb..ca3b896 100644
--- 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
@@ -942,7 +942,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
ctx.kernalContext().continuous().onCacheStop(ctx);
U.stopLifecycleAware(log, lifecycleAwares(cache.configuration(), ctx.jta().tmLookup(),
- ctx.store().configuredStore()));
+ ctx.store().configuredStore()));
if (log.isInfoEnabled())
log.info("Stopped cache: " + cache.name());
@@ -2442,6 +2442,16 @@ public class GridCacheProcessor extends GridProcessorAdapter {
private void addCacheConfigurations(Collection<CacheConfiguration> cfgs) throws IgniteCheckedException {
GridCacheAdapter<CacheTemplateConfigurationKey, TemplateConfigurations> utilityCache = utilityCache();
+ TemplateConfigurations templates =
+ utilityCache.localPeek(new CacheTemplateConfigurationKey(), CachePeekModes.ONHEAP_ONLY, null);
+
+ if (templates != null) {
+ cfgs = templates.needAdd(cfgs);
+
+ if (cfgs == null)
+ return;
+ }
+
final int RETRY_CNT = 5;
for (int i = 0; i < RETRY_CNT; i++) {
@@ -2766,6 +2776,57 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * Checks if need to add new templates.
+ *
+ * @param cfgs Templates to add.
+ * @return Templates which should be added.
+ */
+ @Nullable Collection<CacheConfiguration> needAdd(Collection<CacheConfiguration> cfgs) {
+ Collection<CacheConfiguration> res = null;
+
+ for (CacheConfiguration cfg : cfgs) {
+ boolean found = false;
+
+ if (cfg.getName() != null && cfg.getName().endsWith("*")) {
+ String name0 = cfg.getName().substring(0, cfg.getName().length() - 1);
+
+ if (wildcardNameCfgs != null) {
+ for (CacheConfiguration cfg0 : wildcardNameCfgs) {
+ if (F.eq(cfg0.getName(), name0)) {
+ found = true;
+
+ break;
+ }
+ }
+ }
+ }
+ else {
+ if (exactNameCfgs != null) {
+ for (CacheConfiguration cfg0 : exactNameCfgs) {
+ if (F.eq(cfg0.getName(), cfg.getName())) {
+ found = true;
+
+ break;
+ }
+ }
+ }
+ }
+
+ if (!found) {
+ if (res == null)
+ res = new ArrayList<>();
+
+ System.out.println(Thread.currentThread().getName() + " need add: " + cfg + " " + exactNameCfgs);
+
+
+ res.add(cfg);
+ }
+ }
+
+ return res;
+ }
+
+ /**
* @param cfgs Configurations to add.
*/
void add(Collection<CacheConfiguration> cfgs) {
[08/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-sprint-3' into ignite-680
Posted by vk...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-680
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/414882cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/414882cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/414882cf
Branch: refs/heads/ignite-471
Commit: 414882cfd2e21b961c2d766c5b78a2665336e914
Parents: 86f23de e144a68
Author: sboikov <sb...@gridgain.com>
Authored: Tue Apr 7 09:10:03 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Apr 7 09:10:03 2015 +0300
----------------------------------------------------------------------
assembly/release-fabric.xml | 5 -
modules/clients/readme.md | 2 -
.../cache/eviction/fifo/FifoEvictionPolicy.java | 58 ++-
.../eviction/fifo/FifoEvictionPolicyMBean.java | 16 +
.../store/jdbc/CacheAbstractJdbcStore.java | 104 +++--
.../apache/ignite/internal/GridComponent.java | 2 +-
.../ignite/internal/GridKernalContextImpl.java | 3 +-
.../ignite/internal/GridPluginComponent.java | 4 +-
.../org/apache/ignite/internal/IgniteEx.java | 7 -
.../apache/ignite/internal/IgniteKernal.java | 25 +-
.../ignite/internal/IgniteNodeAttributes.java | 3 -
.../internal/managers/GridManagerAdapter.java | 6 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../processors/cache/CacheDistributionMode.java | 67 ----
.../processors/cache/GridCacheProcessor.java | 6 +-
.../DiscoveryNodeValidationProcessor.java | 27 ++
.../OsDiscoveryNodeValidationProcessor.java | 72 ++++
.../processors/query/GridQueryProcessor.java | 8 +-
.../ignite/internal/util/IgniteUtils.java | 46 ++-
.../ignite/internal/visor/cache/VisorCache.java | 19 +-
.../VisorCacheConfigurationCollectorJob.java | 76 ++++
.../VisorCacheConfigurationCollectorTask.java | 39 ++
.../VisorIgfsProfilerUniformityCounters.java | 6 +-
.../visor/node/VisorGridConfiguration.java | 38 --
.../visor/node/VisorIgfsConfiguration.java | 2 +-
.../visor/node/VisorRestConfiguration.java | 1 +
.../internal/visor/util/VisorTaskUtils.java | 21 +-
.../ignite/spi/IgniteNodeValidationResult.java | 66 ++++
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 2 +-
.../org/apache/ignite/spi/IgniteSpiContext.java | 2 +-
.../spi/IgniteSpiNodeValidationResult.java | 66 ----
.../spi/discovery/tcp/TcpDiscoverySpi.java | 106 +----
.../org/apache/ignite/stream/StreamVisitor.java | 2 +-
.../IgniteCollectionAbstractTest.java | 23 --
...GridCacheDhtEvictionNearReadersSelfTest.java | 2 +-
.../near/GridCacheNearEvictionSelfTest.java | 2 +-
...ePartitionedBasicStoreMultiNodeSelfTest.java | 8 +-
...NearDisabledBasicStoreMultiNodeSelfTest.java | 8 +-
.../eviction/GridCacheEvictionAbstractTest.java | 5 +-
...ridCacheFifoBatchEvictionPolicySelfTest.java | 385 +++++++++++++++++++
.../testframework/GridSpiTestContext.java | 2 +-
.../HadoopDefaultMapReducePlannerSelfTest.java | 5 -
.../query/h2/sql/GridSqlQuerySplitter.java | 22 +-
.../h2/twostep/GridReduceQueryExecutor.java | 15 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 6 +-
...niteCacheAtomicNearEnabledQuerySelfTest.java | 7 +-
.../near/IgniteCacheAtomicQuerySelfTest.java | 7 +-
.../query/h2/sql/GridQueryParsingTest.java | 1 +
.../query/h2/sql/IgniteVsH2QueryTest.java | 7 +
modules/schedule/pom.xml | 20 +
.../commands/cache/VisorCacheCommand.scala | 26 +-
.../config/VisorConfigurationCommand.scala | 15 +-
.../visor/commands/gc/VisorGcCommand.scala | 15 +-
.../scala/org/apache/ignite/visor/visor.scala | 34 +-
modules/yardstick/README.md | 3 +-
.../yardstick/config/benchmark-store.properties | 5 +-
.../yardstick/IgniteAbstractBenchmark.java | 5 +-
.../yardstick/IgniteBenchmarkArguments.java | 22 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 11 +-
parent/pom.xml | 49 +--
pom.xml | 143 ++++++-
61 files changed, 1238 insertions(+), 524 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414882cf/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414882cf/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414882cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
[41/50] [abbrv] incubator-ignite git commit: # Minor fix to cache
object processor.
Posted by vk...@apache.org.
# Minor fix to cache object processor.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7eef373a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7eef373a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7eef373a
Branch: refs/heads/ignite-471
Commit: 7eef373aa8ba17561c9d89dfbc6c0af8bbc23ec9
Parents: 71439bc
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Apr 8 17:54:56 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Apr 8 17:55:49 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/IgniteKernal.java | 11 ++++++++++-
.../internal/processors/cache/GridCacheProcessor.java | 11 ++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7eef373a/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 88bec0f..768bbd3 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
@@ -2240,10 +2240,19 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
/** {@inheritDoc} */
@Override public <K, V> IgniteCache<K, V> cache(@Nullable String name) {
+ return cache(name, true);
+ }
+
+ /**
+ * @param name Cache name.
+ * @param failIfSys Fail if requestsed cache is system cache.
+ * @return Cache.
+ */
+ public <K, V> IgniteCache<K, V> cache(@Nullable String name, boolean failIfSys) {
guard();
try {
- return ctx.cache().publicJCache(name);
+ return ctx.cache().publicJCache(name, true, failIfSys);
}
catch (IgniteCheckedException e) {
throw CU.convertToCacheException(e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7eef373a/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 fcf65b9..35cfd0c 100644
--- 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
@@ -1713,7 +1713,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
*/
public IgniteInternalFuture<?> dynamicStartCache(String cacheName) {
try {
- if (publicJCache(cacheName, false) != null) // Cache with given name already started.
+ if (publicJCache(cacheName, false, true) != null) // Cache with given name already started.
return new GridFinishedFuture<>();
CacheConfiguration cfgTemplate = null;
@@ -2483,21 +2483,22 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @throws IgniteCheckedException If failed.
*/
public <K, V> IgniteCache<K, V> publicJCache(@Nullable String cacheName) throws IgniteCheckedException {
- return publicJCache(cacheName, true);
+ return publicJCache(cacheName, true, true);
}
/**
* @param cacheName Cache name.
* @param failIfNotStarted If {@code true} throws {@link IllegalArgumentException} if cache is not started,
* otherwise returns {@code null} in this case.
+ * @param failIfSys Fail is cache is system.
* @param <K> type of keys.
* @param <V> type of values.
* @return Cache instance for given name.
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
- @Nullable private <K, V> IgniteCache<K, V> publicJCache(@Nullable String cacheName, boolean failIfNotStarted)
- throws IgniteCheckedException
+ @Nullable public <K, V> IgniteCache<K, V> publicJCache(@Nullable String cacheName, boolean failIfNotStarted,
+ boolean failIfSys) throws IgniteCheckedException
{
if (log.isDebugEnabled())
log.debug("Getting public cache for name: " + cacheName);
@@ -2508,7 +2509,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
DynamicCacheDescriptor desc = registeredCaches.get(masked);
- if (desc != null && !desc.cacheType().userCache())
+ if (desc != null && !desc.cacheType().userCache() && failIfSys)
throw new IllegalStateException("Failed to get cache because it is a system cache: " + cacheName);
if (cache == null) {
[30/50] [abbrv] incubator-ignite git commit: # IGNITE-700: Done.
Posted by vk...@apache.org.
# IGNITE-700: Done.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/21c8e893
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/21c8e893
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/21c8e893
Branch: refs/heads/ignite-471
Commit: 21c8e893e2170ae7ab11761676ddb4f2dce912f9
Parents: 080376a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Apr 8 12:59:17 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Apr 8 12:59:17 2015 +0300
----------------------------------------------------------------------
.../processors/cache/transactions/IgniteTxManager.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/21c8e893/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 12f57b4..13db6c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -1263,7 +1263,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
// 15. Update metrics.
if (!tx.dht() && tx.local()) {
- cctx.txMetrics().onTxCommit();
+ if (!tx.system())
+ cctx.txMetrics().onTxCommit();
for (int cacheId : tx.activeCacheIds()) {
GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
@@ -1337,7 +1338,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
// 11. Update metrics.
if (!tx.dht() && tx.local()) {
- cctx.txMetrics().onTxRollback();
+ if (!tx.system())
+ cctx.txMetrics().onTxRollback();
for (int cacheId : tx.activeCacheIds()) {
GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
[47/50] [abbrv] incubator-ignite git commit: ignite-437: test for
bigQuery sql
Posted by vk...@apache.org.
ignite-437: test for bigQuery sql
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fe743909
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fe743909
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fe743909
Branch: refs/heads/ignite-471
Commit: fe743909cf483d00ab5189049523ed3353bf5a3d
Parents: 2f458d2
Author: Artem Shutak <as...@gridgain.com>
Authored: Wed Apr 8 19:55:29 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Wed Apr 8 19:55:29 2015 +0300
----------------------------------------------------------------------
.../h2/sql/AbstractH2CompareQueryTest.java | 341 ++++++++
.../query/h2/sql/BaseH2CompareQueryTest.java | 823 +++++++++++++++++
.../query/h2/sql/H2CompareBigQueryTest.java | 707 +++++++++++++++
.../query/h2/sql/IgniteVsH2QueryTest.java | 875 -------------------
.../IgniteCacheQuerySelfTestSuite.java | 5 +-
.../processors/query/h2/sql/bigQuery.sql | 55 ++
6 files changed, 1929 insertions(+), 877 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe743909/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java
new file mode 100644
index 0000000..c74493f
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java
@@ -0,0 +1,341 @@
+/*
+ * 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.h2.sql;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jetbrains.annotations.*;
+
+import java.sql.*;
+import java.util.*;
+
+/**
+ * Abstract test framework to compare query results from h2 database instance and mixed ignite caches (replicated and partitioned)
+ * which have the same data models and data content.
+ */
+public abstract class AbstractH2CompareQueryTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Partitioned cache. */
+ protected static IgniteCache pCache;
+
+ /** Replicated cache. */
+ protected static IgniteCache rCache;
+
+ /** H2 db connection. */
+ protected static Connection conn;
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration c = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ c.setDiscoverySpi(disco);
+
+ c.setMarshaller(new OptimizedMarshaller(true));
+
+ c.setCacheConfiguration(createCache("part", CacheMode.PARTITIONED),
+ createCache("repl", CacheMode.REPLICATED)
+ );
+
+ return c;
+ }
+
+ /**
+ * Creates new cache configuration.
+ *
+ * @param name Cache name.
+ * @param mode Cache mode.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration createCache(String name, CacheMode mode) {
+ CacheConfiguration<?,?> cc = defaultCacheConfiguration();
+
+ cc.setName(name);
+ cc.setCacheMode(mode);
+ cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+ cc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
+ setIndexedTypes(cc, mode);
+
+ return cc;
+ }
+
+ /**
+ * @param cc Cache configuration.
+ * @param mode Cache Mode.
+ */
+ protected abstract void setIndexedTypes(CacheConfiguration<?, ?> cc, CacheMode mode) ;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ Ignite ignite = startGrids(4);
+
+ pCache = ignite.cache("part");
+
+ rCache = ignite.cache("repl");
+
+ awaitPartitionMapExchange();
+
+ conn = openH2Connection(false);
+
+ initializeH2Schema();
+
+ initCacheAndDbData();
+
+ checkAllDataEquals();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ conn.close();
+
+ stopAllGrids();
+ }
+
+ /**
+ * Populate cache and h2 database with test data.
+ */
+ protected abstract void initCacheAndDbData() throws SQLException;
+
+ /**
+ * @throws Exception If failed.
+ */
+ protected abstract void checkAllDataEquals() throws Exception;
+
+ /**
+ * Initialize h2 database schema.
+ *
+ * @throws SQLException If exception.
+ */
+ protected abstract void initializeH2Schema() throws SQLException;
+
+ /**
+ * Gets connection from a pool.
+ *
+ * @param autocommit {@code true} If connection should use autocommit mode.
+ * @return Pooled connection.
+ * @throws SQLException In case of error.
+ */
+ private Connection openH2Connection(boolean autocommit) throws SQLException {
+ System.setProperty("h2.serializeJavaObject", "false");
+
+ String dbName = "test";
+
+ Connection conn = DriverManager.getConnection("jdbc:h2:mem:" + dbName + ";DB_CLOSE_DELAY=-1");
+
+ conn.setAutoCommit(autocommit);
+
+ return conn;
+ }
+
+ /**
+ * Execute given sql query on h2 database and on partitioned ignite cache and compare results.
+ *
+ * @param sql SQL query.
+ * @param args SQL arguments.
+ * then results will compare as ordered queries.
+ * @return Result set after SQL query execution.
+ * @throws SQLException If exception.
+ */
+ protected final List<List<?>> compareQueryRes0(String sql, @Nullable Object... args) throws SQLException {
+ return compareQueryRes0(pCache, sql, args, Ordering.RANDOM);
+ }
+
+ /**
+ * Execute given sql query on h2 database and on ignite cache and compare results.
+ * Expected that results are not ordered.
+ *
+ * @param cache Ignite cache.
+ * @param sql SQL query.
+ * @param args SQL arguments.
+ * then results will compare as ordered queries.
+ * @return Result set after SQL query execution.
+ * @throws SQLException If exception.
+ */
+ protected final List<List<?>> compareQueryRes0(IgniteCache cache, String sql, @Nullable Object... args) throws SQLException {
+ return compareQueryRes0(cache, sql, args, Ordering.RANDOM);
+ }
+
+ /**
+ * Execute given sql query on h2 database and on partitioned ignite cache and compare results.
+ * Expected that results are ordered.
+ *
+ * @param sql SQL query.
+ * @param args SQL arguments.
+ * then results will compare as ordered queries.
+ * @return Result set after SQL query execution.
+ * @throws SQLException If exception.
+ */
+ protected final List<List<?>> compareOrderedQueryRes0(String sql, @Nullable Object... args) throws SQLException {
+ return compareQueryRes0(pCache, sql, args, Ordering.ORDERED);
+ }
+
+ /**
+ * Execute given sql query on h2 database and on ignite cache and compare results.
+ *
+ * @param cache Ignite cache.
+ * @param sql SQL query.
+ * @param args SQL arguments.
+ * @param ordering Expected ordering of SQL results. If {@link Ordering#ORDERED}
+ * then results will compare as ordered queries.
+ * @return Result set after SQL query execution.
+ * @throws SQLException If exception.
+ */
+ @SuppressWarnings("unchecked")
+ protected final List<List<?>> compareQueryRes0(IgniteCache cache, String sql, @Nullable Object[] args, Ordering ordering) throws SQLException {
+ if (args == null)
+ args = new Object[] {null};
+
+ info("Sql query:\n" + sql + "\nargs=" + Arrays.toString(args));
+
+ List<List<?>> h2Res = executeH2Query(sql, args);
+
+ List<List<?>> cacheRes = cache.query(new SqlFieldsQuery(sql).setArgs(args)).getAll();
+
+ assertRsEquals(h2Res, cacheRes, ordering);
+
+ return h2Res;
+ }
+
+ /**
+ * Execute SQL query on h2 database.
+ *
+ * @param sql SQL query.
+ * @param args SQL arguments.
+ * @return Result of SQL query on h2 database.
+ * @throws SQLException If exception.
+ */
+ private List<List<?>> executeH2Query(String sql, Object[] args) throws SQLException {
+ List<List<?>> res = new ArrayList<>();
+ ResultSet rs = null;
+
+ try(PreparedStatement st = conn.prepareStatement(sql)) {
+ for (int idx = 0; idx < args.length; idx++)
+ st.setObject(idx + 1, args[idx]);
+
+ rs = st.executeQuery();
+
+ int colCnt = rs.getMetaData().getColumnCount();
+
+ while (rs.next()) {
+ List<Object> row = new ArrayList<>(colCnt);
+
+ for (int i = 1; i <= colCnt; i++)
+ row.add(rs.getObject(i));
+
+ res.add(row);
+ }
+ }
+ finally {
+ U.closeQuiet(rs);
+ }
+
+ return res;
+ }
+
+ /**
+ * Assert equals of result sets according to expected ordering.
+ *
+ * @param rs1 Expected result set.
+ * @param rs2 Actual result set.
+ * @param ordering Expected ordering of SQL results. If {@link Ordering#ORDERED}
+ * then results will compare as ordered queries.
+ */
+ private void assertRsEquals(List<List<?>> rs1, List<List<?>> rs2, Ordering ordering) {
+ assertEquals("Rows count has to be equal.", rs1.size(), rs2.size());
+
+ switch (ordering){
+ case ORDERED:
+ for (int rowNum = 0; rowNum < rs1.size(); rowNum++) {
+ List<?> row1 = rs1.get(rowNum);
+ List<?> row2 = rs2.get(rowNum);
+
+ assertEquals("Columns count have to be equal.", row1.size(), row2.size());
+
+ for (int colNum = 0; colNum < row1.size(); colNum++)
+ assertEquals("Row=" + rowNum + ", column=" + colNum, row1.get(colNum), row2.get(colNum));
+ }
+
+ break;
+ case RANDOM:
+ Map<List<?>, Integer> rowsWithCnt1 = extractUniqueRowsWithCounts(rs1);
+ Map<List<?>, Integer> rowsWithCnt2 = extractUniqueRowsWithCounts(rs2);
+
+ assertEquals("Unique rows count has to be equal.", rowsWithCnt1.size(), rowsWithCnt2.size());
+
+ for (Map.Entry<List<?>, Integer> entry1 : rowsWithCnt1.entrySet()) {
+ List<?> row = entry1.getKey();
+ Integer cnt1 = entry1.getValue();
+
+ Integer cnt2 = rowsWithCnt2.get(row);
+
+ assertEquals("Row has different occurance number.\nRow=" + row, cnt1, cnt2);
+ }
+
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ * @param rs Result set.
+ * @return Map of unique rows at the result set to number of occuriances at the result set.
+ */
+ private Map<List<?>, Integer> extractUniqueRowsWithCounts(Iterable<List<?>> rs) {
+ Map<List<?>, Integer> res = new HashMap<>();
+
+ for (List<?> row : rs) {
+ Integer cnt = res.get(row);
+
+ if (cnt == null)
+ cnt = 0;
+
+ res.put(row, cnt + 1);
+ }
+ return res;
+ }
+
+ /**
+ * Ordering type.
+ */
+ protected enum Ordering {
+ /** Random. */
+ RANDOM,
+ /** Ordered. */
+ ORDERED
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe743909/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
new file mode 100644
index 0000000..eea834d
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
@@ -0,0 +1,823 @@
+/*
+ * 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.h2.sql;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+
+import java.io.*;
+import java.sql.*;
+import java.sql.Date;
+import java.util.*;
+
+/**
+ * Base set of queries to compare query results from h2 database instance and mixed ignite caches (replicated and partitioned)
+ * which have the same data models and data content.
+ */
+public class BaseH2CompareQueryTest extends AbstractH2CompareQueryTest {
+ /** Org count. */
+ public static final int ORG_CNT = 30;
+
+ /** Address count. */
+ public static final int ADDR_CNT = 10;
+
+ /** Person count. */
+ public static final int PERS_CNT = 50;
+
+ /** Product count. */
+ public static final int PROD_CNT = 100;
+
+ /** Purchase count. */
+ public static final int PURCH_CNT = PROD_CNT * 5;
+
+ /** {@inheritDoc} */
+ @Override protected void setIndexedTypes(CacheConfiguration<?, ?> cc, CacheMode mode) {
+ if (mode == CacheMode.PARTITIONED)
+ cc.setIndexedTypes(
+ Integer.class, Organization.class,
+ AffinityKey.class, Person.class,
+ AffinityKey.class, Purchase.class
+ );
+ else if (mode == CacheMode.REPLICATED)
+ cc.setIndexedTypes(
+ Integer.class, Product.class,
+ Integer.class, Address.class
+ );
+ else
+ throw new IllegalStateException("mode: " + mode);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override protected void initCacheAndDbData() throws SQLException {
+ int idGen = 0;
+
+ // Organizations.
+ List<Organization> organizations = new ArrayList<>();
+
+ for (int i = 0; i < ORG_CNT; i++) {
+ int id = idGen++;
+
+ Organization org = new Organization(id, "Org" + id);
+
+ organizations.add(org);
+
+ pCache.put(org.id, org);
+
+ insertInDb(org);
+ }
+
+ // Adresses.
+ List<Address> addreses = new ArrayList<>();
+
+ for (int i = 0; i < ADDR_CNT; i++) {
+ int id = idGen++;
+
+ Address addr = new Address(id, "Addr" + id);
+
+ addreses.add(addr);
+
+ rCache.put(addr.id, addr);
+
+ insertInDb(addr);
+ }
+
+ // Persons.
+ List<Person> persons = new ArrayList<>();
+
+ for (int i = 0; i < PERS_CNT; i++) {
+ int id = idGen++;
+
+ Person person = new Person(id, organizations.get(i % organizations.size()),
+ "name" + id, "lastName" + id, id * 100.0, addreses.get(i % addreses.size()));
+
+ // Add a Person without lastname.
+ if (id == organizations.size() + 1)
+ person.lastName = null;
+
+ persons.add(person);
+
+ pCache.put(person.key(), person);
+
+ insertInDb(person);
+ }
+
+ // Products.
+ List<Product> products = new ArrayList<>();
+
+ for (int i = 0; i < PROD_CNT; i++) {
+ int id = idGen++;
+
+ Product product = new Product(id, "Product" + id, id*1000);
+
+ products.add(product);
+
+ rCache.put(product.id, product);
+
+ insertInDb(product);
+ }
+
+ // Purchases.
+ for (int i = 0; i < PURCH_CNT; i++) {
+ int id = idGen++;
+
+ Person person = persons.get(i % persons.size());
+
+ Purchase purchase = new Purchase(id, products.get(i % products.size()), person.orgId, person);
+
+ pCache.put(purchase.key(), purchase);
+
+ insertInDb(purchase);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void checkAllDataEquals() throws Exception {
+ compareQueryRes0("select _key, _val, id, name from \"part\".Organization");
+
+ compareQueryRes0("select _key, _val, id, firstName, lastName, orgId, salary from \"part\".Person");
+
+ compareQueryRes0("select _key, _val, id, personId, productId, organizationId from \"part\".Purchase");
+
+ compareQueryRes0(rCache, "select _key, _val, id, name, price from \"repl\".Product");
+ }
+
+ /**
+ * *
+ * @throws Exception
+ */
+ public void testAllExamples() throws Exception {
+// compareQueryRes0("select ? limit ? offset ?");
+
+// compareQueryRes0("select cool1()");
+// compareQueryRes0("select cool1() z");
+//
+// compareQueryRes0("select b,a from table0('aaa', 100)");
+// compareQueryRes0("select * from table0('aaa', 100)");
+// compareQueryRes0("select * from table0('aaa', 100) t0");
+// compareQueryRes0("select x.a, y.b from table0('aaa', 100) x natural join table0('bbb', 100) y");
+// compareQueryRes0("select * from table0('aaa', 100) x join table0('bbb', 100) y on x.a=y.a and x.b = 'bbb'");
+// compareQueryRes0("select * from table0('aaa', 100) x left join table0('bbb', 100) y on x.a=y.a and x.b = 'bbb'");
+// compareQueryRes0("select * from table0('aaa', 100) x left join table0('bbb', 100) y on x.a=y.a where x.b = 'bbb'");
+// compareQueryRes0("select * from table0('aaa', 100) x left join table0('bbb', 100) y where x.b = 'bbb'");
+
+ final String addStreet = "Addr" + ORG_CNT + 1;
+
+ List<List<?>> res = compareQueryRes0("select avg(old) from \"part\".Person left join \"repl\".Address " +
+ " on Person.addrId = Address.id where lower(Address.street) = lower(?)", addStreet);
+
+ assertNotSame(0, res);
+
+ compareQueryRes0("select avg(old) from \"part\".Person join \"repl\".Address on Person.addrId = Address.id " +
+ "where lower(Address.street) = lower(?)", addStreet);
+
+ compareQueryRes0("select avg(old) from \"part\".Person left join \"repl\".Address where Person.addrId = Address.id " +
+ "and lower(Address.street) = lower(?)", addStreet);
+
+ compareQueryRes0("select avg(old) from \"part\".Person, \"repl\".Address where Person.addrId = Address.id " +
+ "and lower(Address.street) = lower(?)", addStreet);
+
+ compareQueryRes0("select firstName, date from \"part\".Person");
+ compareQueryRes0("select distinct firstName, date from \"part\".Person");
+
+ final String star = " _key, _val, id, firstName, lastName, orgId, salary, addrId, old, date ";
+
+ compareQueryRes0("select " + star + " from \"part\".Person p");
+ compareQueryRes0("select " + star + " from \"part\".Person");
+ compareQueryRes0("select distinct " + star + " from \"part\".Person");
+ compareQueryRes0("select p.firstName, date from \"part\".Person p");
+
+ compareQueryRes0("select p._key, p._val, p.id, p.firstName, p.lastName, p.orgId, p.salary, p.addrId, p.old, " +
+ " p.date, a._key, a._val, a.id, a.street" +
+ " from \"part\".Person p, \"repl\".Address a");
+// compareQueryRes0("select p.* from \"part\".Person p, \"repl\".Address a");
+// compareQueryRes0("select person.* from \"part\".Person, \"repl\".Address a");
+// compareQueryRes0("select p.*, street from \"part\".Person p, \"repl\".Address a");
+ compareQueryRes0("select p.firstName, a.street from \"part\".Person p, \"repl\".Address a");
+ compareQueryRes0("select distinct p.firstName, a.street from \"part\".Person p, \"repl\".Address a");
+ compareQueryRes0("select distinct firstName, street from \"part\".Person, \"repl\".Address group by firstName, street ");
+ compareQueryRes0("select distinct firstName, street from \"part\".Person, \"repl\".Address");
+ // TODO uncomment and investigate (Rows count has to be equal.: Expected :2500, Actual :900)
+// compareQueryRes0("select p1.firstName, a2.street from \"part\".Person p1, \"repl\".Address a1, \"part\".Person p2, \"repl\".Address a2");
+
+ //TODO look at it (org.h2.jdbc.JdbcSQLException: Feature not supported: "VARCHAR +" // at H2)
+// compareQueryRes0("select p.firstName n, a.street s from \"part\".Person p, \"repl\".Address a");
+ compareQueryRes0("select p.firstName, 1 as i, 'aaa' s from \"part\".Person p");
+
+// compareQueryRes0("select p.firstName + 'a', 1 * 3 as i, 'aaa' s, -p.old, -p.old as old from \"part\".Person p");
+// compareQueryRes0("select p.firstName || 'a' + p.firstName, (p.old * 3) % p.old - p.old / p.old, p.firstName = 'aaa', " +
+// " p.firstName is p.firstName, p.old > 0, p.old >= 0, p.old < 0, p.old <= 0, p.old <> 0, p.old is not p.old, " +
+// " p.old is null, p.old is not null " +
+// " from \"part\".Person p");
+
+ compareQueryRes0("select p.firstName from \"part\".Person p where firstName <> 'ivan'");
+ compareQueryRes0("select p.firstName from \"part\".Person p where firstName like 'i%'");
+ compareQueryRes0("select p.firstName from \"part\".Person p where firstName regexp 'i%'");
+ compareQueryRes0("select p.firstName from \"part\".Person p, \"repl\".Address a where p.firstName <> 'ivan' and a.id > 10 or not (a.id = 100)");
+
+ compareQueryRes0("select case p.firstName when 'a' then 1 when 'a' then 2 end as a from \"part\".Person p");
+ compareQueryRes0("select case p.firstName when 'a' then 1 when 'a' then 2 else -1 end as a from \"part\".Person p");
+
+ compareQueryRes0("select abs(p.old) from \"part\".Person p");
+ compareQueryRes0("select cast(p.old as numeric(10, 2)) from \"part\".Person p");
+ compareQueryRes0("select cast(p.old as numeric(10, 2)) z from \"part\".Person p");
+ compareQueryRes0("select cast(p.old as numeric(10, 2)) as z from \"part\".Person p");
+
+ // TODO alanyse
+// compareQueryRes0("select " + star + " from \"part\".Person p where p.firstName in ('a', 'b', '_' + RAND())"); // test ConditionIn
+ compareQueryRes0("select " + star + " from \"part\".Person p where p.firstName in ('a', 'b', 'c')"); // test ConditionInConstantSet
+ compareQueryRes0("select " + star + " from \"part\".Person p where p.firstName in (select a.street from \"repl\".Address a)"); // test ConditionInConstantSet
+
+ compareQueryRes0("select (select a.street from \"repl\".Address a where a.id = p.addrId) from \"part\".Person p"); // test ConditionInConstantSet
+
+ compareQueryRes0("select p.firstName, ? from \"part\".Person p where firstName regexp ? and p.old < ?", 10, "Iv*n", 40);
+
+ compareQueryRes0("select count(*) as a from \"part\".Person");
+ compareQueryRes0("select count(*) as a, count(p.*), count(p.firstName) from \"part\".Person p");
+ compareQueryRes0("select count(distinct p.firstName) from \"part\".Person p");
+
+ compareQueryRes0("select p.firstName, avg(p.old), max(p.old) from \"part\".Person p group by p.firstName");
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.firstName");
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by n");
+
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.addrId, p.firstName");
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.firstName, p.addrId");
+ compareQueryRes0("select p.firstName n, max(p.old) + min(p.old) / count(distinct p.old) from \"part\".Person p group by p.firstName");
+ compareQueryRes0("select p.firstName n, max(p.old) maxOld, min(p.old) minOld from \"part\".Person p group by p.firstName having maxOld > 10 and min(p.old) < 1");
+
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.firstName order by n");
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.firstName order by p.firstName");
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.firstName order by p.firstName, m");
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.firstName order by p.firstName, max(p.old) desc");
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.firstName order by p.firstName nulls first");
+ compareQueryRes0("select p.firstName n, avg(p.old) a, max(p.old) m from \"part\".Person p group by p.firstName order by p.firstName nulls last");
+ compareQueryRes0("select p.firstName n from \"part\".Person p order by p.old + 10");
+ compareQueryRes0("select p.firstName n from \"part\".Person p order by p.old + 10, p.firstName");
+ compareQueryRes0("select p.firstName n from \"part\".Person p order by p.old + 10, p.firstName desc");
+
+ compareQueryRes0("select p.firstName n from \"part\".Person p, (select a.street from \"repl\".Address a where a.street is not null) ");
+ compareQueryRes0("select street from \"part\".Person p, (select a.street from \"repl\".Address a where a.street is not null) ");
+ compareQueryRes0("select addr.street from \"part\".Person p, (select a.street from \"repl\".Address a where a.street is not null) addr");
+
+ compareQueryRes0("select p.firstName n from \"part\".Person p order by p.old + 10");
+
+ compareQueryRes0("select 'foo' as bar union select 'foo' as bar");
+ compareQueryRes0("select 'foo' as bar union all select 'foo' as bar");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testParamSubstitution() throws Exception {
+ compareQueryRes0("select ? from \"part\".Person", "Some arg");
+ }
+
+ /**
+ * @throws SQLException If failed.
+ */
+ public void testAggregateOrderBy() throws SQLException {
+ compareOrderedQueryRes0("select firstName name, count(*) cnt from \"part\".Person group by name order by cnt desc");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNullParamSubstitution() throws Exception {
+ List<List<?>> rs1 = compareQueryRes0("select id from \"part\".Person where lastname is ?", null);
+
+ // Ensure we find something.
+ assertNotSame(0, rs1.size());
+ }
+
+ /**
+ *
+ */
+ public void testUnion() throws SQLException {
+ String base = "select _val v from \"part\".Person";
+
+ compareQueryRes0(base + " union all " + base);
+ compareQueryRes0(base + " union " + base);
+
+ base = "select firstName||lastName name, salary from \"part\".Person";
+
+ assertEquals(10, compareOrderedQueryRes0(base + " union all " + base + " order by salary desc").size());
+ assertEquals(5, compareOrderedQueryRes0(base + " union " + base + " order by salary desc").size());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testEmptyResult() throws Exception {
+ compareQueryRes0("select id from \"part\".Person where 0 = 1");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSqlQueryWithAggregation() throws Exception {
+ compareQueryRes0("select avg(salary) from \"part\".Person, \"part\".Organization where Person.orgId = Organization.id and "
+ + "lower(Organization.name) = lower(?)", "Org1");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSqlFieldsQuery() throws Exception {
+ compareQueryRes0("select concat(firstName, ' ', lastName) from \"part\".Person");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSqlFieldsQueryWithJoin() throws Exception {
+ compareQueryRes0("select concat(firstName, ' ', lastName), "
+ + "Organization.name from \"part\".Person, \"part\".Organization where "
+ + "Person.orgId = Organization.id");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testOrdered() throws Exception {
+ compareOrderedQueryRes0("select firstName, lastName" +
+ " from \"part\".Person" +
+ " order by lastName, firstName"
+ );
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSimpleJoin() throws Exception {
+ // Have expected results.
+ compareQueryRes0("select id, firstName, lastName" +
+ " from \"part\".Person" +
+ " where Person.id = ?", 3);
+
+ // Ignite cache return 0 results...
+ compareQueryRes0("select pe.firstName" +
+ " from \"part\".Person pe join \"part\".Purchase pu on pe.id = pu.personId " +
+ " where pe.id = ?", 3);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSimpleReplicatedSelect() throws Exception {
+ compareQueryRes0(rCache, "select id, name from \"repl\".Product");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void _testCrossCache() throws Exception {
+ //TODO Investigate (should be 20 results instead of 0).
+ compareQueryRes0("select firstName, lastName" +
+ " from \"part\".Person, \"part\".Purchase" +
+ " where Person.id = Purchase.personId");
+
+ //TODO Investigate.
+ compareQueryRes0("select concat(firstName, ' ', lastName), Product.name " +
+ " from \"part\".Person, \"part\".Purchase, \"repl\".Product " +
+ " where Person.id = Purchase.personId and Purchase.productId = Product.id" +
+ " group by Product.id");
+
+ //TODO Investigate.
+ compareQueryRes0("select concat(firstName, ' ', lastName), count (Product.id) " +
+ " from \"part\".Person, \"part\".Purchase, \"repl\".Product " +
+ " where Person.id = Purchase.personId and Purchase.productId = Product.id" +
+ " group by Product.id");
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void initializeH2Schema() throws SQLException {
+ Statement st = conn.createStatement();
+
+ st.execute("CREATE SCHEMA \"part\"");
+ st.execute("CREATE SCHEMA \"repl\"");
+
+ st.execute("create table \"part\".ORGANIZATION" +
+ " (_key int not null," +
+ " _val other not null," +
+ " id int unique," +
+ " name varchar(255))");
+
+ st.execute("create table \"part\".PERSON" +
+ " (_key other not null ," +
+ " _val other not null ," +
+ " id int unique, " +
+ " firstName varchar(255), " +
+ " lastName varchar(255)," +
+ " orgId int not null," +
+ " salary double," +
+ " addrId int," +
+ " old int," +
+ " date Date )");
+
+ st.execute("create table \"repl\".PRODUCT" +
+ " (_key int not null ," +
+ " _val other not null ," +
+ " id int unique, " +
+ " name varchar(255), " +
+ " price int)");
+
+ st.execute("create table \"part\".PURCHASE" +
+ " (_key other not null ," +
+ " _val other not null ," +
+ " id int unique, " +
+ " personId int, " +
+ " organizationId int, " +
+ " productId int)");
+
+ st.execute("create table \"repl\".ADDRESS" +
+ " (_key int not null ," +
+ " _val other not null ," +
+ " id int unique, " +
+ " street varchar(255))");
+
+ conn.commit();
+ }
+
+ /**
+ * Insert {@link Organization} at h2 database.
+ *
+ * @param org Organization.
+ * @throws SQLException If exception.
+ */
+ private void insertInDb(Organization org) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"part\".ORGANIZATION (_key, _val, id, name) values(?, ?, ?, ?)")) {
+ st.setObject(1, org.id);
+ st.setObject(2, org);
+ st.setObject(3, org.id);
+ st.setObject(4, org.name);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Insert {@link Person} at h2 database.
+ *
+ * @param p Person.
+ * @throws SQLException If exception.
+ */
+ private void insertInDb(Person p) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement("insert into \"part\".PERSON " +
+ "(_key, _val, id, firstName, lastName, orgId, salary, addrId, old, date) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
+ st.setObject(1, p.key());
+ st.setObject(2, p);
+ st.setObject(3, p.id);
+ st.setObject(4, p.firstName);
+ st.setObject(5, p.lastName);
+ st.setObject(6, p.orgId);
+ st.setObject(7, p.salary);
+ st.setObject(8, p.addrId);
+ st.setObject(9, p.old);
+ st.setObject(10, p.date);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Insert {@link Product} at h2 database.
+ *
+ * @param p Product.
+ * @throws SQLException If exception.
+ */
+ private void insertInDb(Product p) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"repl\".PRODUCT (_key, _val, id, name, price) values(?, ?, ?, ?, ?)")) {
+ st.setObject(1, p.id);
+ st.setObject(2, p);
+ st.setObject(3, p.id);
+ st.setObject(4, p.name);
+ st.setObject(5, p.price);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Insert {@link Purchase} at h2 database.
+ *
+ * @param p Purchase.
+ * @throws SQLException If exception.
+ */
+ private void insertInDb(Purchase p) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"part\".PURCHASE (_key, _val, id, personId, productId, organizationId) values(?, ?, ?, ?, ?, ?)")) {
+ st.setObject(1, p.key());
+ st.setObject(2, p);
+ st.setObject(3, p.id);
+ st.setObject(4, p.personId);
+ st.setObject(5, p.productId);
+ st.setObject(6, p.organizationId);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Insert {@link Address} at h2 database.
+ *
+ * @param a Address.
+ * @throws SQLException If exception.
+ */
+ private void insertInDb(Address a) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"repl\".ADDRESS (_key, _val, id, street) values(?, ?, ?, ?)")) {
+ st.setObject(1, a.id);
+ st.setObject(2, a);
+ st.setObject(3, a.id);
+ st.setObject(4, a.street);
+
+ st.executeUpdate();
+ }
+ }
+
+ @QuerySqlFunction
+ public static int cool1() {
+ return 1;
+ }
+
+ @QuerySqlFunction
+ public static ResultSet table0(Connection c, String a, int b) throws SQLException {
+ return c.createStatement().executeQuery("select '" + a + "' as a, " + b + " as b");
+ }
+
+ /**
+ * Person class. Stored at partitioned cache.
+ */
+ private static class Person implements Serializable {
+ /** Person ID (indexed). */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Organization ID (indexed). */
+ @QuerySqlField(index = true)
+ private int orgId;
+
+ /** First name (not-indexed). */
+ @QuerySqlField
+ private String firstName;
+
+ /** Last name (not indexed). */
+ @QuerySqlField
+ private String lastName;
+
+ /** Salary (indexed). */
+ @QuerySqlField(index = true)
+ private double salary;
+
+ /** Address Id (indexed). */
+ @QuerySqlField(index = true)
+ private int addrId;
+
+ /** Date. */
+ @QuerySqlField(index = true)
+ public Date date = new Date(System.currentTimeMillis());
+
+ /** Old. */
+ @QuerySqlField(index = true)
+ public int old = 17;
+
+
+ /**
+ * Constructs person record.
+ *
+ * @param org Organization.
+ * @param firstName First name.
+ * @param lastName Last name.
+ * @param salary Salary.
+ */
+ Person(int id, Organization org, String firstName, String lastName, double salary, Address addr) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.salary = salary;
+ orgId = org.id;
+ addrId = addr.id;
+ }
+
+ /**
+ * @return Custom affinity key to guarantee that person is always collocated with organization.
+ */
+ public AffinityKey<Integer> key() {
+ return new AffinityKey<>(id, orgId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof Person && id == ((Person)o).id;
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Person [firstName=" + firstName +
+ ", lastName=" + lastName +
+ ", id=" + id +
+ ", orgId=" + orgId +
+ ", salary=" + salary +
+ ", addrId=" + addrId + ']';
+ }
+ }
+
+ /**
+ * Organization class. Stored at partitioned cache.
+ */
+ private static class Organization implements Serializable {
+ /** Organization ID (indexed). */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Organization name (indexed). */
+ @QuerySqlField(index = true)
+ private String name;
+
+ /**
+ * Create Organization.
+ *
+ * @param id Organization ID.
+ * @param name Organization name.
+ */
+ Organization(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof Organization && id == ((Organization)o).id;
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Organization [id=" + id + ", name=" + name + ']';
+ }
+ }
+
+ /**
+ * Product class. Stored at replicated cache.
+ */
+ private static class Product implements Serializable {
+ /** Primary key. */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Product name. */
+ @QuerySqlField
+ private String name;
+
+ /** Product price */
+ @QuerySqlField
+ private int price;
+
+ /**
+ * Create Product.
+ *
+ * @param id Product ID.
+ * @param name Product name.
+ * @param price Product price.
+ */
+ Product(int id, String name, int price) {
+ this.id = id;
+ this.name = name;
+ this.price = price;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof Product && id == ((Product)o).id;
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Product [id=" + id + ", name=" + name + ", price=" + price + ']';
+ }
+ }
+
+ /**
+ * Purchase class. Stored at partitioned cache.
+ */
+ private static class Purchase implements Serializable {
+ /** Primary key. */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Product ID. */
+ @QuerySqlField
+ private int productId;
+
+ /** Person ID. */
+ @QuerySqlField
+ private int personId;
+
+ /** Organization id. */
+ @QuerySqlField
+ private int organizationId;
+
+ /**
+ * Create Purchase.
+ * @param id Purchase ID.
+ * @param product Purchase product.
+ * @param organizationId Organization Id.
+ * @param person Purchase person.
+ */
+ Purchase(int id, Product product, int organizationId, Person person) {
+ this.id = id;
+ productId = product.id;
+ personId = person.id;
+ this.organizationId = organizationId;
+ }
+
+ /**
+ * @return Custom affinity key to guarantee that purchase is always collocated with person.
+ */
+ public AffinityKey<Integer> key() {
+ return new AffinityKey<>(id, organizationId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof Purchase && id == ((Purchase)o).id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Purchase [id=" + id + ", productId=" + productId + ", personId=" + personId + ']';
+ }
+ }
+
+ /**
+ * Address class. Stored at replicated cache.
+ */
+ private static class Address implements Serializable {
+ @QuerySqlField(index = true)
+ private int id;
+
+ @QuerySqlField(index = true)
+ private String street;
+
+ Address(int id, String street) {
+ this.id = id;
+ this.street = street;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof Address && id == ((Address)o).id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Address [id=" + id + ", street=" + street + ']';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe743909/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
new file mode 100644
index 0000000..c5a2cad
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
@@ -0,0 +1,707 @@
+/*
+ * 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.h2.sql;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+
+import java.io.*;
+import java.sql.Date;
+import java.sql.*;
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * Executes one big query (and subqueries of the big query) to compare query results from h2 database instance and
+ * mixed ignite caches (replicated and partitioned) which have the same data models and data content.
+ *
+ *
+ * <pre>
+ *
+ * -------------------------------------> rootOrderId (virtual) <--------------------------
+ * | | |
+ * | | |
+ * | --------------------- | |
+ * | ------------------ --part.ReplaceOrder-- | |
+ * | --part.CustOrder-- --------------------- | |
+ * | ------------------ - id PK - | |
+ * | - orderId PK - <-- <---> - orderId - | |
+ * -- - rootOrderId - | - rootOrderId - ----------- |
+ * - origOrderId - | - refOrderId - // = origOrderId |
+ * - date - | - date - |
+ * - alias - | - alias - |
+ * - archSeq - | - archSeq - ------------------- |
+ * ------------------ | --------------------- ----repl.Exec------ |
+ * | ------------------- |
+ * ----------------- | - rootOrderId PK - ----
+ * ---part.Cancel--- | - date -
+ * ----------------- | --------------------- - execShares int -
+ * - id PK - | --part.OrderParams--- - price int -
+ * - refOrderId - ---| --------------------- - lastMkt int -
+ * - date - | - id PK - -------------------
+ * ----------------- ------- - orderId -
+ * - date -
+ * - parentAlgo -
+ * ---------------------
+ * </pre>
+ *
+ */
+public class H2CompareBigQueryTest extends AbstractH2CompareQueryTest {
+ /** Root order count. */
+ private static final int ROOT_ORDER_CNT = 1000;
+
+ /** Dates count. */
+ private static final int DATES_CNT = 5;
+
+ /** Full the big query. */
+ private String bigQry = getBigQry();
+
+ /**
+ * Extracts the big query from file.
+ *
+ * @return Big query.
+ */
+ private String getBigQry() {
+ String res = "";
+
+ Reader isr = new InputStreamReader(getClass().getResourceAsStream("bigQuery.sql"));
+
+ try(BufferedReader reader = new BufferedReader(isr)) {
+ for(String line; (line = reader.readLine()) != null; )
+ if (!line.startsWith("--")) // Skip commented lines.
+ res += line + '\n';
+ }
+ catch (Throwable e) {
+ e.printStackTrace();
+
+ fail();
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void setIndexedTypes(CacheConfiguration<?, ?> cc, CacheMode mode) {
+ if (mode == CacheMode.PARTITIONED)
+ cc.setIndexedTypes(
+ Integer.class, CustOrder.class,
+ AffinityKey.class, ReplaceOrder.class,
+ AffinityKey.class, OrderParams.class,
+ AffinityKey.class, Cancel.class
+ );
+ else if (mode == CacheMode.REPLICATED)
+ cc.setIndexedTypes(
+ Integer.class, Exec.class
+ );
+ else
+ throw new IllegalStateException("mode: " + mode);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override protected void initCacheAndDbData() throws SQLException {
+ final AtomicInteger idGen = new AtomicInteger();
+
+ final Iterable<Integer> rootOrderIds = new ArrayList<Integer>(){{
+ for (int i = 0; i < ROOT_ORDER_CNT; i++)
+ add(idGen.incrementAndGet());
+ }};
+
+ final Date curDate = new Date(new java.util.Date().getTime());
+
+ final List<Date> dates = new ArrayList<Date>(){{
+ for (int i = 0; i < DATES_CNT; i++)
+ add(new Date(curDate.getTime() - i * 24 * 60 * 60 * 1000)); // Minus i days.
+ }};
+
+ final Iterable<CustOrder> orders = new ArrayList<CustOrder>(){{
+ for (int rootOrderId : rootOrderIds) {
+ // Generate 1 - 5 orders for 1 root order.
+ for (int i = 0; i < rootOrderId % 5; i++) {
+ int orderId = idGen.incrementAndGet();
+
+ CustOrder order = new CustOrder(orderId, rootOrderId, dates.get(orderId % dates.size()) ,
+ orderId % 2 == 0 ? "CUSTOM" : "OTHER", orderId);
+
+ add(order);
+
+ pCache.put(order.orderId, order);
+
+ insertInDb(order);
+ }
+ }
+ }};
+
+ final Collection<OrderParams> params = new ArrayList<OrderParams>(){{
+ for (CustOrder o : orders) {
+ OrderParams op = new OrderParams(idGen.incrementAndGet(), o.orderId, o.date,
+ o.orderId % 2 == 0 ? "Algo 1" : "Algo 2");
+
+ add(op);
+
+ pCache.put(op.key(), op);
+
+ insertInDb(op);
+ }
+ }};
+
+ final Collection<ReplaceOrder> replaces = new ArrayList<ReplaceOrder>(){{
+ for (CustOrder o : orders) {
+ if (o.orderId % 7 == 0) {
+ ReplaceOrder replace = new ReplaceOrder(idGen.incrementAndGet(), o.orderId, o.rootOrderId, o.alias,
+ new Date(o.date.getTime() + 12 * 60 * 60 * 1000), o.orderId); // Plus a half of day.
+
+ add(replace);
+
+ pCache.put(replace.key(), replace);
+
+ insertInDb(replace);
+ }
+ }
+ }};
+
+ final Collection<Cancel> cancels = new ArrayList<Cancel>(){{
+ for (CustOrder o : orders) {
+ if (o.orderId % 9 == 0) {
+ Cancel c = new Cancel(idGen.incrementAndGet(), o.orderId,
+ new Date(o.date.getTime() + 12 * 60 * 60 * 1000));// Plus a half of day.
+
+ add(c);
+
+ pCache.put(c.key(), c);
+
+ insertInDb(c);
+ }
+ }
+ }};
+
+ final Collection<Exec> execs = new ArrayList<Exec>(){{
+ for (int rootOrderId : rootOrderIds) {
+ int execShares = 10000 + rootOrderId;
+ int price = 1000 + rootOrderId;
+ int latsMkt = 3000 + rootOrderId;
+
+ Exec exec = new Exec(rootOrderId, dates.get(rootOrderId % dates.size()), execShares, price, latsMkt);
+
+ add(exec);
+
+ rCache.put(exec.rootOrderId, exec);
+
+ insertInDb(exec);
+ }
+ }};
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ @Override protected void checkAllDataEquals() throws Exception {
+ compareQueryRes0("select _key, _val, date, orderId, rootOrderId, alias, archSeq, origOrderId " +
+ "from \"part\".CustOrder");
+ compareQueryRes0("select _key, _val, id, date, orderId, rootOrderId, alias, archSeq, refOrderId " +
+ "from \"part\".ReplaceOrder");
+ compareQueryRes0("select _key, _val, id, date, orderId, parentAlgo from \"part\".OrderParams\n");
+ compareQueryRes0("select _key, _val, id, date, refOrderId from \"part\".Cancel\n");
+ compareQueryRes0(rCache, "select _key, _val, date, rootOrderId, execShares, price, lastMkt from \"repl\".Exec\n");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUnionAllOrders() throws Exception {
+ compareQueryRes0(
+ " select date, orderId, rootOrderId " +
+ " from \"part\".CustOrder where alias='CUSTOM'");
+
+ compareQueryRes0(
+ " select date, orderId, rootOrderId " +
+ " from \"part\".ReplaceOrder where alias='CUSTOM'");
+
+ compareQueryRes0(
+ " select 10" +
+
+ " union all" +
+
+ " select 20");
+
+ compareQueryRes0(
+ " select date, orderId, rootOrderId " +
+ " from \"part\".CustOrder where alias='CUSTOM'" +
+
+ " union all" +
+
+ " select date, orderId, rootOrderId " +
+ " from \"part\".ReplaceOrder where alias='CUSTOM'");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBigQuery() throws Exception {
+ List<List<?>> res = compareQueryRes0(bigQry);
+
+ assertTrue(!res.isEmpty()); // Ensure we set good testing data at database.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void initializeH2Schema() throws SQLException {
+ Statement st = conn.createStatement();
+
+ st.execute("CREATE SCHEMA \"part\"");
+ st.execute("CREATE SCHEMA \"repl\"");
+
+ st.execute("create table \"part\".CustOrder" +
+ " (" +
+ " _key int not null," +
+ " _val other not null," +
+ " orderId int unique," +
+ " rootOrderId int," +
+ " origOrderId int," +
+ " archSeq int," +
+ " date Date, " +
+ " alias varchar(255)" +
+ " )");
+
+ st.execute("create table \"part\".ReplaceOrder" +
+ " (" +
+ " _key other not null," +
+ " _val other not null," +
+ " id int unique," +
+ " orderId int ," +
+ " rootOrderId int," +
+ " refOrderId int," +
+ " archSeq int," +
+ " date Date, " +
+ " alias varchar(255)" +
+ " )");
+
+ st.execute("create table \"part\".OrderParams" +
+ " (" +
+ " _key other not null," +
+ " _val other not null," +
+ " id int unique," +
+ " orderId int ," +
+ " date Date, " +
+ " parentAlgo varchar(255)" +
+ " )");
+
+ st.execute("create table \"part\".Cancel" +
+ " (" +
+ " _key other not null," +
+ " _val other not null," +
+ " id int unique," +
+ " date Date, " +
+ " refOrderId int" +
+ " )");
+
+ st.execute("create table \"repl\".Exec" +
+ " (" +
+ " _key int not null," +
+ " _val other not null," +
+ " rootOrderId int unique," +
+ " date Date, " +
+ " execShares int," +
+ " price int," +
+ " lastMkt int" +
+ " )");
+
+ conn.commit();
+ }
+
+ /**
+ * Insert {@link CustOrder} at h2 database.
+ *
+ * @param o CustOrder.
+ */
+ private void insertInDb(CustOrder o) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"part\".CustOrder (_key, _val, orderId, rootOrderId, date, alias, archSeq, origOrderId) " +
+ "values(?, ?, ?, ?, ?, ?, ?, ?)")) {
+ int i = 0;
+
+ st.setObject(++i, o.orderId);
+ st.setObject(++i, o);
+ st.setObject(++i, o.orderId);
+ st.setObject(++i, o.rootOrderId);
+ st.setObject(++i, o.date);
+ st.setObject(++i, o.alias);
+ st.setObject(++i, o.archSeq);
+ st.setObject(++i, o.origOrderId);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Insert {@link ReplaceOrder} at h2 database.
+ *
+ * @param o ReplaceOrder.
+ */
+ private void insertInDb(ReplaceOrder o) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"part\".ReplaceOrder (_key, _val, id, orderId, rootOrderId, date, alias, archSeq, refOrderId) " +
+ "values(?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
+ int i = 0;
+
+ st.setObject(++i, o.key());
+ st.setObject(++i, o);
+ st.setObject(++i, o.id);
+ st.setObject(++i, o.orderId);
+ st.setObject(++i, o.rootOrderId);
+ st.setObject(++i, o.date);
+ st.setObject(++i, o.alias);
+ st.setObject(++i, o.archSeq);
+ st.setObject(++i, o.refOrderId);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Insert {@link OrderParams} at h2 database.
+ *
+ * @param o OrderParams.
+ */
+ private void insertInDb(OrderParams o) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"part\".OrderParams (_key, _val, id, date, orderId, parentAlgo) values(?, ?, ?, ?, ?, ?)")) {
+ int i = 0;
+
+ st.setObject(++i, o.key());
+ st.setObject(++i, o);
+ st.setObject(++i, o.id);
+ st.setObject(++i, o.date);
+ st.setObject(++i, o.orderId);
+ st.setObject(++i, o.parentAlgo);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Insert {@link Cancel} at h2 database.
+ *
+ * @param o Cancel.
+ */
+ private void insertInDb(Cancel o) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"part\".Cancel (_key, _val, id, date, refOrderId) values(?, ?, ?, ?, ?)")) {
+ int i = 0;
+
+ st.setObject(++i, o.key());
+ st.setObject(++i, o);
+ st.setObject(++i, o.id);
+ st.setObject(++i, o.date);
+ st.setObject(++i, o.refOrderId);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Insert {@link Exec} at h2 database.
+ *
+ * @param o Execution.
+ */
+ private void insertInDb(Exec o) throws SQLException {
+ try(PreparedStatement st = conn.prepareStatement(
+ "insert into \"repl\".Exec (_key, _val, date, rootOrderId, execShares, price, lastMkt) " +
+ "values(?, ?, ?, ?, ?, ?, ?)")) {
+ int i = 0;
+
+ st.setObject(++i, o.rootOrderId);
+ st.setObject(++i, o);
+ st.setObject(++i, o.date);
+ st.setObject(++i, o.rootOrderId);
+ st.setObject(++i, o.execShares);
+ st.setObject(++i, o.price);
+ st.setObject(++i, o.lastMkt);
+
+ st.executeUpdate();
+ }
+ }
+
+ /**
+ * Custom Order.
+ */
+ static class CustOrder implements Serializable {
+ /** Primary key. */
+ @QuerySqlField(index = true)
+ private int orderId;
+
+ /** Root order ID*/
+ @QuerySqlField
+ private int rootOrderId;
+
+ /** Orig order ID*/
+ @QuerySqlField
+ private int origOrderId;
+
+ /** Date */
+ @QuerySqlField
+ private Date date ;
+
+ /** */
+ @QuerySqlField
+ private String alias = "CUSTOM";
+
+ /** */
+ @QuerySqlField
+ private int archSeq = 11; // TODO: use it.
+
+ /**
+ * @param orderId Order id.
+ * @param rootOrderId Root order id.
+ * @param date Date.
+ * @param alias Alias.
+ * @param origOrderId Orig order id.
+ */
+ CustOrder(int orderId, int rootOrderId, Date date, String alias, int origOrderId) {
+ this.orderId = orderId;
+ this.rootOrderId = rootOrderId;
+ this.origOrderId = origOrderId;
+ this.date = date;
+ this.alias = alias;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof CustOrder && orderId == ((CustOrder)o).orderId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return orderId;
+ }
+ }
+
+ /**
+ * Replace Order.
+ */
+ static class ReplaceOrder implements Serializable {
+ /** Primary key. */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Order id. */
+ @QuerySqlField(index = true)
+ private int orderId;
+
+ /** Root order ID*/
+ @QuerySqlField
+ private int rootOrderId;
+
+ /** Ref order ID*/
+ @QuerySqlField
+ private int refOrderId;
+
+ /** Date */
+ @QuerySqlField
+ private Date date ;
+
+ /** */
+ @QuerySqlField
+ private String alias = "CUSTOM";
+
+ /** */
+ @QuerySqlField
+ private int archSeq = 111; // TODO: use it.
+
+ /**
+ * @param id Id.
+ * @param orderId Order id.
+ * @param rootOrderId Root order id.
+ * @param alias Alias.
+ * @param date Date.
+ * @param refOrderId Reference order id.
+ */
+ ReplaceOrder(int id, int orderId, int rootOrderId, String alias, Date date, int refOrderId) {
+ this.id = id;
+ this.orderId = orderId;
+ this.rootOrderId = rootOrderId;
+ this.refOrderId = refOrderId;
+ this.date = date;
+ this.alias = alias;
+ }
+
+ /**
+ * @return Afinity key.
+ */
+ public AffinityKey<Integer> key() {
+ return new AffinityKey<>(id, orderId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof ReplaceOrder && id == ((ReplaceOrder)o).id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+ }
+
+ /**
+ * Order params.
+ */
+ static class OrderParams implements Serializable {
+ /** Primary key. */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Order id. */
+ @QuerySqlField(index = true)
+ private int orderId;
+
+ /** Date */
+ @QuerySqlField
+ private Date date ;
+
+ /** */
+ @QuerySqlField
+ private String parentAlgo = "CUSTOM_ALGO";
+
+ /**
+ * @param id Id.
+ * @param orderId Order id.
+ * @param date Date.
+ * @param parentAlgo Parent algo.
+ */
+ OrderParams(int id, int orderId, Date date, String parentAlgo) {
+ this.id = id;
+ this.orderId = orderId;
+ this.date = date;
+ this.parentAlgo = parentAlgo;
+ }
+
+ /**
+ * @return Afinity key.
+ */
+ public AffinityKey<Integer> key() {
+ return new AffinityKey<>(id, orderId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof OrderParams && id == ((OrderParams)o).id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+ }
+
+ /**
+ * Cancel Order.
+ */
+ static class Cancel implements Serializable {
+ /** Primary key. */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Order id. */
+ @QuerySqlField(index = true)
+ private int refOrderId;
+
+ /** Date */
+ @QuerySqlField
+ private Date date;
+
+ /**
+ * @param id
+ * @param refOrderId Reference order id.
+ * @param date Date.
+ */
+ Cancel(int id, int refOrderId, Date date) {
+ this.id = id;
+ this.refOrderId = refOrderId;
+ this.date = date;
+ }
+
+ /**
+ * @return Afinity key.
+ */
+ public AffinityKey<Integer> key() {
+ return new AffinityKey<>(id, refOrderId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof Cancel && id == ((Cancel)o).id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+ }
+
+ /**
+ * Execute information about root query.
+ */
+ static class Exec implements Serializable {
+ /** Primary key. */
+ @QuerySqlField
+ private int rootOrderId;
+
+ /** Date */
+ @QuerySqlField
+ private Date date ;
+
+ /** */
+ @QuerySqlField
+ private int execShares;
+
+ /** */
+ @QuerySqlField
+ private int price;
+
+ /** */
+ @QuerySqlField
+ private int lastMkt;
+
+ /**
+ * @param rootOrderId Root order id.
+ * @param date Date.
+ * @param execShares Execute shares.
+ * @param price Price.
+ * @param lastMkt Last mkt.
+ */
+ Exec(int rootOrderId, Date date, int execShares, int price, int lastMkt) {
+ this.rootOrderId = rootOrderId;
+ this.date = date;
+ this.execShares = execShares;
+ this.price = price;
+ this.lastMkt = lastMkt;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || o instanceof Exec && rootOrderId == ((Exec)o).rootOrderId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return rootOrderId;
+ }
+ }
+}
[15/50] [abbrv] incubator-ignite git commit: Merge branch
'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-624
Posted by vk...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-624
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3daa0b6b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3daa0b6b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3daa0b6b
Branch: refs/heads/ignite-471
Commit: 3daa0b6bbf501def9e88983194a2bb952709c97e
Parents: 5edf4d9 21e328d
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Apr 7 15:40:25 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Apr 7 15:40:25 2015 +0300
----------------------------------------------------------------------
bin/ignite.bat | 2 +-
bin/ignite.sh | 2 +-
bin/include/service.sh | 8 ++--
config/hadoop/default-config.xml | 15 ++++--
.../streaming/StreamTransformerExample.java | 3 +-
.../ipc/shmem/IpcSharedMemoryNativeLoader.java | 48 ++++++++++++++------
pom.xml | 1 +
7 files changed, 54 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
[11/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-sprint-3' into ignite-680
Posted by vk...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-680
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3cdf666f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3cdf666f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3cdf666f
Branch: refs/heads/ignite-471
Commit: 3cdf666f57b32e1eab5ff3ad00a91ed142c95163
Parents: 5832b3a d20d29b
Author: sboikov <sb...@gridgain.com>
Authored: Tue Apr 7 12:07:47 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Apr 7 12:07:47 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
examples/README.txt | 11 +-
examples/config/example-ignite.xml | 2 +-
.../streaming/StreamTransformerExample.java | 101 +
.../streaming/StreamVisitorExample.java | 171 +
.../streaming/marketdata/CacheConfig.java | 44 -
.../streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 103 -
.../examples/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 78 -
.../streaming/wordcount/CacheConfig.java | 48 +
.../streaming/wordcount/QueryWords.java | 77 +
.../streaming/wordcount/StreamWords.java | 68 +
.../streaming/wordcount/alice-in-wonderland.txt | 3735 ++++++++++++++++++
.../streaming/wordcount/package-info.java | 22 +
.../streaming/StreamTransformerExample.java | 97 +
.../java8/streaming/StreamVisitorExample.java | 168 +
.../java8/streaming/marketdata/CacheConfig.java | 44 -
.../java8/streaming/marketdata/Instrument.java | 106 -
.../marketdata/QueryTopInstruments.java | 73 -
.../streaming/marketdata/StreamMarketData.java | 101 -
.../java8/streaming/numbers/CacheConfig.java | 46 -
.../streaming/numbers/QueryPopularNumbers.java | 74 -
.../streaming/numbers/StreamRandomNumbers.java | 74 -
.../ignite/cache/affinity/AffinityUuid.java | 50 +
parent/pom.xml | 1 +
28 files changed, 4549 insertions(+), 1046 deletions(-)
----------------------------------------------------------------------
[12/50] [abbrv] incubator-ignite git commit: Merge remote-tracking
branch 'remotes/origin/ignite-sprint-3' into ignite-680
Posted by vk...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-3' into ignite-680
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/68a99f11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/68a99f11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/68a99f11
Branch: refs/heads/ignite-471
Commit: 68a99f116dfc760a51016cc30390a363077fd8b0
Parents: 3cdf666 5f2d8c2
Author: sboikov <sb...@gridgain.com>
Authored: Tue Apr 7 13:30:10 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Apr 7 13:30:10 2015 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 3 -
.../processors/cache/CacheLazyEntry.java | 10 +-
.../processors/cache/KeyCacheObjectImpl.java | 13 +-
.../cacheobject/IgniteCacheObjectProcessor.java | 3 +-
.../IgniteCacheObjectProcessorImpl.java | 28 +--
.../internal/visor/log/VisorLogSearchTask.java | 3 +-
.../visor/query/VisorQueryNextPageTask.java | 5 +-
.../org/apache/ignite/lang/IgniteImmutable.java | 49 -----
.../ignite/IgniteCacheAffinitySelfTest.java | 5 +
.../GridCacheOnCopyFlagAbstractSelfTest.java | 112 +----------
.../GridCacheReturnValueTransferSelfTest.java | 1 -
.../IgniteCacheStoreValueAbstractTest.java | 186 ++++++++++++++++++-
pom.xml | 12 +-
13 files changed, 215 insertions(+), 215 deletions(-)
----------------------------------------------------------------------
[40/50] [abbrv] incubator-ignite git commit: Merge branch
'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite
into ignite-624
Posted by vk...@apache.org.
Merge branch 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-624
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/71439bc0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/71439bc0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/71439bc0
Branch: refs/heads/ignite-471
Commit: 71439bc0e5040b9df0b3e27e5632133049bc4432
Parents: c2c4da4 5e9addb
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 8 14:37:41 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 8 14:37:41 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 7 +-
.../org/apache/ignite/internal/IgnitionEx.java | 171 +++-----
.../ignite/internal/visor/cache/VisorCache.java | 2 +-
.../cache/VisorCacheAggregatedMetrics.java | 38 +-
.../visor/cache/VisorCacheConfiguration.java | 17 +-
.../internal/visor/cache/VisorCacheMetrics.java | 53 ++-
.../cache/VisorCacheMetricsCollectorTask.java | 59 ++-
.../visor/cache/VisorCacheStopTask.java | 69 +++
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../commands/cache/VisorCacheCommand.scala | 423 +++++++++++--------
.../commands/cache/VisorCacheStopCommand.scala | 145 +++++++
11 files changed, 653 insertions(+), 333 deletions(-)
----------------------------------------------------------------------
[38/50] [abbrv] incubator-ignite git commit: ignite-624 - minor
Posted by vk...@apache.org.
ignite-624 - minor
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ab2fe776
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ab2fe776
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ab2fe776
Branch: refs/heads/ignite-471
Commit: ab2fe77642294b9cfb432ed43ad41bf320503839
Parents: e0d88d3
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Apr 8 14:28:24 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Apr 8 14:28:24 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/util/lang/GridFunc.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ab2fe776/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index fee53ef..c7574f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -5433,8 +5433,18 @@ public class GridFunc {
* @param it Iterable to fetch.
* @return Modified target collection.
*/
+ @SuppressWarnings("unchecked")
public static <T, C extends Collection<T>> C addAll(C c, Iterable<? extends T> it) {
- return it == null ? c : addAll(c, it.iterator());
+ if (it == null)
+ return c;
+
+ if (it instanceof Collection<?>) {
+ c.addAll((Collection<? extends T>)it);
+
+ return c;
+ }
+
+ return addAll(c, it.iterator());
}
/**
[06/50] [abbrv] incubator-ignite git commit: Merge branches
'ignite-639' and 'ignite-sprint-3' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Posted by vk...@apache.org.
Merge branches 'ignite-639' and 'ignite-sprint-3' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-639
Conflicts:
modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f600e7e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f600e7e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f600e7e8
Branch: refs/heads/ignite-471
Commit: f600e7e833055e9965209dcd8cdfc933b9cfe01a
Parents: f1eaf29 e144a68
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Apr 7 11:29:54 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Apr 7 11:29:54 2015 +0700
----------------------------------------------------------------------
.../ignite/internal/visor/cache/VisorCache.java | 17 ++++-
.../VisorCacheConfigurationCollectorJob.java | 76 ++++++++++++++++++++
.../VisorCacheConfigurationCollectorTask.java | 39 ++++++++++
.../VisorIgfsProfilerUniformityCounters.java | 6 +-
.../visor/node/VisorGridConfiguration.java | 38 ----------
.../visor/node/VisorIgfsConfiguration.java | 2 +-
.../visor/node/VisorRestConfiguration.java | 1 +
.../internal/visor/util/VisorTaskUtils.java | 3 +-
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../commands/cache/VisorCacheCommand.scala | 20 +++---
.../config/VisorConfigurationCommand.scala | 15 ++--
.../visor/commands/gc/VisorGcCommand.scala | 15 ++--
.../scala/org/apache/ignite/visor/visor.scala | 34 +++++++--
13 files changed, 191 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f600e7e8/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f600e7e8/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --cc modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 4d35b35,91317c9..055931b
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@@ -214,229 -200,202 +214,229 @@@ class VisorCacheCommand
* @param args Command arguments.
*/
def cache(args: String) {
- breakable {
- if (!isConnected)
- adviseToConnect()
- else {
- var argLst = parseArgs(args)
-
- if (hasArgFlag("i", argLst)) {
- askForNode("Select node from:") match {
- case Some(nid) => ask("Detailed statistics (y/n) [n]: ", "n") match {
- case "n" | "N" => nl(); cache("-id=" + nid).^^
- case "y" | "Y" => nl(); cache("-a -id=" + nid).^^
- case x => nl(); warn("Invalid answer: " + x).^^
- }
- case None => break()
+ if (!isConnected)
+ adviseToConnect()
+ else {
+ var argLst = parseArgs(args)
+
+ if (hasArgFlag("i", argLst)) {
+ askForNode("Select node from:") match {
+ case Some(nid) => ask("Detailed statistics (y/n) [n]: ", "n") match {
+ case "n" | "N" => nl(); cache("-id=" + nid).^^
+ case "y" | "Y" => nl(); cache("-a -id=" + nid).^^
+ case x => nl(); warn("Invalid answer: " + x).^^
}
-
- break()
+ case None => return
}
- val node = parseNode(argLst) match {
- case Left(msg) =>
- scold(msg)
-
- break()
-
- case Right(n) => n
- }
+ return
+ }
- val cacheName = argValue("c", argLst) match {
- case Some(dfltName) if dfltName == DFLT_CACHE_KEY || dfltName == DFLT_CACHE_NAME =>
- argLst = argLst.filter(_._1 != "c") ++ Seq("c" -> null)
+ val node = parseNode(argLst) match {
+ case Left(msg) =>
+ scold(msg)
- Some(null)
+ return
- case cn => cn
- }
+ case Right(n) => n
+ }
- if (Seq("clear", "swap", "scan").exists(hasArgFlag(_, argLst))) {
- if (cacheName.isEmpty)
- askForCache("Select cache from:", node) match {
- case Some(name) => argLst = argLst ++ Seq("c" -> name)
- case None => break()
- }
+ val showSystem = hasArgFlag("system", argLst)
- if (hasArgFlag("clear", argLst))
- VisorCacheClearCommand().clear(argLst, node)
- else if (hasArgFlag("swap", argLst))
- VisorCacheSwapCommand().swap(argLst, node)
- else if (hasArgFlag("scan", argLst))
- VisorCacheScanCommand().scan(argLst, node)
+ var cacheName = argValue("c", argLst) match {
+ case Some(dfltName) if dfltName == DFLT_CACHE_KEY || dfltName == DFLT_CACHE_NAME =>
+ argLst = argLst.filter(_._1 != "c") ++ Seq("c" -> null)
- break()
- }
+ Some(null)
- val all = hasArgFlag("a", argLst)
-
- val sortType = argValue("s", argLst)
- val reversed = hasArgName("r", argLst)
+ case cn => cn
+ }
- if (sortType.isDefined && !isValidSortType(sortType.get))
- scold("Invalid '-s' argument in: " + args).^^
+ /** Check that argument list has flag from list. */
+ def hasArgFlagIn(flags: String *) = {
+ flags.exists(hasArgFlag(_, argLst))
+ }
- // Get cache stats data from all nodes.
- val aggrData = cacheData(node, cacheName)
+ // Get cache stats data from all nodes.
+ val aggrData = cacheData(node, cacheName, showSystem)
- if (aggrData.isEmpty)
- scold("No caches found.").^^
+ if (hasArgFlagIn("clear", "swap", "scan", "stop")) {
+ if (cacheName.isEmpty)
+ askForCache("Select cache from:", node, showSystem && !hasArgFlagIn("clear", "swap", "stop"),
+ aggrData) match {
+ case Some(name) =>
+ argLst = argLst ++ Seq("c" -> name)
- println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis))
+ cacheName = Some(name)
- val sumT = VisorTextTable()
+ case None => return
+ }
- sumT #= ("Name(@)", "Nodes", "Entries", "Hits", "Misses", "Reads", "Writes")
+ cacheName.foreach(name => {
+ if (hasArgFlag("scan", argLst))
+ VisorCacheScanCommand().scan(argLst, node)
+ else {
+ if (!aggrData.exists(cache => safeEquals(cache.name(), name) && cache.system())) {
+ if (hasArgFlag("clear", argLst))
+ VisorCacheClearCommand().clear(argLst, node)
+ else if (hasArgFlag("swap", argLst))
+ VisorCacheSwapCommand().swap(argLst, node)
+ else if (hasArgFlag("stop", argLst))
+ VisorCacheStopCommand().scan(argLst, node)
+ }
+ else {
+ if (hasArgFlag("clear", argLst))
+ warn("Clearing of system cache is not allowed: " + name)
+ else if (hasArgFlag("swap", argLst))
+ warn("Backup swapping of system cache is not allowed: " + name)
+ else if (hasArgFlag("stop", argLst))
+ warn("Stopping of system cache is not allowed: " + name)
+ }
+ }
+ })
- sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach(
- ad => {
- // Add cache host as visor variable.
- registerCacheName(ad.cacheName)
+ return
+ }
- sumT += (
- mkCacheName(ad.cacheName),
- ad.nodes,
- (
- "min: " + ad.minimumSize,
- "avg: " + formatDouble(ad.averageSize),
- "max: " + ad.maximumSize
- ),
- (
- "min: " + ad.minimumHits,
- "avg: " + formatDouble(ad.averageHits),
- "max: " + ad.maximumHits
- ),
- (
- "min: " + ad.minimumMisses,
- "avg: " + formatDouble(ad.averageMisses),
- "max: " + ad.maximumMisses
- ),
- (
- "min: " + ad.minimumReads,
- "avg: " + formatDouble(ad.averageReads),
- "max: " + ad.maximumReads
- ),
- (
- "min: " + ad.minimumWrites,
- "avg: " + formatDouble(ad.averageWrites),
- "max: " + ad.maximumWrites
- )
+ val all = hasArgFlag("a", argLst)
+
+ val sortType = argValue("s", argLst)
+ val reversed = hasArgName("r", argLst)
+
+ if (sortType.isDefined && !isValidSortType(sortType.get))
+ scold("Invalid '-s' argument in: " + args).^^
+
+ if (aggrData.isEmpty)
+ scold("No caches found.").^^
+
+ println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis))
+
+ val sumT = VisorTextTable()
+
+ sumT #= ("Name(@)", "Mode", "Nodes", "Entries", "Hits", "Misses", "Reads", "Writes")
+
+ sortAggregatedData(aggrData, sortType.getOrElse("cn"), reversed).foreach(
+ ad => {
+ // Add cache host as visor variable.
+ registerCacheName(ad.name())
+
+ sumT += (
+ mkCacheName(ad.name()),
+ ad.mode(),
+ ad.nodes,
+ (
+ "min: " + ad.minimumSize,
+ "avg: " + formatDouble(ad.averageSize),
+ "max: " + ad.maximumSize
+ ),
+ (
+ "min: " + ad.minimumHits,
+ "avg: " + formatDouble(ad.averageHits),
+ "max: " + ad.maximumHits
+ ),
+ (
+ "min: " + ad.minimumMisses,
+ "avg: " + formatDouble(ad.averageMisses),
+ "max: " + ad.maximumMisses
+ ),
+ (
+ "min: " + ad.minimumReads,
+ "avg: " + formatDouble(ad.averageReads),
+ "max: " + ad.maximumReads
+ ),
+ (
+ "min: " + ad.minimumWrites,
+ "avg: " + formatDouble(ad.averageWrites),
+ "max: " + ad.maximumWrites
)
- }
- )
+ )
+ }
+ )
- sumT.render()
+ sumT.render()
- if (all) {
- val sorted = aggrData.sortWith((k1, k2) => {
- if (k1.cacheName == null)
- true
- else if (k2.cacheName == null)
- false
- else k1.cacheName.compareTo(k2.cacheName) < 0
- })
+ if (all) {
+ val sorted = aggrData.sortWith((k1, k2) => {
+ if (k1.name() == null)
+ true
+ else if (k2.name() == null)
+ false
+ else k1.name().compareTo(k2.name()) < 0
+ })
- val gCfg = node.map(config).collect {
- case cfg if cfg != null => cfg
- }
+ val gCfg = node.map(config).collect {
+ case cfg if cfg != null => cfg
+ }
- sorted.foreach(ad => {
- val cacheNameVar = mkCacheName(ad.cacheName)
+ sorted.foreach(ad => {
+ val cacheNameVar = mkCacheName(ad.name())
- println("\nCache '" + cacheNameVar + "':")
+ println("\nCache '" + cacheNameVar + "':")
- val m = ad.metrics()
+ val m = ad.metrics()
- val csT = VisorTextTable()
+ val csT = VisorTextTable()
- csT += ("Name(@)", cacheNameVar)
- csT += ("Nodes", m.size())
- csT += ("Size Min/Avg/Max", ad.minimumSize + " / " + formatDouble(ad.averageSize) + " / " + ad.maximumSize)
+ csT += ("Name(@)", cacheNameVar)
+ csT += ("Nodes", m.size())
+ csT += ("Size Min/Avg/Max", ad.minimumSize + " / " + formatDouble(ad.averageSize) + " / " + ad.maximumSize)
- val ciT = VisorTextTable()
+ val ciT = VisorTextTable()
- ciT #= ("Node ID8(@), IP", "CPUs", "Heap Used", "CPU Load", "Up Time", "Size", "Hi/Mi/Rd/Wr")
+ ciT #= ("Node ID8(@), IP", "CPUs", "Heap Used", "CPU Load", "Up Time", "Size", "Hi/Mi/Rd/Wr")
- sortData(m.toMap, sortType.getOrElse("hi"), reversed).foreach { case (nid, cm) =>
- val nm = ignite.cluster.node(nid).metrics()
+ sortData(m.toMap, sortType.getOrElse("hi"), reversed).foreach { case (nid, cm) =>
+ val nm = ignite.cluster.node(nid).metrics()
- ciT += (
- nodeId8Addr(nid),
- nm.getTotalCpus,
- formatDouble(100d * nm.getHeapMemoryUsed / nm.getHeapMemoryMaximum) + " %",
+ ciT += (
+ nodeId8Addr(nid),
+ nm.getTotalCpus,
+ formatDouble(100d * nm.getHeapMemoryUsed / nm.getHeapMemoryMaximum) + " %",
- formatDouble(nm.getCurrentCpuLoad * 100d) + " %",
- X.timeSpan2HMSM(nm.getUpTime),
- cm.keySize(),
- (
- "Hi: " + cm.hits(),
- "Mi: " + cm.misses(),
- "Rd: " + cm.reads(),
- "Wr: " + cm.writes()
- )
+ formatDouble(nm.getCurrentCpuLoad * 100d) + " %",
+ X.timeSpan2HMSM(nm.getUpTime),
+ cm.keySize(),
+ (
+ "Hi: " + cm.hits(),
+ "Mi: " + cm.misses(),
+ "Rd: " + cm.reads(),
+ "Wr: " + cm.writes()
)
- }
+ )
+ }
- csT.render()
+ csT.render()
- nl()
- println("Nodes for: " + cacheNameVar)
+ nl()
+ println("Nodes for: " + cacheNameVar)
- ciT.render()
+ ciT.render()
- // Print footnote.
- println("'Hi' - Number of cache hits.")
- println("'Mi' - Number of cache misses.")
- println("'Rd' - number of cache reads.")
- println("'Wr' - Number of cache writes.")
+ // Print footnote.
+ println("'Hi' - Number of cache hits.")
+ println("'Mi' - Number of cache misses.")
+ println("'Rd' - number of cache reads.")
+ println("'Wr' - Number of cache writes.")
- // Print metrics.
- nl()
- println("Aggregated queries metrics:")
- println(" Minimum execution time: " + X.timeSpan2HMSM(ad.minimumQueryTime()))
- println(" Maximum execution time: " + X.timeSpan2HMSM(ad.maximumQueryTime))
- println(" Average execution time: " + X.timeSpan2HMSM(ad.averageQueryTime.toLong))
- println(" Total number of executions: " + ad.execsQuery)
- println(" Total number of failures: " + ad.failsQuery)
+ // Print metrics.
+ nl()
+ println("Aggregated queries metrics:")
+ println(" Minimum execution time: " + X.timeSpan2HMSM(ad.minimumQueryTime()))
+ println(" Maximum execution time: " + X.timeSpan2HMSM(ad.maximumQueryTime))
+ println(" Average execution time: " + X.timeSpan2HMSM(ad.averageQueryTime.toLong))
+ println(" Total number of executions: " + ad.execsQuery)
+ println(" Total number of failures: " + ad.failsQuery)
- gCfg.foreach(_.caches().find(_.name() == ad.name()).foreach(cfg => {
- nl()
- gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(), ad.cacheName()))
- .foreach(ccfg => {
- nl()
++ gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(), ad.name()))
++ .foreach(ccfg => {
++ nl()
- showCacheConfiguration("Cache configuration:", cfg)
- showCacheConfiguration("Cache configuration:", ccfg)
- }))
- })
- }
- else
- println("\nUse \"-a\" flag to see detailed statistics.")
++ showCacheConfiguration("Cache configuration:", ccfg)
+ }))
+ })
-
}
+ else
+ println("\nUse \"-a\" flag to see detailed statistics.")
}
}
@@@ -506,15 -459,15 +506,15 @@@
}
/**
- * Gets configuration of grid from specified node for callecting of node cache's configuration.
+ * Gets configuration of grid from specified node for collecting of node cache's configuration.
*
* @param node Specified node.
- * @return Grid configuration for specified node.
+ * @return Cache configurations for specified node.
*/
- private def config(node: ClusterNode): VisorGridConfiguration = {
- try
- ignite.compute(ignite.cluster.forNode(node)).withNoFailover()
- .execute(classOf[VisorNodeConfigurationCollectorTask], emptyTaskArgument(node.id()))
+ private def config(node: ClusterNode): JavaCollection[VisorCacheConfiguration] = {
+ try {
+ cacheConfigurations(node.id())
+ }
catch {
case e: IgniteException =>
scold(e.getMessage)