You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/11/25 06:53:17 UTC
[01/15] ignite git commit: IGNITE-1986: C++ examples VS project file
fixed.
Repository: ignite
Updated Branches:
refs/heads/ignite-sql-opt-2 fac3b8b64 -> cd216c3e3
IGNITE-1986: C++ examples VS project file fixed.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ca0de93a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ca0de93a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ca0de93a
Branch: refs/heads/ignite-sql-opt-2
Commit: ca0de93a9ec38615321cc16e01cdcf9f0698aaf0
Parents: 1136933
Author: isapego <is...@gridgain.com>
Authored: Tue Nov 24 12:24:41 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Nov 24 12:24:41 2015 +0300
----------------------------------------------------------------------
.../platforms/cpp/examples/project/vs/ignite-examples.vcxproj | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca0de93a/modules/platforms/cpp/examples/project/vs/ignite-examples.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/project/vs/ignite-examples.vcxproj b/modules/platforms/cpp/examples/project/vs/ignite-examples.vcxproj
index 286a4ea..b04bfb9 100644
--- a/modules/platforms/cpp/examples/project/vs/ignite-examples.vcxproj
+++ b/modules/platforms/cpp/examples/project/vs/ignite-examples.vcxproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
@@ -19,14 +19,14 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
+ <PlatformToolset>v100</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
+ <PlatformToolset>v100</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
[15/15] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sql-cache-stmt' into ignite-sql-opt-2
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sql-cache-stmt' into ignite-sql-opt-2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cd216c3e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cd216c3e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cd216c3e
Branch: refs/heads/ignite-sql-opt-2
Commit: cd216c3e3cacd01c3327a06fedbe18b4ad6a59a4
Parents: eeb3ec4 1171b36
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 25 08:51:38 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 25 08:51:38 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/IgnitionEx.java | 9 +-
.../processors/cache/CacheLockImpl.java | 18 +++-
.../colocated/GridDhtColocatedLockFuture.java | 8 +-
.../cache/query/GridCacheTwoStepQuery.java | 17 +++-
.../cache/GridCacheAbstractFullApiSelfTest.java | 42 +++++++-
.../processors/query/h2/IgniteH2Indexing.java | 53 ++++------
.../query/h2/sql/GridSqlQuerySplitter.java | 2 +-
.../processors/query/h2/sql/GridSqlSelect.java | 37 +++++++
.../query/h2/twostep/GridMergeIndex.java | 7 ++
.../h2/twostep/GridMergeIndexUnsorted.java | 14 +++
.../h2/twostep/GridReduceQueryExecutor.java | 102 +++++++++++++------
11 files changed, 228 insertions(+), 81 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cd216c3e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
[03/15] ignite git commit: DEVNOTES fix
Posted by sb...@apache.org.
DEVNOTES fix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c23cda1d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c23cda1d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c23cda1d
Branch: refs/heads/ignite-sql-opt-2
Commit: c23cda1d27816656e38937fb18c3e676248d7959
Parents: eee3b21
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 24 12:57:13 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 24 12:57:13 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c23cda1d/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index ea9cf17..784be96 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -10,7 +10,7 @@ With LGPL dependencies:
mvn clean package -DskipTests -Prelease,lgpl -Dignite.edition=fabric-lgpl
With LGPL dependencies and Scala 2.10:
- mvn clean package -DskipTests -Prelease,lgpl -Dscala-2.10
+ mvn clean package -DskipTests -Prelease,lgpl -Dignite.edition=fabric-lgpl -Dscala-2.10
Look for apache-ignite-fabric-<version>-bin.zip in ./target/bin directory.
[09/15] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1.5' into ignite-sql-opt
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1.5' into ignite-sql-opt
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9a06c5df
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9a06c5df
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9a06c5df
Branch: refs/heads/ignite-sql-opt-2
Commit: 9a06c5df75909c7a21a07c68336a942ad6248e75
Parents: eed8e6a c23cda1
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 24 19:36:03 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 24 19:36:03 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
.../java/org/apache/ignite/IgniteBinary.java | 6 +----
.../apache/ignite/binary/BinaryIdMapper.java | 2 +-
.../apache/ignite/binary/BinarySerializer.java | 2 +-
.../internal/portable/BinaryTypeImpl.java | 4 ++-
.../processors/cache/CacheObjectContext.java | 26 +++++++++++++++++---
.../datastructures/GridCacheAtomicLongImpl.java | 6 ++++-
.../portable/BinaryMarshallerSelfTest.java | 6 ++---
.../examples/project/vs/ignite-examples.vcxproj | 6 ++---
9 files changed, 40 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
[06/15] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1.5' into ignite-sql-cache-stmt
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1.5' into ignite-sql-cache-stmt
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8a3770e3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8a3770e3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8a3770e3
Branch: refs/heads/ignite-sql-opt-2
Commit: 8a3770e3ae4914afb6b26dfd5ad87e99062a661a
Parents: 7e34cec c23cda1
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 24 16:41:01 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 24 16:41:01 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
.../java/org/apache/ignite/IgniteBinary.java | 6 +----
.../apache/ignite/binary/BinaryIdMapper.java | 2 +-
.../apache/ignite/binary/BinarySerializer.java | 2 +-
.../internal/portable/BinaryTypeImpl.java | 4 ++-
.../processors/cache/CacheObjectContext.java | 26 +++++++++++++++++---
.../datastructures/GridCacheAtomicLongImpl.java | 6 ++++-
.../portable/BinaryMarshallerSelfTest.java | 6 ++---
.../examples/project/vs/ignite-examples.vcxproj | 6 ++---
.../Apache.Ignite.Benchmarks.csproj | 3 +++
.../Apache.Ignite.Core.Tests.TestDll.csproj | 2 ++
.../Apache.Ignite.Core.Tests.csproj | 2 ++
.../Continuous/ContinuousQueryAbstractTest.cs | 23 +++++++++++++----
.../Apache.Ignite.Core.csproj | 2 ++
.../Apache.Ignite.Core/Impl/Events/Events.cs | 8 +++---
modules/platforms/dotnet/Apache.Ignite.sln | 6 ++---
.../dotnet/Apache.Ignite/Apache.Ignite.csproj | 2 ++
.../Apache.Ignite.Examples.csproj | 2 ++
.../Apache.Ignite.ExamplesDll.csproj | 2 ++
19 files changed, 80 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
[07/15] ignite git commit: Skip merge table query.
Posted by sb...@apache.org.
Skip merge table query.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f495cba8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f495cba8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f495cba8
Branch: refs/heads/ignite-sql-opt-2
Commit: f495cba81ecaeb7164af942973888fdbab724439
Parents: 8a3770e
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 24 17:53:04 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 24 17:53:04 2015 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheSqlQuery.java | 20 --------
.../cache/query/GridCacheTwoStepQuery.java | 25 ++++++++--
.../processors/query/h2/IgniteH2Indexing.java | 52 ++++++--------------
.../query/h2/sql/GridSqlQuerySplitter.java | 40 ++-------------
.../processors/query/h2/sql/GridSqlSelect.java | 35 +++++++++++++
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
6 files changed, 77 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f495cba8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index 49a926a..e56e445 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@ -70,10 +70,6 @@ public class GridCacheSqlQuery implements Message {
/** Field kept for backward compatibility. */
private String alias;
- /** */
- @GridDirectTransient
- private boolean skipMergeTbl;
-
/**
* For {@link Message}.
*/
@@ -246,21 +242,6 @@ public class GridCacheSqlQuery implements Message {
}
/**
- * @return {@code True} if reduce query can skip merge table creation and get data directly from merge index.
- */
- public boolean skipMergeTable() {
- return skipMergeTbl;
- }
-
- /**
- * @param skipMergeTbl {@code True} if reduce query can skip merge table creation and get
- * data directly from merge index.
- */
- public void skipMergeTable(boolean skipMergeTbl) {
- this.skipMergeTbl = skipMergeTbl;
- }
-
- /**
* @param args Arguments.
* @return Copy.
*/
@@ -271,7 +252,6 @@ public class GridCacheSqlQuery implements Message {
cp.cols = cols;
cp.paramIdxs = paramIdxs;
cp.paramsSize = paramsSize;
- cp.skipMergeTbl = skipMergeTbl;
if (F.isEmpty(args))
cp.params = EMPTY_PARAMS;
http://git-wip-us.apache.org/repos/asf/ignite/blob/f495cba8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index 1946a4c..e500fa1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -47,16 +47,35 @@ public class GridCacheTwoStepQuery {
/** */
private Set<String> spaces;
+ /** */
+ private boolean skipMergeTbl;
+
/**
* @param spaces All spaces accessed in query.
* @param rdc Reduce query.
+ * @param skipMergeTbl {@code True} if reduce query can skip merge table creation and
+ * get data directly from merge index.
*/
- public GridCacheTwoStepQuery(Set<String> spaces, GridCacheSqlQuery rdc) {
+ public GridCacheTwoStepQuery(Set<String> spaces, GridCacheSqlQuery rdc, boolean skipMergeTbl) {
assert rdc != null;
this.spaces = spaces;
-
this.rdc = rdc;
+ this.skipMergeTbl = skipMergeTbl;
+ }
+ /**
+ * @return {@code True} if reduce query can skip merge table creation and get data directly from merge index.
+ */
+ public boolean skipMergeTable() {
+ return skipMergeTbl;
+ }
+
+ /**
+ * @param skipMergeTbl {@code True} if reduce query can skip merge table creation and get
+ * data directly from merge index.
+ */
+ public void skipMergeTable(boolean skipMergeTbl) {
+ this.skipMergeTbl = skipMergeTbl;
}
/**
@@ -132,7 +151,7 @@ public class GridCacheTwoStepQuery {
public GridCacheTwoStepQuery copy(Object[] args) {
assert !explain;
- GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(spaces, rdc.copy(args));
+ GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(spaces, rdc.copy(args), skipMergeTbl);
cp.pageSize = pageSize;
for (int i = 0; i < mapQrys.size(); i++)
cp.mapQrys.add(mapQrys.get(i).copy(args));
http://git-wip-us.apache.org/repos/asf/ignite/blob/f495cba8/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 96409f6..76e538f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -100,7 +100,6 @@ import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeGuard;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.T3;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -199,6 +198,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
*/
static {
try {
+ System.setProperty("h2.objectCache", "false");
+
COMMAND_FIELD = JdbcPreparedStatement.class.getDeclaredField("command");
COMMAND_FIELD.setAccessible(true);
@@ -251,6 +252,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
c = initialValue();
set(c);
+
+ stmtCache.get().clear();
}
return c;
@@ -276,12 +279,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
private volatile GridKernalContext ctx;
/** */
- private final ThreadLocal<StatementCache<String, PreparedStatement>> stmtCache =
- new ThreadLocal<StatementCache<String, PreparedStatement>>() {
- @Override protected StatementCache<String, PreparedStatement> initialValue() {
- return new StatementCache<>(PREPARED_STMT_CACHE_SIZE);
- }
- };
+ private final ThreadLocal<StatementCache> stmtCache = new ThreadLocal<StatementCache>() {
+ @Override protected StatementCache initialValue() {
+ return new StatementCache(PREPARED_STMT_CACHE_SIZE);
+ }
+ };
/** */
private final GridBoundedConcurrentLinkedHashMap<T3<String, String, Boolean>, TwoStepCachedQuery> twoStepCache =
@@ -309,7 +311,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
*/
private PreparedStatement prepareStatement(Connection c, String sql, boolean useStmtCache) throws SQLException {
if (useStmtCache) {
- StatementCache<String, PreparedStatement> cache = stmtCache.get();
+ StatementCache cache = stmtCache.get();
PreparedStatement stmt = cache.get(sql);
@@ -323,11 +325,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
cache.put(sql, stmt);
- PreparedStatement rmvd = cache.getAndClearRemoved();
-
- if (rmvd != null)
- U.closeQuiet(rmvd);
-
return stmt;
}
else
@@ -2400,13 +2397,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
/**
*
*/
- private static class StatementCache<K, V> extends LinkedHashMap<K, V> {
+ private static class StatementCache extends LinkedHashMap<String, PreparedStatement> {
/** */
private int size;
- /** */
- private V rmvd;
-
/**
* @param size Size.
*/
@@ -2417,30 +2411,16 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
- assert rmvd == null;
-
+ @Override protected boolean removeEldestEntry(Map.Entry<String, PreparedStatement> eldest) {
boolean rmv = size() > size;
- if (rmv)
- this.rmvd = eldest.getValue();
-
- return rmv;
- }
-
- /**
- * @return Removed value.
- */
- @Nullable V getAndClearRemoved() {
- if (rmvd != null) {
- V ret = rmvd;
-
- rmvd = null;
+ if (rmv) {
+ PreparedStatement stmt = eldest.getValue();
- return ret;
+ U.closeQuiet(stmt);
}
- return null;
+ return rmv;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f495cba8/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 04d469b..0c9c8fe 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
@@ -173,46 +173,22 @@ public class GridSqlQuerySplitter {
for (GridSqlElement exp : mapExps) // Add all map expressions as visible.
mapQry.addColumn(exp, true);
- boolean rdcSimpleQry = true;
-
- for (GridSqlElement rdcExp : rdcExps) { // Add corresponding visible reduce columns.
+ for (GridSqlElement rdcExp : rdcExps) // Add corresponding visible reduce columns.
rdcQry.addColumn(rdcExp, true);
- if (rdcSimpleQry) {
- if (rdcExp instanceof GridSqlColumn || rdcExp instanceof GridSqlConst)
- continue;
-
- if (rdcExp instanceof GridSqlAlias) {
- if (rdcExp.size() == 1) {
- GridSqlElement child = rdcExp.child();
-
- if (child instanceof GridSqlColumn || child instanceof GridSqlConst)
- continue;
- }
- }
-
- rdcSimpleQry = false;
- }
- }
-
for (int i = rdcExps.length; i < mapExps.size(); i++) // Add all extra map columns as invisible reduce columns.
rdcQry.addColumn(column(((GridSqlAlias)mapExps.get(i)).alias()), false);
// -- GROUP BY
- if (mapQry.groupColumns() != null && !collocated) {
+ if (mapQry.groupColumns() != null && !collocated)
rdcQry.groupColumns(mapQry.groupColumns());
- rdcSimpleQry = false;
- }
-
// -- HAVING
if (mapQry.havingColumn() >= 0 && !collocated) {
// TODO IGNITE-1140 - Find aggregate functions in HAVING clause or rewrite query to put all aggregates to SELECT clause.
rdcQry.whereAnd(column(columnName(mapQry.havingColumn())));
mapQry.havingColumn(-1);
-
- rdcSimpleQry = false;
}
// -- ORDER BY
@@ -223,8 +199,6 @@ public class GridSqlQuerySplitter {
if (aggregateFound) // Ordering over aggregates does not make sense.
mapQry.clearSort(); // Otherwise map sort will be used by offset-limit.
// TODO IGNITE-1141 - Check if sorting is done over aggregated expression, otherwise we can sort and use offset-limit.
-
- rdcSimpleQry = false;
}
// -- LIMIT
@@ -233,8 +207,6 @@ public class GridSqlQuerySplitter {
if (aggregateFound)
mapQry.limit(null);
-
- rdcSimpleQry = false;
}
// -- OFFSET
@@ -245,16 +217,12 @@ public class GridSqlQuerySplitter {
mapQry.limit(op(GridSqlOperationType.PLUS, mapQry.offset(), mapQry.limit()));
mapQry.offset(null);
-
- rdcSimpleQry = false;
}
// -- DISTINCT
if (mapQry.distinct()) {
mapQry.distinct(!aggregateFound && mapQry.groupColumns() == null && mapQry.havingColumn() < 0);
rdcQry.distinct(true);
-
- rdcSimpleQry = false;
}
IntArray paramIdxs = new IntArray(params.length);
@@ -262,8 +230,6 @@ public class GridSqlQuerySplitter {
GridCacheSqlQuery rdc = new GridCacheSqlQuery(rdcQry.getSQL(),
findParams(rdcQry, params, new ArrayList<>(), paramIdxs).toArray());
- rdc.skipMergeTable(rdcSimpleQry && paramIdxs.size() == 0);
-
rdc.parameterIndexes(toIntArray(paramIdxs));
paramIdxs = new IntArray(params.length);
@@ -275,7 +241,7 @@ public class GridSqlQuerySplitter {
map.parameterIndexes(toIntArray(paramIdxs));
// Build resulting two step query.
- GridCacheTwoStepQuery res = new GridCacheTwoStepQuery(spaces, rdc).addMapQuery(map);
+ GridCacheTwoStepQuery res = new GridCacheTwoStepQuery(spaces, rdc, rdcQry.simpleQuery()).addMapQuery(map);
res.explain(explain);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f495cba8/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 e537ace..ff57362 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
@@ -103,6 +103,41 @@ public class GridSqlSelect extends GridSqlQuery {
}
/**
+ * @return {@code True} if this simple select.
+ */
+ public boolean simpleQuery() {
+ boolean simple = !distinct &&
+ where == null &&
+ grpCols == null &&
+ havingCol < 0 &&
+ sort.isEmpty() &&
+ limit == null &&
+ offset == null;
+
+ if (simple) {
+ for (GridSqlElement expression : columns(true)) {
+ if (expression instanceof GridSqlColumn)
+ continue;
+
+ if (expression instanceof GridSqlAlias) {
+ if (expression.size() == 1) {
+ GridSqlElement child = expression.child();
+
+ if (child instanceof GridSqlColumn)
+ continue;
+ }
+ }
+
+ simple = false;
+
+ break;
+ }
+ }
+
+ return simple;
+ }
+
+ /**
* @param buff Statement builder.
* @param expression Alias expression.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/f495cba8/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 a57366d..bab88a7 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
@@ -512,7 +512,7 @@ public class GridReduceQueryExecutor {
int tblIdx = 0;
- final boolean skipMergeTbl = !qry.explain() && qry.reduceQuery().skipMergeTable();
+ final boolean skipMergeTbl = !qry.explain() && qry.skipMergeTable();
for (GridCacheSqlQuery mapQry : qry.mapQueries()) {
GridMergeIndex idx;
[13/15] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1.5' into ignite-sql-cache-stmt
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1.5' into ignite-sql-cache-stmt
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1171b36b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1171b36b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1171b36b
Branch: refs/heads/ignite-sql-opt-2
Commit: 1171b36b44a7ae8838d71fa7896d1526b485fa65
Parents: 1213f2c dafad52
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 25 08:48:37 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 25 08:48:37 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/IgnitionEx.java | 9 +++--
.../processors/cache/CacheLockImpl.java | 18 ++++++++-
.../colocated/GridDhtColocatedLockFuture.java | 8 ++--
.../cache/GridCacheAbstractFullApiSelfTest.java | 42 +++++++++++++++++++-
4 files changed, 66 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
[14/15] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sql-opt' into ignite-sql-opt-2
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sql-opt' into ignite-sql-opt-2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eeb3ec47
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eeb3ec47
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eeb3ec47
Branch: refs/heads/ignite-sql-opt-2
Commit: eeb3ec47c9cadd0400b90a3d11265ef6ec87e75a
Parents: fac3b8b 17c0b4f
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 25 08:51:20 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 25 08:51:20 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
.../java/org/apache/ignite/IgniteBinary.java | 6 +-
.../apache/ignite/binary/BinaryIdMapper.java | 2 +-
.../apache/ignite/binary/BinarySerializer.java | 2 +-
.../internal/portable/BinaryTypeImpl.java | 4 +-
.../processors/cache/CacheObjectContext.java | 26 ++++-
.../datastructures/GridCacheAtomicLongImpl.java | 6 +-
.../portable/BinaryMarshallerSelfTest.java | 6 +-
.../processors/query/h2/opt/GridH2Table.java | 10 +-
.../query/h2/opt/GridH2TreeIndex.java | 104 ++++++++++---------
.../h2/GridIndexingSpiAbstractSelfTest.java | 17 ++-
.../examples/project/vs/ignite-examples.vcxproj | 6 +-
12 files changed, 118 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
[10/15] ignite git commit: ignite-sql-opt
Posted by sb...@apache.org.
ignite-sql-opt
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/17c0b4f5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/17c0b4f5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/17c0b4f5
Branch: refs/heads/ignite-sql-opt-2
Commit: 17c0b4f58edb0ae15e23c058bd3fe6ddd996749a
Parents: 9a06c5d
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 24 19:48:06 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 24 20:12:22 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/opt/GridH2Table.java | 10 +-
.../query/h2/opt/GridH2TreeIndex.java | 104 ++++++++++---------
.../h2/GridIndexingSpiAbstractSelfTest.java | 17 ++-
3 files changed, 78 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/17c0b4f5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index bf318b2..df4d031 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -54,6 +54,7 @@ import org.h2.table.TableFilter;
import org.h2.value.Value;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
+import org.jsr166.LongAdder8;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.VAL_COL;
@@ -79,6 +80,9 @@ public class GridH2Table extends TableBase {
/** */
private volatile Object[] actualSnapshot;
+ /** */
+ private final LongAdder8 size = new LongAdder8();
+
/**
* Creates table.
*
@@ -379,6 +383,8 @@ public class GridH2Table extends TableBase {
kvOld.onUnswap(kvOld.getValue(VAL_COL), true);
}
+ else if (old == null)
+ size.increment();
int len = idxs.size();
@@ -414,6 +420,8 @@ public class GridH2Table extends TableBase {
}
if (old != null) {
+ size.decrement();
+
// Remove row from all indexes.
// Start from 2 because 0 - Scan (don't need to update), 1 - PK (already updated).
for (int i = 2, len = idxs.size(); i < len; i++) {
@@ -579,7 +587,7 @@ public class GridH2Table extends TableBase {
/** {@inheritDoc} */
@Override public long getRowCountApproximation() {
- return getUniqueIndex().getRowCountApproximation();
+ return size.longValue();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/17c0b4f5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
index 6012645..53cb10b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
@@ -42,7 +42,6 @@ import org.h2.table.IndexColumn;
import org.h2.table.TableFilter;
import org.h2.value.Value;
import org.jetbrains.annotations.Nullable;
-import org.jsr166.LongAdder8;
/**
* Base class for snapshotable tree indexes.
@@ -56,9 +55,6 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
private final ThreadLocal<ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row>> snapshot = new ThreadLocal<>();
/** */
- private final LongAdder8 size = new LongAdder8();
-
- /** */
private final boolean snapshotEnabled;
/**
@@ -88,22 +84,41 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
final GridH2RowDescriptor desc = tbl.rowDescriptor();
+ final boolean snapshotConfigured = false;
+
if (desc == null || desc.memory() == null) {
- snapshotEnabled = false;
+ snapshotEnabled = snapshotConfigured;
- tree = new ConcurrentSkipListMap<>(
- new Comparator<GridSearchRowPointer>() {
- @Override public int compare(GridSearchRowPointer o1, GridSearchRowPointer o2) {
- if (o1 instanceof ComparableRow)
- return ((ComparableRow)o1).compareTo(o2);
+ if (snapshotConfigured) {
+ tree = new SnapTreeMap<GridSearchRowPointer, GridH2Row>(this) {
+ @Override protected void afterNodeUpdate_nl(Node<GridSearchRowPointer, GridH2Row> node, Object val) {
+ if (val != null)
+ node.key = (GridSearchRowPointer)val;
+ }
- if (o2 instanceof ComparableRow)
- return -((ComparableRow)o2).compareTo(o1);
+ @Override protected Comparable<? super GridSearchRowPointer> comparable(Object key) {
+ if (key instanceof ComparableRow)
+ return (Comparable<? super SearchRow>)key;
- return compareRows(o1, o2);
+ return super.comparable(key);
}
- }
- );
+ };
+ }
+ else {
+ tree = new ConcurrentSkipListMap<>(
+ new Comparator<GridSearchRowPointer>() {
+ @Override public int compare(GridSearchRowPointer o1, GridSearchRowPointer o2) {
+ if (o1 instanceof ComparableRow)
+ return ((ComparableRow)o1).compareTo(o2);
+
+ if (o2 instanceof ComparableRow)
+ return -((ComparableRow)o2).compareTo(o1);
+
+ return compareRows(o1, o2);
+ }
+ }
+ );
+ }
}
else {
snapshotEnabled = true;
@@ -149,49 +164,48 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
*/
@SuppressWarnings("unchecked")
@Override public Object takeSnapshot(@Nullable Object s) {
- if (snapshotEnabled) {
- assert snapshot.get() == null;
+ if (!snapshotEnabled)
+ return null;
- if (s == null)
- s = tree instanceof SnapTreeMap ? ((SnapTreeMap)tree).clone() :
- ((GridOffHeapSnapTreeMap)tree).clone();
+ assert snapshot.get() == null;
- snapshot.set((ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row>)s);
+ if (s == null)
+ s = tree instanceof SnapTreeMap ? ((SnapTreeMap)tree).clone() :
+ ((GridOffHeapSnapTreeMap)tree).clone();
- return s;
- }
+ snapshot.set((ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row>)s);
- return null;
+ return s;
}
/**
* Releases snapshot for current thread.
*/
@Override public void releaseSnapshot() {
- if (snapshotEnabled) {
- ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> s = snapshot.get();
+ if (!snapshotEnabled)
+ return;
- snapshot.remove();
+ ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> s = snapshot.get();
- if (s instanceof Closeable)
- U.closeQuiet((Closeable)s);
- }
+ snapshot.remove();
+
+ if (s instanceof Closeable)
+ U.closeQuiet((Closeable)s);
}
/**
* @return Snapshot for current thread if there is one.
*/
private ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> treeForRead() {
- if (snapshotEnabled) {
- ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> res = snapshot.get();
+ if (!snapshotEnabled)
+ return tree;
- if (res == null)
- res = tree;
+ ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> res = snapshot.get();
- return res;
- }
+ if (res == null)
+ res = tree;
- return tree;
+ return res;
}
/** {@inheritDoc} */
@@ -225,7 +239,7 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
/** {@inheritDoc} */
@Override public long getRowCountApproximation() {
- return size.longValue();
+ return table.getRowCountApproximation();
}
/** {@inheritDoc} */
@@ -386,22 +400,12 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
/** {@inheritDoc} */
@Override public GridH2Row put(GridH2Row row) {
- GridH2Row old = tree.put(row, row);
-
- if (old == null)
- size.increment();
-
- return old;
+ return tree.put(row, row);
}
/** {@inheritDoc} */
@Override public GridH2Row remove(SearchRow row) {
- GridH2Row old = tree.remove(comparable(row, 0));
-
- if (old != null)
- size.decrement();
-
- return old;
+ return tree.remove(comparable(row, 0));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/17c0b4f5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 6854cc6..c027b26 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -506,8 +506,21 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
}
/** {@inheritDoc} */
- @Override public GridQueryProperty property(String name) {
- return null;
+ @Override public GridQueryProperty property(final String name) {
+ return new GridQueryProperty() {
+ @Override public Object value(Object key, Object val) throws IgniteCheckedException {
+ return TypeDesc.this.value(name, key, val);
+ }
+
+ @Override public String name() {
+ return name;
+ }
+
+ @Override
+ public Class<?> type() {
+ return Object.class;
+ }
+ };
}
/** {@inheritDoc} */
[08/15] ignite git commit: ignite-sql-cache-stmt
Posted by sb...@apache.org.
ignite-sql-cache-stmt
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1213f2c0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1213f2c0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1213f2c0
Branch: refs/heads/ignite-sql-opt-2
Commit: 1213f2c00f473f331ce88a475c54419010780bfc
Parents: f495cba
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 24 19:27:04 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 24 19:27:04 2015 +0300
----------------------------------------------------------------------
.../processors/cache/query/GridCacheTwoStepQuery.java | 10 +---------
.../internal/processors/query/h2/IgniteH2Indexing.java | 1 +
.../internal/processors/query/h2/sql/GridSqlSelect.java | 4 +++-
3 files changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1213f2c0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index e500fa1..da59c18 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -48,7 +48,7 @@ public class GridCacheTwoStepQuery {
private Set<String> spaces;
/** */
- private boolean skipMergeTbl;
+ private final boolean skipMergeTbl;
/**
* @param spaces All spaces accessed in query.
@@ -71,14 +71,6 @@ public class GridCacheTwoStepQuery {
}
/**
- * @param skipMergeTbl {@code True} if reduce query can skip merge table creation and get
- * data directly from merge index.
- */
- public void skipMergeTable(boolean skipMergeTbl) {
- this.skipMergeTbl = skipMergeTbl;
- }
-
- /**
* @return If this is explain query.
*/
public boolean explain() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1213f2c0/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 76e538f..57f8d3a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -253,6 +253,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
set(c);
+ // Reset statement cache when new connection is created.
stmtCache.get().clear();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1213f2c0/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 ff57362..ae522da 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
@@ -103,10 +103,12 @@ public class GridSqlSelect extends GridSqlQuery {
}
/**
- * @return {@code True} if this simple select.
+ * @return {@code True} if this simple SQL query like 'SELECT A, B, C from SOME_TABLE' without any conditions
+ * and expressions.
*/
public boolean simpleQuery() {
boolean simple = !distinct &&
+ from instanceof GridSqlTable &&
where == null &&
grpCols == null &&
havingCol < 0 &&
[04/15] ignite git commit: Skip merge table query.
Posted by sb...@apache.org.
Skip merge table query.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eb2b5f38
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eb2b5f38
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eb2b5f38
Branch: refs/heads/ignite-sql-opt-2
Commit: eb2b5f38ae639293b682c35603505933ec350612
Parents: a0a10fc
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 24 16:22:03 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 24 16:22:03 2015 +0300
----------------------------------------------------------------------
.../cache/query/GridCacheSqlQuery.java | 20 ++++
.../query/h2/sql/GridSqlQuerySplitter.java | 38 ++++++-
.../query/h2/twostep/GridMergeIndex.java | 7 ++
.../h2/twostep/GridMergeIndexUnsorted.java | 14 +++
.../h2/twostep/GridReduceQueryExecutor.java | 102 +++++++++++++------
5 files changed, 149 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2b5f38/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
index e56e445..49a926a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlQuery.java
@@ -70,6 +70,10 @@ public class GridCacheSqlQuery implements Message {
/** Field kept for backward compatibility. */
private String alias;
+ /** */
+ @GridDirectTransient
+ private boolean skipMergeTbl;
+
/**
* For {@link Message}.
*/
@@ -242,6 +246,21 @@ public class GridCacheSqlQuery implements Message {
}
/**
+ * @return {@code True} if reduce query can skip merge table creation and get data directly from merge index.
+ */
+ public boolean skipMergeTable() {
+ return skipMergeTbl;
+ }
+
+ /**
+ * @param skipMergeTbl {@code True} if reduce query can skip merge table creation and get
+ * data directly from merge index.
+ */
+ public void skipMergeTable(boolean skipMergeTbl) {
+ this.skipMergeTbl = skipMergeTbl;
+ }
+
+ /**
* @param args Arguments.
* @return Copy.
*/
@@ -252,6 +271,7 @@ public class GridCacheSqlQuery implements Message {
cp.cols = cols;
cp.paramIdxs = paramIdxs;
cp.paramsSize = paramsSize;
+ cp.skipMergeTbl = skipMergeTbl;
if (F.isEmpty(args))
cp.params = EMPTY_PARAMS;
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2b5f38/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 ac47b50..741a998 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
@@ -173,22 +173,46 @@ public class GridSqlQuerySplitter {
for (GridSqlElement exp : mapExps) // Add all map expressions as visible.
mapQry.addColumn(exp, true);
- for (GridSqlElement rdcExp : rdcExps) // Add corresponding visible reduce columns.
+ boolean rdcSimpleQry = true;
+
+ for (GridSqlElement rdcExp : rdcExps) { // Add corresponding visible reduce columns.
rdcQry.addColumn(rdcExp, true);
+ if (rdcSimpleQry) {
+ if (rdcExp instanceof GridSqlColumn || rdcExp instanceof GridSqlConst)
+ continue;
+
+ if (rdcExp instanceof GridSqlAlias) {
+ if (rdcExp.size() == 1) {
+ GridSqlElement child = rdcExp.child();
+
+ if (child instanceof GridSqlColumn || child instanceof GridSqlConst)
+ continue;
+ }
+ }
+
+ rdcSimpleQry = false;
+ }
+ }
+
for (int i = rdcExps.length; i < mapExps.size(); i++) // Add all extra map columns as invisible reduce columns.
rdcQry.addColumn(column(((GridSqlAlias)mapExps.get(i)).alias()), false);
// -- GROUP BY
- if (mapQry.groupColumns() != null && !collocated)
+ if (mapQry.groupColumns() != null && !collocated) {
rdcQry.groupColumns(mapQry.groupColumns());
+ rdcSimpleQry = false;
+ }
+
// -- HAVING
if (mapQry.havingColumn() >= 0 && !collocated) {
// TODO IGNITE-1140 - Find aggregate functions in HAVING clause or rewrite query to put all aggregates to SELECT clause.
rdcQry.whereAnd(column(columnName(mapQry.havingColumn())));
mapQry.havingColumn(-1);
+
+ rdcSimpleQry = false;
}
// -- ORDER BY
@@ -199,6 +223,8 @@ public class GridSqlQuerySplitter {
if (aggregateFound) // Ordering over aggregates does not make sense.
mapQry.clearSort(); // Otherwise map sort will be used by offset-limit.
// TODO IGNITE-1141 - Check if sorting is done over aggregated expression, otherwise we can sort and use offset-limit.
+
+ rdcSimpleQry = false;
}
// -- LIMIT
@@ -207,6 +233,8 @@ public class GridSqlQuerySplitter {
if (aggregateFound)
mapQry.limit(null);
+
+ rdcSimpleQry = false;
}
// -- OFFSET
@@ -217,12 +245,16 @@ public class GridSqlQuerySplitter {
mapQry.limit(op(GridSqlOperationType.PLUS, mapQry.offset(), mapQry.limit()));
mapQry.offset(null);
+
+ rdcSimpleQry = false;
}
// -- DISTINCT
if (mapQry.distinct()) {
mapQry.distinct(!aggregateFound && mapQry.groupColumns() == null && mapQry.havingColumn() < 0);
rdcQry.distinct(true);
+
+ rdcSimpleQry = false;
}
IntArray paramIdxs = new IntArray(params.length);
@@ -230,6 +262,8 @@ public class GridSqlQuerySplitter {
GridCacheSqlQuery rdc = new GridCacheSqlQuery(rdcQry.getSQL(),
findParams(rdcQry, params, new ArrayList<>(), paramIdxs).toArray());
+ rdc.skipMergeTable(rdcSimpleQry);
+
rdc.parameterIndexes(toIntArray(paramIdxs));
paramIdxs = new IntArray(params.length);
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2b5f38/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
index 7f8caed..12c2240 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
@@ -80,6 +80,13 @@ public abstract class GridMergeIndex extends BaseIndex {
}
/**
+ *
+ */
+ protected GridMergeIndex() {
+ // No-op.
+ }
+
+ /**
* @return Return source nodes for this merge index.
*/
public Set<UUID> sources() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2b5f38/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
index 5f5eb25..501480a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexUnsorted.java
@@ -47,6 +47,20 @@ public class GridMergeIndexUnsorted extends GridMergeIndex {
super(tbl, name, IndexType.createScan(false), IndexColumn.wrap(tbl.getColumns()));
}
+ /**
+ * @return Dummy index instance.
+ */
+ public static GridMergeIndexUnsorted createDummy() {
+ return new GridMergeIndexUnsorted();
+ }
+
+ /**
+ *
+ */
+ private GridMergeIndexUnsorted() {
+ // No-op.
+ }
+
/** {@inheritDoc} */
@Override protected void addPage0(GridResultPage page) {
assert page.rowsInPage() > 0 || page.isLast() || page.isFail();
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb2b5f38/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 78c1f77..a57366d 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
@@ -79,10 +79,12 @@ import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.h2.command.ddl.CreateTableData;
import org.h2.engine.Session;
+import org.h2.index.Cursor;
import org.h2.jdbc.JdbcConnection;
import org.h2.jdbc.JdbcResultSet;
import org.h2.jdbc.JdbcStatement;
import org.h2.result.ResultInterface;
+import org.h2.result.Row;
import org.h2.table.Column;
import org.h2.util.IntArray;
import org.h2.value.Value;
@@ -184,8 +186,8 @@ public class GridReduceQueryExecutor {
UUID nodeId = ((DiscoveryEvent)evt).eventNode().id();
for (QueryRun r : runs.values()) {
- for (GridMergeTable tbl : r.tbls) {
- if (tbl.getScanIndex(null).hasSource(nodeId)) {
+ for (GridMergeIndex idx : r.idxs) {
+ if (idx.hasSource(nodeId)) {
handleNodeLeft(r, nodeId);
break;
@@ -270,7 +272,7 @@ public class GridReduceQueryExecutor {
final int pageSize = r.pageSize;
- GridMergeIndex idx = r.tbls.get(msg.query()).getScanIndex(null);
+ GridMergeIndex idx = r.idxs.get(msg.query());
GridResultPage page;
@@ -468,7 +470,7 @@ public class GridReduceQueryExecutor {
r.pageSize = qry.pageSize() <= 0 ? GridCacheTwoStepQuery.DFLT_PAGE_SIZE : qry.pageSize();
- r.tbls = new ArrayList<>(qry.mapQueries().size());
+ r.idxs = new ArrayList<>(qry.mapQueries().size());
String space = cctx.name();
@@ -510,27 +512,35 @@ public class GridReduceQueryExecutor {
int tblIdx = 0;
+ final boolean skipMergeTbl = !qry.explain() && qry.reduceQuery().skipMergeTable();
+
for (GridCacheSqlQuery mapQry : qry.mapQueries()) {
- GridMergeTable tbl;
+ GridMergeIndex idx;
- try {
- tbl = createMergeTable(r.conn, mapQry, qry.explain());
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
+ if (!skipMergeTbl) {
+ GridMergeTable tbl;
- GridMergeIndex idx = tbl.getScanIndex(null);
+ try {
+ tbl = createMergeTable(r.conn, mapQry, qry.explain());
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+
+ idx = tbl.getScanIndex(null);
+
+ fakeTable(r.conn, tblIdx++).setInnerTable(tbl);
+ }
+ else
+ idx = GridMergeIndexUnsorted.createDummy();
for (ClusterNode node : nodes)
idx.addSource(node.id());
- r.tbls.add(tbl);
-
- fakeTable(r.conn, tblIdx++).setInnerTable(tbl);
+ r.idxs.add(idx);
}
- r.latch = new CountDownLatch(r.tbls.size() * nodes.size());
+ r.latch = new CountDownLatch(r.idxs.size() * nodes.size());
runs.put(qryReqId, r);
@@ -586,20 +596,50 @@ public class GridReduceQueryExecutor {
else // Send failed.
retry = true;
- ResultSet res = null;
+ Iterator<List<?>> resIter = null;
if (!retry) {
if (qry.explain())
return explainPlan(r.conn, space, qry);
- GridCacheSqlQuery rdc = qry.reduceQuery();
+ if (skipMergeTbl) {
+ List<List<?>> res = new ArrayList<>();
- // Statement caching is prohibited here because we can't guarantee correct merge index reuse.
- res = h2.executeSqlQueryWithTimer(space, r.conn, rdc.query(), F.asList(rdc.parameters()), false);
+ for (GridMergeIndex idx : r.idxs) {
+ Cursor cur = idx.findInStream(null, null);
+
+ while (cur.next()) {
+ Row row = cur.get();
+
+ int cols = row.getColumnCount();
+
+ List<Object> resRow = new ArrayList<>(cols);
+
+ for (int c = 0; c < cols; c++)
+ resRow .add(row.getValue(c).getObject());
+
+ res.add(resRow);
+ }
+ }
+
+ resIter = res.iterator();
+ }
+ else {
+ GridCacheSqlQuery rdc = qry.reduceQuery();
+
+ // Statement caching is prohibited here because we can't guarantee correct merge index reuse.
+ ResultSet res = h2.executeSqlQueryWithTimer(space,
+ r.conn,
+ rdc.query(),
+ F.asList(rdc.parameters()),
+ false);
+
+ resIter = new Iter(res);
+ }
}
- for (GridMergeTable tbl : r.tbls) {
- if (!tbl.getScanIndex(null).fetchedAll()) // We have to explicitly cancel queries on remote nodes.
+ for (GridMergeIndex idx : r.idxs) {
+ if (!idx.fetchedAll()) // We have to explicitly cancel queries on remote nodes.
send(nodes, new GridQueryCancelRequest(qryReqId), null);
}
@@ -610,7 +650,7 @@ public class GridReduceQueryExecutor {
continue;
}
- return new GridQueryCacheObjectsIterator(new Iter(res), cctx, keepPortable);
+ return new GridQueryCacheObjectsIterator(resIter, cctx, keepPortable);
}
catch (IgniteCheckedException | RuntimeException e) {
U.closeQuiet(r.conn);
@@ -634,8 +674,10 @@ public class GridReduceQueryExecutor {
if (!runs.remove(qryReqId, r))
U.warn(log, "Query run was already removed: " + qryReqId);
- for (int i = 0, mapQrys = qry.mapQueries().size(); i < mapQrys; i++)
- fakeTable(null, i).setInnerTable(null); // Drop all merge tables.
+ if (!skipMergeTbl) {
+ for (int i = 0, mapQrys = qry.mapQueries().size(); i < mapQrys; i++)
+ fakeTable(null, i).setInnerTable(null); // Drop all merge tables.
+ }
}
}
}
@@ -1125,7 +1167,7 @@ public class GridReduceQueryExecutor {
*/
private static class QueryRun {
/** */
- private List<GridMergeTable> tbls;
+ private List<GridMergeIndex> idxs;
/** */
private CountDownLatch latch;
@@ -1153,8 +1195,8 @@ public class GridReduceQueryExecutor {
while (latch.getCount() != 0) // We don't need to wait for all nodes to reply.
latch.countDown();
- for (GridMergeTable tbl : tbls) // Fail all merge indexes.
- tbl.getScanIndex(null).fail(nodeId);
+ for (GridMergeIndex idx : idxs) // Fail all merge indexes.
+ idx.fail(nodeId);
}
/**
@@ -1167,8 +1209,8 @@ public class GridReduceQueryExecutor {
while (latch.getCount() != 0) // We don't need to wait for all nodes to reply.
latch.countDown();
- for (GridMergeTable tbl : tbls) // Fail all merge indexes.
- tbl.getScanIndex(null).fail(e);
+ for (GridMergeIndex idx : idxs) // Fail all merge indexes.
+ idx.fail(e);
}
}
[02/15] ignite git commit: Fixed javadoc and Java 1.8 build.
Posted by sb...@apache.org.
Fixed javadoc and Java 1.8 build.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eee3b21b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eee3b21b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eee3b21b
Branch: refs/heads/ignite-sql-opt-2
Commit: eee3b21b10a2ddbc131254fd2d077d95db9340de
Parents: ca0de93
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Nov 24 12:35:43 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Nov 24 12:35:43 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteBinary.java | 6 +----
.../apache/ignite/binary/BinaryIdMapper.java | 2 +-
.../apache/ignite/binary/BinarySerializer.java | 2 +-
.../internal/portable/BinaryTypeImpl.java | 4 ++-
.../processors/cache/CacheObjectContext.java | 26 +++++++++++++++++---
.../datastructures/GridCacheAtomicLongImpl.java | 6 ++++-
.../portable/BinaryMarshallerSelfTest.java | 6 ++---
7 files changed, 36 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eee3b21b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
index 5eb2670..8802c10 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteBinary.java
@@ -67,9 +67,7 @@ import org.jetbrains.annotations.Nullable;
* String field = val.field("myFieldName");
* </pre>
* Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
- * typed objects at all times. In this case we do incur the deserialization cost. However, if
- * {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
- * and will cache the deserialized object, so it does not have to be deserialized again:
+ * typed objects at all times.
* <pre name=code class=java>
* IgniteCache<MyKey.class, MyValue.class> cache = grid.cache(null);
*
@@ -150,8 +148,6 @@ import org.jetbrains.annotations.Nullable;
* automatically.
* <h1 class="header">Configuration</h1>
* By default all your objects are considered as binary and no specific configuration is needed.
- * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects
- * explicitly by calling {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#setClassNames(Collection)}.
* The only requirement Ignite imposes is that your object has an empty
* constructor. Note, that since server side does not have to know the class definition,
* you only need to list portable objects in configuration on the client side. However, if you
http://git-wip-us.apache.org/repos/asf/ignite/blob/eee3b21b/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java
index a4a18f6..9aebf85 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryIdMapper.java
@@ -27,7 +27,7 @@ package org.apache.ignite.binary;
* actually do collide {@code BinaryIdMapper} allows to override the automatically
* generated hash code IDs for the type and field names.
* <p>
- * Binary ID mapper can be configured for all binary objects via {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#getIdMapper()} method,
+ * Binary ID mapper can be configured for all binary objects via {@link org.apache.ignite.configuration.BinaryConfiguration#getIdMapper()} method,
* or for a specific binary type via {@link BinaryTypeConfiguration#getIdMapper()} method.
*/
public interface BinaryIdMapper {
http://git-wip-us.apache.org/repos/asf/ignite/blob/eee3b21b/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java b/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java
index 31b3d30..3a8be3e 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinarySerializer.java
@@ -23,7 +23,7 @@ package org.apache.ignite.binary;
* cannot be changed directly.
* <p>
* Binary serializer can be configured for all binary objects via
- * {@link org.apache.ignite.marshaller.portable.BinaryMarshaller#getSerializer()} method, or for a specific
+ * {@link org.apache.ignite.configuration.BinaryConfiguration#getSerializer()} method, or for a specific
* binary type via {@link BinaryTypeConfiguration#getSerializer()} method.
*/
public interface BinarySerializer {
http://git-wip-us.apache.org/repos/asf/ignite/blob/eee3b21b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
index 2630a40..5f2a91e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryTypeImpl.java
@@ -67,7 +67,9 @@ public class BinaryTypeImpl implements BinaryType {
return meta.affinityKeyFieldName();
}
- /** {@inheritDoc} */
+ /**
+ * @return Portable context.
+ */
public PortableContext context() {
return ctx;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eee3b21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
index d49a029..b3d2d4e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectContext.java
@@ -123,12 +123,21 @@ import org.apache.ignite.internal.util.typedef.F;
return proc;
}
- /** {@inheritDoc} */
+ /**
+ * @param o Object to unwrap.
+ * @param keepPortable Keep binary flag.
+ * @return Unwrapped object.
+ */
public Object unwrapPortableIfNeeded(Object o, boolean keepPortable) {
return unwrapPortableIfNeeded(o, keepPortable, true);
}
- /** {@inheritDoc} */
+ /**
+ * @param o Object to unwrap.
+ * @param keepPortable Keep binary flag.
+ * @param cpy Copy value flag.
+ * @return Unwrapped object.
+ */
public Object unwrapPortableIfNeeded(Object o, boolean keepPortable, boolean cpy) {
if (o == null)
return null;
@@ -136,12 +145,21 @@ import org.apache.ignite.internal.util.typedef.F;
return unwrapPortable(o, keepPortable, cpy);
}
- /** {@inheritDoc} */
+ /**
+ * @param col Collection of objects to unwrap.
+ * @param keepPortable Keep binary flag.
+ * @return Unwrapped collection.
+ */
public Collection<Object> unwrapPortablesIfNeeded(Collection<Object> col, boolean keepPortable) {
return unwrapPortablesIfNeeded(col, keepPortable, true);
}
- /** {@inheritDoc} */
+ /**
+ * @param col Collection to unwrap.
+ * @param keepPortable Keep binary flag.
+ * @param cpy Copy value flag.
+ * @return Unwrapped collection.
+ */
public Collection<Object> unwrapPortablesIfNeeded(Collection<Object> col, boolean keepPortable, boolean cpy) {
if (col instanceof ArrayList)
return unwrapPortables((ArrayList<Object>)col, keepPortable, cpy);
http://git-wip-us.apache.org/repos/asf/ignite/blob/eee3b21b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
index 4169e5e..64fbcde 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
@@ -339,7 +339,11 @@ public final class GridCacheAtomicLongImpl implements GridCacheAtomicLongEx, Ext
}
}
- /** {@inheritDoc} */
+ /**
+ * @param expVal Expected value.
+ * @param newVal New value.
+ * @return Old value.
+ */
public long compareAndSetAndGet(long expVal, long newVal) {
checkRemoved();
http://git-wip-us.apache.org/repos/asf/ignite/blob/eee3b21b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index 4584575..19c40b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -795,7 +795,7 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
BinaryObjectEx po1 = marshal(obj1, marsh);
assertEquals(11111, po1.typeId());
- assertEquals(10, po1.field(22222));
+ assertEquals((Integer)10, po1.field(22222));
assertEquals("str", po1.field(33333));
assertEquals(10, po1.<CustomMappedObject1>deserialize().val1);
@@ -852,7 +852,7 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
BinaryObjectEx po1 = marshal(obj1, marsh);
assertEquals(11111, po1.typeId());
- assertEquals(10, po1.field(22222));
+ assertEquals((Integer)10, po1.field(22222));
assertEquals("str1", po1.field(33333));
assertEquals(10, po1.<CustomMappedObject1>deserialize().val1);
@@ -863,7 +863,7 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
BinaryObjectEx po2 = marshal(obj2, marsh);
assertEquals(44444, po2.typeId());
- assertEquals(20, po2.field(55555));
+ assertEquals((Integer)20, po2.field(55555));
assertEquals("str2", po2.field(66666));
assertEquals(20, po2.<CustomMappedObject2>deserialize().val1);
[12/15] ignite git commit: Better exception message if Ignite is not
started
Posted by sb...@apache.org.
Better exception message if Ignite is not started
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dafad526
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dafad526
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dafad526
Branch: refs/heads/ignite-sql-opt-2
Commit: dafad526f84ecbf503135c7538ffef07dd5e1c4f
Parents: 4d29cb7
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 24 16:34:37 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 24 16:34:37 2015 -0800
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/IgnitionEx.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dafad526/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 7d2b2dc..6bd74be 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
@@ -1187,8 +1187,8 @@ public class IgnitionEx {
Ignite res;
if (grid == null || (res = grid.grid()) == null)
- throw new IgniteIllegalStateException("Grid instance was not properly started " +
- "or was already stopped: " + name);
+ throw new IgniteIllegalStateException("Ignite instance with provided name doesn't exist. " +
+ "Did you call Ignition.start(..) to start an Ignite instance? [name=" + name + ']');
return res;
}
@@ -1205,7 +1205,8 @@ public class IgnitionEx {
IgniteKernal res;
if (grid == null || (res = grid.gridx()) == null)
- throw new IllegalStateException("Grid instance was not properly started or was already stopped: " + name);
+ throw new IgniteIllegalStateException("Ignite instance with provided name doesn't exist. " +
+ "Did you call Ignition.start(..) to start an Ignite instance? [name=" + name + ']');
return res;
}
@@ -2388,4 +2389,4 @@ public class IgnitionEx {
}
}
}
-}
\ No newline at end of file
+}
[05/15] ignite git commit: Skip merge table query.
Posted by sb...@apache.org.
Skip merge table query.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7e34cec3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7e34cec3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7e34cec3
Branch: refs/heads/ignite-sql-opt-2
Commit: 7e34cec3bb0adbea0d94fcd06b3aff549dcf57a0
Parents: eb2b5f3
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 24 16:32:45 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 24 16:32:45 2015 +0300
----------------------------------------------------------------------
.../internal/processors/query/h2/sql/GridSqlQuerySplitter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7e34cec3/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 741a998..04d469b 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
@@ -262,7 +262,7 @@ public class GridSqlQuerySplitter {
GridCacheSqlQuery rdc = new GridCacheSqlQuery(rdcQry.getSQL(),
findParams(rdcQry, params, new ArrayList<>(), paramIdxs).toArray());
- rdc.skipMergeTable(rdcSimpleQry);
+ rdc.skipMergeTable(rdcSimpleQry && paramIdxs.size() == 0);
rdc.parameterIndexes(toIntArray(paramIdxs));
[11/15] ignite git commit: IGNITE-1988 - Exception for explicit lock
inside a transaction
Posted by sb...@apache.org.
IGNITE-1988 - Exception for explicit lock inside a transaction
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4d29cb7f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4d29cb7f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4d29cb7f
Branch: refs/heads/ignite-sql-opt-2
Commit: 4d29cb7f87aafa505807f4b10cddd0264cdac85f
Parents: c23cda1
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 24 16:23:05 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 24 16:23:05 2015 -0800
----------------------------------------------------------------------
.../processors/cache/CacheLockImpl.java | 18 ++++++++-
.../colocated/GridDhtColocatedLockFuture.java | 8 ++--
.../cache/GridCacheAbstractFullApiSelfTest.java | 42 +++++++++++++++++++-
3 files changed, 61 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
index 2e8dc9b..ae7b42e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
@@ -69,6 +69,8 @@ class CacheLockImpl<K, V> implements Lock {
CacheOperationContext prev = gate.enter(opCtx);
try {
+ checkTx();
+
delegate.lockAll(keys, 0);
incrementLockCounter();
@@ -102,6 +104,8 @@ class CacheLockImpl<K, V> implements Lock {
CacheOperationContext prev = gate.enter(opCtx);
try {
+ checkTx();
+
boolean res = delegate.lockAll(keys, -1);
if (res)
@@ -128,6 +132,8 @@ class CacheLockImpl<K, V> implements Lock {
CacheOperationContext prev = gate.enter(opCtx);
try {
+ checkTx();
+
IgniteInternalFuture<Boolean> fut = delegate.lockAllAsync(keys, unit.toMillis(time));
try {
@@ -198,8 +204,18 @@ class CacheLockImpl<K, V> implements Lock {
throw new UnsupportedOperationException();
}
+ /**
+ * Verifies there is no ongoing user transaction.
+ *
+ * @throws CacheException
+ */
+ private void checkTx() throws CacheException {
+ if (delegate.context().tm().inUserTx())
+ throw new CacheException("Explicit lock can't be acquired within a transaction.");
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheLockImpl.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 7e6ce89..ecdf641 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -296,10 +296,6 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
GridCacheMvccCandidate cand = cctx.mvcc().explicitLock(threadId, txKey);
if (inTx()) {
- IgniteTxEntry txEntry = tx.entry(txKey);
-
- txEntry.cached(entry);
-
if (cand != null) {
if (!tx.implicit())
throw new IgniteCheckedException("Cannot access key within transaction if lock is " +
@@ -308,6 +304,10 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
return null;
}
else {
+ IgniteTxEntry txEntry = tx.entry(txKey);
+
+ txEntry.cached(entry);
+
// Check transaction entries (corresponding tx entries must be enlisted in transaction).
cand = new GridCacheMvccCandidate(entry,
cctx.localNodeId(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index e8e86e9..89c4029 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -17,8 +17,6 @@
package org.apache.ignite.internal.processors.cache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -38,6 +36,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import javax.cache.Cache;
+import javax.cache.CacheException;
import javax.cache.expiry.Duration;
import javax.cache.expiry.ExpiryPolicy;
import javax.cache.expiry.TouchedExpiryPolicy;
@@ -45,6 +44,8 @@ import javax.cache.processor.EntryProcessor;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.EntryProcessorResult;
import javax.cache.processor.MutableEntry;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
import junit.framework.AssertionFailedError;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
@@ -5128,6 +5129,43 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * @throws Exception If failed.
+ */
+ public void testLockInsideTransaction() throws Exception {
+ if (txEnabled()) {
+ GridTestUtils.assertThrows(
+ log,
+ new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ try (Transaction tx = ignite(0).transactions().txStart()) {
+ jcache(0).lock("key").lock();
+ }
+
+ return null;
+ }
+ },
+ CacheException.class,
+ "Explicit lock can't be acquired within a transaction."
+ );
+
+ GridTestUtils.assertThrows(
+ log,
+ new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ try (Transaction tx = ignite(0).transactions().txStart()) {
+ jcache(0).lockAll(Arrays.asList("key1", "key2")).lock();
+ }
+
+ return null;
+ }
+ },
+ CacheException.class,
+ "Explicit lock can't be acquired within a transaction."
+ );
+ }
+ }
+
+ /**
* Sets given value, returns old value.
*/
public static final class SetValueProcessor implements EntryProcessor<String, Integer, Integer> {