[ignite] branch master updated: IGNITE-10069: SQL: Added test for implicit schema resolution. This closes #6424.

2019-04-10 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 6808559  IGNITE-10069: SQL: Added test for implicit schema resolution. 
This closes #6424.
6808559 is described below

commit 6808559c741cf1a8b2770617d44af4d650c9f815
Author: alapin 
AuthorDate: Wed Apr 10 15:25:43 2019 +0300

IGNITE-10069: SQL: Added test for implicit schema resolution. This closes 
#6424.
---
 .../ignite/internal/processors/query/SqlSchemaSelfTest.java  | 12 
 1 file changed, 12 insertions(+)

diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java
index 0a446c2..16bfc2b 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSchemaSelfTest.java
@@ -328,6 +328,18 @@ public class SqlSchemaSelfTest extends 
AbstractIndexingCommonTest {
 }
 
 /**
+ * Test table creation and data retrieval with implicit schema.
+ */
+@Test
+public void testImplicitSchema() {
+IgniteCache c = node.getOrCreateCache("testCache1");
+
+c.query(new SqlFieldsQuery("CREATE TABLE TEST1 (ID LONG PRIMARY KEY, 
VAL LONG)" +
+" WITH \"template=replicated\";")).getAll();
+c.query(new SqlFieldsQuery("SELECT * FROM TEST1")).getAll();
+}
+
+/**
  * Person key.
  */
 public static class PersonKey {



[ignite] branch master updated: IGNITE-11442: SQL: Moved system views from "IGNITE" to "SYS" schema. This is more consistent with another databases. Previous behavior can be returned with "-DIGNITE_SQ

2019-04-09 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new f10177b  IGNITE-11442: SQL: Moved system views from "IGNITE" to "SYS" 
schema. This is more consistent with another databases. Previous behavior can 
be returned with "-DIGNITE_SQL_SYSTEM_SCHEMA_NAME_IGNITE=true" system property. 
This closes #6395.
f10177b is described below

commit f10177b83fa8e5f52ed68cfb63a1fce9a6aacfe0
Author: Yuriy Gerzhedovich 
AuthorDate: Tue Apr 9 11:58:40 2019 +0300

IGNITE-11442: SQL: Moved system views from "IGNITE" to "SYS" schema. This 
is more consistent with another databases. Previous behavior can be returned 
with "-DIGNITE_SQL_SYSTEM_SCHEMA_NAME_IGNITE=true" system property. This closes 
#6395.
---
 .../internal/jdbc2/JdbcAbstractSchemaCaseTest.java |   2 +-
 .../internal/jdbc2/JdbcMetadataSelfTest.java   |   2 +-
 .../ignite/jdbc/thin/JdbcThinMetadataSelfTest.java |   2 +-
 .../org/apache/ignite/IgniteSystemProperties.java  |   3 +
 .../internal/processors/query/QueryUtils.java  |   4 +-
 .../query/h2/H2IndexesSystemViewTest.java  |   2 +-
 .../cache/index/H2DynamicTableSelfTest.java|   2 +-
 .../processors/query/SqlIllegalSchemaSelfTest.java |  16 +-
 .../processors/query/SqlSystemViewsSelfTest.java   | 236 +++--
 9 files changed, 145 insertions(+), 124 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractSchemaCaseTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractSchemaCaseTest.java
index 5995010..aaa8724 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractSchemaCaseTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractSchemaCaseTest.java
@@ -202,7 +202,7 @@ public abstract class JdbcAbstractSchemaCaseTest extends 
GridCommonAbstractTest
 ArrayList schemasWithTab = new ArrayList<>();
 
 try (ResultSet tabs = stmt.executeQuery(
-"SELECT SCHEMA_NAME, TABLE_NAME FROM IGNITE.TABLES " +
+"SELECT SCHEMA_NAME, TABLE_NAME FROM SYS.TABLES " +
 "WHERE TABLE_NAME = 'TAB' ORDER BY SCHEMA_NAME;")) {
 while (tabs.next())
 schemasWithTab.add(tabs.getString("SCHEMA_NAME"));
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index 379eb29..2d35db6 100755
--- 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -648,7 +648,7 @@ public class JdbcMetadataSelfTest extends 
GridCommonAbstractTest {
 try (Connection conn = DriverManager.getConnection(BASE_URL)) {
 ResultSet rs = conn.getMetaData().getSchemas();
 
-Set expectedSchemas = new HashSet<>(Arrays.asList("pers", 
"org", "metaTest", "dep", "PUBLIC", "IGNITE", "PREDEFINED_CLIENT_SCHEMA"));
+Set expectedSchemas = new HashSet<>(Arrays.asList("pers", 
"org", "metaTest", "dep", "PUBLIC", "SYS", "PREDEFINED_CLIENT_SCHEMA"));
 
 Set schemas = new HashSet<>();
 
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
index ffe3842..6bd5d0e 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
@@ -734,7 +734,7 @@ public class JdbcThinMetadataSelfTest extends 
JdbcThinAbstractSelfTest {
 try (Connection conn = DriverManager.getConnection(URL)) {
 ResultSet rs = conn.getMetaData().getSchemas();
 
-Set expectedSchemas = new 
HashSet<>(Arrays.asList("IGNITE", "PUBLIC", "pers",
+Set expectedSchemas = new HashSet<>(Arrays.asList("SYS", 
"PUBLIC", "pers",
 "org", "dep", "PREDEFINED_SCHEMAS_1", "PREDEFINED_SCHEMAS_2"));
 
 Set schemas = new HashSet<>();
diff --git 
a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java 
b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index aaf97bf.

[ignite] branch ignite-11564 deleted (was 03066a5)

2019-04-08 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git.


 was 03066a5  IGNITE-11452: Throw exception when cancel is attempted on a 
command which do not support it.

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



[ignite] branch master updated: IGNITE-11226: SQL: Refactored metadata retrieval to avoid exposing stateful H2 objects from indexing interface. This closes #6258.

2019-04-08 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 7be7492  IGNITE-11226: SQL: Refactored metadata retrieval to avoid 
exposing stateful H2 objects from indexing interface. This closes #6258.
7be7492 is described below

commit 7be749219dffed032d533c01c4ecea5635ddcbbd
Author: Pavel Kuznetsov 
AuthorDate: Mon Apr 8 11:59:01 2019 +0300

IGNITE-11226: SQL: Refactored metadata retrieval to avoid exposing stateful 
H2 objects from indexing interface. This closes #6258.
---
 .../internal/jdbc2/JdbcMetadataSelfTest.java   | 145 +++--
 .../ignite/jdbc/thin/JdbcThinMetadataSelfTest.java | 101 --
 .../ignite/internal/jdbc2/JdbcConnection.java  |  23 +---
 .../internal/jdbc2/JdbcPreparedStatement.java  |  94 ++---
 .../internal/jdbc2/JdbcResultSetMetadata.java  |  25 +++-
 .../ignite/internal/jdbc2/JdbcStatement.java   |  18 +++
 .../jdbc2/JdbcStreamedPreparedStatement.java   |   7 +-
 .../processors/odbc/jdbc/JdbcRequestHandler.java   |  82 ++--
 .../processors/odbc/odbc/OdbcRequestHandler.java   |  15 +--
 .../processors/query/GridQueryIndexing.java|  39 --
 .../processors/query/GridQueryProcessor.java   |  14 --
 .../IgniteClientCacheInitializationFailTest.java   |  20 +--
 .../internal/processors/query/h2/H2Utils.java  |  27 
 .../processors/query/h2/IgniteH2Indexing.java  |  60 +
 .../internal/processors/query/h2/QueryParser.java  |  23 +++-
 .../processors/query/h2/QueryParserCacheEntry.java |  17 +++
 .../processors/query/h2/QueryParserResult.java |  24 +++-
 .../processors/query/h2/QueryParserResultDml.java  |  13 --
 .../query/h2/QueryParserResultSelect.java  |  16 +--
 .../query/h2/sql/GridSqlQueryParser.java   |  12 --
 .../processors/cache/SqlFieldsQuerySelfTest.java   |  47 ---
 21 files changed, 557 insertions(+), 265 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index 7cb59d0..379eb29 100755
--- 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -47,6 +47,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteVersionUtils;
 import org.apache.ignite.internal.processors.query.QueryEntityEx;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.NotNull;
 import org.junit.Test;
@@ -185,6 +186,79 @@ public class JdbcMetadataSelfTest extends 
GridCommonAbstractTest {
 }
 
 /**
+ * Check that meta data of PreparedStatement and ResultSet's one are equal.
+ */
+@Test
+public void testPreparedStatementMetaData() throws Exception {
+// Perform checks few times due to query/plan caching.
+for (int i = 0; i < 3; i++) {
+try (Connection conn = DriverManager.getConnection(BASE_URL)) {
+String select = "select p.name, o.id as orgId from 
\"pers\".Person p, \"org\".Organization o where p.orgId = o.id";
+
+ResultSetMetaData rsMeta = 
conn.createStatement().executeQuery(select).getMetaData();
+ResultSetMetaData psMeta = 
conn.prepareStatement(select).getMetaData();
+
+assertEquals(rsMeta.getColumnCount(), rsMeta.getColumnCount());
+
+for (int j = 1; j <= rsMeta.getColumnCount(); j++) {
+assertEquals(rsMeta.getTableName(j), 
psMeta.getTableName(j));
+assertEquals(rsMeta.getColumnName(j), 
psMeta.getColumnName(j));
+assertEquals(rsMeta.getColumnLabel(j), 
psMeta.getColumnLabel(j));
+assertEquals(rsMeta.getColumnType(j), 
psMeta.getColumnType(j));
+assertEquals(rsMeta.getColumnTypeName(j), 
psMeta.getColumnTypeName(j));
+assertEquals(rsMeta.getColumnClassName(j), 
psMeta.getColumnClassName(j));
+}
+}
+}
+}
+
+/**
+ * Check that non-select statements have null metadata.
+ */
+@Test
+public void testPreparedStatementMetaDataNegative() throws Exception {
+// Perform checks few times due to query/plan caching.
+for (int i = 0; i < 3; i++) {
+// Check h2 dml statement.
+try (Connection conn = DriverManager.getConnection(BASE_URL)) {
+String update = "update \"

[ignite] branch master updated: IGNITE-11604: SQL: Fixed problem with DROP COLUMN which was not able remove a column properly in some cases. This closes #6399.

2019-04-05 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 89ba43f  IGNITE-11604: SQL: Fixed problem with DROP COLUMN which was 
not able remove a column properly in some cases. This closes #6399.
89ba43f is described below

commit 89ba43f527ab89e561fc95c003568fedbd117c9b
Author: tledkov 
AuthorDate: Fri Apr 5 13:07:28 2019 +0300

IGNITE-11604: SQL: Fixed problem with DROP COLUMN which was not able remove 
a column properly in some cases. This closes #6399.
---
 .../processors/query/GridQueryProcessor.java   | 14 +--
 .../internal/processors/query/QuerySchema.java |  8 --
 .../internal/processors/query/QueryUtils.java  | 29 ++
 3 files changed, 36 insertions(+), 15 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index d91c2aa..0c21646 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1252,23 +1252,11 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
 op0.tableName());
 }
 else {
-Map aliases = e.getAliases();
-
 for (String colName : op0.columns()) {
 if (err != null)
 break;
 
-String fldName = colName;
-
-if (!F.isEmpty(aliases)) {
-for (Map.Entry a : aliases.entrySet()) 
{
-if (colName.equals(a.getValue())) {
-fldName = a.getKey();
-
-break;
-}
-}
-}
+String fldName = QueryUtils.fieldNameByAlias(e, colName);
 
 if (!e.getFields().containsKey(fldName)) {
 if (op0.ifExists()) {
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java
index 569a02e..082d52f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QuerySchema.java
@@ -298,8 +298,12 @@ public class QuerySchema implements Serializable {
 
 QueryEntity entity = 
((List)entities).get(targetIdx);
 
-for (String field : op0.columns())
-entity.getFields().remove(field);
+for (String field : op0.columns()) {
+boolean rmv = QueryUtils.removeField(entity, field);
+
+assert rmv || op0.ifExists() : "Invalid operation state 
[removed=" + rmv
++ ", ifExists=" + op0.ifExists() + ']';
+}
 }
 }
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index da9279d..de0f743 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -1547,6 +1547,35 @@ public class QueryUtils {
 }
 
 /**
+ * Get field name by alias.
+ *
+ * @param entity Query entity.
+ * @param alias Filed's alias.
+ * @return Field name.
+ */
+public static String fieldNameByAlias(QueryEntity entity, String alias) {
+if (!F.isEmpty(entity.getAliases())) {
+for (Map.Entry aliasEntry : 
entity.getAliases().entrySet()) {
+if (F.eq(aliasEntry.getValue(), alias))
+return aliasEntry.getKey();
+}
+}
+
+return alias;
+}
+
+/**
+ * Remove field by alias.
+ *
+ * @param entity Query entity.
+ * @param alias Filed's alias.
+ * @return {@code true} if the field is removed. Otherwise returns {@code 
false}.
+ */
+public static boolean removeField(QueryEntity entity, String alias) {
+return entity.getFields().remove(fieldNameByAlias(entity, alias)) != 
null;
+}
+
+/**
  * Private constructor.
  */
 private QueryUtils() {



[ignite] branch master updated: IGNITE-11604: SQL: Fixed problem with DROP COLUMN which was not able remove a column properly in some cases. This closes #6399.

2019-04-05 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 9180be9  IGNITE-11604: SQL: Fixed problem with DROP COLUMN which was 
not able remove a column properly in some cases. This closes #6399.
9180be9 is described below

commit 9180be97d098d25898f8ef55cfd6be0f2cedf5cf
Author: tledkov 
AuthorDate: Fri Apr 5 12:23:59 2019 +0300

IGNITE-11604: SQL: Fixed problem with DROP COLUMN which was not able remove 
a column properly in some cases. This closes #6399.
---
 .../ignite/internal/processors/cache/index/StaticCacheDdlTest.java   | 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/StaticCacheDdlTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/StaticCacheDdlTest.java
index 08d5f52..ad5dc9e 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/StaticCacheDdlTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/StaticCacheDdlTest.java
@@ -123,7 +123,6 @@ public class StaticCacheDdlTest extends 
GridCommonAbstractTest {
 /**
  * @throws Exception if failed.
  */
-@Ignore("https://issues.apache.org/jira/browse/IGNITE-11604;)
 @Test
 public void testDropColumn() throws Exception {
 String fieldName = "field_to_drop";



[ignite] branch master updated: IGNITE-11334: SQL: Deprecated SqlQuery in Java. This closes #6151.

2019-04-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new e1ab893  IGNITE-11334: SQL: Deprecated SqlQuery in Java. This closes 
#6151.
e1ab893 is described below

commit e1ab893540e069e25c59d2c909a33f4fd0cee1cb
Author: tledkov 
AuthorDate: Thu Apr 4 11:28:56 2019 +0300

IGNITE-11334: SQL: Deprecated SqlQuery in Java. This closes #6151.
---
 .../datagrid/CacheClientBinaryQueryExample.java| 133 +++--
 .../examples/datagrid/CacheQueryExample.java   |   3 +-
 .../starschema/CacheStarSchemaExample.java |  25 ++--
 .../ignite/examples/sql/SqlQueriesExample.java |  29 ++---
 .../main/java/org/apache/ignite/IgniteCache.java   |   2 -
 .../java/org/apache/ignite/cache/query/Query.java  |   2 -
 .../apache/ignite/cache/query/SqlFieldsQuery.java  |   3 +-
 .../org/apache/ignite/cache/query/SqlQuery.java|   3 +
 .../java/org/apache/ignite/client/ClientCache.java |   3 +-
 .../internal/jdbc/thin/JdbcThinStatement.java  |   4 +-
 10 files changed, 78 insertions(+), 129 deletions(-)

diff --git 
a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
 
b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
index a3c9996..0c9becc 100644
--- 
a/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
+++ 
b/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
@@ -19,12 +19,13 @@ package org.apache.ignite.examples.binary.datagrid;
 
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.LinkedHashMap;
+import java.util.Collections;
 import java.util.List;
 import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.cache.CacheKeyConfiguration;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.QueryEntity;
@@ -32,7 +33,6 @@ import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.QueryIndexType;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.cache.query.TextQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.examples.model.Address;
@@ -40,17 +40,16 @@ import org.apache.ignite.examples.model.Employee;
 import org.apache.ignite.examples.model.EmployeeKey;
 import org.apache.ignite.examples.model.Organization;
 import org.apache.ignite.examples.model.OrganizationType;
-import org.apache.ignite.binary.BinaryObject;
 
 /**
- * This example demonstrates use of binary objects with cache queries.
- * The example populates cache with sample data and runs several SQL and full 
text queries over this data.
+ * This example demonstrates use of binary objects with cache queries. The 
example populates cache with sample data and
+ * runs several SQL and full text queries over this data.
  * 
- * Remote nodes should always be started with the following command:
- * {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}
+ * Remote nodes should always be started with the following command: {@code 
'ignite.{sh|bat}
+ * examples/config/example-ignite.xml'}
  * 
- * Alternatively you can run {@link 
org.apache.ignite.examples.ExampleNodeStartup} in another JVM which will
- * start a node with {@code examples/config/example-ignite.xml} configuration.
+ * Alternatively you can run {@link 
org.apache.ignite.examples.ExampleNodeStartup} in another JVM which will start a
+ * node with {@code examples/config/example-ignite.xml} configuration.
  */
 public class CacheClientBinaryQueryExample {
 /** Organization cache name. */
@@ -106,15 +105,12 @@ public class CacheClientBinaryQueryExample {
 // Get cache that will work with binary objects.
 IgniteCache binaryCache = 
employeeCache.withKeepBinary();
 
-// Run SQL query example.
-sqlQuery(binaryCache);
+// Run SQL fields query example.
+sqlFieldsQuery(binaryCache);
 
 // Run SQL query with join example.
 sqlJoinQuery(binaryCache);
 
-// Run SQL fields query example.
-sqlFieldsQuery(binaryCache);
-
 // Run full text query example.
 textQuery(binaryCache);
 
@@ -134,30 +130,21 @@ public class CacheClientBinaryQueryExample {
  * @return Cache type metadata.
  */
 private static QueryEntity createEmployeeQueryEntity() {
-QueryEntity employeeEntity = new QueryEntity

[ignite] branch master updated: IGNITE-7664: SQL: Throw better error messages for unsupported SQL keywords and features. This closes #6138.

2019-04-01 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 70b9e0e  IGNITE-7664: SQL: Throw better error messages for unsupported 
SQL keywords and features. This closes #6138.
70b9e0e is described below

commit 70b9e0e83e36be04ff306cf809f024f736cbf7e8
Author: tledkov 
AuthorDate: Mon Apr 1 16:36:02 2019 +0300

IGNITE-7664: SQL: Throw better error messages for unsupported SQL keywords 
and features. This closes #6138.
---
 .../org/apache/ignite/internal/sql/SqlKeyword.java |  12 +
 .../org/apache/ignite/internal/sql/SqlParser.java  |  67 +
 .../apache/ignite/internal/sql/SqlParserUtils.java |   2 +-
 .../internal/sql/SqlStrictParseException.java  |  27 +-
 .../internal/processors/query/h2/QueryParser.java  |  25 +-
 .../processors/query/h2/sql/GridSqlKeyword.java|   3 +-
 .../query/h2/sql/GridSqlQueryParser.java   | 199 +---
 .../cache/IgniteCacheUpdateSqlQuerySelfTest.java   |  33 --
 .../query/h2/sql/GridQueryParsingTest.java |  47 +--
 .../query/h2/sql/SqlUnsupportedSelfTest.java   | 332 +
 .../IgniteBinaryCacheQueryTestSuite.java   |   2 +
 11 files changed, 639 insertions(+), 110 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java
index 05cde79..c249a8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlKeyword.java
@@ -284,6 +284,18 @@ public class SqlKeyword {
 /** Keyword: PASSWORD. */
 public static final String PASSWORD = "PASSWORD";
 
+/** Keyword: SHOW. */
+public static final String SHOW = "SHOW";
+
+/** Keyword: HELP. */
+public static final String HELP = "HELP";
+
+/** Keyword: GRANT. */
+public static final String GRANT = "GRANT";
+
+/** Keyword: REVOKE. */
+public static final String REVOKE = "REVOKE";
+
 /** All keywords. */
 private static final HashSet KEYWORDS;
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParser.java 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParser.java
index aaf5614..c5a0371 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/sql/SqlParser.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.sql;
 
+import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.sql.command.SqlAlterTableCommand;
 import org.apache.ignite.internal.sql.command.SqlAlterUserCommand;
 import org.apache.ignite.internal.sql.command.SqlBeginTransactionCommand;
@@ -37,11 +38,15 @@ import static 
org.apache.ignite.internal.sql.SqlKeyword.COMMIT;
 import static org.apache.ignite.internal.sql.SqlKeyword.COPY;
 import static org.apache.ignite.internal.sql.SqlKeyword.CREATE;
 import static org.apache.ignite.internal.sql.SqlKeyword.DROP;
+import static org.apache.ignite.internal.sql.SqlKeyword.GRANT;
 import static org.apache.ignite.internal.sql.SqlKeyword.HASH;
+import static org.apache.ignite.internal.sql.SqlKeyword.HELP;
 import static org.apache.ignite.internal.sql.SqlKeyword.INDEX;
 import static org.apache.ignite.internal.sql.SqlKeyword.PRIMARY;
+import static org.apache.ignite.internal.sql.SqlKeyword.REVOKE;
 import static org.apache.ignite.internal.sql.SqlKeyword.ROLLBACK;
 import static org.apache.ignite.internal.sql.SqlKeyword.SET;
+import static org.apache.ignite.internal.sql.SqlKeyword.SHOW;
 import static org.apache.ignite.internal.sql.SqlKeyword.SPATIAL;
 import static org.apache.ignite.internal.sql.SqlKeyword.START;
 import static org.apache.ignite.internal.sql.SqlKeyword.STREAMING;
@@ -175,6 +180,28 @@ public class SqlParser {
 
 case ALTER:
 cmd = processAlter();
+
+break;
+
+case HELP:
+cmd = processHelp();
+
+break;
+
+case SHOW:
+cmd = processShow();
+
+break;
+
+case GRANT:
+cmd = processGrant();
+
+break;
+
+case REVOKE:
+cmd = processRevoke();
+
+break;
 }
 
 if (cmd != null) {
@@ -371,6 +398,46 @@ public class SqlParser {
 }
 
 /**
+ * Process HELP keyword.
+ *
+ * @return Command.
+ */
+private SqlCommand processHelp() {
+ 

[ignite] branch master updated: IGNITE-11143: SQL: Improved printout of long-running queries. This closes #6353.

2019-04-01 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 963a40b  IGNITE-11143: SQL: Improved printout of long-running queries. 
This closes #6353.
963a40b is described below

commit 963a40b7aad623f3b56b41e40d61894b9e15a6b6
Author: tledkov 
AuthorDate: Mon Apr 1 14:20:32 2019 +0300

IGNITE-11143: SQL: Improved printout of long-running queries. This closes 
#6353.
---
 .../org/apache/ignite/internal/IgniteKernal.java   | 227 +
 .../internal/StripedExecutorMXBeanAdapter.java |   2 +-
 .../internal/TransactionMetricsMxBeanImpl.java |   2 +-
 .../ignite/internal/TransactionsMXBeanImpl.java|   2 +-
 .../internal/managers/IgniteMBeansManager.java | 283 +
 .../processors/query/GridQueryIndexing.java|   9 +
 .../IgniteClientCacheInitializationFailTest.java   |   6 +
 .../ignite/internal/mxbean/SqlQueryMXBean.java |  71 ++
 .../ignite/internal/mxbean/SqlQueryMXBeanImpl.java |  56 
 .../internal/processors/query/h2/H2QueryInfo.java  | 159 
 .../processors/query/h2/IgniteH2Indexing.java  |  76 +++---
 .../query/h2/LongRunningQueryManager.java  | 204 +++
 .../processors/query/h2/MapH2QueryInfo.java|  58 +
 .../processors/query/h2/ReduceH2QueryInfo.java |  44 
 .../query/h2/twostep/GridMapQueryExecutor.java |   8 +-
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  20 +-
 .../processors/query/LongRunningQueryTest.java | 194 ++
 .../processors/query/h2/QueryDataPageScanTest.java |   5 +-
 18 files changed, 1162 insertions(+), 264 deletions(-)

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 3b8604f..e1564c7 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
@@ -38,13 +38,11 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ThreadPoolExecutor;
@@ -52,7 +50,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.cache.CacheException;
 import javax.management.JMException;
-import javax.management.ObjectName;
 import org.apache.ignite.DataRegionMetrics;
 import org.apache.ignite.DataRegionMetricsAdapter;
 import org.apache.ignite.DataStorageMetrics;
@@ -105,6 +102,7 @@ import org.apache.ignite.internal.binary.BinaryUtils;
 import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
 import org.apache.ignite.internal.cluster.IgniteClusterEx;
 import org.apache.ignite.internal.managers.GridManager;
+import org.apache.ignite.internal.managers.IgniteMBeansManager;
 import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager;
 import org.apache.ignite.internal.managers.collision.GridCollisionManager;
 import org.apache.ignite.internal.managers.communication.GridIoManager;
@@ -132,11 +130,9 @@ import 
org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import 
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccProcessorImpl;
 import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
-import 
org.apache.ignite.internal.processors.cache.persistence.DataStorageMXBeanImpl;
 import 
org.apache.ignite.internal.processors.cache.persistence.filename.PdsConsistentIdProcessor;
 import 
org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
 import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
-import 
org.apache.ignite.internal.processors.cluster.BaselineConfigurationMXBeanImpl;
 import org.apache.ignite.internal.processors.cluster.ClusterProcessor;
 import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
 import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
@@ -174,7 +170,6 @@ import 
org.apache.ignite.internal.processors.session.GridTaskSessionProcessor;
 import 
org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor;
 import org.apache.ignite.internal.processors.task.GridTaskProcessor;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
-import org.apache.ignite.internal.stat.IoStatisticsMetricsLocalMXBeanImpl;
 import

[ignite] branch master updated: IGNITE-11634: SQL: Fixed anonymous class handling in DmlStatementsProcessor. This closes #6349.

2019-03-28 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 9dab4e4  IGNITE-11634: SQL: Fixed anonymous class handling in 
DmlStatementsProcessor. This closes #6349.
9dab4e4 is described below

commit 9dab4e441d7e7240206477421305e005acfc9b4a
Author: Roman Guseinov 
AuthorDate: Thu Mar 28 12:11:09 2019 +0300

IGNITE-11634: SQL: Fixed anonymous class handling in 
DmlStatementsProcessor. This closes #6349.
---
 .../query/h2/DmlStatementsProcessor.java   |  21 ++--
 .../query/h2/DmlStatementsProcessorTest.java   | 111 +
 .../IgniteBinaryCacheQueryTestSuite2.java  |   3 +
 3 files changed, 125 insertions(+), 10 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index 937e383..2072622 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -111,20 +111,21 @@ public class DmlStatementsProcessor {
 }
 };
 
-/** Dummy anonymous class to advance RMV anonymous value to 5. */
-private static final Runnable DUMMY_4 = new Runnable() {
-@Override public void run() {
-// No-op.
-}
-};
+/** Remove updater for compatibility with < 2.7.0. Must not be moved 
around to keep at anonymous position 4. */
+public static final IgniteInClosure> RMV_OLD =
+new IgniteInClosure>() {
+@Override public void apply(MutableEntry e) {
+e.remove();
+}
+};
 
 /** Remove updater. Must not be moved around to keep at anonymous position 
5. */
 public static final IgniteInClosure> RMV =
 new IgniteInClosure>() {
-@Override public void apply(MutableEntry e) {
-e.remove();
-}
-};
+@Override public void apply(MutableEntry e) {
+e.remove();
+}
+};
 
 /**
  * Entry value updater.
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessorTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessorTest.java
new file mode 100644
index 000..da57e82
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessorTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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;
+
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Ensures that abstart classes of entry modifiers are compatible with old 
versions.
+ */
+public class DmlStatementsProcessorTest {
+/**
+ * Checks that remove-closure is available by anonymous class position (4).
+ * This is required for compatibility with versions < 2.7.0.
+ *
+ * @throws Exception If failed.
+ */
+@Test
+public void testRemoveEntryModifierCompatibilityOld() throws Exception {
+checkRemoveClosureByAnonymousPosition(4);
+}
+
+/**
+ * Checks that remove-closure is available by anonymous class position (5).
+ * This is required for compatibility with versions >= 2.7.0.
+ *
+ * @throws Exception If failed.
+ */
+@Test
+public void testRemoveEntryModifierCompatibilityNew() throws Exception {
+checkRemoveClosureByAnonymousPosition(5);
+}
+
+/**
+ * Checks that remove-closure is available by anonymous class position.
+ */
+private void checkRemoveClosureByAnonymousPosition(int position) throws 
Exception {
+Class cls = Class.forName(DmlStatementsPr

[ignite] branch master updated: IGNITE-11431: SQL: Added "SCHEMAS" system view. This closes #6237.

2019-03-28 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 4c3c2e5  IGNITE-11431: SQL: Added "SCHEMAS" system view. This closes 
#6237.
4c3c2e5 is described below

commit 4c3c2e5a7171cd4a26ab841d39ed27e8f5f410a1
Author: Yuriy Gerzhedovich 
AuthorDate: Thu Mar 28 12:05:04 2019 +0300

IGNITE-11431: SQL: Added "SCHEMAS" system view. This closes #6237.
---
 .../processors/query/h2/SchemaManager.java |  2 +
 .../query/h2/sys/view/SqlSystemViewSchemas.java| 73 ++
 .../processors/query/SqlSystemViewsSelfTest.java   | 32 ++
 3 files changed, 107 insertions(+)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java
index 7bc78b7..885fa7a 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java
@@ -60,6 +60,7 @@ import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNode
 import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodes;
 import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewQueryHistoryMetrics;
 import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewRunningQueries;
+import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewSchemas;
 import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewTables;
 import 
org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
 import org.apache.ignite.internal.util.typedef.F;
@@ -175,6 +176,7 @@ public class SchemaManager {
 views.add(new SqlSystemViewQueryHistoryMetrics(ctx));
 views.add(new SqlSystemViewTables(ctx, this));
 views.add(new SqlSystemViewIndexes(ctx, this));
+views.add(new SqlSystemViewSchemas(ctx, this));
 
 return views;
 }
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewSchemas.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewSchemas.java
new file mode 100644
index 000..395e56c
--- /dev/null
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewSchemas.java
@@ -0,0 +1,73 @@
+/*
+ * 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.sys.view;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.query.h2.SchemaManager;
+import org.h2.engine.Session;
+import org.h2.result.Row;
+import org.h2.result.SearchRow;
+
+/**
+ * View that contains information about all the sql tables in the cluster.
+ */
+public class SqlSystemViewSchemas extends SqlAbstractLocalSystemView {
+/** Schema manager. */
+private final SchemaManager schemaMgr;
+
+/**
+ * Creates view with columns.
+ *
+ * @param ctx kernal context.
+ */
+public SqlSystemViewSchemas(GridKernalContext ctx, SchemaManager 
schemaMgr) {
+super("SCHEMAS", "Ignite SQL schemas", ctx,
+newColumn("SCHEMA_NAME")
+);
+
+this.schemaMgr = schemaMgr;
+}
+
+/** {@inheritDoc} */
+@Override public Iterator getRows(Session ses, SearchRow first, 
SearchRow last) {
+Set schemaNames = schemaMgr.schemaNames();
+
+List rows = new ArrayList<>(schemaNames.size());
+
+for (String schemaName : schemaNames)
+rows.add(createRow(ses, schemaName));
+
+return rows.iterator();
+}
+
+/** {@inheritDoc} */
+@Override public boolean canGetRowCount() {
+  

[ignite] branch master updated: IGNITE-11646: SQL: Fixed failing H2IndexesSystemViewTest. This closes #6361.

2019-03-28 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 26f15b8  IGNITE-11646: SQL: Fixed failing H2IndexesSystemViewTest. 
This closes #6361.
26f15b8 is described below

commit 26f15b804701233577d7428106dff495937fec8c
Author: Yuriy Gerzhedovich 
AuthorDate: Thu Mar 28 11:49:48 2019 +0300

IGNITE-11646: SQL: Fixed failing H2IndexesSystemViewTest. This closes #6361.
---
 .../internal/processors/query/h2/H2IndexesSystemViewTest.java  | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
 
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
index eb245ef..3a9f0cb 100644
--- 
a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
+++ 
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
@@ -33,7 +33,6 @@ import org.junit.Test;
  * Test expose SPATIAL indexes through SQL system view INDEXES.
  */
 public class H2IndexesSystemViewTest extends GridCommonAbstractTest {
-
 /** {@inheritDoc} */
 @Override protected IgniteConfiguration getConfiguration() throws 
Exception {
 return super.getConfiguration().setCacheConfiguration(new 
CacheConfiguration().setName(DEFAULT_CACHE_NAME));
@@ -41,6 +40,7 @@ public class H2IndexesSystemViewTest extends 
GridCommonAbstractTest {
 
 /**
  * Test indexes system view.
+ *
  * @throws Exception in case of failure.
  */
 @Test
@@ -62,10 +62,10 @@ public class H2IndexesSystemViewTest extends 
GridCommonAbstractTest {
 Assert.assertEquals(srvNodeIndexes.toString(), 
clientNodeNodeIndexes.toString());
 
 String[][] expectedResults = {
-{"PUBLIC", "AFF_CACHE", "IDX_GEO_1", "\"GEOM\" ASC", "SPATIAL", 
"false", "false", "-825022849", "SQL_PUBLIC_AFF_CACHE", "-825022849", 
"SQL_PUBLIC_AFF_CACHE", "null"},
-{"PUBLIC", "AFF_CACHE", "__SCAN_", "null", "SCAN", "false", 
"false", "-825022849", "SQL_PUBLIC_AFF_CACHE", "-825022849", 
"SQL_PUBLIC_AFF_CACHE", "null"},
-{"PUBLIC", "AFF_CACHE", "_key_PK", "\"ID1\" ASC", "BTREE", "true", 
"true", "-825022849", "SQL_PUBLIC_AFF_CACHE", "-825022849", 
"SQL_PUBLIC_AFF_CACHE", "5"},
-{"PUBLIC", "AFF_CACHE", "_key_PK_hash", "\"ID1\" ASC", "HASH", 
"false", "true", "-825022849", "SQL_PUBLIC_AFF_CACHE", "-825022849", 
"SQL_PUBLIC_AFF_CACHE", "null"},
+{"-825022849", "SQL_PUBLIC_AFF_CACHE", "-825022849", 
"SQL_PUBLIC_AFF_CACHE", "PUBLIC", "AFF_CACHE", "IDX_GEO_1", "SPATIAL", 
"\"GEOM\" ASC", "false", "false", "null"},
+{"-825022849", "SQL_PUBLIC_AFF_CACHE", "-825022849", 
"SQL_PUBLIC_AFF_CACHE", "PUBLIC", "AFF_CACHE", "__SCAN_", "SCAN", "null", 
"false", "false", "null"},
+{"-825022849", "SQL_PUBLIC_AFF_CACHE", "-825022849", 
"SQL_PUBLIC_AFF_CACHE", "PUBLIC", "AFF_CACHE", "_key_PK", "BTREE", "\"ID1\" 
ASC", "true", "true", "5"},
+{"-825022849", "SQL_PUBLIC_AFF_CACHE", "-825022849", 
"SQL_PUBLIC_AFF_CACHE", "PUBLIC", "AFF_CACHE", "_key_PK_hash", "HASH", "\"ID1\" 
ASC", "false", "true", "null"},
 };
 
 for (int i = 0; i < srvNodeIndexes.size(); i++) {



[ignite] branch master updated: IGNITE-11524: JDBC Thin Driver: fixed statement leak in connections. This closes #6265.

2019-03-27 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 4f5732b  IGNITE-11524: JDBC Thin Driver: fixed statement leak in 
connections. This closes #6265.
 new 2fe45c7  Merge remote-tracking branch 'origin/master'
4f5732b is described below

commit 4f5732b2fc7bf077ed5fd314031709edf4c1e1e9
Author: tledkov 
AuthorDate: Wed Mar 27 17:32:23 2019 +0300

IGNITE-11524: JDBC Thin Driver: fixed statement leak in connections. This 
closes #6265.
---
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |  5 +-
 .../thin/JdbcThinPreparedStatementLeakTest.java| 77 ++
 .../internal/jdbc/thin/JdbcThinConnection.java | 25 ++-
 .../internal/jdbc/thin/JdbcThinStatement.java  |  2 +
 4 files changed, 107 insertions(+), 2 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index 75fc63d..e77dfc9 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -74,6 +74,7 @@ import org.apache.ignite.jdbc.thin.JdbcThinMetadataSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinMissingLongArrayResultsTest;
 import org.apache.ignite.jdbc.thin.JdbcThinMultiStatementSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinNoDefaultSchemaTest;
+import org.apache.ignite.jdbc.thin.JdbcThinPreparedStatementLeakTest;
 import org.apache.ignite.jdbc.thin.JdbcThinPreparedStatementSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinResultSetSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinSchemaCaseSelfTest;
@@ -226,7 +227,9 @@ import org.junit.runners.Suite;
 
 // Various commands.
 JdbcThinWalModeChangeSelfTest.class,
-JdbcThinAuthenticateConnectionSelfTest.class
+JdbcThinAuthenticateConnectionSelfTest.class,
+
+JdbcThinPreparedStatementLeakTest.class,
 })
 public class IgniteJdbcDriverTestSuite {
 }
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPreparedStatementLeakTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPreparedStatementLeakTest.java
new file mode 100644
index 000..f9c1de7
--- /dev/null
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPreparedStatementLeakTest.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.jdbc.thin;
+
+import org.apache.ignite.IgniteJdbcThinDriver;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * Prepared statement leaks test.
+ */
+@SuppressWarnings("ThrowableNotThrown")
+public class JdbcThinPreparedStatementLeakTest extends 
JdbcThinAbstractSelfTest {
+/** URL. */
+private static final String URL = "jdbc:ignite:thin://127.0.0.1/";
+
+
+/** {@inheritDoc} */
+@Override protected void beforeTest() throws Exception {
+super.beforeTest();
+
+startGrid();
+}
+
+/** {@inheritDoc} */
+@Override protected void afterTest() throws Exception {
+stopAllGrids();
+
+super.afterTest();
+}
+
+/**
+ * @throws Exception If failed.
+ */
+@SuppressWarnings("StatementWithEmptyBody")
+@Test
+public void test() throws Exception {
+try (Connection conn = new IgniteJdbcThinDriver().connect(URL, new 
Properties())) {
+for (int i = 0; i < 5; ++i) {
+try (PreparedStatement st = conn.prepareStatement("select 1")) 
{
+ResultSet rs = st.executeQuery();
+
+while (rs.next()) {
+// No-op.
+}
+
+rs.clos

[ignite] branch master updated: IGNITE-11552: ODBC: Fixed quoted schema handling. This closes #6348.

2019-03-27 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 8abb80c  IGNITE-11552: ODBC: Fixed quoted schema handling. This closes 
#6348.
8abb80c is described below

commit 8abb80cfa3f546a3e56d14627ce80b93ac4b414c
Author: Igor Sapego 
AuthorDate: Wed Mar 27 17:24:56 2019 +0300

IGNITE-11552: ODBC: Fixed quoted schema handling. This closes #6348.
---
 .../processors/odbc/odbc/OdbcRequestHandler.java   | 18 +++---
 .../internal/processors/odbc/odbc/OdbcUtils.java   | 12 
 .../cpp/odbc-test/src/api_robustness_test.cpp  | 68 +++---
 3 files changed, 68 insertions(+), 30 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
index d1ebaa9..869af22 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
@@ -53,7 +53,6 @@ import 
org.apache.ignite.internal.processors.query.GridQueryProperty;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.processors.query.IgniteSQLException;
 import org.apache.ignite.internal.processors.query.NestedTxMode;
-import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.processors.query.SqlClientContext;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -352,7 +351,7 @@ public class OdbcRequestHandler implements 
ClientListenerRequestHandler {
 qry.setReplicatedOnly(cliCtx.isReplicatedOnly());
 qry.setCollocated(cliCtx.isCollocated());
 qry.setLazy(cliCtx.isLazy());
-qry.setSchema(F.isEmpty(schema) ? QueryUtils.DFLT_SCHEMA : schema);
+qry.setSchema(OdbcUtils.prepareSchema(schema));
 qry.setSkipReducerOnUpdate(cliCtx.isSkipReducerOnUpdate());
 qry.setNestedTxMode(nestedTxMode);
 
@@ -557,7 +556,7 @@ public class OdbcRequestHandler implements 
ClientListenerRequestHandler {
 assert cliCtx.isStream();
 
 ctx.query().streamBatchedUpdateQuery(
-qry.getSchema(),
+OdbcUtils.prepareSchema(qry.getSchema()),
 cliCtx,
 qry.getSql(),
 qry.batchedArguments()
@@ -654,16 +653,16 @@ public class OdbcRequestHandler implements 
ClientListenerRequestHandler {
 // Parsing two-part table name.
 String[] parts = req.tablePattern().split("\\.");
 
-schemaPattern = 
OdbcUtils.removeQuotationMarksIfNeeded(parts[0]);
-
+schemaPattern = parts[0];
 tablePattern = parts[1];
 }
 else {
-schemaPattern = 
OdbcUtils.removeQuotationMarksIfNeeded(req.schemaPattern());
-
+schemaPattern = req.schemaPattern();
 tablePattern = req.tablePattern();
 }
 
+schemaPattern = 
OdbcUtils.removeQuotationMarksIfNeeded(schemaPattern);
+
 for (String cacheName : ctx.cache().publicCacheNames()) {
 for (GridQueryTypeDescriptor table : 
ctx.query().types(cacheName)) {
 if (!matches(table.schemaName(), schemaPattern) ||
@@ -741,7 +740,10 @@ public class OdbcRequestHandler implements 
ClientListenerRequestHandler {
  */
 private ClientListenerResponse getParamsMeta(OdbcQueryGetParamsMetaRequest 
req) {
 try {
-PreparedStatement stmt = 
ctx.query().getIndexing().prepareNativeStatement(req.schema(), req.query());
+String sql = OdbcEscapeUtils.parse(req.query());
+String schema = OdbcUtils.prepareSchema(req.schema());
+
+PreparedStatement stmt = 
ctx.query().getIndexing().prepareNativeStatement(schema, sql);
 
 ParameterMetaData pmd = stmt.getParameterMetaData();
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java
index c55ff1d..a687b96 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java
@@ -26,6 +26,7 @@ import 
org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.processors.odbc.SqlListenerDataTypes;
 import org.apache.ignite.internal.processors.odbc.SqlListenerUtil

[ignite] branch ignite-11564 updated: IGNITE-11452: Throw exception when cancel is attempted on a command which do not support it.

2019-03-27 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-11564 by this push:
 new 03066a5  IGNITE-11452: Throw exception when cancel is attempted on a 
command which do not support it.
03066a5 is described below

commit 03066a510a0c3cd2980cf57e353d3d37001a42d1
Author: Yuriy Gerzhedovich 
AuthorDate: Wed Mar 27 17:03:05 2019 +0300

IGNITE-11452: Throw exception when cancel is attempted on a command which 
do not support it.
---
 .../processors/query/h2/CommandProcessor.java  |   7 +-
 .../processors/query/h2/IgniteH2Indexing.java  |   7 +-
 .../internal/processors/query/KillQueryTest.java   | 363 ++---
 3 files changed, 323 insertions(+), 54 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
index f360e28..9f2ae7e 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
@@ -299,8 +299,9 @@ public class CommandProcessor {
 GridRunningQueryInfo runningQryInfo = 
idx.runningQueryManager().runningQueryInfo(qryId);
 
 if (runningQryInfo == null)
-err = "Failed to cancel query due to query doesn't exist " +
-"[nodeId=" + ctx.localNodeId() + ",qryId=" + qryId + "]";
+err = "Query with provided ID doesn't exist [nodeId=" + 
ctx.localNodeId() + ", qryId=" + qryId + "]";
+else if (!runningQryInfo.cancelable())
+err = "Query doesn't support cancellation [nodeId=" + 
ctx.localNodeId() + ", qryId=" + qryId + "]";
 
 if (msg.asyncResponse()) {
 snd = idx.send(GridTopic.TOPIC_QUERY,
@@ -314,7 +315,7 @@ public class CommandProcessor {
 }
 
 try {
-if (runningQryInfo != null)
+if (err == null)
 runningQryInfo.cancel();
 }
 catch (Exception e) {
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 39a606c..b5e807b 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
@@ -1339,9 +1339,6 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 boolean keepBinary,
 GridQueryCancel cancel
 ) {
-if (cancel == null)
-cancel = new GridQueryCancel();
-
 // Check security.
 if (ctx.security().enabled())
 checkSecurity(select.cacheIds());
@@ -2304,6 +2301,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 try {
 List>> cur = plan.createRows(argss);
 
+//https://issues.apache.org/jira/browse/IGNITE-11176 - 
Need to support cancellation
 ress = DmlUtils.processSelectResultBatched(plan, cur, 
qryParams.pageSize());
 }
 finally {
@@ -2573,6 +2571,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 
 int pageSize = loc ? 0 : qryParams.pageSize();
 
+//https://issues.apache.org/jira/browse/IGNITE-11176 - Need to support 
cancellation
 return DmlUtils.processSelectResult(plan, cur, pageSize);
 }
 
@@ -2662,6 +2661,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 it = plan.iteratorForTransaction(connMgr, cur);
 }
 
+//https://issues.apache.org/jira/browse/IGNITE-11176 - Need to 
support cancellation
 IgniteInternalFuture fut = tx.updateAsync(
 cctx,
 it,
@@ -2700,6 +2700,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 if (parts != null && parts.length == 0)
 return new UpdateResult(0, X.EMPTY_OBJECT_ARRAY);
 else {
+//https://issues.apache.org/jira/browse/IGNITE-11176 - Need to 
support cancellation
 IgniteInternalFuture fut = tx.updateAsync(
 cctx,
 ids,
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/KillQueryTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/KillQueryTest.java
index 369099a..aeb6da1 100644
-

[ignite] branch ignite-11564 updated (b7f563a -> d808657)

2019-03-27 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git.


from b7f563a  Merge branch 'master' into ignite-10161
 add b8806e1  IGNITE-11560 @WithSystemProperty annotation breaks some 
existing tests - Fixes #6287.
 add 38777da  IGNITE-11555 Fixed exchange latch coordinator failover - 
Fixes #6283.
 add 2efa886  IGNITE-11508 Add IGNITE_YARN_QUEUE property to override YARN 
queue name - Fixes #6302.
 add 9473492  IGNITE-11561: [ML] IgniteDistributedModel for XGBoost doesn't 
work in example
 add a63f9bf  IGNITE-11356 Test framework: Remove custom assumption 
exceptions handling - Fixes #6288.
 add 4104f78  IGNITE-11548: MVCC: Fixed mvcc snapshot request hanging on 
stop. This closes #6291.
 add 243b29f  IGNITE-11557: SQL: Fixed flaky test 
SqlSystemViewsSelfTest.testQueryHistoryMetricsModes. This closes #6285.
 add d9693a7  IGNITE-11371 Return non-null value if read-through value 
store failed due to version mismatch - Fixes #6290.
 add 9700f5f  IGNITE-11511: SQL: Added more tests for DML with parameters 
located in both UPDATE and WHERE parts. This closes #6308.
 add 145feac  IGNITE-11438 Fixed issue with TTL manager not cleaning 
entries from the underlying store. Fixes #6197
 add b221ab8  IGNITE-11545 Logging baseline auto-adjust
 add c69ff4a  IGNITE-11471: JDBC Thin Driver: Randomize the first server 
address to connect to. This closes #6260.
 add 221cd6c  IGNITE-11572 Node restart in ignite.sh was broken by 
IGNITE-11216 (#6307)
 add e7e1e77  IGNITE-10691: Python thin client: UUID marshalling fix
 add 5307b0a  IGNITE-1090 Fixed 
GridCachePartitionedOptimisticTxNodeRestartTest - Fixes #6140.
 add 4c352bc  IGNITE-11600 Fix launch script for Java 12 (#6323)
 add edcf722  Revert "IGNITE-11600 Fix launch script for Java 12 (#6323)"
 add 3caa230  IGNITE-11595 Fix broken Javadoc stylesheet (#6322)
 add 68b2207  IGNITE-11612 Fix of the test. - Fixes #6328.
 add b019978  IGNITE-11613 Fixed GridSpringBeanSerializationSelfTest - 
Fixes #6329.
 add 47a49cd  IGNITE-11600: Fix launch scripts for Java 12 (#6326)
 add 7a7c407  IGNITE-11484 Get rid of ForkJoinPool#commonPool usage for 
system critical task - Fixes #6243.
 add df17242  IGNITE-11535 AtomicLong cannot be found after creation - 
Fixes #6263.
 add 9849987  IGNITE-11615 Fixed NPE on node stop in 
IgniteBaselineAffinityTopologyActivationTest - Fixes #6331.
 add 3b53649  IGNITE-11618 Not fail when transaction is concurrently rolled 
back - Fixes #6333.
 add 87bd39f  IGNITE-11590: NPE during onKernalStop in mvcc processor. This 
closes #6317.
 add 9419272  IGNITE-11617 New exchange coordinator skips client fast reply 
for previous exchange - Fixes #6332.
 add e3a6aac  IGNITE-9799 Web Console: Removed unused code.
 add 2580c6a  IGNITE-11541 Static cache configuration should not override 
persisted configuration - Fixes #6318.
 add 63f25a7  IGNITE-11541 Added tests to the suite
 add d8d7110  IGNITE-11568 Change afterTest() annotation in 
TcpDiscoveryFailedJoinTest (#6303)
 add 1cef0ec  IGNITE-11380 Add support of JAR files to UriDeploymentSpi - 
Fixes #6177.
 add 6b5658b  IGNITE-11428: SQL: Schemas are now shown through JDBC 
drivers. This closes #6236.
 add 47693b6  IGNITE-11443: SQL: Usability changes to system views. This 
closes #6248.
 add 217accf  IGNITE-11589 Fix GridDhtPartitionsExchangeFuture remained 
incompleted in some circumstances - Fixes #6316.
 add ed9a415  IGNITE-10997 Add new property to DataRegionMetrics: empty 
pages count in reuseList. - Fixes #6319.
 add 6701a76  IGNITE-11347 Fix pending message in discovery spi on empty 
ring - Fixes #6123.
 new d808657  Merge branch 'master' into ignite-11564

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 assembly/docfiles/javadoc.css  | 648 -
 bin/control.bat|   2 +-
 bin/control.sh |   2 +-
 bin/ignite-tf.sh   |   2 +-
 bin/ignite.bat |   2 +-
 bin/ignite.sh  |  14 +-
 bin/ignitevisorcmd.bat |   2 +-
 bin/ignitevisorcmd.sh  |   2 +-
 modules/clients/src/test/config/jdbc-config.xml|   6 +
 .../internal/jdbc2/JdbcMetadataSelfTest.java   |   5 +-
 .../ignite/jdbc/thin/JdbcThinAbstractSelfTest.java |   2 +-
 .../ignite/jdbc/thin/JdbcThinMetadataSelfTest.java |   9 +-
 .../java/org/apache/ignite/DataRegionMetrics.ja

[ignite] 01/01: Merge branch 'master' into ignite-11564

2019-03-27 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit d808657e7bf5b9d862b389dbd3e7b0a243d6fbae
Merge: b7f563a 6701a76
Author: devozerov 
AuthorDate: Wed Mar 27 12:11:30 2019 +0300

Merge branch 'master' into ignite-11564

 assembly/docfiles/javadoc.css  | 648 -
 bin/control.bat|   2 +-
 bin/control.sh |   2 +-
 bin/ignite-tf.sh   |   2 +-
 bin/ignite.bat |   2 +-
 bin/ignite.sh  |  14 +-
 bin/ignitevisorcmd.bat |   2 +-
 bin/ignitevisorcmd.sh  |   2 +-
 modules/clients/src/test/config/jdbc-config.xml|   6 +
 .../internal/jdbc2/JdbcMetadataSelfTest.java   |   5 +-
 .../ignite/jdbc/thin/JdbcThinAbstractSelfTest.java |   2 +-
 .../ignite/jdbc/thin/JdbcThinMetadataSelfTest.java |   9 +-
 .../java/org/apache/ignite/DataRegionMetrics.java  |  12 +
 .../apache/ignite/DataRegionMetricsProvider.java   |  39 ++
 .../org/apache/ignite/IgniteSystemProperties.java  |  22 +-
 .../cluster/DistributedBaselineConfiguration.java  |   2 -
 .../ignite/internal/jdbc/thin/JdbcThinTcpIo.java   |   6 +-
 .../processors/cache/CacheGroupContext.java|   6 +-
 .../processors/cache/GridCacheAdapter.java |  16 +-
 .../processors/cache/GridCacheMapEntry.java|  10 +-
 .../internal/processors/cache/GridCacheMvcc.java   |   5 +-
 .../processors/cache/GridCacheProcessor.java   |  44 +-
 .../processors/cache/GridCacheTtlManager.java  |  47 +-
 .../cache/IgniteCacheOffheapManagerImpl.java   |  25 +-
 .../distributed/GridDistributedCacheEntry.java |   2 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java|   3 +-
 .../preloader/GridDhtPartitionsExchangeFuture.java | 158 ++---
 .../dht/preloader/latch/ExchangeLatchManager.java  | 146 +++--
 .../processors/cache/mvcc/MvccProcessorImpl.java   | 135 +++--
 .../cache/persistence/DataRegionMetricsImpl.java   |  18 +-
 .../persistence/DataRegionMetricsMXBeanImpl.java   |   5 +
 .../persistence/DataRegionMetricsSnapshot.java |   9 +
 .../GridCacheDatabaseSharedManager.java| 138 -
 .../cache/persistence/GridCacheOffheapManager.java |  69 ++-
 .../IgniteCacheDatabaseSharedManager.java  |  41 +-
 .../cache/transactions/IgniteTxHandler.java|   6 +-
 .../cache/transactions/IgniteTxManager.java|   5 +-
 .../autoadjust/BaselineAutoAdjustExecutor.java |  12 +-
 .../autoadjust/BaselineAutoAdjustScheduler.java| 121 +++-
 .../baseline/autoadjust/ChangeTopologyWatcher.java |   6 +-
 .../datastructures/AtomicDataStructureProxy.java   |  39 +-
 .../datastructures/GridCacheAtomicLongImpl.java|  67 +--
 .../GridCacheAtomicReferenceImpl.java  |  36 +-
 .../datastructures/GridCacheAtomicStampedImpl.java |  37 +-
 .../processors/odbc/jdbc/JdbcMetadataInfo.java |  10 +-
 .../platform/cluster/PlatformClusterGroup.java |   1 +
 .../processors/query/GridQueryIndexing.java|   8 +
 .../processors/query/GridQueryProcessor.java   |  23 +
 .../internal/util/GridReadOnlyArrayView.java   |  81 +++
 .../apache/ignite/internal/util/IgniteUtils.java   | 101 +++-
 .../ignite/mxbean/DataRegionMetricsMXBean.java |   4 +
 .../ignite/spi/discovery/tcp/ServerImpl.java   |  57 +-
 modules/core/src/test/config/tests.properties  |   5 +-
 ...ientReconnectAtomicsWithLostPartitionsTest.java | 372 
 .../cache/CacheGetRemoveSkipStoreTest.java | 293 ++
 .../processors/cache/CacheMetricsManageTest.java   |  32 +-
 .../ClientFastReplyCoordinatorFailureTest.java | 141 +
 .../processors/cache/GridCacheTestEntryEx.java |   2 +-
 .../IgniteClientCacheInitializationFailTest.java   |   5 +
 ...iteExchangeLatchManagerCoordinatorFailTest.java |  93 ++-
 ...achePartitionedOptimisticTxNodeRestartTest.java |   6 -
 .../near/NearCacheMultithreadedUpdateTest.java |   2 +-
 .../CommonPoolStarvationCheckpointTest.java| 147 +
 .../ClientAffinityAssignmentWithBaselineTest.java  |   4 -
 .../cache/persistence/db/IgnitePdsWithTtlTest.java | 118 +++-
 .../pagemem/UsedPagesMetricAbstractTest.java   |  97 +++
 .../persistence/pagemem/UsedPagesMetricTest.java   |  58 ++
 .../pagemem/UsedPagesMetricTestPersistence.java|  91 +++
 .../DistributedMetaStoragePersistentTest.java  |   4 +-
 .../discovery/tcp/TcpDiscoveryFailedJoinTest.java  |   6 +-
 .../apache/ignite/testframework/GridTestUtils.java |  37 +-
 .../testframework/junits/GridAbstractTest.java | 142 ++---
 .../junits/GridAbstractTestWithAssumption.java |  50 --
 .../testsuites/IgniteCacheMvccTestSuite4.java  |   2 +
 .../testsuites/IgniteCacheRestartTestSuite.java|   2

[ignite] branch master updated: IGNITE-11443: SQL: Usability changes to system views. This closes #6248.

2019-03-26 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 47693b6  IGNITE-11443: SQL: Usability changes to system views. This 
closes #6248.
47693b6 is described below

commit 47693b61ede12f4b94cb42c51e1cc67cd82bff8b
Author: Yuriy Gerzhedovich 
AuthorDate: Tue Mar 26 16:34:05 2019 +0300

IGNITE-11443: SQL: Usability changes to system views. This closes #6248.
---
 .../h2/sys/view/SqlAbstractLocalSystemView.java|  46 
 .../h2/sys/view/SqlSystemViewBaselineNodes.java|   2 +-
 .../h2/sys/view/SqlSystemViewCacheGroups.java  |  51 ++--
 .../view/SqlSystemViewCacheGroupsIOStatistics.java |   8 +-
 .../query/h2/sys/view/SqlSystemViewCaches.java | 147 ++--
 .../query/h2/sys/view/SqlSystemViewIndexes.java|  32 ++-
 .../query/h2/sys/view/SqlSystemViewNodes.java  |   8 +-
 .../query/h2/sys/view/SqlSystemViewTables.java |  35 ++-
 .../processors/query/SqlSystemViewsSelfTest.java   | 262 +
 9 files changed, 368 insertions(+), 223 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
index 01102da..ef1d329 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
@@ -18,7 +18,11 @@
 package org.apache.ignite.internal.processors.query.h2.sys.view;
 
 import java.util.UUID;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.lang.IgnitePredicate;
 import org.h2.engine.Session;
 import org.h2.result.Row;
 import org.h2.result.SearchRow;
@@ -27,6 +31,7 @@ import org.h2.value.Value;
 import org.h2.value.ValueNull;
 import org.h2.value.ValueString;
 import org.h2.value.ValueTimestamp;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Local system view base class (which uses only local node data).
@@ -147,4 +152,45 @@ public abstract class SqlAbstractLocalSystemView extends 
SqlAbstractSystemView {
 else
 return ValueTimestamp.fromMillis(millis);
 }
+
+/**
+ * Get node's filter string representation.
+ *
+ * @param ccfg Cache configuration.
+ *
+ * @return String representation of node filter.
+ */
+@Nullable protected static String nodeFilter(CacheConfiguration 
ccfg) {
+IgnitePredicate nodeFilter = ccfg.getNodeFilter();
+
+if (nodeFilter instanceof CacheConfiguration.IgniteAllNodesPredicate)
+nodeFilter = null;
+
+return toStringSafe(nodeFilter);
+}
+
+/**
+ * Get string representation of an object properly catching all exceptions.
+ *
+ * @param obj Object.
+ * @return Result or {@code null}.
+ */
+@Nullable protected static String toStringSafe(@Nullable Object obj) {
+if (obj == null)
+return null;
+else {
+try {
+return obj.toString();
+}
+catch (Exception e) {
+try {
+return "Failed to convert object to string: " + 
e.getMessage();
+}
+catch (Exception e0) {
+return "Failed to convert object to string (error message 
is not available)";
+}
+}
+}
+
+}
 }
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewBaselineNodes.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewBaselineNodes.java
index 54fb9b6..2090830 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewBaselineNodes.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewBaselineNodes.java
@@ -65,7 +65,7 @@ public class SqlSystemViewBaselineNodes extends 
SqlAbstractLocalSystemView {
 rows.add(
 createRow(
 ses,
-consistentId,
+toStringSafe(consistentId),
 aliveNodeIds.contains(consistentId)
 )
 );
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewCacheGroups.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewCacheGroups.java
in

[ignite] branch master updated: IGNITE-11428: SQL: Schemas are now shown through JDBC drivers. This closes #6236.

2019-03-26 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 6b5658b  IGNITE-11428: SQL: Schemas are now shown through JDBC 
drivers. This closes #6236.
6b5658b is described below

commit 6b5658b2e303782c61752c93ccf7f1b99ceaf280
Author: Yuriy Gerzhedovich 
AuthorDate: Tue Mar 26 16:20:13 2019 +0300

IGNITE-11428: SQL: Schemas are now shown through JDBC drivers. This closes 
#6236.
---
 modules/clients/src/test/config/jdbc-config.xml  |  6 ++
 .../apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java   |  5 -
 .../apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java|  2 +-
 .../apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java|  9 -
 .../internal/processors/odbc/jdbc/JdbcMetadataInfo.java  | 10 --
 .../ignite/internal/processors/query/GridQueryIndexing.java  |  8 
 .../cache/IgniteClientCacheInitializationFailTest.java   |  5 +
 .../internal/processors/query/h2/IgniteH2Indexing.java   |  6 ++
 .../ignite/internal/processors/query/h2/SchemaManager.java   | 12 +++-
 9 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/modules/clients/src/test/config/jdbc-config.xml 
b/modules/clients/src/test/config/jdbc-config.xml
index 38535a1..c9b61f9 100644
--- a/modules/clients/src/test/config/jdbc-config.xml
+++ b/modules/clients/src/test/config/jdbc-config.xml
@@ -46,6 +46,12 @@
 
 
 
+
+
+PREDEFINED_CLIENT_SCHEMA
+
+
+
 
 
 
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index 5172cf7..7cb59d0 100755
--- 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -96,6 +96,9 @@ public class JdbcMetadataSelfTest extends 
GridCommonAbstractTest {
 
 cfg.setConnectorConfiguration(new ConnectorConfiguration());
 
+cfg.setSqlSchemas("PREDEFINED_SCHEMAS_1", "PREDEFINED_SCHEMAS_2");
+
+
 return cfg;
 }
 
@@ -522,7 +525,7 @@ public class JdbcMetadataSelfTest extends 
GridCommonAbstractTest {
 try (Connection conn = DriverManager.getConnection(BASE_URL)) {
 ResultSet rs = conn.getMetaData().getSchemas();
 
-Set expectedSchemas = new HashSet<>(Arrays.asList("pers", 
"org", "metaTest", "dep", "PUBLIC"));
+Set expectedSchemas = new HashSet<>(Arrays.asList("pers", 
"org", "metaTest", "dep", "PUBLIC", "IGNITE", "PREDEFINED_CLIENT_SCHEMA"));
 
 Set schemas = new HashSet<>();
 
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java
index 6d5f59a..37f7f21 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractSelfTest.java
@@ -170,4 +170,4 @@ public class JdbcThinAbstractSelfTest extends 
GridCommonAbstractTest {
 return Collections.emptyList();
 }
 }
-}
\ No newline at end of file
+}
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
index 13ae776..0b16646 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMetadataSelfTest.java
@@ -43,6 +43,7 @@ import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.affinity.AffinityKey;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteVersionUtils;
 import org.apache.ignite.internal.jdbc2.JdbcUtils;
 import org.apache.ignite.internal.processors.query.QueryEntityEx;
@@ -64,6 +65,11 @@ public class JdbcThinMetadataSelfTest extends 
JdbcThinAbstractSelfTest {
 /** URL. */
 private static final String URL = "jdbc:ignite:thin://127.0.0.1/";
 
+/** {@inheritDoc} */
+@Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
+return 
super.getConfiguration(igniteInstanceName).setSqlSchemas(&q

[ignite] branch master updated: IGNITE-11471: JDBC Thin Driver: Randomize the first server address to connect to. This closes #6260.

2019-03-21 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new c69ff4a  IGNITE-11471: JDBC Thin Driver: Randomize the first server 
address to connect to. This closes #6260.
c69ff4a is described below

commit c69ff4ae96c412c31e29024a0ade37652e028bef
Author: Igor Belyakov 
AuthorDate: Thu Mar 21 13:20:38 2019 +0300

IGNITE-11471: JDBC Thin Driver: Randomize the first server address to 
connect to. This closes #6260.
---
 .../java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java| 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
index 2b8a0af..35f11f3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
@@ -28,6 +28,7 @@ import java.net.UnknownHostException;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Random;
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.query.QueryCancelledException;
@@ -56,6 +57,7 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteProductVersion;
 
+import static java.lang.Math.abs;
 import static 
org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.nullableBooleanToByte;
 
 /**
@@ -105,7 +107,7 @@ public class JdbcThinTcpIo {
 private static final int QUERY_CLOSE_MSG_SIZE = 9;
 
 /** Random. */
-private static final AtomicLong IDX_GEN = new AtomicLong();
+private static final AtomicLong IDX_GEN = new AtomicLong(new 
Random(U.currentTimeMillis()).nextLong());
 
 /** Connection properties. */
 private final ConnectionProperties connProps;
@@ -736,7 +738,7 @@ public class JdbcThinTcpIo {
 else {
 long nextIdx = IDX_GEN.getAndIncrement();
 
-return (int)(nextIdx % len);
+return (int)(abs(nextIdx) % len);
 }
 }
 



[ignite] branch master updated: IGNITE-11511: SQL: Added more tests for DML with parameters located in both UPDATE and WHERE parts. This closes #6308.

2019-03-20 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 9700f5f  IGNITE-11511: SQL: Added more tests for DML with parameters 
located in both UPDATE and WHERE parts. This closes #6308.
9700f5f is described below

commit 9700f5ff15ac8b62a06b7d436e93b0331386f37d
Author: Pavel Kuznetsov 
AuthorDate: Wed Mar 20 15:02:58 2019 +0300

IGNITE-11511: SQL: Added more tests for DML with parameters located in both 
UPDATE and WHERE parts. This closes #6308.
---
 .../cache/IgniteCacheUpdateSqlQuerySelfTest.java   | 115 ++---
 1 file changed, 101 insertions(+), 14 deletions(-)

diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
index d404d98..5599271 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
@@ -35,6 +35,8 @@ import 
org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.junit.Test;
 
+import static java.util.Arrays.asList;
+
 /**
  *
  */
@@ -82,16 +84,16 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends 
IgniteCacheAbstractSqlDml
 
 assertEquals(4, leftovers.size());
 
-assertEqualsCollections(Arrays.asList("FirstKey", createPerson(2, 
"Jo", "White"), 2, "Jo", "White"),
+assertEqualsCollections(asList("FirstKey", createPerson(2, "Jo", 
"White"), 2, "Jo", "White"),
 leftovers.get(0));
 
-assertEqualsCollections(Arrays.asList("SecondKey", createPerson(2, 
"Joe", "Black"), 2, "Joe", "Black"),
+assertEqualsCollections(asList("SecondKey", createPerson(2, "Joe", 
"Black"), 2, "Joe", "Black"),
 leftovers.get(1));
 
-assertEqualsCollections(Arrays.asList("f0u4thk3y", createPerson(4, 
"Jane", "Silver"), 4, "Jane", "Silver"),
+assertEqualsCollections(asList("f0u4thk3y", createPerson(4, "Jane", 
"Silver"), 4, "Jane", "Silver"),
 leftovers.get(2));
 
-assertEqualsCollections(Arrays.asList("k3", createPerson(6, "Sy", 
"Green"), 6, "Sy", "Green"),
+assertEqualsCollections(asList("k3", createPerson(6, "Sy", "Green"), 
6, "Sy", "Green"),
 leftovers.get(3));
 }
 
@@ -119,16 +121,16 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends 
IgniteCacheAbstractSqlDml
 
 assertEquals(4, leftovers.size());
 
-assertEqualsCollections(Arrays.asList("FirstKey", createPerson(2, 
"Jo", "White"), 2, "Jo", "White"),
+assertEqualsCollections(asList("FirstKey", createPerson(2, "Jo", 
"White"), 2, "Jo", "White"),
 leftovers.get(0));
 
-assertEqualsCollections(Arrays.asList("SecondKey", createPerson(2, 
"Joe", "Black"), 2, "Joe", "Black"),
+assertEqualsCollections(asList("SecondKey", createPerson(2, "Joe", 
"Black"), 2, "Joe", "Black"),
 leftovers.get(1));
 
-assertEqualsCollections(Arrays.asList("k3", createPerson(3, 
"Sylvia", "Green"), 3, "Sylvia", "Green"),
+assertEqualsCollections(asList("k3", createPerson(3, "Sylvia", 
"Green"), 3, "Sylvia", "Green"),
 leftovers.get(2));
 
-assertEqualsCollections(Arrays.asList("f0u4thk3y", createPerson(4, 
"Jane", "Silver"), 4, "Jane", "Silver"),
+assertEqualsCollections(asList("f0u4thk3y", createPerson(4, 
"Jane", "Silver"), 4, "Jane", "Silver"),
 leftovers.get(3));
 }
 finally {
@@ -164,14 +166,14 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends 
IgniteCacheAbstractSqlDml
 // Update inner fields just by their names
 p.query(new SqlFieldsQuery("UPDATE \&qu

[ignite] branch master updated: IGNITE-11557: SQL: Fixed flaky test SqlSystemViewsSelfTest.testQueryHistoryMetricsModes. This closes #6285.

2019-03-20 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 243b29f  IGNITE-11557: SQL: Fixed flaky test 
SqlSystemViewsSelfTest.testQueryHistoryMetricsModes. This closes #6285.
243b29f is described below

commit 243b29f6f673e3f20b19deecf9c9218b4823ae62
Author: Yuriy Gerzhedovich 
AuthorDate: Wed Mar 20 14:51:31 2019 +0300

IGNITE-11557: SQL: Fixed flaky test 
SqlSystemViewsSelfTest.testQueryHistoryMetricsModes. This closes #6285.
---
 .../apache/ignite/testframework/GridTestUtils.java | 37 +-
 .../processors/query/SqlSystemViewsSelfTest.java   | 11 ---
 2 files changed, 35 insertions(+), 13 deletions(-)

diff --git 
a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java 
b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index 75b5367..b763b8f 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -46,7 +46,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Properties;
 import java.util.Queue;
 import java.util.Random;
 import java.util.Set;
@@ -2090,9 +2089,9 @@ public final class GridTestUtils {
 
 public static class SqlTestFunctions {
 /** Sleep milliseconds. */
-public static volatile long sleepMs = 0;
+public static volatile long sleepMs;
 /** Fail flag. */
-public static volatile boolean fail = false;
+public static volatile boolean fail;
 
 /**
  * Do sleep {@code sleepMs} milliseconds
@@ -2100,13 +2099,21 @@ public final class GridTestUtils {
  * @return amount of milliseconds to sleep
  */
 @QuerySqlFunction
+@SuppressWarnings("BusyWait")
 public static long sleep() {
-try {
-Thread.sleep(sleepMs);
-}
-catch (InterruptedException ignored) {
-// No-op
+long end = System.currentTimeMillis() + sleepMs;
+
+long remainTime =sleepMs;
+
+do {
+try {
+Thread.sleep(remainTime);
+}
+catch (InterruptedException ignored) {
+// No-op
+}
 }
+while ((remainTime = end - System.currentTimeMillis()) > 0);
 
 return sleepMs;
 }
@@ -2123,5 +2130,19 @@ public final class GridTestUtils {
 else
 return 0;
 }
+
+/**
+ * Function do sleep {@code sleepMs} milliseconds and do fail in case 
of {@code fail} is true, return 0 otherwise.
+ *
+ * @return amount of milliseconds to sleep in case of {@code fail} is 
false, fail otherwise.
+ */
+@QuerySqlFunction
+public static long sleep_and_can_fail() {
+long sleep = sleep();
+
+can_fail();
+
+return sleep;
+}
 }
 }
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
index 773d06a..1850eae 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
@@ -47,7 +47,6 @@ import org.apache.ignite.cache.query.FieldsQueryCursor;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
 import org.apache.ignite.cluster.ClusterMetrics;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -318,6 +317,7 @@ public class SqlSystemViewsSelfTest extends 
AbstractIndexingCommonTest {
 
 final String SCHEMA_NAME = "TEST_SCHEMA";
 final long MAX_SLEEP = 500;
+final long MIN_SLEEP = 50;
 
 long tsBeforeRun = System.currentTimeMillis();
 
@@ -330,9 +330,9 @@ public class SqlSystemViewsSelfTest extends 
AbstractIndexingCommonTest {
 
 cache.put(100, "200");
 
-String sql = "SELECT \"STRING\"._KEY, \"STRING\"._VAL FROM \"STRING\" 
WHERE _key=100 AND sleep()>0 AND can_fail()=0";
+String sql = "SELECT \"STRING\"._KEY, \"STRING\"._VAL FROM \"STRING\" 
WHERE _key=100 AND sleep_and_can_fail()>0&quo

[ignite] 04/05: Merge remote-tracking branch 'upstream/ignite-10161' into ignite-10161

2019-03-19 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 7090a4020a4f767a96303a18b4c0a6d77edc8c02
Merge: e091770 8b84603
Author: devozerov 
AuthorDate: Tue Mar 19 10:20:42 2019 +0300

Merge remote-tracking branch 'upstream/ignite-10161' into ignite-10161

 examples/README.md |   8 +-
 examples/pom-standalone-lgpl.xml   |  44 +
 examples/pom-standalone.xml|   1 -
 .../tcp/redis/RedisProtocolGetAllAsArrayTest.java  |  17 +-
 .../cache/binary/BinaryMetadataTransport.java  |  28 ++-
 .../binary/CacheObjectBinaryProcessorImpl.java |  67 ---
 .../cache/persistence/GridCacheOffheapManager.java |   9 +
 .../cache/persistence/file/FileDownloader.java | 166 +++---
 .../cache/persistence/file/FilePageStore.java  |   2 +-
 .../cache/persistence/file/FileUploader.java   |  40 ++---
 .../processors/query/QueryHistoryMetrics.java  |  15 +-
 .../processors/query/QueryHistoryMetricsValue.java |  10 +-
 .../affinity/AffinityDistributionLoggingTest.java  |  37 +---
 .../cache/affinity/AffinityHistoryCleanupTest.java | 138 +++
 .../failure/FailureHandlingConfigurationTest.java  |  54 ++
 .../ConsistentIdImplicitlyExplicitlyTest.java  |  18 +-
 ...dCachePartitionExchangeManagerHistSizeTest.java |  23 +--
 .../ignite/internal/GridVersionSelfTest.java   |  11 +-
 .../ignite/internal/IgniteClientRejoinTest.java|  14 +-
 .../IgniteDiscoveryMassiveNodeFailTest.java|  19 +-
 ...iteUpdateNotifierPerClusterSettingSelfTest.java |  20 +--
 .../BinaryConfigurationConsistencySelfTest.java|  28 ++-
 .../IgniteTxConcurrentRemoveObjectsTest.java   |  24 +--
 .../cache/persistence/file/FileDownloaderTest.java |  15 +-
 .../apache/ignite/testframework/GridTestUtils.java |  75 
 .../testframework/junits/GridAbstractTest.java |  68 +++-
 .../junits/SystemPropertiesList.java}  |  28 ++-
 .../testframework/junits/WithSystemProperty.java}  |  31 ++--
 modules/dev-utils/ignite-modules-test/README.md|  16 ++
 modules/dev-utils/ignite-modules-test/build.gradle | 139 +++
 .../src/test/java/module-info.java}|  26 +--
 .../modulestest/IgniteLaunchInModularEnvTest.java  |  97 +++
 .../processors/query/h2/IgniteH2Indexing.java  |   3 +
 .../processors/query/h2/SchemaManager.java |   2 +
 .../sys/view/SqlSystemViewQueryHistoryMetrics.java |  92 ++
 .../cache/BinaryTypeRegistrationTest.java  | 194 +
 .../cache/StartCachesInParallelTest.java   |  43 ++---
 ...tributedPartitionQueryNodeRestartsSelfTest.java |  22 +--
 ...cheQueryNodeRestartDistributedJoinSelfTest.java |  27 ++-
 .../index/DynamicIndexAbstractBasicSelfTest.java   |  67 +++
 .../persistence/db/wal/IgniteWalRecoveryTest.java  | 140 ---
 .../transaction/DmlInsideTransactionTest.java  |  26 ++-
 ...tStoreQueryWithMultipleClassesPerCacheTest.java |   8 +-
 .../IgnitePersistentStoreSchemaLoadTest.java   |   6 +-
 .../processors/query/LocalQueryLazyTest.java   | 108 
 .../processors/query/SqlQueryHistorySelfTest.java  |   2 +-
 .../processors/query/SqlSystemViewsSelfTest.java   |  92 +-
 .../DisappearedCacheCauseRetryMessageSelfTest.java |   4 +-
 ...DisappearedCacheWasNotFoundMessageSelfTest.java |   4 +-
 .../twostep/NonCollocatedRetryMessageSelfTest.java |  17 +-
 .../h2/twostep/RetryCauseMessageSelfTest.java  |   4 +-
 .../IgniteBinaryCacheQueryTestSuite2.java  |   3 +
 .../IgniteCacheWithIndexingTestSuite.java  |   3 +
 .../tcp/ipfinder/zk/ZookeeperIpFinderTest.java |   5 +-
 ...erDiscoveryConcurrentStartAndStartStopTest.java |  13 +-
 ...coverySegmentationAndConnectionRestoreTest.java | 108 ++--
 .../ZookeeperDiscoverySpiSaslFailedAuthTest.java   |  13 +-
 ...ookeeperDiscoverySpiSaslSuccessfulAuthTest.java |   8 +-
 58 files changed, 1494 insertions(+), 808 deletions(-)



[ignite] branch ignite-11564 created (now b7f563a)

2019-03-19 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git.


  at b7f563a  Merge branch 'master' into ignite-10161

This branch includes the following new commits:

 new e091770  Merge branch 'master' into ignite-10161
 new 0ea7630  Merge branch 'master' into ignite-10161
 new 8b84603  Merge branch 'master' into ignite-10161
 new 7090a40  Merge remote-tracking branch 'upstream/ignite-10161' into 
ignite-10161
 new b7f563a  Merge branch 'master' into ignite-10161

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[ignite] 02/05: Merge branch 'master' into ignite-10161

2019-03-19 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 0ea763059098e1eecba796bd90687e5f63cf27fb
Merge: 8ffd36b 08f8b4e
Author: Yury Gerzhedovich 
AuthorDate: Fri Mar 15 12:34:38 2019 +0300

Merge branch 'master' into ignite-10161

 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |   2 +
 .../thin/JdbcThinStreamingResetStreamTest.java | 142 +++
 .../org/apache/ignite/internal/IgniteKernal.java   |   8 +-
 .../ignite/internal/commandline/Arguments.java |  25 +-
 .../internal/commandline/CommandHandler.java   | 407 +++--
 .../commandline/baseline/AutoAdjustCommandArg.java |  50 +++
 .../commandline/baseline/BaselineArguments.java| 165 +
 .../commandline/baseline/BaselineCommand.java  | 103 ++
 .../internal/jdbc/thin/JdbcThinConnection.java |   5 +-
 .../cache/persistence/file/FilePageStore.java  |   2 +-
 .../persistence/wal/FileWriteAheadLogManager.java  |  11 +-
 .../cluster/BaselineConfigurationMXBeanImpl.java   |  69 
 .../processors/cluster/ClusterProcessor.java   |  16 +-
 .../autoadjust/BaselineAutoAdjustData.java |  45 ++-
 .../autoadjust/BaselineAutoAdjustExecutor.java |   2 +
 .../autoadjust/BaselineAutoAdjustScheduler.java|  17 +-
 .../autoadjust/BaselineAutoAdjustStatistic.java|  90 +
 .../baseline/autoadjust/ChangeTopologyWatcher.java |  24 +-
 .../odbc/jdbc/JdbcBatchExecuteRequest.java |   2 +-
 .../odbc/jdbc/JdbcBatchExecuteResult.java  |   2 +-
 .../odbc/jdbc/JdbcOrderedBatchExecuteRequest.java  |   2 +-
 .../odbc/jdbc/JdbcOrderedBatchExecuteResult.java   |   2 +-
 .../odbc/jdbc/JdbcQueryExecuteRequest.java |   2 +-
 .../odbc/jdbc/JdbcQueryExecuteResult.java  |   2 +-
 .../internal/processors/odbc/jdbc/JdbcRequest.java |   6 +
 .../processors/odbc/jdbc/JdbcRequestHandler.java   |  29 +-
 .../internal/processors/odbc/jdbc/JdbcResult.java  |   6 +
 .../processors/odbc/odbc/OdbcRequestHandler.java   |  19 +-
 .../processors/query/QueryHistoryMetrics.java  |  15 +-
 .../processors/query/QueryHistoryMetricsValue.java |  10 +-
 .../processors/query/SqlClientContext.java |  25 +-
 .../processors/service/IgniteServiceProcessor.java |   8 +-
 .../baseline/VisorBaselineAutoAdjustSettings.java  |  30 +-
 .../internal/visor/baseline/VisorBaselineTask.java |  19 +-
 .../visor/baseline/VisorBaselineTaskResult.java|  39 +-
 .../visor/baseline/VisorBaselineViewTask.java  |   7 +-
 .../ignite/mxbean/BaselineConfigurationMXBean.java |  45 +++
 .../commandline/CommandHandlerParsingTest.java |   4 +-
 .../db/checkpoint/CheckpointFreeListTest.java  |   7 +-
 .../IgniteCacheContinuousQueryBackupQueueTest.java |   7 +-
 .../cluster/BaselineConfigurationMXBeanTest.java   |  84 +
 ...ServiceHotRedeploymentViaDeploymentSpiTest.java | 161 
 .../apache/ignite/testframework/GridTestUtils.java |  38 ++
 .../ignite/testsuites/IgniteBasicTestSuite.java|   2 +
 .../testsuites/IgniteServiceGridTestSuite.java |   2 +
 .../apache/ignite/util/GridCommandHandlerTest.java |  46 ++-
 .../processors/query/h2/IgniteH2Indexing.java  |   3 +
 .../processors/query/h2/SchemaManager.java |   2 +
 .../sys/view/SqlSystemViewQueryHistoryMetrics.java |  92 +
 .../mvcc/CacheMvccBasicContinuousQueryTest.java|  36 +-
 .../processors/query/LocalQueryLazyTest.java   | 108 ++
 .../processors/query/SqlQueryHistorySelfTest.java  |   2 +-
 .../processors/query/SqlSystemViewsSelfTest.java   |  92 -
 .../processors/query/oom/AbstractQueryOOMTest.java |  69 ++--
 .../IgniteBinaryCacheQueryTestSuite2.java  |   3 +
 .../cpp/odbc/src/streaming/streaming_context.cpp   |   2 +
 56 files changed, 1746 insertions(+), 467 deletions(-)




[ignite] 03/05: Merge branch 'master' into ignite-10161

2019-03-19 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 8b846035944093d198639e85465f544d352d78bd
Merge: 0ea7630 eb3a9aa
Author: Yury Gerzhedovich 
AuthorDate: Mon Mar 18 12:00:03 2019 +0300

Merge branch 'master' into ignite-10161

 examples/README.md |   8 +-
 examples/pom-standalone-lgpl.xml   |  44 +
 examples/pom-standalone.xml|   1 -
 .../tcp/redis/RedisProtocolGetAllAsArrayTest.java  |  17 +-
 .../cache/binary/BinaryMetadataTransport.java  |  28 ++-
 .../binary/CacheObjectBinaryProcessorImpl.java |  67 ---
 .../cache/persistence/GridCacheOffheapManager.java |   9 +
 .../cache/persistence/file/FileDownloader.java | 166 +++---
 .../cache/persistence/file/FilePageStore.java  |   2 +-
 .../cache/persistence/file/FileUploader.java   |  40 ++---
 .../affinity/AffinityDistributionLoggingTest.java  |  37 +---
 .../cache/affinity/AffinityHistoryCleanupTest.java | 138 +++
 .../failure/FailureHandlingConfigurationTest.java  |  54 ++
 .../ConsistentIdImplicitlyExplicitlyTest.java  |  18 +-
 ...dCachePartitionExchangeManagerHistSizeTest.java |  23 +--
 .../ignite/internal/GridVersionSelfTest.java   |  11 +-
 .../ignite/internal/IgniteClientRejoinTest.java|  14 +-
 .../IgniteDiscoveryMassiveNodeFailTest.java|  19 +-
 ...iteUpdateNotifierPerClusterSettingSelfTest.java |  20 +--
 .../BinaryConfigurationConsistencySelfTest.java|  28 ++-
 .../IgniteTxConcurrentRemoveObjectsTest.java   |  24 +--
 .../cache/persistence/file/FileDownloaderTest.java |  15 +-
 .../apache/ignite/testframework/GridTestUtils.java |  37 
 .../testframework/junits/GridAbstractTest.java |  68 +++-
 .../junits/SystemPropertiesList.java}  |  28 ++-
 .../testframework/junits/WithSystemProperty.java}  |  31 ++--
 modules/dev-utils/ignite-modules-test/README.md|  16 ++
 modules/dev-utils/ignite-modules-test/build.gradle | 139 +++
 .../src/test/java/module-info.java}|  26 +--
 .../modulestest/IgniteLaunchInModularEnvTest.java  |  97 +++
 .../cache/BinaryTypeRegistrationTest.java  | 194 +
 .../cache/StartCachesInParallelTest.java   |  43 ++---
 ...tributedPartitionQueryNodeRestartsSelfTest.java |  22 +--
 ...cheQueryNodeRestartDistributedJoinSelfTest.java |  27 ++-
 .../index/DynamicIndexAbstractBasicSelfTest.java   |  67 +++
 .../persistence/db/wal/IgniteWalRecoveryTest.java  | 140 ---
 .../transaction/DmlInsideTransactionTest.java  |  26 ++-
 ...tStoreQueryWithMultipleClassesPerCacheTest.java |   8 +-
 .../IgnitePersistentStoreSchemaLoadTest.java   |   6 +-
 .../DisappearedCacheCauseRetryMessageSelfTest.java |   4 +-
 ...DisappearedCacheWasNotFoundMessageSelfTest.java |   4 +-
 .../twostep/NonCollocatedRetryMessageSelfTest.java |  17 +-
 .../h2/twostep/RetryCauseMessageSelfTest.java  |   4 +-
 .../IgniteCacheWithIndexingTestSuite.java  |   3 +
 .../tcp/ipfinder/zk/ZookeeperIpFinderTest.java |   5 +-
 ...erDiscoveryConcurrentStartAndStartStopTest.java |  13 +-
 ...coverySegmentationAndConnectionRestoreTest.java | 108 ++--
 .../ZookeeperDiscoverySpiSaslFailedAuthTest.java   |  13 +-
 ...ookeeperDiscoverySpiSaslSuccessfulAuthTest.java |   8 +-
 49 files changed, 1145 insertions(+), 792 deletions(-)



[ignite] 01/05: Merge branch 'master' into ignite-10161

2019-03-19 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit e091770cd26dd9a53990ef6161b4fb3d0b0565ba
Merge: 8ffd36b 42633b5
Author: devozerov 
AuthorDate: Thu Mar 14 12:46:02 2019 +0300

Merge branch 'master' into ignite-10161

 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |   2 +
 .../thin/JdbcThinStreamingResetStreamTest.java | 142 +++
 .../org/apache/ignite/internal/IgniteKernal.java   |   8 +-
 .../ignite/internal/commandline/Arguments.java |  25 +-
 .../internal/commandline/CommandHandler.java   | 407 +++--
 .../commandline/baseline/AutoAdjustCommandArg.java |  50 +++
 .../commandline/baseline/BaselineArguments.java| 165 +
 .../commandline/baseline/BaselineCommand.java  | 103 ++
 .../internal/jdbc/thin/JdbcThinConnection.java |   5 +-
 .../cache/persistence/file/FilePageStore.java  |   2 +-
 .../persistence/wal/FileWriteAheadLogManager.java  |  11 +-
 .../cluster/BaselineConfigurationMXBeanImpl.java   |  69 
 .../processors/cluster/ClusterProcessor.java   |  16 +-
 .../autoadjust/BaselineAutoAdjustData.java |  45 ++-
 .../autoadjust/BaselineAutoAdjustExecutor.java |   2 +
 .../autoadjust/BaselineAutoAdjustScheduler.java|  17 +-
 .../autoadjust/BaselineAutoAdjustStatistic.java|  90 +
 .../baseline/autoadjust/ChangeTopologyWatcher.java |  24 +-
 .../odbc/jdbc/JdbcBatchExecuteRequest.java |   2 +-
 .../odbc/jdbc/JdbcBatchExecuteResult.java  |   2 +-
 .../odbc/jdbc/JdbcOrderedBatchExecuteRequest.java  |   2 +-
 .../odbc/jdbc/JdbcOrderedBatchExecuteResult.java   |   2 +-
 .../odbc/jdbc/JdbcQueryExecuteRequest.java |   2 +-
 .../odbc/jdbc/JdbcQueryExecuteResult.java  |   2 +-
 .../internal/processors/odbc/jdbc/JdbcRequest.java |   6 +
 .../processors/odbc/jdbc/JdbcRequestHandler.java   |  29 +-
 .../internal/processors/odbc/jdbc/JdbcResult.java  |   6 +
 .../processors/odbc/odbc/OdbcRequestHandler.java   |  19 +-
 .../processors/query/SqlClientContext.java |  25 +-
 .../processors/service/IgniteServiceProcessor.java |   8 +-
 .../baseline/VisorBaselineAutoAdjustSettings.java  |  30 +-
 .../internal/visor/baseline/VisorBaselineTask.java |  19 +-
 .../visor/baseline/VisorBaselineTaskResult.java|  39 +-
 .../visor/baseline/VisorBaselineViewTask.java  |   7 +-
 .../ignite/mxbean/BaselineConfigurationMXBean.java |  45 +++
 .../commandline/CommandHandlerParsingTest.java |   4 +-
 .../db/checkpoint/CheckpointFreeListTest.java  |   7 +-
 .../IgniteCacheContinuousQueryBackupQueueTest.java |   7 +-
 .../cluster/BaselineConfigurationMXBeanTest.java   |  84 +
 ...ServiceHotRedeploymentViaDeploymentSpiTest.java | 161 
 .../ignite/testsuites/IgniteBasicTestSuite.java|   2 +
 .../testsuites/IgniteServiceGridTestSuite.java |   2 +
 .../apache/ignite/util/GridCommandHandlerTest.java |  46 ++-
 .../mvcc/CacheMvccBasicContinuousQueryTest.java|  36 +-
 .../processors/query/oom/AbstractQueryOOMTest.java |  69 ++--
 .../cpp/odbc/src/streaming/streaming_context.cpp   |   2 +
 46 files changed, 1397 insertions(+), 451 deletions(-)



[ignite] 05/05: Merge branch 'master' into ignite-10161

2019-03-19 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11564
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit b7f563ae81b3ee5a34398ef5f3a18e20338cc60d
Merge: 7090a40 4e95bb4
Author: devozerov 
AuthorDate: Tue Mar 19 10:21:05 2019 +0300

Merge branch 'master' into ignite-10161

 .../internal/jdbc2/JdbcDefaultNoOpCacheTest.java   |  33 --
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |   1 -
 .../cache/IgniteCacheOffheapManagerImpl.java   | 132 +++---
 .../processors/cache/mvcc/MvccProcessorImpl.java   |  41 +-
 .../cache/persistence/pagemem/PageMemoryImpl.java  |   2 +-
 .../processors/query/GridQueryProcessor.java   |  37 +-
 .../ignite/cache/NodeWithFilterRestartTest.java|   6 +-
 .../GridHistoryAffinityAssignmentTest.java |   6 -
 ...istoryAffinityAssignmentTestNoOptimization.java |   3 -
 .../processors/cache/CacheNamesSelfTest.java   |  85 
 .../cache/CacheNamesWithSpecialCharactersTest.java |  74 
 .../GridCacheConfigurationValidationSelfTest.java  |  64 ++-
 .../IgniteClientCacheInitializationFailTest.java   |   2 +-
 .../IgnitePdsBinarySortObjectFieldsTest.java   | 123 +++---
 .../IgnitePdsSporadicDataRecordsOnBackupTest.java  | 491 ++---
 .../ClientAffinityAssignmentWithBaselineTest.java  |   4 +
 .../db/checkpoint/CheckpointFreeListTest.java  |   3 -
 .../wal/ExplicitWalDeltaConsistencyTest.java   |   2 -
 .../PageMemoryTrackerPluginProvider.java   |   6 +-
 .../IgniteCacheContinuousQueryClientTest.java  |   6 +
 .../cluster/ChangeTopologyWatcherTest.java |   5 +-
 .../spi/ExponentialBackoffTimeoutStrategyTest.java |   3 -
 .../TcpCommunicationSpiFaultyClientSslTest.java|   3 -
 .../tcp/TcpCommunicationSpiFreezingClientTest.java |   3 -
 .../tcp/TcpDiscoveryCoordinatorFailureTest.java|   3 -
 .../testsuites/IgniteCacheMvccTestSuite1.java  |   4 -
 .../ignite/testsuites/IgniteCacheTestSuite.java|   4 -
 .../cache/index/H2DynamicTableSelfTest.java|   2 +-
 .../mvcc/CacheMvccContinuousQueryClientTest.java   |   9 -
 .../mvcc/MvccDeadlockDetectionConfigTest.java  |   3 -
 .../processors/query/SqlSystemViewsSelfTest.java   |  20 +-
 .../twostep/AbstractPartitionPruningBaseTest.java  |   3 -
 .../twostep/DmlSelectPartitionPruningSelfTest.java |   6 +-
 .../twostep/MvccDmlPartitionPruningSelfTest.java   |   3 -
 .../processors/query/oom/AbstractQueryOOMTest.java |   3 -
 .../oom/QueryOOMWithQueryParallelismTest.java  |   4 -
 .../oom/QueryOOMWithoutQueryParallelismTest.java   |   4 -
 .../components/modal-import-models/component.js|   5 +-
 38 files changed, 532 insertions(+), 676 deletions(-)



[ignite] branch master updated: IGNITE-11542: Fixed IgnitePdsBinarySortObjectFieldsTest. This closes #6270.

2019-03-19 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 4e95bb4  IGNITE-11542: Fixed IgnitePdsBinarySortObjectFieldsTest. This 
closes #6270.
4e95bb4 is described below

commit 4e95bb400198b6d7c51be353e323c37e36578db4
Author: AMRepo 
AuthorDate: Tue Mar 19 09:57:23 2019 +0300

IGNITE-11542: Fixed IgnitePdsBinarySortObjectFieldsTest. This closes #6270.
---
 .../IgnitePdsBinarySortObjectFieldsTest.java   | 123 ++---
 1 file changed, 59 insertions(+), 64 deletions(-)

diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinarySortObjectFieldsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinarySortObjectFieldsTest.java
index a14ed8c..bccad9d 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinarySortObjectFieldsTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinarySortObjectFieldsTest.java
@@ -19,11 +19,15 @@ package 
org.apache.ignite.internal.processors.cache.persistence;
 
 import java.util.concurrent.TimeUnit;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
@@ -34,6 +38,60 @@ public class IgnitePdsBinarySortObjectFieldsTest extends 
GridCommonAbstractTest
 /** */
 private static final String CACHE_NAME = 
"ignitePdsBinarySortObjectFieldsTestCache";
 
+/** {@inheritDoc} */
+@Override protected void afterTestsStopped() throws Exception {
+cleanPersistenceDir();
+}
+
+/** {@inheritDoc} */
+@Override protected void beforeTest() throws Exception {
+super.beforeTest();
+
+cleanPersistenceDir();
+}
+
+/** {@inheritDoc} */
+@Override protected void afterTest() throws Exception {
+stopAllGrids();
+
+cleanPersistenceDir();
+
+super.afterTest();
+}
+
+/** {@inheritDoc} */
+@Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
+IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+cfg.setConsistentId(gridName);
+
+cfg.setDataStorageConfiguration(new DataStorageConfiguration()
+.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+
.setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE)
+.setPersistenceEnabled(true)));
+
+return cfg;
+}
+
+/**
+ * @throws Exception if failed.
+ */
+@Test
+@WithSystemProperty(key = 
IgniteSystemProperties.IGNITE_BINARY_SORT_OBJECT_FIELDS, value = "true")
+public void testGivenCacheWithPojoValueAndPds_WhenPut_ThenNoHangup() 
throws Exception {
+IgniteEx ignite = startGrid(0);
+
+ignite.cluster().active(true);
+
+final IgniteCache cache = ignite.getOrCreateCache(
+new CacheConfiguration(CACHE_NAME)
+.setAffinity(new 
RendezvousAffinityFunction().setPartitions(32)));
+
+GridTestUtils.assertTimeout(5, TimeUnit.SECONDS, () -> cache.put(1L, 
new Value(1L)));
+
+assertEquals(1, cache.size());
+}
+
 /**
  * Value.
  */
@@ -78,67 +136,4 @@ public class IgnitePdsBinarySortObjectFieldsTest extends 
GridCommonAbstractTest
 return "Value [val=" + val + ']';
 }
 }
-
-/** {@inheritDoc} */
-@Override protected void afterTestsStopped() throws Exception {
-cleanPersistenceDir();
-}
-
-/** {@inheritDoc} */
-@Override protected void beforeTest() throws Exception {
-super.beforeTest();
-
-cleanPersistenceDir();
-}
-
-/** {@inheritDoc} */
-@Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-cfg.setConsistentId(gridName);
-
-cfg.setPersistentStoreConfiguration(new 
PersistentStoreConfiguration());
-
-return cfg;
-}
-
-/** {@inheritDoc} */
-@Override 

[ignite] branch master updated: IGNITE-11441: SQL: Do not register schemas of caches with disabled SQL. This closes #6239.

2019-03-19 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 952cf2e  IGNITE-11441: SQL: Do not register schemas of caches with 
disabled SQL. This closes #6239.
952cf2e is described below

commit 952cf2e48e0a33cd7660f4bfb6152a652a00da23
Author: Yuriy Gerzhedovich 
AuthorDate: Tue Mar 19 09:46:42 2019 +0300

IGNITE-11441: SQL: Do not register schemas of caches with disabled SQL. 
This closes #6239.
---
 .../internal/jdbc2/JdbcDefaultNoOpCacheTest.java   | 33 ---
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |  1 -
 .../processors/query/GridQueryProcessor.java   | 37 --
 .../IgniteClientCacheInitializationFailTest.java   |  2 +-
 .../cache/index/H2DynamicTableSelfTest.java|  2 +-
 .../processors/query/SqlSystemViewsSelfTest.java   | 20 ++--
 6 files changed, 46 insertions(+), 49 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDefaultNoOpCacheTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDefaultNoOpCacheTest.java
deleted file mode 100644
index 57ef52c..000
--- 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDefaultNoOpCacheTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.jdbc2;
-
-import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
-
-/**
- * Test to check JDBC2 driver behavior when cache specified in connection 
string does not have any query entities.
- */
-public class JdbcDefaultNoOpCacheTest extends 
org.apache.ignite.jdbc.JdbcDefaultNoOpCacheTest {
-/** Ignite configuration URL. */
-private static final String CFG_URL = 
"modules/clients/src/test/config/jdbc-config.xml";
-
-/** {@inheritDoc} */
-protected String getUrl() {
-return CFG_URL_PREFIX + "cache=noop@" + CFG_URL;
-}
-}
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index c5d56d7..75fc63d 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -127,7 +127,6 @@ import org.junit.runners.Suite;
 org.apache.ignite.internal.jdbc2.JdbcEmptyCacheSelfTest.class,
 org.apache.ignite.internal.jdbc2.JdbcLocalCachesSelfTest.class,
 org.apache.ignite.internal.jdbc2.JdbcNoDefaultCacheTest.class,
-org.apache.ignite.internal.jdbc2.JdbcDefaultNoOpCacheTest.class,
 org.apache.ignite.internal.jdbc2.JdbcMergeStatementSelfTest.class,
 
org.apache.ignite.internal.jdbc2.JdbcBinaryMarshallerMergeStatementSelfTest.class,
 org.apache.ignite.internal.jdbc2.JdbcUpdateStatementSelfTest.class,
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index bac148d..33c0a02 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -677,6 +677,8 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
  */
 public void onCacheStart0(GridCacheContextInfo cacheInfo, 
QuerySchema schema, boolean isSql)
 throws IgniteCheckedException {
+if (!cacheSupportSql(cacheInfo.config()))
+return;
 
 ctx.cache().context().database().checkpointReadLock();
 
@@ -1698,7 +1700,7 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
  * @param destroy Destroy flag.
  */
 public void onCacheStop0(GridCacheContextInfo cacheInfo, boolean destroy) {
-if (idx == null)
+if (idx == null || !cacheSupportSql(

[ignite] branch master updated: IGNITE-11435: SQL: Implemented LOCAL_SQL_QUERY_HISTORY view. This closes #6255.

2019-03-15 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 08f8b4e  IGNITE-11435: SQL: Implemented LOCAL_SQL_QUERY_HISTORY view. 
This closes #6255.
08f8b4e is described below

commit 08f8b4e90f4858455afed824980ddb168ae048be
Author: Yuriy Gerzhedovich 
AuthorDate: Fri Mar 15 11:36:30 2019 +0300

IGNITE-11435: SQL: Implemented LOCAL_SQL_QUERY_HISTORY view. This closes 
#6255.
---
 .../processors/query/QueryHistoryMetrics.java  | 15 ++--
 .../processors/query/QueryHistoryMetricsValue.java | 10 +--
 .../apache/ignite/testframework/GridTestUtils.java | 38 +
 .../processors/query/h2/SchemaManager.java |  2 +
 .../sys/view/SqlSystemViewQueryHistoryMetrics.java | 92 ++
 .../processors/query/SqlQueryHistorySelfTest.java  |  2 +-
 .../processors/query/SqlSystemViewsSelfTest.java   | 92 +-
 7 files changed, 235 insertions(+), 16 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryHistoryMetrics.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryHistoryMetrics.java
index 0f8a07d..1d494ac 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryHistoryMetrics.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryHistoryMetrics.java
@@ -44,17 +44,16 @@ public class QueryHistoryMetrics {
  * @param qry Textual query representation.
  * @param schema Schema name.
  * @param loc {@code true} for local query.
- * @param startTime Duration of queue execution.
- * @param duration Duration of queue execution.
+ * @param startTime Start time of query execution.
+ * @param duration Duration of query execution.
  * @param failed {@code True} query executed unsuccessfully {@code false} 
otherwise.
  */
 public QueryHistoryMetrics(String qry, String schema, boolean loc, long 
startTime, long duration, boolean failed) {
 key = new QueryHistoryMetricsKey(qry, schema, loc);
 
-if (failed)
-val = new QueryHistoryMetricsValue(1, 1, 0, 0, startTime);
-else
-val = new QueryHistoryMetricsValue(1, 0, duration, duration, 
startTime);
+long failures = failed ? 1 : 0;
+
+val = new QueryHistoryMetricsValue(1, failures, duration, duration, 
startTime);
 
 linkRef = new AtomicReference<>();
 }
@@ -109,7 +108,7 @@ public class QueryHistoryMetrics {
  *
  * @return Number of executions.
  */
-public int executions() {
+public long executions() {
 return val.execs();
 }
 
@@ -118,7 +117,7 @@ public class QueryHistoryMetrics {
  *
  * @return Number of times a query execution failed.
  */
-public int failures() {
+public long failures() {
 return val.failures();
 }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryHistoryMetricsValue.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryHistoryMetricsValue.java
index c37e141..babac6d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryHistoryMetricsValue.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryHistoryMetricsValue.java
@@ -23,10 +23,10 @@ package org.apache.ignite.internal.processors.query;
  */
 class QueryHistoryMetricsValue {
 /** Number of executions. */
-private final int execs;
+private final long execs;
 
 /** Number of failures. */
-private final int failures;
+private final long failures;
 
 /** Minimum time of execution. */
 private final long minTime;
@@ -44,7 +44,7 @@ class QueryHistoryMetricsValue {
  * @param maxTime Max time of execution.
  * @param lastStartTime Last start time of execution.
  */
-public QueryHistoryMetricsValue(int execs, int failures, long minTime, 
long maxTime, long lastStartTime) {
+public QueryHistoryMetricsValue(long execs, long failures, long minTime, 
long maxTime, long lastStartTime) {
 this.execs = execs;
 this.failures = failures;
 this.minTime = minTime;
@@ -57,7 +57,7 @@ class QueryHistoryMetricsValue {
  *
  * @return Number of executions.
  */
-public int execs() {
+public long execs() {
 return execs;
 }
 
@@ -66,7 +66,7 @@ class QueryHistoryMetricsValue {
  *
  * @return Number of times a query execution failed.
  */
-public int failures() {
+public long failures() {
 return failures;
 }
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java 
b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index 2

[ignite] branch master updated: IGNITE-7139: SQL: Lazy execution support for local queries. This closes #6262.

2019-03-15 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 54a7983  IGNITE-7139: SQL: Lazy execution support for local queries. 
This closes #6262.
54a7983 is described below

commit 54a7983d8656e35a3d39ed35affdd647380e114d
Author: tledkov 
AuthorDate: Fri Mar 15 10:50:24 2019 +0300

IGNITE-7139: SQL: Lazy execution support for local queries. This closes 
#6262.
---
 .../processors/query/h2/IgniteH2Indexing.java  |   3 +
 .../processors/query/LocalQueryLazyTest.java   | 108 +
 .../IgniteBinaryCacheQueryTestSuite2.java  |   3 +
 3 files changed, 114 insertions(+)

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 5d912aa..467dd15 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
@@ -533,6 +533,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 try {
 Connection conn0 = 
conn.object().connection(qryDesc.schemaName());
 
+H2Utils.setupConnection(conn0,
+qryDesc.distributedJoins(), 
qryDesc.enforceJoinOrder(), qryParams.lazy());
+
 List args = F.asList(qryParams.arguments());
 
 PreparedStatement stmt = preparedStatementWithParams(
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/LocalQueryLazyTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/LocalQueryLazyTest.java
new file mode 100644
index 000..1818d9e
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/LocalQueryLazyTest.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.FieldsQueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import 
org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.h2.result.LazyResult;
+import org.h2.result.ResultInterface;
+import org.junit.Test;
+
+/**
+ * Tests for local query execution in lazy mode.
+ */
+public class LocalQueryLazyTest extends AbstractIndexingCommonTest {
+/** Keys count. */
+private static final int KEY_CNT = 10;
+
+/** Queries count. */
+private static final int QRY_CNT = 10;
+
+/** {@inheritDoc} */
+@Override protected void beforeTest() throws Exception {
+super.beforeTest();
+
+startGrid();
+
+IgniteCache c = grid().createCache(new 
CacheConfiguration()
+.setName("test")
+.setSqlSchema("TEST")
+.setQueryEntities(Collections.singleton(new 
QueryEntity(Long.class, Long.class)
+.setTableName("test")
+.addQueryField("id", Long.class.getName(), null)
+.addQueryField("val", Long.class.getName(), null)
+.setKeyFieldName("id")
+.setValueFieldName("val")
+))
+.setAffinity(new RendezvousAffinityFunction(false, 10)));
+
+for (long i = 0; i < KEY_CNT; ++i)
+c.put(i, i);
+}
+
+/** {@inheritDoc} */
+@Override protected void afterTest() throws Exception {
+stopA

[ignite] branch master updated: IGNITE-10991: JDBC Thin Driver: fixed streaming mode handling for ordered mode. This closes #6146.

2019-03-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 42633b5  IGNITE-10991: JDBC Thin Driver: fixed streaming mode handling 
for ordered mode. This closes #6146.
42633b5 is described below

commit 42633b536865e18ee8056d65106c8b8455d16a9c
Author: tledkov 
AuthorDate: Thu Mar 14 10:45:20 2019 +0300

IGNITE-10991: JDBC Thin Driver: fixed streaming mode handling for ordered 
mode. This closes #6146.
---
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |   2 +
 .../thin/JdbcThinStreamingResetStreamTest.java | 142 +
 .../internal/jdbc/thin/JdbcThinConnection.java |   5 +-
 .../odbc/jdbc/JdbcBatchExecuteRequest.java |   2 +-
 .../odbc/jdbc/JdbcBatchExecuteResult.java  |   2 +-
 .../odbc/jdbc/JdbcOrderedBatchExecuteRequest.java  |   2 +-
 .../odbc/jdbc/JdbcOrderedBatchExecuteResult.java   |   2 +-
 .../odbc/jdbc/JdbcQueryExecuteRequest.java |   2 +-
 .../odbc/jdbc/JdbcQueryExecuteResult.java  |   2 +-
 .../internal/processors/odbc/jdbc/JdbcRequest.java |   6 +
 .../processors/odbc/jdbc/JdbcRequestHandler.java   |  29 +++--
 .../internal/processors/odbc/jdbc/JdbcResult.java  |   6 +
 .../processors/odbc/odbc/OdbcRequestHandler.java   |  19 ++-
 .../processors/query/SqlClientContext.java |  25 ++--
 .../cpp/odbc/src/streaming/streaming_context.cpp   |   2 +
 15 files changed, 204 insertions(+), 44 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index 2aae34e..c5d56d7 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -81,6 +81,7 @@ import 
org.apache.ignite.jdbc.thin.JdbcThinSelectAfterAlterTable;
 import org.apache.ignite.jdbc.thin.JdbcThinStatementCancelSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinStatementSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinStatementTimeoutSelfTest;
+import org.apache.ignite.jdbc.thin.JdbcThinStreamingResetStreamTest;
 import org.apache.ignite.jdbc.thin.JdbcThinStreamingNotOrderedSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinStreamingOrderedSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinTcpIoTest;
@@ -145,6 +146,7 @@ import org.junit.runners.Suite;
 JdbcThinStreamingNotOrderedSelfTest.class,
 JdbcThinStreamingOrderedSelfTest.class,
 JdbcThinDataPageScanPropertySelfTest.class,
+JdbcThinStreamingResetStreamTest.class,
 
 // DDL tests.
 
org.apache.ignite.internal.jdbc2.JdbcDynamicIndexAtomicPartitionedNearSelfTest.class,
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStreamingResetStreamTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStreamingResetStreamTest.java
new file mode 100644
index 000..54a3c7d
--- /dev/null
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinStreamingResetStreamTest.java
@@ -0,0 +1,142 @@
+/*
+ * 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.jdbc.thin;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.util.Properties;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+/**
+ * Test JDBC streaming with restart / reset multiple times.
+ */
+public class JdbcThinStreamingResetStreamTest extends GridCommonAbstractTest {
+/** JDBC URL. */
+private static final String URL = "jdbc:ignite:thin://127.0.0.1/";
+
+/** JDBC Connection. */
+private Connection conn;
+
+/** {@inheritDoc} */
+@Override protected void beforeTestsStarted() throws Exception {
+super.beforeTestsStarted();
+
+startGrids(3);
+}
+
+/** {@inheritDoc} */

[ignite] branch ignite-10104 deleted (was fdd6cae)

2019-03-13 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch ignite-10104
in repository https://gitbox.apache.org/repos/asf/ignite.git.


 was fdd6cae  pending

This change permanently discards the following revisions:

 discard fdd6cae  pending



[ignite] branch master updated: IGNITE-11340: SQL: Fixed OOME suite tests. This closes #6231.

2019-03-13 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 5ad4b94  IGNITE-11340: SQL: Fixed OOME suite tests. This closes #6231.
5ad4b94 is described below

commit 5ad4b94f0d7420eb4aa61fd179f786a6d444d8c1
Author: tledkov 
AuthorDate: Wed Mar 13 11:32:21 2019 +0300

IGNITE-11340: SQL: Fixed OOME suite tests. This closes #6231.
---
 .../processors/query/oom/AbstractQueryOOMTest.java | 69 +++---
 1 file changed, 35 insertions(+), 34 deletions(-)

diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/AbstractQueryOOMTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/AbstractQueryOOMTest.java
index 1d9b4a7..cfe2d3e 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/AbstractQueryOOMTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/oom/AbstractQueryOOMTest.java
@@ -23,10 +23,12 @@ import java.sql.ResultSet;
 import java.sql.Statement;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.QueryEntity;
 import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
@@ -54,7 +56,10 @@ import org.junit.runners.JUnit4;
 @RunWith(JUnit4.class)
 public abstract class AbstractQueryOOMTest extends GridCommonAbstractTest {
 /** */
-private static final long KEY_CNT = 2_000_000L;
+private static final long KEY_CNT = 1_000_000L;
+
+/** */
+private static final int BATCH_SIZE = 10_000;
 
 /** */
 private static final String CACHE_NAME = "test_cache";
@@ -75,7 +80,7 @@ public abstract class AbstractQueryOOMTest extends 
GridCommonAbstractTest {
 
 /** {@inheritDoc} */
 @Override protected List additionalRemoteJvmArgs() {
-return Arrays.asList("-Xmx128m");
+return Arrays.asList("-Xmx64m", "-Xms64m");
 }
 
 /** {@inheritDoc} */
@@ -126,13 +131,27 @@ public abstract class AbstractQueryOOMTest extends 
GridCommonAbstractTest {
 
 local.cluster().active(true);
 
-try (IgniteDataStreamer streamer = local.dataStreamer(CACHE_NAME)) {
-for (long i = 0; i < KEY_CNT; ++i) {
-streamer.addData(i, new Value(i));
+IgniteCache c = local.cache(CACHE_NAME);
+
+Map batch = new HashMap<>(BATCH_SIZE);
+
+for (long i = 0; i < KEY_CNT; ++i) {
+batch.put(i, new Value(i));
 
-if (i % 100_000 == 0)
-log.info("Populate " + i + " values");
+if (batch.size() >= BATCH_SIZE) {
+c.putAll(batch);
+
+batch.clear();
 }
+
+if (i % 100_000 == 0)
+log.info("Populate " + i + " values");
+}
+
+if (!batch.isEmpty()) {
+c.putAll(batch);
+
+batch.clear();
 }
 
 awaitPartitionMapExchange(true, true, null);
@@ -140,6 +159,8 @@ public abstract class AbstractQueryOOMTest extends 
GridCommonAbstractTest {
 local.cluster().active(false);
 
 stopAllGrids(false);
+
+IgniteProcessProxy.killAll();
 }
 
 /** {@inheritDoc} */
@@ -151,11 +172,10 @@ public abstract class AbstractQueryOOMTest extends 
GridCommonAbstractTest {
 stopAllGrids();
 }
 
-/**
- * beforeTest is not user to save the time fot muted tests.
- * @throws Exception On error.
- */
-private void startTestGrid() throws Exception {
+/** {@inheritDoc} */
+@Override protected void beforeTest() throws Exception {
+super.beforeTest();
+
 log.info("Restart cluster");
 
 Ignite loc = startGrid(0);
@@ -182,8 +202,6 @@ public abstract class AbstractQueryOOMTest extends 
GridCommonAbstractTest {
  */
 @Test
 public void testHeavyScanLazy() throws Exception {
-startTestGrid();
-
 checkQuery("SELECT * from test", KEY_CNT, true);
 }
 
@@ -193,8 +211,6 @@ public abstract class AbstractQueryOOMTest extends 
GridCommonAbstractTest {
 @Ignore("https://issues.apache.org/jira/browse/IGNITE-9480;)
 @Test
 public void testHeavyScanNonLazy() throws Exception {
-startTestGrid();
-
 checkQueryExpectOOM("SELECT * from test", false);
 }
 
@@ -205,8 +221,6 @@ public abstract class AbstractQueryOOMTest extends 
GridCommonAbstractTest {

[ignite] branch master updated: IGNITE-11227: SQL: Added missing security checks which were incorrectly removed in IGNITE-11227.

2019-03-11 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new aaa37fc  IGNITE-11227: SQL: Added missing security checks which were 
incorrectly removed in IGNITE-11227.
aaa37fc is described below

commit aaa37fc4d25e691200fdbc5bd5adb73941f099c1
Author: devozerov 
AuthorDate: Mon Mar 11 12:13:01 2019 +0300

IGNITE-11227: SQL: Added missing security checks which were incorrectly 
removed in IGNITE-11227.
---
 .../ignite/internal/processors/query/h2/IgniteH2Indexing.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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 17e9b1d..5d912aa 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
@@ -456,9 +456,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 throw new IgniteSQLException("SELECT FOR UPDATE query requires 
transactional " +
 "cache with MVCC enabled.", 
IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
 
-if (ctx.security().enabled())
-checkSecurity(select.cacheIds());
-
 GridNearTxSelectForUpdateFuture sfuFut = null;
 
 int opTimeout = qryParams.timeout();
@@ -1426,6 +1423,9 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 MvccQueryTracker mvccTracker,
 GridQueryCancel cancel
 ) throws IgniteCheckedException {
+if (ctx.security().enabled())
+checkSecurity(select.cacheIds());
+
 boolean autoStartTx = mvccEnabled(ctx) && !qryParams.autoCommit() && 
tx(ctx) == null;
 
 Iterable> iter;



[ignite] branch master updated: IGNITE-10414: SQL: Fixed schema resolution for JDBC drivers. This closes #6088.

2019-03-11 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 3e80ca4  IGNITE-10414: SQL: Fixed schema resolution for JDBC drivers. 
This closes #6088.
3e80ca4 is described below

commit 3e80ca44e4f6818eeb6f69980e5a5afb22b698e6
Author: Pavel Kuznetsov 
AuthorDate: Mon Mar 11 12:01:06 2019 +0300

IGNITE-10414: SQL: Fixed schema resolution for JDBC drivers. This closes 
#6088.
---
 .../internal/jdbc2/JdbcAbstractSchemaCaseTest.java | 228 +
 .../internal/jdbc2/JdbcMetadataSelfTest.java   |   2 +-
 .../internal/jdbc2/JdbcSchemaCaseSelfTest.java |  41 
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |   6 +-
 .../jdbc/thin/JdbcThinSchemaCaseSelfTest.java  |  33 +++
 .../ignite/jdbc/thin/JdbcThinSchemaCaseTest.java   | 114 ---
 .../internal/jdbc/thin/JdbcThinConnection.java |  26 +--
 .../ignite/internal/jdbc2/JdbcConnection.java  |   2 +-
 .../apache/ignite/internal/jdbc2/JdbcUtils.java|  22 ++
 .../processors/query/GridQueryProcessor.java   |   4 +-
 .../cache/index/H2DynamicTableSelfTest.java|  36 +++-
 .../processors/query/RunningQueriesTest.java   |  78 ---
 .../processors/query/SqlSystemViewsSelfTest.java   |  14 +-
 13 files changed, 429 insertions(+), 177 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractSchemaCaseTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractSchemaCaseTest.java
new file mode 100644
index 000..5995010
--- /dev/null
+++ 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractSchemaCaseTest.java
@@ -0,0 +1,228 @@
+/*
+ * 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.jdbc2;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Base (for v2 and thin drivers) test for the case (in)sensitivity of schema 
name.
+ */
+public abstract class JdbcAbstractSchemaCaseTest extends 
GridCommonAbstractTest {
+/** Grid count. */
+private static final int GRID_CNT = 2;
+
+/** {@inheritDoc} */
+@Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
+IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+cfg.setCacheConfiguration(
+cacheConfiguration("test0", "test0"),
+cacheConfiguration("test1", "tEst1"),
+cacheConfiguration("test2", "\"TestCase\""));
+
+return cfg;
+}
+
+/**
+ * Set up connection with specified schema as default JDBC connection 
schema.
+ */
+protected abstract Connection connect(String schema) throws SQLException;
+
+/**
+ * @param name Cache name.
+ * @param schema Schema name.
+ * @return Cache configuration.
+ * @throws Exception In case of error.
+ */
+@SuppressWarnings("unchecked")
+private CacheConfiguration cacheConfiguration(@NotNull String name, 
@NotNull String schema) throws Exception {
+CacheConfiguration cfg = defaultCacheConfiguration();
+
+cfg.setIndexedTypes(Integer.class, Integer.class);
+
+cfg.setName(name);
+
+cfg.setSqlSchema(schema);
+
+return cfg;
+}
+
+/** {@inheritDoc} */
+@Override protected void beforeTestsStarted() throws Exception {
+super.beforeTestsStarted();
+

[ignite] branch master updated: IGNITE-11227: SQL: Decoupled query execution entry point from DML. This closes #6246.

2019-03-08 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 455b56d  IGNITE-11227: SQL: Decoupled query execution entry point from 
DML. This closes #6246.
455b56d is described below

commit 455b56d4166c9455a4b02532049de63e2e6090e3
Author: devozerov 
AuthorDate: Fri Mar 8 14:12:38 2019 +0300

IGNITE-11227: SQL: Decoupled query execution entry point from DML. This 
closes #6246.
---
 .../thin/JdbcThinDataPageScanPropertySelfTest.java |   33 +-
 .../thin/JdbcThinStreamingAbstractSelfTest.java|   22 +-
 .../internal/processors/cache/mvcc/MvccUtils.java  |7 +-
 .../processors/query/GridQueryIndexing.java|   15 +-
 .../processors/query/GridQueryProcessor.java   |9 +-
 .../IgniteClientCacheInitializationFailTest.java   |   12 +-
 .../processors/query/h2/CommandProcessor.java  |   26 +-
 .../processors/query/h2/IgniteH2Indexing.java  | 1163 +++-
 ...eryParserCacheKey.java => QueryDescriptor.java} |  110 +-
 .../processors/query/h2/QueryParameters.java   |  215 
 .../internal/processors/query/h2/QueryParser.java  |  131 ++-
 .../processors/query/h2/QueryParserResult.java |   29 +-
 .../processors/query/h2/dml/UpdatePlanBuilder.java |   68 +-
 .../processors/query/RunningQueriesTest.java   |   27 +-
 14 files changed, 1167 insertions(+), 700 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDataPageScanPropertySelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDataPageScanPropertySelfTest.java
index 40e1d78..9bd9064 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDataPageScanPropertySelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDataPageScanPropertySelfTest.java
@@ -25,7 +25,6 @@ import java.util.concurrent.LinkedBlockingQueue;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.query.FieldsQueryCursor;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker;
 import org.apache.ignite.internal.processors.query.GridQueryCancel;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.processors.query.SqlClientContext;
@@ -121,14 +120,19 @@ public class JdbcThinDataPageScanPropertySelfTest extends 
GridCommonAbstractTest
 private void checkDataPageScanInBatch(String qryWithParam, @Nullable 
Boolean dps) throws Exception {
 String params = (dps == null) ? null : "dataPageScanEnabled=" + dps;
 
+int expCnt = 0;
+
 try (Connection conn = GridTestUtils.connect(grid(0), params)) {
 try (PreparedStatement upd = conn.prepareStatement(qryWithParam)) {
 for (int i = 0; i < TOTAL_QUERIES_TO_EXECUTE; i++) {
 upd.setInt(1, i);
 upd.addBatch();
 
-if ((i + 1) % BATCH_SIZE == 0 || (i + 1) == 
TOTAL_QUERIES_TO_EXECUTE)
+if ((i + 1) % BATCH_SIZE == 0 || (i + 1) == 
TOTAL_QUERIES_TO_EXECUTE) {
 upd.executeBatch();
+
+expCnt++;
+}
 }
 }
 }
@@ -146,10 +150,7 @@ public class JdbcThinDataPageScanPropertySelfTest extends 
GridCommonAbstractTest
 
 int executed = IndexingWithQueries.queries.size();
 
-assertTrue(
-"Expected that there are executed at least " + 
TOTAL_QUERIES_TO_EXECUTE + " queries. " +
-"But executed only " + executed,
-executed >= TOTAL_QUERIES_TO_EXECUTE);
+assertEquals(expCnt, executed);
 
 IndexingWithQueries.queries.clear();
 }
@@ -198,12 +199,24 @@ public class JdbcThinDataPageScanPropertySelfTest extends 
GridCommonAbstractTest
 static final Queue queries = new 
LinkedBlockingQueue<>();
 
 /** {@inheritDoc} */
-@Override public List>> 
querySqlFields(String schemaName, SqlFieldsQuery qry,
-@Nullable SqlClientContext cliCtx, boolean keepBinary, boolean 
failOnMultipleStmts,
-MvccQueryTracker tracker, GridQueryCancel cancel, boolean 
registerAsNewQry) {
+@Override public List>> querySqlFields(
+String schemaName,
+SqlFieldsQuery qry,
+@Nullable SqlClientContext cliCtx,
+boolean keepBinary,
+boolean failOnMultipleStmts,
+GridQueryCancel cancel
+) {
 queries.add(qry);
 
-return super.querySqlFields(schemaName, qry, cliCtx, keepBinary, 
failOnMultipleStmts, tracker, cancel, registerAsNewQry);
+return super.querySqlFields(
+  

[ignite] branch master updated: IGNITE-11446: SQL: Renamed CACHE_GROUPS_IO to LOCAL_CACHE_GROUPS_IO. This closes #6221.

2019-03-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 285be9a  IGNITE-11446: SQL: Renamed CACHE_GROUPS_IO to 
LOCAL_CACHE_GROUPS_IO. This closes #6221.
285be9a is described below

commit 285be9a06a71825e67113b9e2fb79d8feb6f4a75
Author: Yuriy Gerzhedovich 
AuthorDate: Tue Mar 5 10:15:59 2019 +0300

IGNITE-11446: SQL: Renamed CACHE_GROUPS_IO to LOCAL_CACHE_GROUPS_IO. This 
closes #6221.
---
 .../query/h2/sys/view/SqlSystemViewCacheGroupsIOStatistics.java   | 2 +-
 .../ignite/internal/processors/query/SqlSystemViewsSelfTest.java  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewCacheGroupsIOStatistics.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewCacheGroupsIOStatistics.java
index 5dfe957..a2e0cfb 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewCacheGroupsIOStatistics.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewCacheGroupsIOStatistics.java
@@ -40,7 +40,7 @@ public class SqlSystemViewCacheGroupsIOStatistics extends 
SqlAbstractLocalSystem
  * @param ctx Grid context.
  */
 public SqlSystemViewCacheGroupsIOStatistics(GridKernalContext ctx) {
-super("CACHE_GROUPS_IO", "IO statistics for cache groups", ctx, 
"GROUP_NAME",
+super("LOCAL_CACHE_GROUPS_IO", "Local node IO statistics for cache 
groups", ctx, "GROUP_NAME",
 newColumn("GROUP_ID", Value.INT),
 newColumn("GROUP_NAME"),
 newColumn("PHYSICAL_READS", Value.LONG),
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
index a34a3ea..456838c 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
@@ -761,7 +761,7 @@ public class SqlSystemViewsSelfTest extends 
AbstractIndexingCommonTest {
 for (int i = 0; i < 500; i++)
 execSql("INSERT INTO DEFAULT.TST(id, name, age) VALUES (" + i + 
",'name-" + i + "'," + i + 1 + ")");
 
-String sql1 = "SELECT GROUP_ID, GROUP_NAME, PHYSICAL_READS, 
LOGICAL_READS FROM IGNITE.CACHE_GROUPS_IO";
+String sql1 = "SELECT GROUP_ID, GROUP_NAME, PHYSICAL_READS, 
LOGICAL_READS FROM IGNITE.LOCAL_CACHE_GROUPS_IO";
 
 List> res1 = execSql(sql1);
 
@@ -775,7 +775,7 @@ public class SqlSystemViewsSelfTest extends 
AbstractIndexingCommonTest {
 
 assertTrue(map.containsKey(DEFAULT_CACHE_NAME));
 
-sql1 = "SELECT GROUP_ID, GROUP_NAME, PHYSICAL_READS, LOGICAL_READS 
FROM IGNITE.CACHE_GROUPS_IO WHERE " +
+sql1 = "SELECT GROUP_ID, GROUP_NAME, PHYSICAL_READS, LOGICAL_READS 
FROM IGNITE.LOCAL_CACHE_GROUPS_IO WHERE " +
 "GROUP_NAME='SQL_default_TST'";
 
 assertEquals(1, execSql(sql1).size());



[ignite] branch master updated: IGNITE-11430: SQL: Changed timestamp with TZ to simple timestamp for running queries SQL system view. This closes #6206.

2019-03-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new a8a3073  IGNITE-11430: SQL: Changed timestamp with TZ to simple 
timestamp for running queries SQL system view. This closes #6206.
a8a3073 is described below

commit a8a3073c7d2f6a24ea82541f406eb59302f5d709
Author: Yuriy Gerzhedovich 
AuthorDate: Tue Mar 5 10:02:34 2019 +0300

IGNITE-11430: SQL: Changed timestamp with TZ to simple timestamp for 
running queries SQL system view. This closes #6206.
---
 .../h2/sys/view/SqlAbstractLocalSystemView.java| 22 --
 .../h2/sys/view/SqlSystemViewRunningQueries.java   |  4 ++--
 .../processors/query/SqlSystemViewsSelfTest.java   | 16 ++--
 3 files changed, 8 insertions(+), 34 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
index 1446f91..01102da 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
@@ -17,28 +17,22 @@
 
 package org.apache.ignite.internal.processors.query.h2.sys.view;
 
-import java.util.TimeZone;
 import java.util.UUID;
 import org.apache.ignite.internal.GridKernalContext;
 import org.h2.engine.Session;
 import org.h2.result.Row;
 import org.h2.result.SearchRow;
 import org.h2.table.Column;
-import org.h2.util.DateTimeUtils;
 import org.h2.value.Value;
 import org.h2.value.ValueNull;
 import org.h2.value.ValueString;
 import org.h2.value.ValueTimestamp;
-import org.h2.value.ValueTimestampTimeZone;
 
 /**
  * Local system view base class (which uses only local node data).
  */
 @SuppressWarnings("IfMayBeConditional")
 public abstract class SqlAbstractLocalSystemView extends SqlAbstractSystemView 
{
-
-public static final int MILLIS_IN_MIN = 60_000;
-
 /**
  * @param tblName Table name.
  * @param desc Description.
@@ -153,20 +147,4 @@ public abstract class SqlAbstractLocalSystemView extends 
SqlAbstractSystemView {
 else
 return ValueTimestamp.fromMillis(millis);
 }
-
-/**
- * Converts millis to H2 ValueTimestamp in default time zone.
- *
- * @param millis Millis.
- */
-protected static Value valueTimestampZoneFromMillis(long millis) {
-long dateVal = DateTimeUtils.dateValueFromDate(millis);
-long nanos = DateTimeUtils.nanosFromDate(millis);
-int tzOff = TimeZone.getDefault().getRawOffset();
-
-if(tzOff % MILLIS_IN_MIN == 0)
-return ValueTimestampTimeZone.fromDateValueAndNanos(dateVal, 
nanos, (short)(tzOff / MILLIS_IN_MIN));
-else
-return 
DateTimeUtils.timestampTimeZoneFromLocalDateValueAndNanos(dateVal, nanos);
-}
 }
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewRunningQueries.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewRunningQueries.java
index d53056e..d692be9 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewRunningQueries.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewRunningQueries.java
@@ -43,7 +43,7 @@ public class SqlSystemViewRunningQueries extends 
SqlAbstractLocalSystemView {
 newColumn("SQL"),
 newColumn("SCHEMA_NAME"),
 newColumn("LOCAL", Value.BOOLEAN),
-newColumn("START_TIME", Value.TIMESTAMP_TZ),
+newColumn("START_TIME", Value.TIMESTAMP),
 newColumn("DURATION", Value.LONG)
 );
 }
@@ -80,7 +80,7 @@ public class SqlSystemViewRunningQueries extends 
SqlAbstractLocalSystemView {
 info.query(),
 info.schemaName(),
 info.local(),
-valueTimestampZoneFromMillis(info.startTime()),
+valueTimestampFromMillis(info.startTime()),
 duration
 )
 );
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
index fb6d335..a34a3ea 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/

[ignite] branch master updated: IGNITE-10937: JDBC Thin Driver: add data page scan support. This closes #6114.

2019-03-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 45c4dc9  IGNITE-10937: JDBC Thin Driver: add data page scan support. 
This closes #6114.
45c4dc9 is described below

commit 45c4dc98e0eac33cccd2e24acb3e9882f098cad1
Author: Pavel Kuznetsov 
AuthorDate: Mon Mar 4 12:29:52 2019 +0300

IGNITE-10937: JDBC Thin Driver: add data page scan support. This closes 
#6114.
---
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |   2 +
 .../thin/JdbcThinDataPageScanPropertySelfTest.java | 209 +
 .../apache/ignite/IgniteJdbcThinDataSource.java|  17 ++
 .../internal/jdbc/thin/ConnectionProperties.java   |  13 ++
 .../jdbc/thin/ConnectionPropertiesImpl.java|  32 +++-
 .../ignite/internal/jdbc/thin/JdbcThinTcpIo.java   |   5 +
 .../ignite/internal/jdbc/thin/JdbcThinUtils.java   |  45 -
 .../odbc/jdbc/JdbcConnectionContext.java   |  11 +-
 .../processors/odbc/jdbc/JdbcRequestHandler.java   |  32 +++-
 .../processors/odbc/odbc/OdbcRequestHandler.java   |   3 +-
 .../processors/query/SqlClientContext.java |  15 +-
 11 files changed, 367 insertions(+), 17 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index 7934ca2..bdd3700 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -52,6 +52,7 @@ import 
org.apache.ignite.jdbc.thin.JdbcThinConnectionMvccEnabledSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionSSLTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionTimeoutSelfTest;
+import org.apache.ignite.jdbc.thin.JdbcThinDataPageScanPropertySelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinDataSourceSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinDeleteStatementSelfTest;
 import 
org.apache.ignite.jdbc.thin.JdbcThinDynamicIndexAtomicPartitionedNearSelfTest;
@@ -141,6 +142,7 @@ import org.junit.runners.Suite;
 org.apache.ignite.internal.jdbc2.JdbcStreamingSelfTest.class,
 JdbcThinStreamingNotOrderedSelfTest.class,
 JdbcThinStreamingOrderedSelfTest.class,
+JdbcThinDataPageScanPropertySelfTest.class,
 
 // DDL tests.
 
org.apache.ignite.internal.jdbc2.JdbcDynamicIndexAtomicPartitionedNearSelfTest.class,
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDataPageScanPropertySelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDataPageScanPropertySelfTest.java
new file mode 100644
index 000..40e1d78
--- /dev/null
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDataPageScanPropertySelfTest.java
@@ -0,0 +1,209 @@
+/*
+ * 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.jdbc.thin;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.LinkedBlockingQueue;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.FieldsQueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker;
+import org.apache.ignite.internal.processors.query.GridQueryCancel;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.query.SqlClientContext;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Check that data page scan property defined in the thin driver correctly 
passed to Indexing

[ignite] branch master updated: IGNITE-11210: SQL: Merged DML and other command plans into a single cache. This closes #6200.

2019-03-01 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new ab01d51  IGNITE-11210: SQL: Merged DML and other command plans into a 
single cache. This closes #6200.
 new 1948ba8  Merge remote-tracking branch 'origin/master'
ab01d51 is described below

commit ab01d51f51d93841f27c162e6a54e85ae911dfe1
Author: devozerov 
AuthorDate: Fri Mar 1 13:46:04 2019 +0300

IGNITE-11210: SQL: Merged DML and other command plans into a single cache. 
This closes #6200.
---
 .../processors/query/h2/IgniteH2Indexing.java  | 107 +
 .../internal/processors/query/h2/QueryParser.java  |  36 ++-
 .../processors/query/h2/QueryParserResultDml.java  |  16 ++-
 3 files changed, 72 insertions(+), 87 deletions(-)

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 acf1136..65a85ba 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
@@ -32,7 +32,6 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.TimeUnit;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteDataStreamer;
@@ -109,7 +108,6 @@ import 
org.apache.ignite.internal.processors.query.h2.dml.DmlUpdateSingleEntryIt
 import org.apache.ignite.internal.processors.query.h2.dml.DmlUtils;
 import org.apache.ignite.internal.processors.query.h2.dml.UpdateMode;
 import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan;
-import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
 import org.apache.ignite.internal.processors.query.h2.opt.QueryContext;
@@ -127,7 +125,6 @@ import org.apache.ignite.internal.sql.command.SqlCommand;
 import org.apache.ignite.internal.sql.command.SqlCommitTransactionCommand;
 import org.apache.ignite.internal.sql.command.SqlRollbackTransactionCommand;
 import org.apache.ignite.internal.sql.optimizer.affinity.PartitionResult;
-import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap;
 import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 import org.apache.ignite.internal.util.IgniteUtils;
@@ -198,17 +195,10 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 /** Default number of attempts to re-run DELETE and UPDATE queries in case 
of concurrent modifications of values. */
 private static final int DFLT_UPDATE_RERUN_ATTEMPTS = 4;
 
-/** Default size for update plan cache. */
-private static final int UPDATE_PLAN_CACHE_SIZE = 1024;
-
 /** Cached value of {@code 
IgniteSystemProperties.IGNITE_ALLOW_DML_INSIDE_TRANSACTION}. */
 private final boolean updateInTxAllowed =
 
Boolean.getBoolean(IgniteSystemProperties.IGNITE_ALLOW_DML_INSIDE_TRANSACTION);
 
-/** Update plans cache. */
-private volatile ConcurrentMap 
updatePlanCache =
-new GridBoundedConcurrentLinkedHashMap<>(UPDATE_PLAN_CACHE_SIZE);
-
 /** Logger. */
 @LoggerResource
 private IgniteLogger log;
@@ -475,7 +465,11 @@ public class IgniteH2Indexing implements GridQueryIndexing 
{
 QueryParserResult parseRes = parser.parse(schemaName, fieldsQry, 
false);
 
 if (parseRes.isDml()) {
-UpdateResult updRes = executeUpdate(schemaName, 
parseRes.dml(), fieldsQry, true, filter, cancel);
+QueryParserResultDml dml = parseRes.dml();
+
+assert dml != null;
+
+UpdateResult updRes = executeUpdate(schemaName, dml, 
fieldsQry, true, filter, cancel);
 
 List updResRow = 
Collections.singletonList(updRes.counter());
 
@@ -754,7 +748,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 boolean fail = false;
 
 try {
-UpdatePlan plan = updatePlan(schemaName, dml, null);
+UpdatePlan plan = dml.plan();
 
 List> planRows = plan.createRows(args != null ? args : 
X.EMPTY_OBJECT_ARRAY);
 
@@ -1285,12 +1279,16 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 
 // Execute.
 if (parseRes.isCommand()) {
+QueryParserResultCommand cmd = parseRes.command();
+
+assert cmd != null;
+
 // Execut

[ignite] branch master updated: IGNITE-11333: SQL: Removed H2 console support. This closes #6149.

2019-02-26 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 111e472  IGNITE-11333: SQL: Removed H2 console support. This closes 
#6149.
 new 4936285  Merge remote-tracking branch 'origin/master'
111e472 is described below

commit 111e47270ff728b0ea155776f29403d19531f69d
Author: tledkov-gridgain 
AuthorDate: Tue Feb 26 14:26:31 2019 +0300

IGNITE-11333: SQL: Removed H2 console support. This closes #6149.
---
 .../org/apache/ignite/IgniteSystemProperties.java  |  6 +++
 .../processors/query/h2/ConnectionManager.java | 43 +-
 2 files changed, 7 insertions(+), 42 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java 
b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 6398e2d..5b9788f 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -386,7 +386,10 @@ public final class IgniteSystemProperties {
 
 /**
  * If this property set then debug console will be opened for H2 indexing 
SPI.
+ *
+ * @deprecated Since 2.8. H2 console is no longer supported.
  */
+@Deprecated
 public static final String IGNITE_H2_DEBUG_CONSOLE = 
"IGNITE_H2_DEBUG_CONSOLE";
 
 /**
@@ -394,7 +397,10 @@ public final class IgniteSystemProperties {
  * to start H2 debug console on. If this property is not set or set to 0, 
H2 debug
  * console will use system-provided dynamic port.
  * This property is only relevant when {@link #IGNITE_H2_DEBUG_CONSOLE} 
property is set.
+ *
+ * @deprecated Since 2.8. H2 console is no longer supported.
  */
+@Deprecated
 public static final String IGNITE_H2_DEBUG_CONSOLE_PORT = 
"IGNITE_H2_DEBUG_CONSOLE_PORT";
 
 /**
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
index db67edf..2b3776c 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
@@ -38,16 +38,10 @@ import 
org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.h2.jdbc.JdbcStatement;
-import org.h2.server.web.WebServer;
-import org.h2.tools.Server;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_H2_DEBUG_CONSOLE;
-import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_H2_DEBUG_CONSOLE_PORT;
 import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_H2_INDEXING_CACHE_CLEANUP_PERIOD;
 import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_H2_INDEXING_CACHE_THREAD_USAGE_TIMEOUT;
-import static org.apache.ignite.IgniteSystemProperties.getInteger;
-import static org.apache.ignite.IgniteSystemProperties.getString;
 
 /**
  * H2 connection manager.
@@ -147,9 +141,8 @@ public class ConnectionManager {
  * Constructor.
  *
  * @param ctx Context.
- * @throws IgniteCheckedException On error.
  */
-public ConnectionManager(GridKernalContext ctx) throws 
IgniteCheckedException {
+public ConnectionManager(GridKernalContext ctx) {
 dbUrl = "jdbc:h2:mem:" + ctx.localNodeId() + DB_OPTIONS;
 
 log = ctx.log(ConnectionManager.class);
@@ -160,8 +153,6 @@ public class ConnectionManager {
 
 stmtCleanupTask = ctx.timeout().schedule(this::cleanupStatements, 
stmtCleanupPeriod, stmtCleanupPeriod);
 connCleanupTask = ctx.timeout().schedule(this::cleanupConnections, 
CONN_CLEANUP_PERIOD, CONN_CLEANUP_PERIOD);
-
-startDebugConsole();
 }
 
 /**
@@ -444,38 +435,6 @@ public class ConnectionManager {
 }
 
 /**
- * Start debug console if needed.
- *
- * @throws IgniteCheckedException If failed.
- */
-private void startDebugConsole() throws IgniteCheckedException {
-try {
-if (getString(IGNITE_H2_DEBUG_CONSOLE) != null) {
-Connection c = DriverManager.getConnection(dbUrl);
-
-int port = getInteger(IGNITE_H2_DEBUG_CONSOLE_PORT, 0);
-
-WebServer webSrv = new WebServer();
-Server web = new Server(webSrv, "-webPort", 
Integer.toString(port));
-web.start();
-String url = webSrv.addSession(c);
-
-U.quietAndInfo(log, "H2 debug 

[ignite] branch master updated: IGNITE-11333: SQL: Removed H2 console support.

2019-02-26 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 5a7372e  IGNITE-11333: SQL: Removed H2 console support.
5a7372e is described below

commit 5a7372e0ff949a029fdc18519415409277bd4a6b
Author: devozerov 
AuthorDate: Tue Feb 26 14:24:14 2019 +0300

IGNITE-11333: SQL: Removed H2 console support.
---
 .../org/apache/ignite/IgniteSystemProperties.java  |  6 +++
 .../processors/query/h2/ConnectionManager.java | 43 +-
 2 files changed, 7 insertions(+), 42 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java 
b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 6398e2d..5b9788f 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -386,7 +386,10 @@ public final class IgniteSystemProperties {
 
 /**
  * If this property set then debug console will be opened for H2 indexing 
SPI.
+ *
+ * @deprecated Since 2.8. H2 console is no longer supported.
  */
+@Deprecated
 public static final String IGNITE_H2_DEBUG_CONSOLE = 
"IGNITE_H2_DEBUG_CONSOLE";
 
 /**
@@ -394,7 +397,10 @@ public final class IgniteSystemProperties {
  * to start H2 debug console on. If this property is not set or set to 0, 
H2 debug
  * console will use system-provided dynamic port.
  * This property is only relevant when {@link #IGNITE_H2_DEBUG_CONSOLE} 
property is set.
+ *
+ * @deprecated Since 2.8. H2 console is no longer supported.
  */
+@Deprecated
 public static final String IGNITE_H2_DEBUG_CONSOLE_PORT = 
"IGNITE_H2_DEBUG_CONSOLE_PORT";
 
 /**
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
index db67edf..2b3776c 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
@@ -38,16 +38,10 @@ import 
org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.h2.jdbc.JdbcStatement;
-import org.h2.server.web.WebServer;
-import org.h2.tools.Server;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_H2_DEBUG_CONSOLE;
-import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_H2_DEBUG_CONSOLE_PORT;
 import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_H2_INDEXING_CACHE_CLEANUP_PERIOD;
 import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_H2_INDEXING_CACHE_THREAD_USAGE_TIMEOUT;
-import static org.apache.ignite.IgniteSystemProperties.getInteger;
-import static org.apache.ignite.IgniteSystemProperties.getString;
 
 /**
  * H2 connection manager.
@@ -147,9 +141,8 @@ public class ConnectionManager {
  * Constructor.
  *
  * @param ctx Context.
- * @throws IgniteCheckedException On error.
  */
-public ConnectionManager(GridKernalContext ctx) throws 
IgniteCheckedException {
+public ConnectionManager(GridKernalContext ctx) {
 dbUrl = "jdbc:h2:mem:" + ctx.localNodeId() + DB_OPTIONS;
 
 log = ctx.log(ConnectionManager.class);
@@ -160,8 +153,6 @@ public class ConnectionManager {
 
 stmtCleanupTask = ctx.timeout().schedule(this::cleanupStatements, 
stmtCleanupPeriod, stmtCleanupPeriod);
 connCleanupTask = ctx.timeout().schedule(this::cleanupConnections, 
CONN_CLEANUP_PERIOD, CONN_CLEANUP_PERIOD);
-
-startDebugConsole();
 }
 
 /**
@@ -444,38 +435,6 @@ public class ConnectionManager {
 }
 
 /**
- * Start debug console if needed.
- *
- * @throws IgniteCheckedException If failed.
- */
-private void startDebugConsole() throws IgniteCheckedException {
-try {
-if (getString(IGNITE_H2_DEBUG_CONSOLE) != null) {
-Connection c = DriverManager.getConnection(dbUrl);
-
-int port = getInteger(IGNITE_H2_DEBUG_CONSOLE_PORT, 0);
-
-WebServer webSrv = new WebServer();
-Server web = new Server(webSrv, "-webPort", 
Integer.toString(port));
-web.start();
-String url = webSrv.addSession(c);
-
-U.quietAndInfo(log, "H2 debug console URL: " + url);
-
-try {
-Server.openBrowser(url);
-}
-cat

[ignite] branch master updated: IGNITE-6609: SQL: Consistent expiration handling for PK hash index. This closes #6158.

2019-02-26 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new af04149  IGNITE-6609: SQL: Consistent expiration handling for PK hash 
index. This closes #6158.
af04149 is described below

commit af041491423cc2c91668de3790a81e3631bcfa5c
Author: palmuhal 
AuthorDate: Tue Feb 26 12:21:35 2019 +0300

IGNITE-6609: SQL: Consistent expiration handling for PK hash index. This 
closes #6158.
---
 .../query/h2/database/H2PkHashIndex.java   |  21 +-
 .../processors/query/h2/database/H2TreeIndex.java  |  23 ++-
 .../cache/index/H2RowExpireTimeIndexSelfTest.java  | 230 +
 .../IgniteBinaryCacheQueryTestSuite.java   |   2 +
 4 files changed, 272 insertions(+), 4 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
index 84393dd..b073da7 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
@@ -32,11 +32,12 @@ import 
org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.tree.CacheDataRowStore;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
-import org.apache.ignite.internal.processors.query.h2.opt.H2CacheRow;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
+import org.apache.ignite.internal.processors.query.h2.opt.H2CacheRow;
 import org.apache.ignite.internal.processors.query.h2.opt.QueryContext;
 import org.apache.ignite.internal.util.lang.GridCursor;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.indexing.IndexingQueryCacheFilter;
 import org.apache.ignite.spi.indexing.IndexingQueryFilter;
 import org.h2.engine.Session;
@@ -215,6 +216,9 @@ public class H2PkHashIndex extends GridH2IndexBase {
 /** */
 private GridCursor curr;
 
+/** Creation time of this cursor to check if some row is expired. */
+private final long time;
+
 /**
  * @param iter Cursors iterator.
  */
@@ -224,6 +228,8 @@ public class H2PkHashIndex extends GridH2IndexBase {
 this.iter = iter;
 
 desc = rowDescriptor();
+
+time = U.currentTimeMillis();
 }
 
 /** {@inheritDoc} */
@@ -251,9 +257,11 @@ public class H2PkHashIndex extends GridH2IndexBase {
 for (;;) {
 if (curr != null) {
 while (curr.next()) {
+CacheDataRow row = curr.get();
 // Need to filter rows by value type because in a 
single cache
 // we can have multiple indexed types.
-if (type.matchType(curr.get().value()))
+// Also need to skip expired rows.
+if (type.matchType(row.value()) && 
!wasExpired(row))
 return true;
 }
 }
@@ -272,6 +280,15 @@ public class H2PkHashIndex extends GridH2IndexBase {
 }
 }
 
+/**
+ * @param row to check.
+ * @return {@code true} if row was expired at the moment this cursor 
was created; {@code false} if not or if
+ * expire time is not set for this cursor.
+ */
+private boolean wasExpired(CacheDataRow row) {
+return row.expireTime() > 0 && row.expireTime() <= time;
+}
+
 /** {@inheritDoc} */
 @Override public boolean previous() {
 throw DbException.getUnsupportedException("previous");
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index 263ae67..2a327e2 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -84,6 +84,7 @@ import org.h2.result.SearchRow;
 import org.h2.table.IndexColumn;
 import org.h2.table.TableFilter;
 import org.h2.value.Value;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static jav

[ignite] branch master updated: IGNITE-11056: SQL: Added system view with indexes. This closes #5906.

2019-02-26 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new fb52e5e  IGNITE-11056: SQL: Added system view with indexes. This 
closes #5906.
fb52e5e is described below

commit fb52e5e622e4e9f104e0357744c0654a213ece44
Author: Yuriy Gerzhedovich 
AuthorDate: Tue Feb 26 12:06:00 2019 +0300

IGNITE-11056: SQL: Added system view with indexes. This closes #5906.
---
 .../query/h2/H2IndexesSystemViewTest.java  | 108 ++
 .../testsuites/GeoSpatialIndexingTestSuite.java|   4 +-
 .../processors/query/h2/H2TableDescriptor.java |   6 +
 .../internal/processors/query/h2/H2Utils.java  |  94 ++--
 .../processors/query/h2/IgniteH2Indexing.java  |   2 +-
 .../processors/query/h2/SchemaManager.java |   2 +
 .../processors/query/h2/database/H2IndexType.java} |  28 ++---
 .../processors/query/h2/database/H2Tree.java   |   2 +-
 .../query/h2/database/H2TreeClientIndex.java   |  36 +-
 .../processors/query/h2/database/H2TreeIndex.java  | 104 -
 .../query/h2/database/H2TreeIndexBase.java |  90 +++
 .../query/h2/database/IndexInformation.java| 106 ++
 .../query/h2/opt/GridH2RowDescriptor.java  |   9 ++
 .../processors/query/h2/opt/GridH2Table.java   |  55 +
 .../processors/query/h2/opt/H2TableScanIndex.java  |   2 +-
 .../query/h2/sys/view/SqlSystemViewIndexes.java| 124 +
 .../processors/query/SqlSystemViewsSelfTest.java   | 119 +++-
 17 files changed, 773 insertions(+), 118 deletions(-)

diff --git 
a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
 
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
new file mode 100644
index 000..eb245ef
--- /dev/null
+++ 
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexesSystemViewTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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;
+
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test expose SPATIAL indexes through SQL system view INDEXES.
+ */
+public class H2IndexesSystemViewTest extends GridCommonAbstractTest {
+
+/** {@inheritDoc} */
+@Override protected IgniteConfiguration getConfiguration() throws 
Exception {
+return super.getConfiguration().setCacheConfiguration(new 
CacheConfiguration().setName(DEFAULT_CACHE_NAME));
+}
+
+/**
+ * Test indexes system view.
+ * @throws Exception in case of failure.
+ */
+@Test
+public void testIndexesView() throws Exception {
+IgniteEx srv = startGrid(getConfiguration());
+
+IgniteEx client = 
startGrid(getConfiguration().setClientMode(true).setIgniteInstanceName("CLIENT"));
+
+execSql("CREATE TABLE PUBLIC.AFF_CACHE (ID1 INT, ID2 INT, GEOM 
GEOMETRY, PRIMARY KEY (ID1))");
+
+execSql("CREATE SPATIAL INDEX IDX_GEO_1 ON PUBLIC.AFF_CACHE(GEOM)");
+
+String idxSql = "SELECT * FROM IGNITE.INDEXES ORDER BY TABLE_NAME, 
INDEX_NAME";
+
+List> srvNodeIndexes = execSql(srv, idxSql);
+
+List> clientNodeNodeIndexes = execSql(client, idxSql);
+
+Assert.assertEquals(srvNodeIndexes.toString(), 
clientNodeNodeIndexes.toString());
+
+String[][] expectedResults = {
+{"PUBLIC", "AFF_CACHE", "IDX_GEO_1", "\"GEOM\" ASC", "SPATIAL", 

[ignite] branch master updated: IGNITE-10206: SQL: ability to configure query parallelism from DDL (CREATE TABLE). This closes #6080.

2019-02-25 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 4d0515f  IGNITE-10206: SQL: ability to configure query parallelism 
from DDL (CREATE TABLE). This closes #6080.
4d0515f is described below

commit 4d0515f32be746667687cb316ece7bb63bee10af
Author: Pavel Kuznetsov 
AuthorDate: Mon Feb 25 12:20:27 2019 +0300

IGNITE-10206: SQL: ability to configure query parallelism from DDL (CREATE 
TABLE). This closes #6080.
---
 .../processors/query/GridQueryProcessor.java   | 24 +-
 .../processors/query/h2/CommandProcessor.java  | 18 -
 .../query/h2/sql/GridSqlCreateTable.java   | 18 +
 .../query/h2/sql/GridSqlQueryParser.java   | 16 
 .../cache/index/H2DynamicTableSelfTest.java| 87 +-
 5 files changed, 154 insertions(+), 9 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index a6f5580..b6af8ca 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1513,14 +1513,27 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
  * @param backups Backups.
  * @param ifNotExists Quietly ignore this command if table already exists.
  * @param encrypted Encrypted flag.
+ * @param qryParallelism query parallelism value for configuration of 
underlying cache.
  * @throws IgniteCheckedException If failed.
  */
-public void dynamicTableCreate(String schemaName, QueryEntity entity, 
String templateName, String cacheName,
-String cacheGroup, @Nullable String dataRegion, String affinityKey, 
@Nullable CacheAtomicityMode atomicityMode,
-@Nullable CacheWriteSynchronizationMode writeSyncMode, @Nullable 
Integer backups, boolean ifNotExists,
-boolean encrypted) throws IgniteCheckedException {
+public void dynamicTableCreate(
+String schemaName,
+QueryEntity entity,
+String templateName,
+String cacheName,
+String cacheGroup,
+@Nullable String dataRegion,
+String affinityKey,
+@Nullable CacheAtomicityMode atomicityMode,
+@Nullable CacheWriteSynchronizationMode writeSyncMode,
+@Nullable Integer backups,
+boolean ifNotExists,
+boolean encrypted,
+@Nullable Integer qryParallelism
+) throws IgniteCheckedException {
 assert !F.isEmpty(templateName);
 assert backups == null || backups >= 0;
+assert qryParallelism == null || qryParallelism > 0;
 
 CacheConfiguration ccfg = 
ctx.cache().getConfigFromTemplate(templateName);
 
@@ -1562,6 +1575,9 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
 if (backups != null)
 ccfg.setBackups(backups);
 
+if (qryParallelism != null)
+ccfg.setQueryParallelism(qryParallelism);
+
 ccfg.setEncryptionEnabled(encrypted);
 ccfg.setSqlSchema(schemaName);
 ccfg.setSqlEscapeAll(true);
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
index def2447..0007fd8 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
@@ -435,9 +435,21 @@ public class CommandProcessor {
 if (err != null)
 throw err;
 
-ctx.query().dynamicTableCreate(cmd.schemaName(), e, 
cmd.templateName(), cmd.cacheName(),
-cmd.cacheGroup(), cmd.dataRegionName(), 
cmd.affinityKey(), cmd.atomicityMode(),
-cmd.writeSynchronizationMode(), cmd.backups(), 
cmd.ifNotExists(), cmd.encrypted());
+ctx.query().dynamicTableCreate(
+cmd.schemaName(),
+e,
+cmd.templateName(),
+cmd.cacheName(),
+cmd.cacheGroup(),
+cmd.dataRegionName(),
+cmd.affinityKey(),
+cmd.atomicityMode(),
+cmd.writeSynchronizationMode(),
+cmd.backups(),
+cmd.ifNotExists(),
+cmd.encrypted(),
+cmd.paral

[ignite] branch master updated: IGNITE-11331: SQL: removed unnecessary parameters binding during parsing. This closes #6115.

2019-02-16 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 6f909d3  IGNITE-11331: SQL: removed unnecessary parameters binding 
during parsing. This closes #6115.
6f909d3 is described below

commit 6f909d3c83f65cb3b082eec87f9b40e8ab911135
Author: devozerov 
AuthorDate: Sun Feb 17 10:21:02 2019 +0300

IGNITE-11331: SQL: removed unnecessary parameters binding during parsing. 
This closes #6115.
---
 .../internal/processors/query/h2/H2Utils.java  |  27 +--
 .../processors/query/h2/IgniteH2Indexing.java  |  37 +++-
 .../internal/processors/query/h2/QueryParser.java  |   9 +-
 .../processors/query/h2/QueryParserResult.java |   8 +
 .../processors/query/h2/QueryParserResultDml.java  |  20 ++-
 .../query/h2/QueryParserResultSelect.java  |  13 ++
 .../processors/query/h2/dml/UpdatePlanBuilder.java |   3 -
 .../query/h2/sql/GridSqlQuerySplitter.java |  82 +
 .../processors/query/h2/sql/SplitterUtils.java |  40 ++---
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  22 ++-
 .../query/h2/sql/BaseH2CompareQueryTest.java   |   5 +-
 .../query/h2/sql/ParameterTypeInferenceTest.java   | 196 +
 .../IgniteBinaryCacheQueryTestSuite.java   |   4 +-
 13 files changed, 367 insertions(+), 99 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
index f45e574..4a73a1b 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
@@ -69,7 +69,6 @@ import org.apache.ignite.internal.util.lang.GridCursor;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.h2.command.Prepared;
 import org.h2.engine.Session;
 import org.h2.jdbc.JdbcConnection;
 import org.h2.result.Row;
@@ -102,7 +101,6 @@ import javax.cache.CacheException;
 
 import static 
org.apache.ignite.internal.processors.query.QueryUtils.KEY_FIELD_NAME;
 import static 
org.apache.ignite.internal.processors.query.QueryUtils.VAL_FIELD_NAME;
-import static 
org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser.prepared;
 
 /**
  * H2 utility methods.
@@ -720,28 +718,6 @@ public class H2Utils {
 }
 
 /**
- * Get optimized prepared statement.
- *
- * @param c Connection.
- * @param qry Parsed query.
- * @param params Query parameters.
- * @param enforceJoinOrder Enforce join order.
- * @return Optimized prepared command.
- * @throws SQLException If failed.
- * @throws IgniteCheckedException If failed.
- */
-public static Prepared optimize(Connection c, String qry, Object[] params, 
boolean distributedJoins,
-boolean enforceJoinOrder) throws SQLException, IgniteCheckedException {
-setupConnection(c, distributedJoins, enforceJoinOrder);
-
-try (PreparedStatement s = c.prepareStatement(qry)) {
-bindParameters(s, F.asList(params));
-
-return prepared(s);
-}
-}
-
-/**
  * @param arr Array.
  * @param off Offset.
  * @param cmp Comparator.
@@ -761,7 +737,7 @@ public class H2Utils {
  * @param mainCacheId Id of main cache.
  * @return Result.
  */
-@Nullable public static List collectCacheIds(
+public static List collectCacheIds(
 IgniteH2Indexing idx,
 @Nullable Integer mainCacheId,
 Collection tbls
@@ -830,6 +806,7 @@ public class H2Utils {
  * @param forUpdate For update flag.
  * @param tbls Tables.
  */
+@SuppressWarnings("ForLoopReplaceableByForEach")
 public static void checkQuery(
 IgniteH2Indexing idx,
 List cacheIds,
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 12e8f9e..0a60018 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
@@ -171,7 +171,6 @@ import static 
org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx;
 import static 
org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.txStart;
 import static 
org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.TEXT;
 import static 
org.apache.ignite.internal.processors.query.h2.H2Utils.UPDATE_RESULT_META;
-imp

[ignite] branch master updated: IGNITE-11326: SQL: Common parsing routine for all command types. This closes #6112.

2019-02-15 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 1619dd5  IGNITE-11326: SQL: Common parsing routine for all command 
types. This closes #6112.
1619dd5 is described below

commit 1619dd5603f9b9eb71dbffc70add54df0a290e2c
Author: devozerov 
AuthorDate: Fri Feb 15 17:05:42 2019 +0300

IGNITE-11326: SQL: Common parsing routine for all command types. This 
closes #6112.
---
 .../dht/colocated/GridDhtColocatedCache.java   |   4 +-
 .../cache/distributed/near/GridNearTxLocal.java|   4 +-
 .../internal/processors/cache/mvcc/MvccUtils.java  |   6 +-
 .../cache/query/GridCacheQueryAdapter.java |   2 +-
 .../processors/odbc/jdbc/JdbcRequestHandler.java   |   8 +-
 .../processors/odbc/odbc/OdbcRequestHandler.java   |   7 +-
 .../processors/query/GridQueryProcessor.java   |   2 +
 .../processors/query/h2/ConnectionManager.java |  27 +-
 .../processors/query/h2/H2CachedStatementKey.java  |  13 +-
 .../internal/processors/query/h2/H2Utils.java  |   5 +-
 .../processors/query/h2/IgniteH2Indexing.java  | 531 ++---
 .../processors/query/h2/PreparedStatementEx.java   |  48 --
 .../query/h2/PreparedStatementExImpl.java  | 648 -
 .../internal/processors/query/h2/QueryParser.java  | 320 ++
 .../processors/query/h2/QueryParserResultDml.java  |  24 +-
 .../query/h2/QueryParserResultSelect.java  |  76 ++-
 .../processors/query/h2/dml/UpdatePlanBuilder.java | 100 ++--
 .../query/h2/sql/GridSqlQueryParser.java   |  18 +-
 .../processors/query/RunningQueriesTest.java   |  50 --
 .../query/h2/H2StatementCacheSelfTest.java |  86 ---
 .../query/h2/PreparedStatementExSelfTest.java  |  64 --
 .../IgniteBinaryCacheQueryTestSuite.java   |   4 -
 22 files changed, 600 insertions(+), 1447 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index 281669e..1c60aae 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -237,7 +237,7 @@ public class GridDhtColocatedCache extends 
GridDhtTransactionalCacheAdapte
 if (ctx.mvccEnabled()) {
 try {
 if (tx != null)
-mvccSnapshot = MvccUtils.requestSnapshot(ctx, tx);
+mvccSnapshot = MvccUtils.requestSnapshot(tx);
 else {
 mvccTracker = MvccUtils.mvccTracker(ctx, null);
 
@@ -342,7 +342,7 @@ public class GridDhtColocatedCache extends 
GridDhtTransactionalCacheAdapte
 if (ctx.mvccEnabled()) {
 try {
 if (tx != null)
-mvccSnapshot = MvccUtils.requestSnapshot(ctx, tx);
+mvccSnapshot = MvccUtils.requestSnapshot(tx);
 else {
 mvccTracker = MvccUtils.mvccTracker(ctx, null);
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index d6fcf50..db673e5 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -718,7 +718,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter 
implements GridTimeou
 @Nullable final CacheEntryPredicate filter
 ) {
 try {
-MvccUtils.requestSnapshot(cacheCtx, this);
+MvccUtils.requestSnapshot(this);
 
 beforePut(cacheCtx, retval, true);
 }
@@ -1898,7 +1898,7 @@ public class GridNearTxLocal extends 
GridDhtTxLocalAdapter implements GridTimeou
 @Nullable final CacheEntryPredicate filter
 ) {
 try {
-MvccUtils.requestSnapshot(cacheCtx, this);
+MvccUtils.requestSnapshot(this);
 
 beforeRemove(cacheCtx, retval, true);
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
index 225af81..cf7b62b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors

[ignite] branch master updated: IGNITE-11177: SQL: Fixed time overflow for IGNITE.NODE_METRICS view. This closes #6044.

2019-02-15 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 26577ee  IGNITE-11177: SQL: Fixed time overflow for 
IGNITE.NODE_METRICS view. This closes #6044.
26577ee is described below

commit 26577eefc84dbb3a9f434fbc4143de24864a7956
Author: palmuhal 
AuthorDate: Fri Feb 15 12:05:34 2019 +0300

IGNITE-11177: SQL: Fixed time overflow for IGNITE.NODE_METRICS view. This 
closes #6044.
---
 .../h2/sys/view/SqlAbstractLocalSystemView.java|  14 --
 .../h2/sys/view/SqlSystemViewNodeMetrics.java  |  44 ++---
 .../processors/query/SqlSystemViewsSelfTest.java   | 205 ++---
 3 files changed, 197 insertions(+), 66 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
index cfc1ba9..1446f91 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlAbstractLocalSystemView.java
@@ -28,7 +28,6 @@ import org.h2.util.DateTimeUtils;
 import org.h2.value.Value;
 import org.h2.value.ValueNull;
 import org.h2.value.ValueString;
-import org.h2.value.ValueTime;
 import org.h2.value.ValueTimestamp;
 import org.h2.value.ValueTimestampTimeZone;
 
@@ -144,19 +143,6 @@ public abstract class SqlAbstractLocalSystemView extends 
SqlAbstractSystemView {
 }
 
 /**
- * Converts millis to ValueTime
- *
- * @param millis Millis.
- */
-protected static Value valueTimeFromMillis(long millis) {
-if (millis == -1L || millis == Long.MAX_VALUE)
-return ValueNull.INSTANCE;
-else
-// Note: ValueTime.fromMillis(long) method trying to convert time 
using timezone and return wrong result.
-return ValueTime.fromNanos(millis * 1_000_000L);
-}
-
-/**
  * Converts millis to ValueTimestamp
  *
  * @param millis Millis.
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodeMetrics.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodeMetrics.java
index b67423f..6183907 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodeMetrics.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewNodeMetrics.java
@@ -57,18 +57,18 @@ public class SqlSystemViewNodeMetrics extends 
SqlAbstractLocalSystemView {
 newColumn("CUR_CANCELED_JOBS", Value.INT),
 newColumn("AVG_CANCELED_JOBS", Value.FLOAT),
 newColumn("TOTAL_CANCELED_JOBS", Value.INT),
-newColumn("MAX_JOBS_WAIT_TIME", Value.TIME),
-newColumn("CUR_JOBS_WAIT_TIME", Value.TIME),
-newColumn("AVG_JOBS_WAIT_TIME", Value.TIME),
-newColumn("MAX_JOBS_EXECUTE_TIME", Value.TIME),
-newColumn("CUR_JOBS_EXECUTE_TIME", Value.TIME),
-newColumn("AVG_JOBS_EXECUTE_TIME", Value.TIME),
-newColumn("TOTAL_JOBS_EXECUTE_TIME", Value.TIME),
+newColumn("MAX_JOBS_WAIT_TIME", Value.LONG),
+newColumn("CUR_JOBS_WAIT_TIME", Value.LONG),
+newColumn("AVG_JOBS_WAIT_TIME", Value.LONG),
+newColumn("MAX_JOBS_EXECUTE_TIME", Value.LONG),
+newColumn("CUR_JOBS_EXECUTE_TIME", Value.LONG),
+newColumn("AVG_JOBS_EXECUTE_TIME", Value.LONG),
+newColumn("TOTAL_JOBS_EXECUTE_TIME", Value.LONG),
 newColumn("TOTAL_EXECUTED_JOBS", Value.INT),
 newColumn("TOTAL_EXECUTED_TASKS", Value.INT),
-newColumn("TOTAL_BUSY_TIME", Value.TIME),
-newColumn("TOTAL_IDLE_TIME", Value.TIME),
-newColumn("CUR_IDLE_TIME", Value.TIME),
+newColumn("TOTAL_BUSY_TIME", Value.LONG),
+newColumn("TOTAL_IDLE_TIME", Value.LONG),
+newColumn("CUR_IDLE_TIME", Value.LONG),
 newColumn("BUSY_TIME_PERCENTAGE", Value.FLOAT),
 newColumn("IDLE_TIME_PERCENTAGE", Value.FLOAT),
 newColumn("TOTAL_CPU", Value.INT),
@@ -85,7 +85,7 @@ public class SqlSystemViewNodeMetrics extends 
SqlAbstractLocalSystemView {
 newColumn("NONHEAP_MEMORY_COMMI

[ignite] branch master updated: IGNITE-11279: SQL: Removed "prepared" from parser's cache.

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 9860670  IGNITE-11279: SQL: Removed "prepared" from parser's cache.
9860670 is described below

commit 98606705ef26b30bd006c31c74989a9ede74054b
Author: devozerov 
AuthorDate: Fri Feb 15 08:25:49 2019 +0300

IGNITE-11279: SQL: Removed "prepared" from parser's cache.
---
 .../internal/processors/cache/mvcc/MvccUtils.java  |  13 +--
 .../internal/processors/query/h2/H2Utils.java  |   6 +-
 .../processors/query/h2/IgniteH2Indexing.java  | 106 +++--
 .../internal/processors/query/h2/QueryParser.java  |  62 +++-
 .../processors/query/h2/QueryParserResultDml.java  |  24 +++--
 .../processors/query/h2/dml/UpdatePlanBuilder.java |  94 ++
 .../query/h2/sql/GridSqlQueryParser.java   |  40 
 7 files changed, 191 insertions(+), 154 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
index f904966..225af81 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.mvcc;
 
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.TransactionConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import 
org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -845,14 +846,14 @@ public class MvccUtils {
 /**
  * Throws atomicity modes compatibility validation exception.
  *
- * @param ctx1 Cache context.
- * @param ctx2 Another cache context.
+ * @param ccfg1 Config 1.
+ * @param ccfg2 Config 2.
  */
-public static void throwAtomicityModesMismatchException(GridCacheContext 
ctx1, GridCacheContext ctx2) {
+public static void throwAtomicityModesMismatchException(CacheConfiguration 
ccfg1, CacheConfiguration ccfg2) {
 throw new IgniteException("Caches with transactional_snapshot 
atomicity mode cannot participate in the same" +
-" transaction with caches having another atomicity mode. 
[cacheName=" + ctx1.name() +
-", cacheMode=" + ctx1.config().getAtomicityMode() +
-", anotherCacheName=" + ctx2.name() + " anotherCacheMode=" + 
ctx2.config().getAtomicityMode() + ']');
+" transaction with caches having another atomicity mode. 
[cacheName=" + ccfg1.getName() +
+", cacheMode=" + ccfg1.getAtomicityMode() + ", anotherCacheName=" 
+ ccfg2.getName() +
+" anotherCacheMode=" + ccfg2.getAtomicityMode() + ']');
 }
 
 /** */
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
index 50b8def..b86a481 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
@@ -775,9 +775,7 @@ public class H2Utils {
 if (tbl != null) {
 checkAndStartNotStartedCache(idx.kernalContext(), tbl);
 
-int cacheId = tbl.cacheId();
-
-caches0.add(cacheId);
+caches0.add(tbl.cacheId());
 }
 }
 }
@@ -814,7 +812,7 @@ public class H2Utils {
 cctx0 = cctx;
 }
 else if (cctx.mvccEnabled() != mvccEnabled)
-MvccUtils.throwAtomicityModesMismatchException(cctx0, cctx);
+MvccUtils.throwAtomicityModesMismatchException(cctx0.config(), 
cctx.config());
 }
 
 return mvccEnabled;
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 0b44cfc..7f24399 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
@@ -502,6 +502,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 Prepared p = GridSqlQueryParser.prepared(stmt);
 
  

[ignite] branch master updated: IGNITE-11310: SQL: Removed distirbuted joins from local segmented queries. This closes #6103.

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 62e9bc8  IGNITE-11310: SQL: Removed distirbuted joins from local 
segmented queries. This closes #6103.
62e9bc8 is described below

commit 62e9bc8761057fed8ba0bdbd479a1a29ddf73d4c
Author: devozerov 
AuthorDate: Thu Feb 14 20:53:57 2019 +0300

IGNITE-11310: SQL: Removed distirbuted joins from local segmented queries. 
This closes #6103.
---
 .../query/h2/H2IndexingAbstractGeoSelfTest.java|  39 
 .../cache/query/GridCacheTwoStepQuery.java |  22 -
 .../processors/query/h2/IgniteH2Indexing.java  |   6 +-
 .../internal/processors/query/h2/QueryParser.java  |  97 ---
 .../query/h2/QueryParserResultSelect.java  |  27 +-
 .../processors/query/h2/dml/UpdatePlanBuilder.java |   7 +-
 .../query/h2/opt/join/DistributedJoinContext.java  |  22 ++---
 .../query/h2/opt/join/DistributedLookupBatch.java  |  88 +
 .../query/h2/sql/GridSqlQuerySplitter.java |  33 +--
 .../query/h2/twostep/GridMapQueryExecutor.java |  28 ++
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  15 ++-
 .../query/h2/twostep/msg/GridH2QueryRequest.java   |  11 ++-
 .../query/IgniteQueryDedicatedPoolTest.java|   1 -
 .../query/IgniteSqlSegmentedIndexSelfTest.java | 107 +
 14 files changed, 213 insertions(+), 290 deletions(-)

diff --git 
a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
 
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
index 423f714..ddf1344 100644
--- 
a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
+++ 
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
@@ -562,8 +562,6 @@ public abstract class H2IndexingAbstractGeoSelfTest extends 
GridCacheAbstractSel
 }
 
 checkDistributedQuery();
-
-checkLocalQuery();
 }
 finally {
 destroy(c1, grid(0), dynamic);
@@ -604,43 +602,6 @@ public abstract class H2IndexingAbstractGeoSelfTest 
extends GridCacheAbstractSel
 }
 
 /**
- * Check local query.
- *
- * @throws ParseException If failed.
- */
-private void checkLocalQuery() throws ParseException {
-IgniteCache c1 = grid(0).cache("enemy");
-IgniteCache c2 = grid(0).cache("camp");
-
-final Geometry lethalArea = new WKTReader().read("POLYGON((30 30, 30 
70, 70 70, 70 30, 30 30))");
-
-Set localCampsIDs = new HashSet<>();
-
-for(Cache.Entry e : c2.localEntries())
-localCampsIDs.add(e.getKey());
-
-int expectedEnemies = 0;
-
-for (Cache.Entry e : c1.localEntries()) {
-final Integer campID = e.getValue().campId;
-
-if (localCampsIDs.contains(campID)) {
-final EnemyCamp camp = c2.get(campID);
-
-if (lethalArea.covers(camp.coords))
-expectedEnemies++;
-}
-}
-
-final SqlFieldsQuery query = new SqlFieldsQuery("select e._val, c._val 
from \"enemy\".Enemy e, " +
-"\"camp\".EnemyCamp c where e.campId = c._key and c.coords && 
?").setArgs(lethalArea);
-
-List> result = c1.query(query.setLocal(true)).getAll();
-
-assertEquals(expectedEnemies, result.size());
-}
-
-/**
  *
  */
 private static class Enemy {
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index aad9cdd..0fcddeb 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -56,7 +56,7 @@ public class GridCacheTwoStepQuery {
 private final List cacheIds;
 
 /** */
-private final boolean local;
+private final boolean locSplit;
 
 /** */
 private final PartitionResult derivedPartitions;
@@ -87,7 +87,7 @@ public class GridCacheTwoStepQuery {
 PartitionResult derivedPartitions,
 List cacheIds,
 boolean mvccEnabled,
-boolean local
+boolean locSplit
 ) {
 this.originalSql = originalSql;
 this.paramsCnt = paramsCnt;
@@ -101,7 +101,7 @@ public class GridCacheTwoStepQuery {
 this.derivedPartitions = derive

[ignite] branch ignite-11310-nodml deleted (was c32d0c2)

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch ignite-11310-nodml
in repository https://gitbox.apache.org/repos/asf/ignite.git.


 was c32d0c2  Test fixes.

This change permanently discards the following revisions:

 discard c32d0c2  Test fixes.
 discard 3fa6523  No caching for multi-staement.
 discard 0935071  Revert "DML."
 discard 0a0cd44  Test fixes.
 discard 643a45b  Merge branch 'master' into ignite-11310



[ignite] 05/05: Test fixes.

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11310-nodml
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit c32d0c2cd627436fbe6e791b71ab1604dc108a98
Author: devozerov 
AuthorDate: Thu Feb 14 15:17:38 2019 +0300

Test fixes.
---
 .../query/IgniteSqlSegmentedIndexSelfTest.java | 107 +
 1 file changed, 44 insertions(+), 63 deletions(-)

diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
index be8a5f0..8f57367 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSegmentedIndexSelfTest.java
@@ -27,13 +27,12 @@ import javax.cache.Cache;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheKeyConfiguration;
 import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
 import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
 import 
org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest;
 import org.junit.Test;
 
@@ -57,20 +56,7 @@ public class IgniteSqlSegmentedIndexSelfTest extends 
AbstractIndexingCommonTest
 private static final int ORPHAN_ROWS = 10;
 
 /** */
-private static int QRY_PARALLELISM_LVL = 97;
-
-/** {@inheritDoc} */
-@Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-CacheKeyConfiguration keyCfg = new CacheKeyConfiguration("MyCache", 
"affKey");
-
-cfg.setCacheKeyConfiguration(keyCfg);
-
-cfg.setPeerClassLoadingEnabled(false);
-
-return cfg;
-}
+private static final int QRY_PARALLELISM_LVL = 97;
 
 /** @return number of nodes to be prestarted. */
 protected int nodesCount() {
@@ -78,11 +64,13 @@ public class IgniteSqlSegmentedIndexSelfTest extends 
AbstractIndexingCommonTest
 }
 
 /** {@inheritDoc} */
+@SuppressWarnings("deprecation")
 @Override protected void beforeTestsStarted() throws Exception {
 startGrids(nodesCount());
 }
 
 /** {@inheritDoc} */
+@SuppressWarnings("deprecation")
 @Override protected void afterTest() throws Exception {
 super.afterTest();
 
@@ -105,11 +93,11 @@ public class IgniteSqlSegmentedIndexSelfTest extends 
AbstractIndexingCommonTest
 }
 
 /**
- * @throws Exception If failed.
+ * Test segmented index.
  */
 @Test
-public void testSegmentedIndex() throws Exception {
-ignite(0).createCache(cacheConfig(PERSON_CAHE_NAME, true, 
Integer.class, Person.class));
+public void testSegmentedIndex() {
+ignite(0).createCache(cacheConfig(PERSON_CAHE_NAME, true, 
PersonKey.class, Person.class));
 ignite(0).createCache(cacheConfig(ORG_CACHE_NAME, true, Integer.class, 
Organization.class));
 
 fillCache();
@@ -123,10 +111,9 @@ public class IgniteSqlSegmentedIndexSelfTest extends 
AbstractIndexingCommonTest
 
 /**
  * Check correct index snapshots with segmented indices.
- * @throws Exception If failed.
  */
 @Test
-public void testSegmentedIndexReproducableResults() throws Exception {
+public void testSegmentedIndexReproducableResults() {
 ignite(0).createCache(cacheConfig(ORG_CACHE_NAME, true, Integer.class, 
Organization.class));
 
 IgniteCache cache = ignite(0).cache(ORG_CACHE_NAME);
@@ -149,10 +136,9 @@ public class IgniteSqlSegmentedIndexSelfTest extends 
AbstractIndexingCommonTest
 
 /**
  * Checks correct select count(*) result with segmented 
indices.
- * @throws Exception If failed.
  */
 @Test
-public void testSegmentedIndexSizeReproducableResults() throws Exception {
+public void testSegmentedIndexSizeReproducableResults() {
 ignite(0).createCache(cacheConfig(ORG_CACHE_NAME, true, Integer.class, 
Organization.class));
 
 IgniteCache cache = ignite(0).cache(ORG_CACHE_NAME);
@@ -174,12 +160,11 @@ public class IgniteSqlSegmentedIndexSelfTest extends 
AbstractIndexingCommonTest
 }
 
 /**
- * Run tests on single-node grid
- *
- * @throws Exception If failed.
+ * Run tests on single-node grid.
  */
+@SuppressWarnings("deprecation")
 @Test
-  

[ignite] 04/05: No caching for multi-staement.

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11310-nodml
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 3fa65235e6515d27f570436a42d521bac3e1beac
Author: devozerov 
AuthorDate: Thu Feb 14 14:53:18 2019 +0300

No caching for multi-staement.
---
 .../org/apache/ignite/internal/processors/query/h2/QueryParser.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
index 496ec0e..54a3bbd 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
@@ -247,7 +247,7 @@ public class QueryParser {
 PreparedStatement stmt;
 
 try {
-stmt = connMgr.prepareStatement(c, qry.getSql());
+stmt = connMgr.prepareStatementNoCache(c, qry.getSql());
 }
 catch (SQLException e) {
 throw new IgniteSQLException("Failed to parse query. " + 
e.getMessage(),



[ignite] 01/05: Merge branch 'master' into ignite-11310

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11310-nodml
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 643a45b008f5659331a2a396df3d74da58f804fc
Merge: b4b5810 d620268
Author: devozerov 
AuthorDate: Thu Feb 14 12:54:28 2019 +0300

Merge branch 'master' into ignite-11310

 .../ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java   | 2 --
 1 file changed, 2 deletions(-)




[ignite] 03/05: Revert "DML."

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11310-nodml
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 093507152a1acf22cb9d438e4c3855dea1c1e924
Author: devozerov 
AuthorDate: Thu Feb 14 14:19:17 2019 +0300

Revert "DML."

This reverts commit b4b5810aad5be3d69675427daa99a4045f65d298.
---
 .../processors/query/h2/ConnectionManager.java |  4 +-
 .../processors/query/h2/H2CachedStatementKey.java  | 15 +++-
 .../processors/query/h2/H2StatementCache.java  |  2 +-
 .../processors/query/h2/IgniteH2Indexing.java  | 51 +++--
 .../processors/query/h2/dml/UpdatePlanBuilder.java | 22 --
 .../query/h2/twostep/GridMapQueryExecutor.java | 16 ++--
 .../query/h2/H2StatementCacheSelfTest.java | 86 ++
 .../IgniteBinaryCacheQueryTestSuite.java   |  2 +
 8 files changed, 154 insertions(+), 44 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
index d0efc0a8..8c1e89c 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ConnectionManager.java
@@ -298,7 +298,7 @@ public class ConnectionManager {
 @Nullable public PreparedStatement cachedPreparedStatement(Connection c, 
String sql) throws SQLException {
 H2StatementCache cache = statementCacheForThread();
 
-H2CachedStatementKey key = new H2CachedStatementKey(c.getSchema(), 
sql, null);
+H2CachedStatementKey key = new H2CachedStatementKey(c.getSchema(), 
sql);
 
 PreparedStatement stmt = cache.get(key);
 
@@ -326,7 +326,7 @@ public class ConnectionManager {
 if (stmt == null) {
 H2StatementCache cache = statementCacheForThread();
 
-H2CachedStatementKey key = new H2CachedStatementKey(c.getSchema(), 
sql, null);
+H2CachedStatementKey key = new H2CachedStatementKey(c.getSchema(), 
sql);
 
 stmt = PreparedStatementExImpl.wrap(prepareStatementNoCache(c, 
sql));
 
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2CachedStatementKey.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2CachedStatementKey.java
index ca94e24..300ed6c 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2CachedStatementKey.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2CachedStatementKey.java
@@ -36,17 +36,28 @@ class H2CachedStatementKey {
 private final byte flags;
 
 /**
+ * Constructor.
+ *
+ * @param schemaName Schema name.
+ * @param sql SQL.
+ */
+H2CachedStatementKey(String schemaName, String sql) {
+this(schemaName, sql, null, false);
+}
+
+/**
  * Full-fledged constructor.
  *
  * @param schemaName Schema name.
  * @param sql SQL.
  * @param fieldsQry Query with flags.
+ * @param loc DML {@code SELECT} Locality flag.
  */
-public H2CachedStatementKey(String schemaName, String sql, SqlFieldsQuery 
fieldsQry) {
+public H2CachedStatementKey(String schemaName, String sql, SqlFieldsQuery 
fieldsQry, boolean loc) {
 this.schemaName = schemaName;
 this.sql = sql;
 
-if (fieldsQry == null || 
!UpdatePlanBuilder.isSkipReducerOnUpdateQuery(fieldsQry))
+if (fieldsQry == null || loc || 
!UpdatePlanBuilder.isSkipReducerOnUpdateQuery(fieldsQry))
 this.flags = 0; // flags only relevant for server side updates.
 else {
 this.flags = (byte)(1 +
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2StatementCache.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2StatementCache.java
index 41e04c6..edde67a 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2StatementCache.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2StatementCache.java
@@ -94,7 +94,7 @@ final class H2StatementCache {
  * @param sql SQL statement.
  */
 void remove(String schemaName, String sql) {
-lruStmtCache.remove(new H2CachedStatementKey(schemaName, sql, null));
+lruStmtCache.remove(new H2CachedStatementKey(schemaName, sql));
 }
 
 /**
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 0d0c060..d43cfc5 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processor

[ignite] 02/05: Test fixes.

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-11310-nodml
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 0a0cd44c045cf31b37f1d8a504247a37aaf7db30
Author: devozerov 
AuthorDate: Thu Feb 14 13:23:16 2019 +0300

Test fixes.
---
 .../query/h2/H2IndexingAbstractGeoSelfTest.java| 39 --
 1 file changed, 39 deletions(-)

diff --git 
a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
 
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
index 423f714..ddf1344 100644
--- 
a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
+++ 
b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
@@ -562,8 +562,6 @@ public abstract class H2IndexingAbstractGeoSelfTest extends 
GridCacheAbstractSel
 }
 
 checkDistributedQuery();
-
-checkLocalQuery();
 }
 finally {
 destroy(c1, grid(0), dynamic);
@@ -604,43 +602,6 @@ public abstract class H2IndexingAbstractGeoSelfTest 
extends GridCacheAbstractSel
 }
 
 /**
- * Check local query.
- *
- * @throws ParseException If failed.
- */
-private void checkLocalQuery() throws ParseException {
-IgniteCache c1 = grid(0).cache("enemy");
-IgniteCache c2 = grid(0).cache("camp");
-
-final Geometry lethalArea = new WKTReader().read("POLYGON((30 30, 30 
70, 70 70, 70 30, 30 30))");
-
-Set localCampsIDs = new HashSet<>();
-
-for(Cache.Entry e : c2.localEntries())
-localCampsIDs.add(e.getKey());
-
-int expectedEnemies = 0;
-
-for (Cache.Entry e : c1.localEntries()) {
-final Integer campID = e.getValue().campId;
-
-if (localCampsIDs.contains(campID)) {
-final EnemyCamp camp = c2.get(campID);
-
-if (lethalArea.covers(camp.coords))
-expectedEnemies++;
-}
-}
-
-final SqlFieldsQuery query = new SqlFieldsQuery("select e._val, c._val 
from \"enemy\".Enemy e, " +
-"\"camp\".EnemyCamp c where e.campId = c._key and c.coords && 
?").setArgs(lethalArea);
-
-List> result = c1.query(query.setLocal(true)).getAll();
-
-assertEquals(expectedEnemies, result.size());
-}
-
-/**
  *
  */
 private static class Enemy {



[ignite] branch ignite-11310-nodml created (now c32d0c2)

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch ignite-11310-nodml
in repository https://gitbox.apache.org/repos/asf/ignite.git.


  at c32d0c2  Test fixes.

This branch includes the following new commits:

 new 643a45b  Merge branch 'master' into ignite-11310
 new 0a0cd44  Test fixes.
 new 0935071  Revert "DML."
 new 3fa6523  No caching for multi-staement.
 new c32d0c2  Test fixes.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[ignite] branch master updated: Removed irrelevant TODOs.

2019-02-14 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new d620268  Removed irrelevant TODOs.
d620268 is described below

commit d6202689f421bd4ccf293650acc3a83d438f537e
Author: devozerov 
AuthorDate: Thu Feb 14 11:13:22 2019 +0300

Removed irrelevant TODOs.
---
 .../ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java   | 2 --
 1 file changed, 2 deletions(-)

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 406c323..e3fca3c 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
@@ -1194,7 +1194,6 @@ public class GridSqlQuerySplitter {
 
 // -- HAVING
 if (havingCol >= 0 && !collocatedGrpBy) {
-// TODO IGNITE-1140 - Find aggregate functions in HAVING clause or 
rewrite query to put all aggregates to SELECT clause.
 // We need to find HAVING column in reduce query.
 for (int i = visibleCols; i < rdcQry.allColumns(); i++) {
 GridSqlAst c = rdcQry.column(i);
@@ -1217,7 +1216,6 @@ public class GridSqlQuerySplitter {
 // If collocatedGrpBy is true, then aggregateFound is always false.
 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.
 }
 
 // -- LIMIT



[ignite] branch master updated: IGNITE-11304: SQL: cache fields metadata for both distributed and local queries. This closes #6096.

2019-02-13 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 6c9a17b  IGNITE-11304: SQL: cache fields metadata for both distributed 
and local queries. This closes #6096.
6c9a17b is described below

commit 6c9a17b4b231a993c3a8285bb686efbc5a4a5790
Author: devozerov 
AuthorDate: Wed Feb 13 16:00:30 2019 +0300

IGNITE-11304: SQL: cache fields metadata for both distributed and local 
queries. This closes #6096.
---
 .../processors/query/h2/IgniteH2Indexing.java  | 94 +++---
 .../internal/processors/query/h2/QueryParser.java  | 45 +--
 .../query/h2/QueryParserResultSelect.java  | 34 
 3 files changed, 81 insertions(+), 92 deletions(-)

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 c876d3c..88a72e8 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
@@ -474,6 +474,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 final String schemaName,
 String qry,
 @Nullable final Collection params,
+@Nullable List meta,
 final IndexingQueryFilter filter,
 boolean enforceJoinOrder,
 boolean startTx,
@@ -582,21 +583,6 @@ public class IgniteH2Indexing implements GridQueryIndexing 
{
 }
 }
 
-List meta;
-
-try {
-meta = H2Utils.meta(stmt.getMetaData());
-
-if (forUpdate) {
-assert meta.size() >= 1;
-
-meta = meta.subList(0, meta.size() - 1);
-}
-}
-catch (SQLException e) {
-throw new IgniteCheckedException("Cannot prepare query 
metadata", e);
-}
-
 GridNearTxLocal tx0 = tx;
 MvccQueryTracker mvccTracker0 = mvccTracker;
 GridNearTxSelectForUpdateFuture sfuFut0 = sfuFut;
@@ -809,28 +795,11 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 QueryCursorImpl> stepCur = new QueryCursorImpl<>(new 
Iterable>() {
 @Override public Iterator> iterator() {
 try {
-Object[] params = args != null ? args : 
X.EMPTY_OBJECT_ARRAY;
+assert F.isEmpty(plan.selectQuery());
 
-Iterator> it;
-
-if (!F.isEmpty(plan.selectQuery())) {
-GridQueryFieldsResult res = executeQueryLocal0(
-schema(cctx.name()),
-plan.selectQuery(),
-F.asList(params),
-null,
-false,
-false,
-0,
-null,
-null,
-null
-);
+Object[] params = args != null ? args : 
X.EMPTY_OBJECT_ARRAY;
 
-it = res.iterator();
-}
-else
-it = plan.createRows(params).iterator();
+Iterator> it = 
plan.createRows(params).iterator();
 
 return new GridQueryCacheObjectsIterator(it, 
objectContext(), cctx.keepBinary());
 }
@@ -1092,6 +1061,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 private FieldsQueryCursor> executeQueryLocal(
 String schemaName,
 SqlFieldsQuery qry,
+List meta,
 final boolean keepBinary,
 IndexingQueryFilter filter,
 GridQueryCancel cancel,
@@ -1103,6 +1073,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 schemaName,
 qry.getSql(),
 F.asList(qry.getArgs()),
+meta,
 filter,
 qry.isEnforceJoinOrder(),
 startTx,
@@ -1579,10 +1550,10 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 // Execute SQL.
 assert select != null;
 
-GridCacheTwoStepQuery twoStepQry = select.twoStepQuery();
-
-if (twoStepQry != null) {
+if (!select.isLocal()) {
 // Distributed query.
+GridCacheTwoStepQuery twoStepQry = select.twoStepQuery();
+
 if (ctx.security().enabled())
 checkSecurity(twoStepQry.cacheIds());

[ignite] branch master updated: IGNITE-11280: SQL: common caching logic for all statement types. This closes #6091.

2019-02-13 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new ed69632  IGNITE-11280: SQL: common caching logic for all statement 
types. This closes #6091.
ed69632 is described below

commit ed6963269046fd0cd11dc9f8b45c3d3cd464bfef
Author: devozerov 
AuthorDate: Wed Feb 13 11:53:06 2019 +0300

IGNITE-11280: SQL: common caching logic for all statement types. This 
closes #6091.
---
 .../jdbc/thin/JdbcThinLocalQueriesSelfTest.java|   7 --
 .../internal/processors/query/h2/QueryParser.java  | 111 +
 .../processors/query/h2/QueryParserCacheEntry.java |  53 ++
 .../query/h2/QueryParserResultSelect.java  |   3 +-
 .../query/IgniteCachelessQueriesSelfTest.java  |   2 +-
 5 files changed, 85 insertions(+), 91 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinLocalQueriesSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinLocalQueriesSelfTest.java
index ac81a71..d460dbc 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinLocalQueriesSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinLocalQueriesSelfTest.java
@@ -20,9 +20,7 @@ package org.apache.ignite.jdbc.thin;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.List;
-import java.util.Map;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
 import org.junit.Test;
 
 /**
@@ -65,11 +63,6 @@ public class JdbcThinLocalQueriesSelfTest extends 
JdbcThinAbstractSelfTest {
 "p.companyid = c.id");
 
 assertEqualsCollections(F.asList(2, "John", "Apple"), res.get(0));
-
-Map twoStepCache = 
U.field((Object)U.field(grid(0).context().query().getIndexing(), "parser"), 
"cache");
-
-// No two step queries cached => local select.
-assertEquals(0, twoStepCache.size());
 }
 }
 }
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
index 0b0baf0..7ab2696 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
@@ -123,34 +123,36 @@ public class QueryParser {
  */
 private QueryParserResult parse0(String schemaName, SqlFieldsQuery qry) {
 // First, let's check if we already have a two-step query for this 
statement...
-QueryParserCacheKey cachedQryKey = new QueryParserCacheKey(
+QueryParserCacheKey cachedKey = new QueryParserCacheKey(
 schemaName,
 qry.getSql(),
 qry.isCollocated(),
 qry.isDistributedJoins(),
 qry.isEnforceJoinOrder(),
-qry.isLocal());
+qry.isLocal()
+);
 
-QueryParserCacheEntry cachedQry = cache.get(cachedQryKey);
+QueryParserCacheEntry cached = cache.get(cachedKey);
 
-if (cachedQry != null) {
-QueryParserResultSelect select = new QueryParserResultSelect(
-cachedQry.query(),
-cachedQry.meta(),
-null
-);
-
-return new QueryParserResult(qry, null, select, null, null);
-}
+if (cached != null)
+return new QueryParserResult(qry, null, cached.select(), 
cached.dml(), cached.command());
 
 // Try parting as native command.
 QueryParserResult parseRes = parseNative(schemaName, qry);
 
-if (parseRes != null)
-return parseRes;
+// Otherwise parse with H2.
+if (parseRes == null)
+parseRes = parseH2(schemaName, qry);
+
+// Add to cache if not multi-statement.
+if (parseRes.remainingQuery() == null) {
+cached = new QueryParserCacheEntry(parseRes.select(), 
parseRes.dml(), parseRes.command());
+
+cache.put(cachedKey, cached);
+}
 
-// Parse with H2.
-return parseH2(schemaName, qry);
+// Done.
+return parseRes;
 }
 
 /**
@@ -371,56 +373,39 @@ public class QueryParser {
 }
 
 // Only distirbuted SELECT are possible at this point.
-QueryParserCacheKey cachedQryKey = new QueryParserCacheKey(
-schemaName,
-qry.getSql(),
-qry.isCollocated(),
-qry.isDistributedJoins(),
-qry.isEnforceJoinOrder(),
-qry.isLocal()
-);
-
-QueryParserCacheEntry cachedQry = cache.get(cachedQryKey);
+  

[ignite] branch master updated: IGNITE-11278: SQL: Extracted parser logic from IgniteH2Indexing. This closes #6075.

2019-02-10 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 5725a77  IGNITE-11278: SQL: Extracted parser logic from 
IgniteH2Indexing. This closes #6075.
5725a77 is described below

commit 5725a77b264f4f9ea9b5b16e8275c92b842e8568
Author: devozerov 
AuthorDate: Sun Feb 10 12:38:08 2019 +0300

IGNITE-11278: SQL: Extracted parser logic from IgniteH2Indexing. This 
closes #6075.
---
 .../thin/JdbcThinBulkLoadAbstractSelfTest.java |   4 +-
 .../jdbc/thin/JdbcThinLocalQueriesSelfTest.java|   2 +-
 .../processors/query/h2/CommandProcessor.java  |   9 +
 .../processors/query/h2/ConnectionManager.java |   2 +-
 .../processors/query/h2/IgniteH2Indexing.java  | 478 -
 .../processors/query/h2/ParsingResult.java | 186 
 .../internal/processors/query/h2/QueryParser.java  | 456 
 ...CachedQuery.java => QueryParserCacheEntry.java} |   6 +-
 ...achedQueryKey.java => QueryParserCacheKey.java} |   6 +-
 .../processors/query/h2/QueryParserResult.java | 120 ++
 .../query/h2/QueryParserResultCommand.java |  70 +++
 .../processors/query/h2/QueryParserResultDml.java  |  44 ++
 ...chedQuery.java => QueryParserResultSelect.java} |  50 ++-
 .../query/IgniteCachelessQueriesSelfTest.java  |   6 +-
 .../processors/query/SqlQueryHistorySelfTest.java  |  15 +-
 15 files changed, 844 insertions(+), 610 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java
index 7aea354..525d89a 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinBulkLoadAbstractSelfTest.java
@@ -642,7 +642,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest 
extends JdbcThinAbstractD
 
 return null;
 }
-}, SQLException.class, "The query isn't SELECT query");
+}, SQLException.class, "Given statement type does not match that 
declared by JDBC driver");
 }
 
 /**
@@ -727,7 +727,7 @@ public abstract class JdbcThinBulkLoadAbstractSelfTest 
extends JdbcThinAbstractD
 
 return null;
 }
-}, SQLException.class, "The query isn't SELECT query");
+}, SQLException.class, "Given statement type does not match that 
declared by JDBC driver");
 }
 
 /**
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinLocalQueriesSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinLocalQueriesSelfTest.java
index 370b40f..ac81a71 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinLocalQueriesSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinLocalQueriesSelfTest.java
@@ -66,7 +66,7 @@ public class JdbcThinLocalQueriesSelfTest extends 
JdbcThinAbstractSelfTest {
 
 assertEqualsCollections(F.asList(2, "John", "Apple"), res.get(0));
 
-Map twoStepCache = 
U.field(grid(0).context().query().getIndexing(), "twoStepCache");
+Map twoStepCache = 
U.field((Object)U.field(grid(0).context().query().getIndexing(), "parser"), 
"cache");
 
 // No two step queries cached => local select.
 assertEquals(0, twoStepCache.size());
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
index 8c52296..def2447 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
@@ -98,6 +98,7 @@ import org.h2.command.ddl.CreateIndex;
 import org.h2.command.ddl.CreateTable;
 import org.h2.command.ddl.DropIndex;
 import org.h2.command.ddl.DropTable;
+import org.h2.command.dml.NoOperation;
 import org.h2.table.Column;
 import org.h2.value.DataType;
 import org.h2.value.Value;
@@ -797,6 +798,14 @@ public class CommandProcessor {
 }
 
 /**
+ * @param cmd Statement.
+ * @return Whether {@code cmd} is a no-op.
+ */
+public static boolean isCommandNoOp(Prepared cmd) {
+return cmd instanceof NoOperation;
+}
+
+/**
  * Helper function for obtaining type class name for H2.
  *
  * @param col Column.
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/Co

[ignite] branch master updated: IGNITE-12275: SQL: Moved non-SELECT/DML commands processing to separate class. This closes #6071.

2019-02-09 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 88fcc92  IGNITE-12275: SQL: Moved non-SELECT/DML commands processing 
to separate class. This closes #6071.
88fcc92 is described below

commit 88fcc92243df12bff1d18742211062d5e1d7dee4
Author: devozerov 
AuthorDate: Sat Feb 9 18:02:37 2019 +0300

IGNITE-12275: SQL: Moved non-SELECT/DML commands processing to separate 
class. This closes #6071.
---
 ...tementsProcessor.java => CommandProcessor.java} | 323 
 .../processors/query/h2/CommandResult.java |  58 
 .../processors/query/h2/IgniteH2Indexing.java  | 324 +
 .../processors/query/h2/ParsingResult.java |  45 ++-
 .../cache/index/H2DynamicTableSelfTest.java|   4 +-
 5 files changed, 435 insertions(+), 319 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
similarity index 72%
rename from 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
rename to 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
index 84dfea2..8c52296 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/CommandProcessor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.h2.ddl;
+package org.apache.ignite.internal.processors.query.h2;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -28,28 +28,41 @@ import java.util.Set;
 import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.QueryEntity;
 import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.QueryIndexType;
+import org.apache.ignite.cache.query.BulkLoadContextCursor;
 import org.apache.ignite.cache.query.FieldsQueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import 
org.apache.ignite.internal.processors.bulkload.BulkLoadAckClientParameters;
+import org.apache.ignite.internal.processors.bulkload.BulkLoadCacheWriter;
+import org.apache.ignite.internal.processors.bulkload.BulkLoadParser;
+import org.apache.ignite.internal.processors.bulkload.BulkLoadProcessor;
+import org.apache.ignite.internal.processors.bulkload.BulkLoadStreamerWriter;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils;
 import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
+import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx;
 import org.apache.ignite.internal.processors.query.GridQueryProperty;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.processors.query.IgniteSQLException;
+import org.apache.ignite.internal.processors.query.NestedTxMode;
 import org.apache.ignite.internal.processors.query.QueryEntityEx;
 import org.apache.ignite.internal.processors.query.QueryField;
 import org.apache.ignite.internal.processors.query.QueryUtils;
-import org.apache.ignite.internal.processors.query.h2.H2Utils;
-import org.apache.ignite.internal.processors.query.h2.SchemaManager;
+import org.apache.ignite.internal.processors.query.RunningQueryManager;
+import org.apache.ignite.internal.processors.query.SqlClientContext;
+import 
org.apache.ignite.internal.processors.query.h2.dml.DmlBulkLoadDataConverter;
+import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan;
+import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
 import 
org.apache.ignite.internal.processors.query.h2.sql.GridSqlAlterTableAddColumn;
 import 
org.apache.ignite.internal.processors.query.h2.sql.GridSqlAlterTableDropColumn;
@@ -58,20 +71,26 @@ import 
org.apache.ignite.internal.processors.query.h2.sql.GridSqlCreateIndex;
 imp

[ignite] branch master updated: IGNITE-11223: SQL: Make two-step plan immutable. Note that GridCacheSqlQuery is still mutable, what will be fixed separately. This closes #6070.

2019-02-09 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 208c53f  IGNITE-11223: SQL: Make two-step plan immutable. Note that 
GridCacheSqlQuery is still mutable, what will be fixed separately. This closes 
#6070.
208c53f is described below

commit 208c53f467797606cfd0b116bda3101cf3451d5b
Author: devozerov 
AuthorDate: Sat Feb 9 11:19:55 2019 +0300

IGNITE-11223: SQL: Make two-step plan immutable. Note that 
GridCacheSqlQuery is still mutable, what will be fixed separately. This closes 
#6070.
---
 .../cache/query/GridCacheTwoStepQuery.java | 183 ---
 .../internal/processors/query/h2/H2Utils.java  | 141 
 .../processors/query/h2/IgniteH2Indexing.java  | 250 +
 .../processors/query/h2/dml/UpdatePlanBuilder.java |  21 +-
 .../query/h2/sql/GridSqlQuerySplitter.java |  59 ++---
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  34 ++-
 .../query/h2/twostep/ReduceQueryRun.java   |   5 +-
 7 files changed, 317 insertions(+), 376 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index cc5dd03..aad9cdd 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -17,12 +17,12 @@
 
 package org.apache.ignite.internal.processors.cache.query;
 
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.sql.optimizer.affinity.PartitionResult;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
@@ -30,48 +30,42 @@ import org.apache.ignite.internal.util.typedef.internal.S;
  */
 public class GridCacheTwoStepQuery {
 /** */
-public static final int DFLT_PAGE_SIZE = 1000;
-
-/** */
 @GridToStringInclude
-private List mapQrys = new ArrayList<>();
+private final List mapQrys;
 
 /** */
 @GridToStringInclude
-private GridCacheSqlQuery rdc;
-
-/** */
-private int pageSize = DFLT_PAGE_SIZE;
+private final GridCacheSqlQuery rdc;
 
 /** */
-private boolean explain;
+private final boolean explain;
 
 /** */
-private String originalSql;
+private final String originalSql;
 
 /** */
-private Set tbls;
+private final Set tbls;
 
 /** */
-private boolean distributedJoins;
+private final boolean distributedJoins;
 
 /** */
-private boolean skipMergeTbl;
+private final boolean skipMergeTbl;
 
 /** */
-private List cacheIds;
+private final List cacheIds;
 
 /** */
-private boolean local;
+private final boolean local;
 
 /** */
-private PartitionResult derivedPartitions;
+private final PartitionResult derivedPartitions;
 
 /** */
-private boolean mvccEnabled;
+private final boolean mvccEnabled;
 
 /** {@code FOR UPDATE} flag. */
-private boolean forUpdate;
+private final boolean forUpdate;
 
 /** Number of positional arguments in the sql. */
 private final int paramsCnt;
@@ -80,19 +74,34 @@ public class GridCacheTwoStepQuery {
  * @param originalSql Original query SQL.
  * @param tbls Tables in query.
  */
-public GridCacheTwoStepQuery(String originalSql, int paramsCnt, 
Set tbls) {
+public GridCacheTwoStepQuery(
+String originalSql,
+int paramsCnt,
+Set tbls,
+GridCacheSqlQuery rdc,
+List mapQrys,
+boolean skipMergeTbl,
+boolean explain,
+boolean distributedJoins,
+boolean forUpdate,
+PartitionResult derivedPartitions,
+List cacheIds,
+boolean mvccEnabled,
+boolean local
+) {
 this.originalSql = originalSql;
 this.paramsCnt = paramsCnt;
 this.tbls = tbls;
-}
-
-/**
- * Specify if distributed joins are enabled for this query.
- *
- * @param distributedJoins Distributed joins enabled.
- */
-public void distributedJoins(boolean distributedJoins) {
+this.rdc = rdc;
+this.mapQrys = F.isEmpty(mapQrys) ? Collections.emptyList() : mapQrys;
+this.skipMergeTbl = skipMergeTbl;
+this.explain = explain;
 this.distributedJoins = distributedJoins;
+this.forUpdate = forUpdate;
+this.derivedPartitions = derivedPart

[ignite] branch master updated: IGNITE-10347: SQL: system view with running queries. This closes #5845.

2019-02-08 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 9ec36bf  IGNITE-10347: SQL: system view with running queries. This 
closes #5845.
9ec36bf is described below

commit 9ec36bf4d7875700bdf604e837254ddc353e9b87
Author: Yuriy Gerzhedovich 
AuthorDate: Fri Feb 8 12:26:26 2019 +0300

IGNITE-10347: SQL: system view with running queries. This closes #5845.
---
 .../processors/query/RunningQueryManager.java  |  19 +++-
 .../processors/query/h2/IgniteH2Indexing.java  |   9 ++
 .../processors/query/h2/SchemaManager.java |   2 +
 .../h2/sys/view/SqlAbstractLocalSystemView.java|  33 ++-
 .../h2/sys/view/SqlSystemViewRunningQueries.java   | 101 
 .../processors/query/RunningQueriesTest.java   |   2 +-
 .../processors/query/SqlSystemViewsSelfTest.java   | 105 +
 7 files changed, 265 insertions(+), 6 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/RunningQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/RunningQueryManager.java
index 0c7a5a2..807488c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/RunningQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/RunningQueryManager.java
@@ -21,6 +21,7 @@ package org.apache.ignite.internal.processors.query;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
@@ -117,6 +118,22 @@ public class RunningQueryManager {
 }
 
 /**
+ * Return SQL queries which executing right now.
+ *
+ * @return List of SQL running queries.
+ */
+public List runningSqlQueries() {
+List res = new ArrayList<>();
+
+for (GridRunningQueryInfo run : runs.values()) {
+if (isSqlQuery(run))
+res.add(run);
+}
+
+return res;
+}
+
+/**
  * Check belongs running query to an SQL type.
  *
  * @param runningQryInfo Running query info object.
@@ -130,7 +147,7 @@ public class RunningQueryManager {
  * Return long running user queries.
  *
  * @param duration Duration of long query.
- * @return List of queries which running longer than given duration.
+ * @return Collection of queries which running longer than given duration.
  */
 public Collection longRunningQueries(long duration) {
 Collection res = new ArrayList<>();
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 5170c2a..6d346c0 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
@@ -2704,6 +2704,15 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 rdcQryExec.onDisconnected(reconnectFut);
 }
 
+/**
+ * Return SQL running queries.
+ *
+ * @return SQL running queries.
+ */
+public List runningSqlQueries() {
+return runningQueryMgr.runningSqlQueries();
+}
+
 /** {@inheritDoc} */
 @Override public Collection runningQueries(long 
duration) {
 return runningQueryMgr.longRunningQueries(duration);
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java
index f681036..bf52d2f 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/SchemaManager.java
@@ -56,6 +56,7 @@ import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewCach
 import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodeAttributes;
 import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodeMetrics;
 import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodes;
+import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewRunningQueries;
 import 
org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewTables;
 import 
org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
 import org.apache.ignite.internal.util.typedef.F;
@@ -167,6 +168,7 @@ public class SchemaManager {
 views.add(new SqlSystemVi

[ignite] branch master updated: IGNITE-10602: SQL: Fixed parsing of multi-statements when both native and H2 parsers are invloved. This closes #6018.

2019-02-08 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new bb6dedb  IGNITE-10602: SQL: Fixed parsing of multi-statements when 
both native and H2 parsers are invloved. This closes #6018.
bb6dedb is described below

commit bb6dedb31c34ce13deabd8be12a68ef182e7477e
Author: palmuhal 
AuthorDate: Fri Feb 8 11:09:44 2019 +0300

IGNITE-10602: SQL: Fixed parsing of multi-statements when both native and 
H2 parsers are invloved. This closes #6018.
---
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java  |   2 +
 .../jdbc/thin/JdbcThinMultiStatementSelfTest.java  | 198 +
 .../org/apache/ignite/internal/sql/SqlLexer.java   |   9 +-
 .../org/apache/ignite/internal/sql/SqlParser.java  |  54 -
 .../sql/SqlParserMultiStatementSelfTest.java   |  95 +
 .../cache/query/GridCacheTwoStepQuery.java |  16 +-
 .../processors/query/h2/IgniteH2Indexing.java  | 236 +++--
 .../processors/query/h2/ParsingResult.java |  77 ++-
 .../query/h2/sql/GridSqlQuerySplitter.java |   4 +-
 .../IgniteBinaryCacheQueryTestSuite.java   |   2 +
 10 files changed, 563 insertions(+), 130 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index d78e7b5..7934ca2 100644
--- 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -70,6 +70,7 @@ import 
org.apache.ignite.jdbc.thin.JdbcThinMergeStatementSkipReducerOnUpdateSelf
 import org.apache.ignite.jdbc.thin.JdbcThinMetadataPrimaryKeysSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinMetadataSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinMissingLongArrayResultsTest;
+import org.apache.ignite.jdbc.thin.JdbcThinMultiStatementSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinNoDefaultSchemaTest;
 import org.apache.ignite.jdbc.thin.JdbcThinPreparedStatementSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinResultSetSelfTest;
@@ -187,6 +188,7 @@ import org.junit.runners.Suite;
 JdbcThinDynamicIndexTransactionalPartitionedNearSelfTest.class,
 JdbcThinDynamicIndexTransactionalPartitionedSelfTest.class,
 JdbcThinDynamicIndexTransactionalReplicatedSelfTest.class,
+JdbcThinMultiStatementSelfTest.class,
 
 // New thin JDBC driver, DML tests
 JdbcThinBulkLoadAtomicPartitionedNearSelfTest.class,
diff --git 
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMultiStatementSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMultiStatementSelfTest.java
new file mode 100644
index 000..2a4a368
--- /dev/null
+++ 
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMultiStatementSelfTest.java
@@ -0,0 +1,198 @@
+/*
+ * 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.jdbc.thin;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for ddl queries that contain multiply sql statements, separated by 
";".
+ */
+public class JdbcThinMultiStatementSelfTest extends GridCommonAbstractTest {
+/** {@inheritDoc} */
+@Override public void beforeTestsStarted() throws Exception {
+
System.setProperty(IgniteSystemProperties.IGNITE_SQL_PARSER_DISABLE_H2_FALLBACK,
 "false");
+
+startGrids(2);
+}
+
+/**
+ * Setup tables.
+ */
+@Before
+public void setupTables() throws Exception {
+execute("DROP TABLE IF EXISTS TEST_TX; " +
+   

[ignite] branch master updated: IGNITE-11118: SQL: Type conversions for thin client partition pruning. This closes #6016.

2019-02-07 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 3524eb9  IGNITE-8: SQL: Type conversions for thin client partition 
pruning. This closes #6016.
3524eb9 is described below

commit 3524eb9d42bd865d28326c4f82070928c5e5fd75
Author: sanpwc 
AuthorDate: Thu Feb 7 16:46:27 2019 +0300

IGNITE-8: SQL: Type conversions for thin client partition pruning. This 
closes #6016.
---
 .../sql/optimizer/affinity/PartitionAllNode.java   |   2 +-
 ...onResolver.java => PartitionClientContext.java} |  19 +-
 .../optimizer/affinity/PartitionCompositeNode.java |  27 +-
 .../optimizer/affinity/PartitionConstantNode.java  |   2 +-
 .../optimizer/affinity/PartitionDataTypeUtils.java | 528 +
 .../sql/optimizer/affinity/PartitionGroupNode.java |  13 +-
 .../sql/optimizer/affinity/PartitionNode.java  |   4 +-
 .../sql/optimizer/affinity/PartitionNoneNode.java  |   2 +-
 .../optimizer/affinity/PartitionParameterNode.java |  36 +-
 ...onResolver.java => PartitionParameterType.java} |  45 +-
 .../sql/optimizer/affinity/PartitionResolver.java  |   1 +
 .../optimizer/affinity/PartitionSingleNode.java|  14 +-
 .../processors/query/h2/IgniteH2Indexing.java  |   6 +-
 .../query/h2/affinity/PartitionExtractor.java  |  69 ++-
 .../h2/twostep/SqlDataTypeConversionTest.java  | 372 +++
 .../IgniteBinaryCacheQueryTestSuite.java   |   5 +-
 16 files changed, 1079 insertions(+), 66 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAllNode.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAllNode.java
index c625089..cb9500d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAllNode.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAllNode.java
@@ -36,7 +36,7 @@ public class PartitionAllNode implements PartitionNode {
 }
 
 /** {@inheritDoc} */
-@Override public Collection apply(Object... args) {
+@Override public Collection apply(PartitionClientContext cliCtx, 
Object... args) {
 return null;
 }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionResolver.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionClientContext.java
similarity index 66%
copy from 
modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionResolver.java
copy to 
modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionClientContext.java
index e606200..1d7594f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionResolver.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionClientContext.java
@@ -14,23 +14,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.ignite.internal.sql.optimizer.affinity;
 
-import org.apache.ignite.IgniteCheckedException;
+import org.jetbrains.annotations.Nullable;
 
 /**
- * Partition resolver interface. Takes argument, data type and cache name, 
returns partition.
+ * Client context. Passed to partition resolver on thin clients.
  */
-public interface PartitionResolver {
+public class PartitionClientContext {
 /**
  * Resolve partition.
  *
  * @param arg Argument.
- * @param dataType Data type.
+ * @param typ Type.
  * @param cacheName Cache name.
- * @return Partition.
- * @throws IgniteCheckedException If failed.
+ * @return Partition or {@code null} if cannot be resolved.
  */
-int partition(Object arg, int dataType, String cacheName) throws 
IgniteCheckedException;
+@Nullable public Integer partition(Object arg, @Nullable 
PartitionParameterType typ, String cacheName) {
+PartitionDataTypeUtils.convert(arg, typ);
+
+// TODO: IGNITE-10308: Implement partition resolution logic.
+return null;
+}
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionCompositeNode.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionCompositeNode.java
index d724cf8..1235e6a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionCompositeNode.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionCompositeNode.java
@@ -56,14 +56,21 @@ public class PartitionCompositeNode implements 
PartitionNode {
 }
 
 /** {@inheritDoc} */
-@Override public Collection apply(Object... args) 

[ignite] branch master updated: IGNITE-11219: SQL: Fixed affinity mapper resolution for CREATE TABLE templates. This closes #6046.

2019-02-07 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 2a19e3f  IGNITE-11219: SQL: Fixed affinity mapper resolution for 
CREATE TABLE templates. This closes #6046.
2a19e3f is described below

commit 2a19e3f2789320b6b45dcd5fb91e82fd8bdcc1a1
Author: Max-Pudov 
AuthorDate: Thu Feb 7 15:36:00 2019 +0300

IGNITE-11219: SQL: Fixed affinity mapper resolution for CREATE TABLE 
templates. This closes #6046.
---
 .../binary/CacheObjectBinaryProcessorImpl.java |   7 +-
 .../processors/query/GridQueryProcessor.java   |   3 +
 .../internal/processors/query/QueryUtils.java  |  12 ++
 .../query/IgniteSqlCreateTableTemplateTest.java| 159 +
 .../IgniteBinaryCacheQueryTestSuite2.java  |   3 +
 5 files changed, 178 insertions(+), 6 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 8ac9810..5e43dd3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -948,11 +948,6 @@ public class CacheObjectBinaryProcessorImpl extends 
GridProcessorAdapter impleme
 
 AffinityKeyMapper cacheAffMapper = ccfg.getAffinityMapper();
 
-boolean customAffMapper =
-cacheAffMapper != null &&
-!(cacheAffMapper instanceof CacheDefaultBinaryAffinityKeyMapper) &&
-!(cacheAffMapper instanceof GridCacheDefaultAffinityKeyMapper);
-
 AffinityKeyMapper dfltAffMapper = binaryEnabled ?
 new 
CacheDefaultBinaryAffinityKeyMapper(ccfg.getKeyConfiguration()) :
 new GridCacheDefaultAffinityKeyMapper();
@@ -962,7 +957,7 @@ public class CacheObjectBinaryProcessorImpl extends 
GridProcessorAdapter impleme
 return new CacheObjectContext(ctx,
 ccfg.getName(),
 dfltAffMapper,
-customAffMapper,
+QueryUtils.isCustomAffinityMapper(ccfg.getAffinityMapper()),
 ccfg.isCopyOnRead(),
 storeVal,
 ctx.config().isPeerClassLoadingEnabled() && !isBinaryEnabled(ccfg),
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 94ad17d..e5f323d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1567,6 +1567,9 @@ public class GridQueryProcessor extends 
GridProcessorAdapter {
 ccfg.setSqlEscapeAll(true);
 ccfg.setQueryEntities(Collections.singleton(entity));
 
+if (!QueryUtils.isCustomAffinityMapper(ccfg.getAffinityMapper()))
+ccfg.setAffinityMapper(null);
+
 if (affinityKey != null)
 ccfg.setKeyConfiguration(new 
CacheKeyConfiguration(entity.getKeyType(), affinityKey));
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index 316cf4c..e15687e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -1396,6 +1396,18 @@ public class QueryUtils {
 }
 
 /**
+ * Checks whether affinity key mapper is custom or default.
+ *
+ * @param affinityKeyMapper Affinity key mapper.
+ * @return {@code true} if affinity key mapper is custom.
+ */
+public static boolean isCustomAffinityMapper(AffinityKeyMapper 
affinityKeyMapper) {
+return affinityKeyMapper != null &&
+!(affinityKeyMapper instanceof 
CacheDefaultBinaryAffinityKeyMapper) &&
+!(affinityKeyMapper instanceof 
GridCacheDefaultAffinityKeyMapper);
+}
+
+/**
  * Checks if given column can be removed from table using its {@link 
QueryEntity}.
  *
  * @param entity Query entity.
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java
new file mode 100644
index 000..a1b8b92
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/que

[ignite] branch master updated: IGNITE-11231: Removed unnecessary merge scan index. This closes #6042.

2019-02-06 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 10a9447  IGNITE-11231: Removed unnecessary merge scan index. This 
closes #6042.
10a9447 is described below

commit 10a9447a2a3b429c29fc2742e3cf5cbcca3cc330
Author: devozerov 
AuthorDate: Wed Feb 6 20:02:17 2019 +0300

IGNITE-11231: Removed unnecessary merge scan index. This closes #6042.
---
 .../processors/query/h2/opt/GridH2Table.java   |  4 +-
 .../opt/{GridH2ScanIndex.java => H2ScanIndex.java} | 23 ---
 ...PrimaryScanIndex.java => H2TableScanIndex.java} | 13 +++---
 .../query/h2/twostep/ReduceScanIndex.java  | 46 --
 .../processors/query/h2/twostep/ReduceTable.java   |  8 ++--
 5 files changed, 31 insertions(+), 63 deletions(-)

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 d6b4134..173e4a4 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
@@ -170,9 +170,9 @@ public class GridH2Table extends TableBase {
 
 // Add scan index at 0 which is required by H2.
 if (hasHashIndex)
-idxs.add(0, new GridH2PrimaryScanIndex(this, index(1), index(0)));
+idxs.add(0, new H2TableScanIndex(this, index(1), index(0)));
 else
-idxs.add(0, new GridH2PrimaryScanIndex(this, index(0), null));
+idxs.add(0, new H2TableScanIndex(this, index(0), null));
 
 pkIndexPos = hasHashIndex ? 2 : 1;
 
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ScanIndex.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/H2ScanIndex.java
similarity index 89%
rename from 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ScanIndex.java
rename to 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/H2ScanIndex.java
index b3d3952..bf27132 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ScanIndex.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/H2ScanIndex.java
@@ -18,6 +18,8 @@
 package org.apache.ignite.internal.processors.query.h2.opt;
 
 import java.util.ArrayList;
+import java.util.HashSet;
+
 import org.h2.engine.Database;
 import org.h2.engine.DbObject;
 import org.h2.engine.Session;
@@ -28,6 +30,7 @@ import org.h2.index.IndexType;
 import org.h2.message.DbException;
 import org.h2.result.Row;
 import org.h2.result.SearchRow;
+import org.h2.result.SortOrder;
 import org.h2.schema.Schema;
 import org.h2.table.Column;
 import org.h2.table.IndexColumn;
@@ -35,19 +38,21 @@ import org.h2.table.Table;
 import org.h2.table.TableFilter;
 
 /**
- * Scan index base class.
+ * Scan index. Do not actually store any information, but rather delegate to 
some underlying index. The only reason
+ * why this index exists is H2 requirement that every table must have the very 
first index with
+ * {@link IndexType#isScan} set to {@code true}. See {@link #TYPE}.
  */
-public abstract class GridH2ScanIndex extends BaseIndex {
-/** */
+public class H2ScanIndex extends BaseIndex {
+/** Type of this index. */
 private static final IndexType TYPE = IndexType.createScan(false);
 
-/** */
+/** Underlying index. */
 private final D delegate;
 
 /**
  * @param delegate Delegate.
  */
-public GridH2ScanIndex(D delegate) {
+public H2ScanIndex(D delegate) {
 this.delegate = delegate;
 }
 
@@ -277,4 +282,12 @@ public abstract class GridH2ScanIndex 
extends BaseIndex {
 @Override public void setTemporary(boolean temporary) {
 throw DbException.getUnsupportedException("temporary");
 }
+
+/** {@inheritDoc} */
+@Override public double getCost(Session session, int[] masks, 
TableFilter[] filters, int filter,
+SortOrder sortOrder, HashSet allColumnsSet) {
+long rows = getRowCountApproximation();
+
+return getCostRangeIndex(masks, rows, filters, filter, sortOrder, 
true, allColumnsSet);
+}
 }
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2PrimaryScanIndex.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/H2TableScanIndex.java
similarity index 83%
rename from 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2PrimaryScanIndex.java
rename to 
modules/indexing/src/main

[ignite] branch master updated: IGNITE-11180: SQL: Proper naming for map- and reduce- related classes. This closes #6008.

2019-02-06 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 731f740  IGNITE-11180: SQL: Proper naming for map- and reduce- related 
classes. This closes #6008.
731f740 is described below

commit 731f74028d3cfc881f3da2fc46c0500a37d80074
Author: devozerov 
AuthorDate: Wed Feb 6 13:00:39 2019 +0300

IGNITE-11180: SQL: Proper naming for map- and reduce- related classes. This 
closes #6008.
---
 .../processors/query/h2/database/H2Tree.java   |   5 +-
 .../DmlDistributedUpdateRun.java}  |  14 +-
 .../processors/query/h2/opt/GridH2ProxyIndex.java  |  50 +-
 .../query/h2/opt/GridH2RowDescriptor.java  |   3 +-
 .../h2/opt/join/ProxyDistributedLookupBatch.java   |  76 +
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  85 --
 .../query/h2/twostep/ReduceBlockList.java  | 103 
 .../{GridMergeIndex.java => ReduceIndex.java}  | 180 -
 ...IndexIterator.java => ReduceIndexIterator.java} |  16 +-
 ...ergeIndexSorted.java => ReduceIndexSorted.java} |  20 +--
 ...IndexUnsorted.java => ReduceIndexUnsorted.java} |  14 +-
 .../query/h2/twostep/ReducePartitionMapper.java|   4 +-
 .../query/h2/twostep/ReduceQueryRun.java   |  12 +-
 .../{GridResultPage.java => ReduceResultPage.java} |  25 +--
 .../query/h2/twostep/ReduceScanIndex.java  |  46 ++
 .../query/h2/twostep/ReduceSourceKey.java  |  60 +++
 .../{GridMergeTable.java => ReduceTable.java}  |  41 ++---
 .../query/h2/twostep/ReduceTableEngine.java|  78 +
 ...readLocalTable.java => ReduceTableWrapper.java} |  46 +-
 .../query/IgniteSqlSplitterSelfTest.java   |   6 +-
 ...neOrSinglePartitionsQueryOptimizationsTest.java |   2 +-
 21 files changed, 508 insertions(+), 378 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
index a3d865c..53e2af1 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
@@ -48,6 +48,7 @@ import 
org.apache.ignite.internal.processors.query.h2.opt.H2CacheRow;
 import org.apache.ignite.internal.stat.IoStatisticsHolder;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.h2.result.SearchRow;
 import org.h2.table.IndexColumn;
 import org.h2.value.Value;
 import org.jetbrains.annotations.Nullable;
@@ -396,7 +397,7 @@ public class H2Tree extends BPlusTree {
 
 inlineSizeRecomendation(row);
 
-org.h2.result.SearchRow rowData = getRow(io, pageAddr, idx);
+SearchRow rowData = getRow(io, pageAddr, idx);
 
 for (int i = lastIdxUsed, len = cols.length; i < len; i++) {
 IndexColumn col = cols[i];
@@ -500,7 +501,7 @@ public class H2Tree extends BPlusTree {
  * @param row Grid H2 row related to given inline indexes.
  */
 @SuppressWarnings({"ConditionalBreakInInfiniteLoop", "IfMayBeConditional"})
-private void inlineSizeRecomendation(org.h2.result.SearchRow row) {
+private void inlineSizeRecomendation(SearchRow row) {
 //Do the check only for put operations.
 if(!(row instanceof H2CacheRow))
 return;
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/DistributedUpdateRun.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlDistributedUpdateRun.java
similarity index 90%
rename from 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/DistributedUpdateRun.java
rename to 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlDistributedUpdateRun.java
index 9e7b9ae..9982141 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/DistributedUpdateRun.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlDistributedUpdateRun.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.h2.twostep;
+package org.apache.ignite.internal.processors.query.h2.dml;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -31,7 +31,7 @@ import org.apache.ignite.internal.util.typedef.F;
 /**
  * Context for DML operation on reducer node.
  */
-class DistributedUpdateRun {
+public class DmlDistributedUpdateRun {
 /** Expected number of responses. */
 private fi

[ignite] branch master updated: IGNITE-11202: SQL: Moved partition reservation logic out of GridMapQueryExecutor to allow for it's reuse in future. This closes #6023.

2019-02-05 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 299f557  IGNITE-11202: SQL: Moved partition reservation logic out of 
GridMapQueryExecutor to allow for it's reuse in future. This closes #6023.
299f557 is described below

commit 299f557d9b0b7cbc4f7584d28be302056c6fb46c
Author: devozerov 
AuthorDate: Tue Feb 5 17:58:46 2019 +0300

IGNITE-11202: SQL: Moved partition reservation logic out of 
GridMapQueryExecutor to allow for it's reuse in future. This closes #6023.
---
 .../processors/query/h2/IgniteH2Indexing.java  |  15 +-
 .../processors/query/h2/opt/QueryContext.java  |  17 +-
 .../query/h2/twostep/GridMapQueryExecutor.java | 298 ++-
 .../query/h2/twostep/MapReplicatedReservation.java |  38 ---
 .../query/h2/twostep/PartitionReservation.java |  92 ++
 ...vationKey.java => PartitionReservationKey.java} |   8 +-
 .../h2/twostep/PartitionReservationManager.java| 319 +
 .../h2/twostep/RetryCauseMessageSelfTest.java  |  34 ++-
 8 files changed, 482 insertions(+), 339 deletions(-)

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 d3aeedc..9ee056f 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
@@ -96,6 +96,7 @@ import 
org.apache.ignite.internal.processors.query.h2.affinity.PartitionExtracto
 import 
org.apache.ignite.internal.processors.query.h2.affinity.H2PartitionResolver;
 import org.apache.ignite.internal.processors.query.h2.opt.QueryContext;
 import org.apache.ignite.internal.processors.query.h2.opt.QueryContextRegistry;
+import 
org.apache.ignite.internal.processors.query.h2.twostep.PartitionReservationManager;
 import org.apache.ignite.internal.sql.optimizer.affinity.PartitionResult;
 import 
org.apache.ignite.internal.processors.query.h2.database.H2TreeClientIndex;
 import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
@@ -253,6 +254,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 /** */
 private DdlStatementsProcessor ddlProc;
 
+/** Partition reservation manager. */
+private PartitionReservationManager partReservationMgr;
+
 /** Partition extractor. */
 private PartitionExtractor partExtractor;
 
@@ -2400,6 +2404,8 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 
 this.ctx = ctx;
 
+partReservationMgr = new PartitionReservationManager(ctx);
+
 connMgr = new ConnectionManager(ctx);
 
 schemaMgr = new SchemaManager(ctx, connMgr);
@@ -2607,7 +2613,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 
 String cacheName = cacheInfo.name();
 
-mapQryExec.onCacheStop(cacheName);
+partReservationMgr.onCacheStop(cacheName);
 dmlProc.onCacheStop(cacheName);
 
 // Drop schema (needs to be called after callback to DML processor 
because the latter depends on schema).
@@ -2747,6 +2753,13 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 }
 
 /**
+ * @return Partition reservation manager.
+ */
+public PartitionReservationManager partitionReservationManager() {
+return partReservationMgr;
+}
+
+/**
  * Collect cache identifiers from two-step query.
  *
  * @param mainCacheId Id of main cache.
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/QueryContext.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/QueryContext.java
index e66ec7f..ca0c940 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/QueryContext.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/QueryContext.java
@@ -17,17 +17,14 @@
 
 package org.apache.ignite.internal.processors.query.h2.opt;
 
-import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable;
 import org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot;
 import 
org.apache.ignite.internal.processors.query.h2.opt.join.DistributedJoinContext;
 import 
org.apache.ignite.internal.processors.query.h2.twostep.MapQueryLazyWorker;
-import org.apache.ignite.internal.util.typedef.F;
+import 
org.apache.ignite.internal.processors.query.h2.twostep.PartitionReservation;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.spi.indexing.IndexingQueryFilter;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.L

[ignite] branch master updated: IGNITE-11200: SQL: reworked GridH2QueryContext. Now it is not static and thread-local and shared operations are well-separated. This closes #6020.

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 693a6e88 IGNITE-11200: SQL: reworked GridH2QueryContext. Now it is not 
static and thread-local and shared operations are well-separated. This closes 
#6020.
693a6e88 is described below

commit 693a6e88e28ac4d8ee44824e77b522e31cb0edfd
Author: devozerov 
AuthorDate: Tue Feb 5 10:36:29 2019 +0300

IGNITE-11200: SQL: reworked GridH2QueryContext. Now it is not static and 
thread-local and shared operations are well-separated. This closes #6020.
---
 .../query/h2/opt/GridH2SpatialIndex.java   |   5 +-
 .../processors/query/h2/IgniteH2Indexing.java  |  54 ++--
 .../query/h2/database/H2PkHashIndex.java   |  12 +-
 .../query/h2/database/H2TreeClientIndex.java   |   2 +
 .../processors/query/h2/database/H2TreeIndex.java  |  40 +--
 .../query/h2/database/H2TreeIndexBase.java |  10 +
 .../processors/query/h2/opt/GridH2IndexBase.java   |  28 +-
 .../query/h2/opt/GridH2QueryContext.java   | 303 -
 .../processors/query/h2/opt/GridH2QueryType.java   |  44 ---
 .../processors/query/h2/opt/QueryContext.java  | 141 ++
 .../processors/query/h2/opt/QueryContextKey.java   |  40 +--
 .../query/h2/opt/QueryContextRegistry.java | 150 ++
 .../query/h2/opt/join/DistributedJoinContext.java  |   2 +-
 .../query/h2/opt/join/DistributedLookupBatch.java  |  13 +-
 .../query/h2/twostep/GridMapQueryExecutor.java |  54 ++--
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  23 +-
 .../query/h2/twostep/MapQueryLazyWorker.java   |  14 +-
 17 files changed, 461 insertions(+), 474 deletions(-)

diff --git 
a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
 
b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
index f2f0b01..efd7899 100644
--- 
a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
+++ 
b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
@@ -105,6 +105,8 @@ public class GridH2SpatialIndex extends GridH2IndexBase 
implements SpatialIndex
  */
 @SuppressWarnings("unchecked")
 public GridH2SpatialIndex(GridH2Table tbl, String idxName, int 
segmentsCnt, IndexColumn... cols) {
+super(tbl);
+
 if (cols.length > 1)
 throw DbException.getUnsupportedException("can only do one 
column");
 
@@ -349,7 +351,8 @@ public class GridH2SpatialIndex extends GridH2IndexBase 
implements SpatialIndex
 long time = System.currentTimeMillis();
 
 IndexingQueryFilter qryFilter = null;
-GridH2QueryContext qctx = GridH2QueryContext.get();
+
+QueryContext qctx = queryContextRegistry().getThreadLocal();
 
 if (qctx != null)
 qryFilter = qctx.filter();
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 5b83088..d3aeedc 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
@@ -94,6 +94,8 @@ import 
org.apache.ignite.internal.processors.query.SqlClientContext;
 import org.apache.ignite.internal.processors.query.UpdateSourceIterator;
 import 
org.apache.ignite.internal.processors.query.h2.affinity.PartitionExtractor;
 import 
org.apache.ignite.internal.processors.query.h2.affinity.H2PartitionResolver;
+import org.apache.ignite.internal.processors.query.h2.opt.QueryContext;
+import org.apache.ignite.internal.processors.query.h2.opt.QueryContextRegistry;
 import org.apache.ignite.internal.sql.optimizer.affinity.PartitionResult;
 import 
org.apache.ignite.internal.processors.query.h2.database.H2TreeClientIndex;
 import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
@@ -107,7 +109,6 @@ import 
org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor
 import org.apache.ignite.internal.processors.query.h2.dml.DmlUtils;
 import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
-import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
 import org.apache.ignite.internal.processors.query.h2.sql.GridSqlAlias;
 import org.apache.ignite.internal.processors.query.h2.sql.GridSqlAst;
@@ -181,7 

[ignite] branch master updated: IGNITE-11185: SQL: moved index distributed join logic to H2TreeIndex. Minor changes to collocation model. This closes #6012.

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 7b61c32  IGNITE-11185: SQL: moved index distributed join logic to 
H2TreeIndex. Minor changes to collocation model. This closes #6012.
7b61c32 is described below

commit 7b61c32a1c5ab443b315d5a87fec43d19b39e6fc
Author: devozerov 
AuthorDate: Mon Feb 4 16:32:52 2019 +0300

IGNITE-11185: SQL: moved index distributed join logic to H2TreeIndex. Minor 
changes to collocation model. This closes #6012.
---
 .../query/h2/opt/GridH2SpatialIndex.java   |   8 +-
 .../internal/processors/query/h2/H2Utils.java  |  15 +
 .../query/h2/database/H2PkHashIndex.java   |   3 +-
 .../query/h2/database/H2TreeClientIndex.java   |  49 +--
 .../processors/query/h2/database/H2TreeIndex.java  | 423 ++--
 .../processors/query/h2/opt/GridH2IndexBase.java   | 443 +
 .../query/h2/opt/join/BroadcastCursor.java |   4 +-
 .../query/h2/opt/join/CollocationModel.java| 219 --
 .../h2/opt/join/CollocationModelAffinity.java  |  32 ++
 .../h2/opt/join/CollocationModelMultiplier.java|  54 +++
 .../query/h2/opt/join/CollocationModelType.java|  75 
 .../query/h2/opt/join/DistributedLookupBatch.java  |  17 +-
 .../processors/query/h2/opt/join/RangeSource.java  |   6 +-
 .../processors/query/h2/opt/join/RangeStream.java  |   6 +-
 .../query/h2/twostep/GridMergeIndexSorted.java |   4 +-
 .../query/h2/twostep/GridReduceQueryExecutor.java  |   3 +-
 16 files changed, 709 insertions(+), 652 deletions(-)

diff --git 
a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
 
b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
index 4af31fb..f2f0b01 100644
--- 
a/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
+++ 
b/modules/geospatial/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2SpatialIndex.java
@@ -27,6 +27,7 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.processors.query.h2.H2Cursor;
 import org.apache.ignite.internal.processors.query.h2.H2Utils;
@@ -60,6 +61,9 @@ import org.locationtech.jts.geom.Geometry;
  */
 @SuppressWarnings("unused"/*reflection*/)
 public class GridH2SpatialIndex extends GridH2IndexBase implements 
SpatialIndex {
+/** Cache context. */
+private final GridCacheContext ctx;
+
 /** */
 private final ReadWriteLock lock = new ReentrantReadWriteLock();
 
@@ -173,7 +177,7 @@ public class GridH2SpatialIndex extends GridH2IndexBase 
implements SpatialIndex
 
 assert key != null;
 
-final int seg = segmentForRow(row);
+final int seg = segmentForRow(ctx, row);
 
 Long rowId = keyToId.get(key);
 
@@ -249,7 +253,7 @@ public class GridH2SpatialIndex extends GridH2IndexBase 
implements SpatialIndex
 
 assert oldRow != null;
 
-final int seg = segmentForRow(row);
+final int seg = segmentForRow(ctx, row);
 
 if (!segments[seg].remove(getEnvelope(row, rowId), rowId))
 throw DbException.throwInternalError("row not found");
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
index 7078b43..684ecf7 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
@@ -32,6 +32,7 @@ import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -728,4 +729,18 @@ public class H2Utils {
 return prepared(s);
 }
 }
+
+/**
+ * @param arr Array.
+ * @param off Offset.
+ * @param cmp Comparator.
+ */
+public static  void bubbleUp(Z[] arr, int off, Comparator cmp) {
+for (int i = off, last = arr.length - 1; i < last; i++) {
+if (cmp.compare(arr[i], arr[i + 1]) <= 0)
+break;
+
+U.swap(arr, i, i + 1);
+}
+}
 }
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/d

[ignite] branch col_model deleted (was 9dfda73)

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git.


 was 9dfda73  WIP.

This change permanently discards the following revisions:

 discard 9dfda73  WIP.
 discard 37ba8a6  Minors.
 discard 3c5c42b  Merge with master.
 discard 353fe53  Merge branch 'master' into col_model
 discard 896bc23  Merge branch 'master' into col_model
 discard 3b21ea7  Moved.
 discard 9039d6a  Minors.
 discard 160e04c  Converted multiplier to enum.



[ignite] 07/08: Minors.

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 37ba8a68afd9d9db1a2d5915ddc0d812965eea56
Author: devozerov 
AuthorDate: Mon Feb 4 11:13:03 2019 +0300

Minors.
---
 .../internal/processors/query/h2/opt/GridH2IndexBase.java   | 13 ++---
 .../query/h2/twostep/GridReduceQueryExecutor.java   |  3 ++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 4c1757e..fa09e69 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -297,14 +297,21 @@ public abstract class GridH2IndexBase extends BaseIndex {
  * @param msg Message.
  */
 public void send(Collection nodes, Message msg) {
-if (!getTable().rowDescriptor().indexing().send(msgTopic,
+boolean res = getTable().rowDescriptor().indexing().send(msgTopic,
 -1,
 nodes,
 msg,
 null,
-locNodeHnd,
+new CIX2() {
+@Override public void applyx(ClusterNode clusterNode, Message 
msg) {
+onMessage0(clusterNode.id(), msg);
+}
+},
 GridIoPolicy.IDX_POOL,
-false))
+false
+);
+
+if (!res)
 throw H2Utils.retryException("Failed to send message to nodes: " + 
nodes);
 }
 
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 8097800..fdfb44c 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
@@ -1209,7 +1209,8 @@ public class GridReduceQueryExecutor {
 specialize,
 locNodeHnd,
 GridIoPolicy.QUERY_POOL,
-runLocParallel);
+runLocParallel
+);
 }
 
 /**



[ignite] branch col_model created (now 9dfda73)

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git.


  at 9dfda73  WIP.

This branch includes the following new commits:

 new 160e04c  Converted multiplier to enum.
 new 9039d6a  Minors.
 new 3b21ea7  Moved.
 new 896bc23  Merge branch 'master' into col_model
 new 353fe53  Merge branch 'master' into col_model
 new 3c5c42b  Merge with master.
 new 37ba8a6  Minors.
 new 9dfda73  WIP.

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[ignite] 08/08: WIP.

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 9dfda733fbc7523ff6c653dbf802013cf2dbdbac
Author: devozerov 
AuthorDate: Mon Feb 4 11:16:33 2019 +0300

WIP.
---
 .../internal/processors/query/h2/H2Utils.java  | 15 +++
 .../processors/query/h2/opt/GridH2IndexBase.java   | 22 --
 .../query/h2/opt/join/BroadcastCursor.java |  3 ++-
 .../query/h2/twostep/GridMergeIndexSorted.java |  4 ++--
 4 files changed, 19 insertions(+), 25 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
index 7078b43..684ecf7 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/H2Utils.java
@@ -32,6 +32,7 @@ import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -728,4 +729,18 @@ public class H2Utils {
 return prepared(s);
 }
 }
+
+/**
+ * @param arr Array.
+ * @param off Offset.
+ * @param cmp Comparator.
+ */
+public static  void bubbleUp(Z[] arr, int off, Comparator cmp) {
+for (int i = off, last = arr.length - 1; i < last; i++) {
+if (cmp.compare(arr[i], arr[i + 1]) <= 0)
+break;
+
+U.swap(arr, i, i + 1);
+}
+}
 }
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index fa09e69..46258b0 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -67,7 +67,6 @@ import org.h2.value.Value;
 import javax.cache.CacheException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -97,12 +96,6 @@ public abstract class GridH2IndexBase extends BaseIndex {
 private IgniteLogger log;
 
 /** */
-private final CIX2 locNodeHnd = new 
CIX2() {
-@Override public void applyx(ClusterNode clusterNode, Message msg) {
-onMessage0(clusterNode.id(), msg);
-}
-};
-
 protected GridCacheContext ctx;
 
 /**
@@ -527,21 +520,6 @@ public abstract class GridH2IndexBase extends BaseIndex {
 }
 
 /**
- * @param arr Array.
- * @param off Offset.
- * @param cmp Comparator.
- */
-public static  void bubbleUp(Z[] arr, int off, Comparator cmp) {
-// TODO Optimize: use binary search if the range in array is big.
-for (int i = off, last = arr.length - 1; i < last; i++) {
-if (cmp.compare(arr[i], arr[i + 1]) <= 0)
-break;
-
-U.swap(arr, i, i + 1);
-}
-}
-
-/**
  * @return Index segments count.
  */
 public abstract int segmentsCount();
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/BroadcastCursor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/BroadcastCursor.java
index 632d72a..9d12028 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/BroadcastCursor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/BroadcastCursor.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.h2.opt.join;
 
+import org.apache.ignite.internal.processors.query.h2.H2Utils;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
 import org.h2.index.Cursor;
 import org.h2.result.Row;
@@ -122,7 +123,7 @@ public class BroadcastCursor implements Cursor, 
Comparator {
 }
 
 // Bubble up current min stream with respect to fetched row to achieve 
correct sort order of streams.
-GridH2IndexBase.bubbleUp(streams, off, this);
+H2Utils.bubbleUp(streams, off, this);
 
 return true;
 }
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexSorted.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndexSorted.java
index 880e305..482752a 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeInde

[ignite] 04/08: Merge branch 'master' into col_model

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 896bc2303b46282bc58ad88ef88843f5ccb6a6e8
Merge: 3b21ea7 ef04782
Author: devozerov 
AuthorDate: Mon Feb 4 11:04:07 2019 +0300

Merge branch 'master' into col_model

 .../ParametricVectorGeneratorExample.java  |  65 
 .../util/generators/StandardGeneratorsExample.java |  75 +
 .../generators/VectorGeneratorFamilyExample.java   |  65 
 .../VectorGeneratorPrimitivesExample.java  |  97 +++
 .../examples/ml/util/generators/package-info.java  |  17 +-
 .../processors/cache/GridCacheProcessor.java   |   8 +-
 .../processors/cache/mvcc/MvccProcessor.java   |  12 ++
 .../processors/cache/mvcc/MvccProcessorImpl.java   |  32 +++-
 .../GridCacheDatabaseSharedManager.java|  21 ++-
 .../processors/cache/CacheMetricsManageTest.java   |   2 +-
 .../cache/CacheNearReaderUpdateTest.java   |   2 +-
 .../cache/CacheNoAffinityExchangeTest.java |   2 +-
 .../processors/cache/CacheRebalancingSelfTest.java |   2 +-
 .../cache/GridCacheBasicApiAbstractTest.java   |  30 ++--
 .../cache/GridCacheEntryMemorySizeSelfTest.java|   4 +-
 ...CacheInterceptorTransactionalRebalanceTest.java |   2 +-
 .../cache/GridCachePartitionedGetSelfTest.java |   2 +-
 .../cache/GridCachePartitionedWritesTest.java  |   2 +-
 .../GridCachePreloadingEvictionsSelfTest.java  |   2 +-
 .../cache/GridCacheReferenceCleanupSelfTest.java   |  13 +-
 .../cache/GridCacheTtlManagerEvictionSelfTest.java |   4 +-
 .../GridCacheValueConsistencyAbstractSelfTest.java |   4 +-
 ...IgniteCacheInvokeReadThroughSingleNodeTest.java |   5 +-
 .../cache/IgniteCacheInvokeReadThroughTest.java|   5 +-
 .../IgniteCacheReadThroughEvictionSelfTest.java|  21 ++-
 .../cache/IgniteClusterActivateDeactivateTest.java |   6 -
 ...teDynamicCacheStartFailWithPersistenceTest.java |   7 -
 .../cache/WalModeChangeAbstractSelfTest.java   |   4 +-
 .../cache/WalModeChangeAdvancedSelfTest.java   |   4 -
 .../CacheDataLossOnPartitionMoveTest.java  |   4 -
 .../CacheLoadingConcurrentGridStartSelfTest.java   |   2 +-
 .../distributed/CacheLockReleaseNodeLeaveTest.java |   2 +-
 .../distributed/CacheTryLockMultithreadedTest.java |   2 +-
 .../GridCacheAbstractPrimarySyncSelfTest.java  |   2 +-
 .../distributed/GridCacheBasicOpAbstractTest.java  |   4 +-
 .../GridCacheMultiNodeAbstractTest.java|   6 +-
 .../GridCacheMultiNodeLockAbstractTest.java|   4 +-
 .../GridCacheNodeFailureAbstractTest.java  |   2 +-
 .../GridCachePartitionNotLoadedEventSelfTest.java  |   2 +-
 .../GridCachePreloadEventsAbstractSelfTest.java|   2 +-
 .../GridCachePreloadRestartAbstractSelfTest.java   |   2 +-
 .../IgniteCacheClientNodeChangingTopologyTest.java |   2 +-
 .../IgniteTxRemoveTimeoutObjectsTest.java  |   2 +-
 .../distributed/dht/GridCacheDhtEntrySelfTest.java |   2 +-
 .../dht/GridCacheDhtMappingSelfTest.java   |   2 +-
 .../dht/GridCacheDhtPreloadDisabledSelfTest.java   |   2 +-
 .../GridCacheDhtPreloadMultiThreadedSelfTest.java  |   2 +-
 .../near/GridCacheNearMetricsSelfTest.java |   2 +-
 .../near/GridCacheNearOnlyTopologySelfTest.java|   2 +-
 .../GridCacheNearPartitionedClearSelfTest.java |   2 +-
 .../near/GridCacheNearReaderPreloadSelfTest.java   |   2 +-
 .../near/GridCacheNearReadersSelfTest.java |   2 +-
 .../near/GridCachePartitionedEventSelfTest.java|   2 +-
 ...PartitionedExplicitLockNodeFailureSelfTest.java |   2 +-
 .../GridCachePartitionedHitsAndMissesSelfTest.java |   2 +-
 .../GridCachePartitionedLoadCacheSelfTest.java |   2 +-
 .../near/GridNearCacheStoreUpdateTest.java |   4 +-
 ...dCacheRebalancingWithAsyncClearingMvccTest.java |   6 +-
 .../GridCacheReplicatedPreloadSelfTest.java|   4 +-
 .../cache/eviction/DhtAndNearEvictionTest.java |   2 +-
 .../GridCacheEmptyEntriesLocalSelfTest.java|   4 +-
 .../GridCacheEmptyEntriesPartitionedSelfTest.java  |   2 +-
 .../eviction/GridCacheEvictionFilterSelfTest.java  |   4 +-
 .../local/GridCacheDaemonNodeLocalSelfTest.java|   2 +-
 .../local/GridCacheLocalIsolatedNodesSelfTest.java |   2 +-
 .../cache/mvcc/CacheMvccAbstractTest.java  |   6 +
 .../processors/cache/mvcc/CacheMvccVacuumTest.java | 184 -
 ...tePdsContinuousRestartTestWithExpiryPolicy.java |   2 +-
 .../IgnitePdsPartitionFilesDestroyTest.java|   4 -
 ...gniteRebalanceScheduleResendPartitionsTest.java |   4 -
 ...ocalWalModeChangeDuringRebalancingSelfTest.java |  13 --
 ...NoChangeDuringRebalanceOnNonNodeAssignTest.java |   6 +-
 ...itePdsPageEvictionDuringPartitionClearTest.java |   4 -
 ...gnitePdsRebalancingOnNotStableTopologyTest.java |   4 -
 .../cache/persistence/db/IgnitePdsWithTtlTest.java |   2 +-
 .../persistence/db

[ignite] 05/08: Merge branch 'master' into col_model

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 353fe5307b31f652aea43b05e118075d76091e47
Merge: 896bc23 1602cc7
Author: devozerov 
AuthorDate: Mon Feb 4 11:05:53 2019 +0300

Merge branch 'master' into col_model

# Conflicts:
#   
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
#   
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java

 .../testframework/util/MavenUtils.java |  22 +-
 .../transactions/PlatformTransactions.java |   2 +
 .../processors/database/BPlusTreeSelfTest.java |  28 +-
 .../processors/query/h2/IgniteH2Indexing.java  |  48 +-
 .../processors/query/h2/opt/GridH2IndexBase.java   |  52 +--
 .../query/h2/opt/GridH2QueryContext.java   | 290 +---
 .../processors/query/h2/opt/GridH2QueryType.java   |   7 +-
 .../query/h2/opt/join/CollocationModel.java|  70 ++-
 .../query/h2/opt/join/DistributedJoinContext.java  | 263 +++
 .../query/h2/opt/join/DistributedJoinMode.java |  51 ---
 .../query/h2/opt/join/DistributedLookupBatch.java  |  64 +--
 .../processors/query/h2/opt/join/RangeStream.java  |  13 +-
 .../query/h2/sql/GridSqlQuerySplitter.java |  43 ++
 .../processors/query/h2/sql/SplitterContext.java   |  85 
 .../query/h2/twostep/GridMapQueryExecutor.java | 118 +++--
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  13 +-
 .../persistence/db/IgniteTcBotInitNewPageTest.java |  13 +-
 .../Cache/CacheTimeoutOnPmeTransactionalTest.cs| 108 +++--
 .../Apache.Ignite.Core/IgniteConfiguration.cs  |   2 +-
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs   |   2 +-
 .../Impl/Transactions/Transaction.cs   |   6 +
 .../Impl/Transactions/TransactionImpl.cs   |  15 +-
 .../Impl/Transactions/TransactionsImpl.cs  |  14 +-
 .../Transactions/ITransaction.cs   |   8 +
 modules/web-console/frontend/app/app.d.ts  |   2 +-
 modules/web-console/frontend/app/app.js| 498 ++---
 .../components/form-field-size/controller.ts   |  23 +-
 .../form-field/igniteFormField.directive.ts|  76 
 .../frontend/app/components/form-field/index.js|   2 +
 .../frontend/app/components/page-admin/index.js|   2 +-
 .../components/cache-edit-form/index.js|  21 -
 .../components/cluster-edit-form/index.js  |  21 -
 .../components/model-edit-form/index.js|  21 -
 .../page-configure/components/pcValidation.ts  | 197 
 .../app/components/page-configure/index.d.ts   | 154 ---
 .../components/page-configure/types/uirouter.d.ts  |  20 -
 .../ignite-information}/information.directive.js   |   0
 .../components/ignite-information}/information.pug |   0
 .../ignite-information}/information.scss   |   0
 .../components/queries-notebook/index.js   |   2 +
 .../frontend/app/components/page-queries/index.ts  |   2 +-
 .../button-download-project/component.ts}  |   9 +-
 .../components/button-download-project/index.ts}   |   0
 .../button-download-project/template.pug   |   0
 .../components/button-import-models/component.ts}  |  11 +-
 .../components/button-import-models/index.ts}  |   4 +-
 .../components/button-import-models/style.scss |   0
 .../components/button-import-models/template.pug   |   0
 .../button-preview-project/component.ts}   |   9 +-
 .../components/button-preview-project/index.ts}|   4 +-
 .../components/button-preview-project/template.pug |   0
 .../components/fakeUICanExit.spec.js   |   0
 .../components/fakeUICanExit.ts}   |  15 +-
 .../components/formUICanExitGuard.ts}  |   9 +-
 .../components/modal-import-models/component.js|   6 +-
 .../components/modal-import-models/index.ts}   |   0
 .../selected-items-amount-indicator/component.ts}  |   0
 .../selected-items-amount-indicator/style.scss |   1 -
 .../selected-items-amount-indicator/template.pug   |   0
 .../components/modal-import-models/service.ts} |  21 +-
 .../step-indicator/component.ts}   |   8 +-
 .../modal-import-models/step-indicator/style.scss  |   1 -
 .../step-indicator/template.pug|   0
 .../components/modal-import-models/style.scss  |   0
 .../tables-action-cell/component.ts}   |  13 +-
 .../tables-action-cell/style.scss  |   0
 .../tables-action-cell/template.pug|   0
 .../modal-import-models/template.tpl.pug   |   1 +
 .../components/modal-preview-project/component.ts} |   0
 .../modal-preview-project/controller.ts}   |  33 +-
 .../components/modal-preview-project/index.ts} |   0
 .../components/modal-preview-project/service.ts}   |  18

[ignite] 03/08: Moved.

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 3b21ea72cbfc56645d3b1f23bd06ddf71bd360d8
Author: devozerov 
AuthorDate: Fri Feb 1 18:17:35 2019 +0300

Moved.
---
 .../query/h2/opt/join/CollocationModel.java| 151 +++--
 .../h2/opt/join/CollocationModelAffinity.java  |  32 +
 .../query/h2/opt/join/CollocationModelType.java|  83 +++
 3 files changed, 162 insertions(+), 104 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index 6b4dcb7..c3c2412 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@ -46,6 +46,9 @@ import org.h2.table.TableView;
  * Collocation model for a query.
  */
 public final class CollocationModel {
+/** Empty filter array. */
+private static final TableFilter[] EMPTY_FILTERS = new TableFilter[0];
+
 /** */
 private final CollocationModel upper;
 
@@ -59,7 +62,7 @@ public final class CollocationModel {
 private CollocationModelMultiplier multiplier;
 
 /** */
-private Type type;
+private CollocationModelType type;
 
 /** */
 private CollocationModel[] children;
@@ -245,7 +248,7 @@ public final class CollocationModel {
 for (int i = 0; i < childFilters.length; i++) {
 CollocationModel child = child(i, true);
 
-Type t = child.type(true);
+CollocationModelType t = child.type(true);
 
 if (child.multiplier == 
CollocationModelMultiplier.REPLICATED_NOT_LAST)
 maxMultiplier = child.multiplier;
@@ -268,7 +271,7 @@ public final class CollocationModel {
 }
 }
 
-type = Type.of(partitioned, collocated);
+type = CollocationModelType.of(partitioned, collocated);
 multiplier = maxMultiplier;
 }
 else {
@@ -280,7 +283,7 @@ public final class CollocationModel {
 
 // Only partitioned tables will do distributed joins.
 if (!(tbl instanceof GridH2Table) || 
!((GridH2Table)tbl).isPartitioned()) {
-type = Type.REPLICATED;
+type = CollocationModelType.REPLICATED;
 multiplier = CollocationModelMultiplier.COLLOCATED;
 
 return;
@@ -289,8 +292,8 @@ public final class CollocationModel {
 // If we are the first partitioned table in a join, then we are 
"base" for all the rest partitioned tables
 // which will need to get remote result (if there is no affinity 
condition). Since this query is broadcasted
 // to all the affinity nodes the "base" does not need to get 
remote results.
-if (!upper.findPartitionedTableBefore(filter)) {
-type = Type.PARTITIONED_COLLOCATED;
+if (!upper.isPartitionedTableBeforeExists(filter)) {
+type = CollocationModelType.PARTITIONED_COLLOCATED;
 multiplier = CollocationModelMultiplier.COLLOCATED;
 }
 else {
@@ -298,19 +301,19 @@ public final class CollocationModel {
 // collocated. If we at least have affinity key condition, 
then we do unicast which is cheaper.
 switch (upper.joinedWithCollocated(filter)) {
 case COLLOCATED_JOIN:
-type = Type.PARTITIONED_COLLOCATED;
+type = CollocationModelType.PARTITIONED_COLLOCATED;
 multiplier = CollocationModelMultiplier.COLLOCATED;
 
 break;
 
 case HAS_AFFINITY_CONDITION:
-type = Type.PARTITIONED_NOT_COLLOCATED;
+type = CollocationModelType.PARTITIONED_NOT_COLLOCATED;
 multiplier = CollocationModelMultiplier.UNICAST;
 
 break;
 
 case NONE:
-type = Type.PARTITIONED_NOT_COLLOCATED;
+type = CollocationModelType.PARTITIONED_NOT_COLLOCATED;
 multiplier = CollocationModelMultiplier.BROADCAST;
 
 break;
@@ -320,18 +323,20 @@ public final class CollocationModel {
 }
 }
 
-if (upper.previousReplicated(filter))
+if (upper.isPreviousTableReplicated(filter))
 multiplier = CollocationModelMultiplier.REPLICATED_NOT_LAST;
 }
 }
 
 /**
- * @param f Current filter.
- * @return {@code tru

[ignite] 02/08: Minors.

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 9039d6a44de43b22c7a48a47413b75b1ae3c6725
Author: devozerov 
AuthorDate: Fri Feb 1 17:40:59 2019 +0300

Minors.
---
 .../processors/query/h2/opt/GridH2IndexBase.java |  2 +-
 .../query/h2/opt/join/CollocationModel.java  | 20 ++--
 .../h2/opt/join/CollocationModelMultiplier.java  |  8 
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index f353aff..9c45ce3 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -230,7 +230,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
 // Query expressions can not be distributed as well.
 if (qctx == null || qctx.type() != PREPARE || 
qctx.distributedJoinMode() == OFF ||
 !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
-return 
CollocationModelMultiplier.MULTIPLIER_COLLOCATED.multiplier();
+return CollocationModelMultiplier.COLLOCATED.multiplier();
 
 // We have to clear this cache because normally sub-query plan cost 
does not depend on anything
 // other than index condition masks and sort order, but in our case it 
can depend on order
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index 95895fe..6b4dcb7 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@ -240,14 +240,14 @@ public final class CollocationModel {
 
 boolean collocated = true;
 boolean partitioned = false;
-CollocationModelMultiplier maxMultiplier = 
CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
+CollocationModelMultiplier maxMultiplier = 
CollocationModelMultiplier.COLLOCATED;
 
 for (int i = 0; i < childFilters.length; i++) {
 CollocationModel child = child(i, true);
 
 Type t = child.type(true);
 
-if (child.multiplier == 
CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
+if (child.multiplier == 
CollocationModelMultiplier.REPLICATED_NOT_LAST)
 maxMultiplier = child.multiplier;
 
 if (t.isPartitioned()) {
@@ -261,7 +261,7 @@ public final class CollocationModel {
 if (m.multiplier() > maxMultiplier.multiplier()) {
 maxMultiplier = m;
 
-if (maxMultiplier == 
CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
+if (maxMultiplier == 
CollocationModelMultiplier.REPLICATED_NOT_LAST)
 break;
 }
 }
@@ -281,7 +281,7 @@ public final class CollocationModel {
 // Only partitioned tables will do distributed joins.
 if (!(tbl instanceof GridH2Table) || 
!((GridH2Table)tbl).isPartitioned()) {
 type = Type.REPLICATED;
-multiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
+multiplier = CollocationModelMultiplier.COLLOCATED;
 
 return;
 }
@@ -291,7 +291,7 @@ public final class CollocationModel {
 // to all the affinity nodes the "base" does not need to get 
remote results.
 if (!upper.findPartitionedTableBefore(filter)) {
 type = Type.PARTITIONED_COLLOCATED;
-multiplier = CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
+multiplier = CollocationModelMultiplier.COLLOCATED;
 }
 else {
 // It is enough to make sure that our previous join by 
affinity key is collocated, then we are
@@ -299,19 +299,19 @@ public final class CollocationModel {
 switch (upper.joinedWithCollocated(filter)) {
 case COLLOCATED_JOIN:
 type = Type.PARTITIONED_COLLOCATED;
-multiplier = 
CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
+multiplier = CollocationModelMultiplier.COLLOCATED;
 
 break;
 
 case HAS_AF

[ignite] 06/08: Merge with master.

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 3c5c42bf66f5c8c0e46ad719f167c1d2653ab02a
Author: devozerov 
AuthorDate: Mon Feb 4 11:09:33 2019 +0300

Merge with master.
---
 .../processors/query/h2/opt/GridH2IndexBase.java   | 14 ++
 .../processors/query/h2/opt/join/CollocationModel.java | 18 +++---
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index e2f06a3..4c1757e 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -38,7 +38,6 @@ import 
org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModel;
 import org.apache.ignite.internal.processors.query.h2.opt.join.RangeSource;
 import org.apache.ignite.internal.processors.query.h2.opt.join.RangeStream;
 import org.apache.ignite.internal.processors.query.h2.opt.join.SegmentKey;
-import org.apache.ignite.internal.processors.query.h2.sql.SplitterContext;
 import 
org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2IndexRangeRequest;
 import 
org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2IndexRangeResponse;
 import 
org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2RowMessage;
@@ -210,18 +209,9 @@ public abstract class GridH2IndexBase extends BaseIndex {
  * @return Multiplier.
  */
 public final int getDistributedMultiplier(Session ses, TableFilter[] 
filters, int filter) {
-// We do optimizations with respect to distributed joins only on 
PREPARE stage only.
-// Notice that we check for isJoinBatchEnabled, because we can do 
multiple different
-// optimization passes on PREPARE stage.
-// Query expressions can not be distributed as well.
-SplitterContext ctx = SplitterContext.get();
+CollocationModelMultiplier mul = 
CollocationModel.distributedMultiplier(ses, filters, filter);
 
-if (!ctx.distributedJoins() || !ses.isJoinBatchEnabled() || 
ses.isPreparingQueryExpression())
-return CollocationModelMultiplier.COLLOCATED.multiplier();
-
-assert filters != null;
-
-return CollocationModel.distributedMultiplier(ctx, ses, filters, 
filter);
+return mul.multiplier();
 }
 
 /** {@inheritDoc} */
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index efe413c..6bbd968 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@ -629,18 +629,22 @@ public final class CollocationModel {
 /**
  * Get distributed multiplier for the given sequence of tables.
  *
- * @param ctx Splitter context.
  * @param ses Session.
  * @param filters Filters.
  * @param filter Filter index.
  * @return Multiplier.
  */
-public static int distributedMultiplier(
-SplitterContext ctx,
-Session ses,
-TableFilter[] filters,
-int filter
-) {
+public static CollocationModelMultiplier distributedMultiplier(Session 
ses, TableFilter[] filters, int filter) {
+// Notice that we check for isJoinBatchEnabled, because we can do 
multiple different
+// optimization passes on PREPARE stage.
+// Query expressions can not be distributed as well.
+SplitterContext ctx = SplitterContext.get();
+
+if (!ctx.distributedJoins() || !ses.isJoinBatchEnabled() || 
ses.isPreparingQueryExpression())
+return CollocationModelMultiplier.COLLOCATED;
+
+assert filters != null;
+
 clearViewIndexCache(ses);
 
 CollocationModel model = buildCollocationModel(ctx, 
ses.getSubQueryInfo(), filters, filter, false);



[ignite] 01/08: Converted multiplier to enum.

2019-02-04 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch col_model
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 160e04c0580f7a50fae9403ddcb45e4e08675445
Author: devozerov 
AuthorDate: Fri Feb 1 17:40:33 2019 +0300

Converted multiplier to enum.
---
 .../processors/query/h2/opt/GridH2IndexBase.java   |  3 +-
 .../query/h2/opt/join/CollocationModel.java| 54 +-
 .../h2/opt/join/CollocationModelMultiplier.java| 54 ++
 3 files changed, 78 insertions(+), 33 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index ab9929d..f353aff 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -30,6 +30,7 @@ import 
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
 import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.processors.query.h2.H2Cursor;
 import org.apache.ignite.internal.processors.query.h2.H2Utils;
+import 
org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModelMultiplier;
 import 
org.apache.ignite.internal.processors.query.h2.opt.join.CursorIteratorWrapper;
 import 
org.apache.ignite.internal.processors.query.h2.opt.join.DistributedLookupBatch;
 import 
org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModel;
@@ -229,7 +230,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
 // Query expressions can not be distributed as well.
 if (qctx == null || qctx.type() != PREPARE || 
qctx.distributedJoinMode() == OFF ||
 !ses.isJoinBatchEnabled() || ses.isPreparingQueryExpression())
-return CollocationModel.MULTIPLIER_COLLOCATED;
+return 
CollocationModelMultiplier.MULTIPLIER_COLLOCATED.multiplier();
 
 // We have to clear this cache because normally sub-query plan cost 
does not depend on anything
 // other than index condition masks and sort order, but in our case it 
can depend on order
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
index 03653c7..95895fe 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/join/CollocationModel.java
@@ -47,18 +47,6 @@ import org.h2.table.TableView;
  */
 public final class CollocationModel {
 /** */
-public static final int MULTIPLIER_COLLOCATED = 1;
-
-/** */
-private static final int MULTIPLIER_UNICAST = 50;
-
-/** */
-private static final int MULTIPLIER_BROADCAST = 200;
-
-/** */
-private static final int MULTIPLIER_REPLICATED_NOT_LAST = 10_000;
-
-/** */
 private final CollocationModel upper;
 
 /** */
@@ -68,7 +56,7 @@ public final class CollocationModel {
 private final boolean view;
 
 /** */
-private int multiplier;
+private CollocationModelMultiplier multiplier;
 
 /** */
 private Type type;
@@ -234,7 +222,7 @@ public final class CollocationModel {
 
 // Reset results.
 type = null;
-multiplier = 0;
+multiplier = null;
 
 return true;
 }
@@ -252,14 +240,14 @@ public final class CollocationModel {
 
 boolean collocated = true;
 boolean partitioned = false;
-int maxMultiplier = MULTIPLIER_COLLOCATED;
+CollocationModelMultiplier maxMultiplier = 
CollocationModelMultiplier.MULTIPLIER_COLLOCATED;
 
 for (int i = 0; i < childFilters.length; i++) {
 CollocationModel child = child(i, true);
 
 Type t = child.type(true);
 
-if (child.multiplier == MULTIPLIER_REPLICATED_NOT_LAST)
+if (child.multiplier == 
CollocationModelMultiplier.MULTIPLIER_REPLICATED_NOT_LAST)
 maxMultiplier = child.multiplier;
 
 if (t.isPartitioned()) {
@@ -268,12 +256,12 @@ public final class CollocationModel {
 if (!t.isCollocated()) {
 collocated = false;
 
-int m = child.multiplier(true);
+CollocationModelMultiplier m = child.multiplier(true);
 
-if (m > maxMultiplier) {
+if (m.multiplier() > maxMultiplier.multiplier()) {
 maxMulti

[ignite] branch master updated: IGNITE-11169: SQL: encapsulated distributed join information into separate context object to simplify (and possibly remove in future) GridH2QueryContext object. This cl

2019-02-03 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new c71e7df  IGNITE-11169: SQL: encapsulated distributed join information 
into separate context object to simplify (and possibly remove in future) 
GridH2QueryContext object. This closes #6005.
c71e7df is described below

commit c71e7dfed112b57861620270eb31c11226ebf7b9
Author: devozerov 
AuthorDate: Sun Feb 3 13:45:58 2019 +0300

IGNITE-11169: SQL: encapsulated distributed join information into separate 
context object to simplify (and possibly remove in future) GridH2QueryContext 
object. This closes #6005.
---
 .../processors/query/h2/IgniteH2Indexing.java  |  48 ++--
 .../processors/query/h2/opt/GridH2IndexBase.java   |  52 ++--
 .../query/h2/opt/GridH2QueryContext.java   | 290 ++---
 .../processors/query/h2/opt/GridH2QueryType.java   |   7 +-
 .../query/h2/opt/join/CollocationModel.java|  70 +++--
 .../query/h2/opt/join/DistributedJoinContext.java  | 263 +++
 .../query/h2/opt/join/DistributedJoinMode.java |  51 
 .../query/h2/opt/join/DistributedLookupBatch.java  |  64 ++---
 .../processors/query/h2/opt/join/RangeStream.java  |  13 +-
 .../query/h2/sql/GridSqlQuerySplitter.java |  43 +++
 .../processors/query/h2/sql/SplitterContext.java   |  85 ++
 .../query/h2/twostep/GridMapQueryExecutor.java | 118 -
 .../query/h2/twostep/GridReduceQueryExecutor.java  |  13 +-
 13 files changed, 610 insertions(+), 507 deletions(-)

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 1579ec6..5b83088 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
@@ -182,9 +182,6 @@ import static 
org.apache.ignite.internal.processors.cache.query.GridCacheQueryTy
 import static 
org.apache.ignite.internal.processors.query.h2.PreparedStatementEx.MVCC_CACHE_ID;
 import static 
org.apache.ignite.internal.processors.query.h2.PreparedStatementEx.MVCC_STATE;
 import static 
org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.LOCAL;
-import static 
org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.PREPARE;
-import static 
org.apache.ignite.internal.processors.query.h2.opt.join.DistributedJoinMode.OFF;
-import static 
org.apache.ignite.internal.processors.query.h2.opt.join.DistributedJoinMode.distributedJoinMode;
 import static 
org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest.isDataPageScanEnabled;
 
 /**
@@ -545,8 +542,14 @@ public class IgniteH2Indexing implements GridQueryIndexing 
{
 IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
 }
 
-final GridH2QueryContext ctx = new GridH2QueryContext(nodeId, 
nodeId, 0, LOCAL)
-.filter(filter).distributedJoinMode(OFF);
+final GridH2QueryContext ctx = new GridH2QueryContext(
+nodeId,
+nodeId,
+0,
+0,
+LOCAL,
+filter
+);
 
 boolean forUpdate = GridSqlQueryParser.isForUpdateQuery(p);
 
@@ -691,8 +694,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 }
 }
 
-return new H2FieldsIterator(rs, mvccTracker0, sfuFut0 
!= null,
-detachedConn);
+return new H2FieldsIterator(rs, mvccTracker0, sfuFut0 
!= null, detachedConn);
 }
 catch (IgniteCheckedException | RuntimeException | Error 
e) {
 detachedConn.recycle();
@@ -1843,8 +1845,6 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 if (!hasTwoStep)
 return new ParsingResult(prepared, newQry, remainingSql, null, 
null, null);
 
-final UUID locNodeId = ctx.localNodeId();
-
 // Now we're sure to have a distributed query. Let's try to get a 
two-step plan from the cache, or perform the
 // split if needed.
 H2TwoStepCachedQueryKey cachedQryKey = new 
H2TwoStepCachedQueryKey(schemaName, qry.getSql(),
@@ -1863,28 +1863,20 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 }
 
 try {
-GridH2QueryContext.set(new GridH2QueryContext(locNodeId, 
locNodeId, 0, PREPARE)
-.distributedJoinMode(distributedJoinMode(qry.isLocal(), 
qry.isDistributedJoins(;
-
-try {
-GridCacheTwoStepQuery twoStepQry

[ignite] branch master updated: IGNITE-9989: JDBC: Fixed metadata pattern handling for JDBCv2 driver. Moved metadata management code common to v2 and thin drivers to a single place. This closes #5716.

2019-02-01 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new bf49d56  IGNITE-9989: JDBC: Fixed metadata pattern handling for JDBCv2 
driver. Moved metadata management code common to v2 and thin drivers to a 
single place. This closes #5716.
bf49d56 is described below

commit bf49d56cc0635a5962523415c6a9d97a31c4e62c
Author: Pavel Kuznetsov 
AuthorDate: Fri Feb 1 16:29:20 2019 +0300

IGNITE-9989: JDBC: Fixed metadata pattern handling for JDBCv2 driver. Moved 
metadata management code common to v2 and thin drivers to a single place. This 
closes #5716.
---
 .../internal/jdbc2/JdbcMetadataSelfTest.java   |  88 +--
 .../ignite/jdbc/thin/JdbcThinMetadataSelfTest.java |  26 +-
 .../jdbc/thin/JdbcThinDatabaseMetadata.java| 123 +
 .../ignite/internal/jdbc2/JdbcConnection.java  |   4 +-
 .../internal/jdbc2/JdbcDatabaseMetadata.java   | 289 ++---
 .../apache/ignite/internal/jdbc2/JdbcUtils.java| 125 -
 .../processors/odbc/jdbc/JdbcMetadataInfo.java | 269 +++
 .../processors/odbc/jdbc/JdbcRequestHandler.java   | 172 ++--
 .../internal/processors/query/QueryUtils.java  |  26 +-
 .../processors/query/h2/dml/UpdatePlanBuilder.java |   3 +
 .../Cache/Query/CacheDmlQueriesTest.cs |   2 +-
 11 files changed, 604 insertions(+), 523 deletions(-)

diff --git 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index f845b9e..ad21e6a 100755
--- 
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ 
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
+import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.ParameterMetaData;
 import java.sql.PreparedStatement;
@@ -29,7 +30,6 @@ import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Types;
-import java.sql.Date;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -51,10 +51,10 @@ import 
org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.NotNull;
 import org.junit.Test;
 
+import static java.sql.Types.DATE;
+import static java.sql.Types.DECIMAL;
 import static java.sql.Types.INTEGER;
 import static java.sql.Types.VARCHAR;
-import static java.sql.Types.DECIMAL;
-import static java.sql.Types.DATE;
 import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -129,6 +129,21 @@ public class JdbcMetadataSelfTest extends 
GridCommonAbstractTest {
 personCache.put(new AffinityKey<>("p1", "o1"), new Person("John 
White", 25, 1));
 personCache.put(new AffinityKey<>("p2", "o1"), new Person("Joe Black", 
35, 1));
 personCache.put(new AffinityKey<>("p3", "o2"), new Person("Mike 
Green", 40, 2));
+
+jcache(grid(0),
+defaultCacheConfiguration().setIndexedTypes(Integer.class, 
Department.class),
+"dep");
+
+try (Connection conn = DriverManager.getConnection(BASE_URL)) {
+Statement stmt = conn.createStatement();
+
+stmt.execute("CREATE TABLE PUBLIC.TEST (ID INT, NAME VARCHAR(50) 
default 'default name', " +
+"age int default 21, VAL VARCHAR(50), PRIMARY KEY (ID, 
NAME))");
+stmt.execute("CREATE TABLE PUBLIC.\"Quoted\" (\"Id\" INT primary 
key, \"Name\" VARCHAR(50)) WITH WRAP_KEY");
+stmt.execute("CREATE INDEX \"MyTestIndex quoted\" on 
PUBLIC.\"Quoted\" (\"Id\" DESC)");
+stmt.execute("CREATE INDEX IDX ON PUBLIC.TEST (ID ASC)");
+stmt.execute("CREATE TABLE PUBLIC.TEST_DECIMAL_COLUMN (ID INT 
primary key, DEC_COL DECIMAL(8, 3))");
+}
 }
 
 /**
@@ -213,28 +228,28 @@ public class JdbcMetadataSelfTest extends 
GridCommonAbstractTest {
 assertNotNull(rs);
 assertTrue(rs.next());
 assertEquals("TABLE", rs.getString("TABLE_TYPE"));
-assertEquals(JdbcDatabaseMetadata.CATALOG_NAME, 
rs.getString("TABLE_CAT"));
+assertEquals(JdbcUtils.CATALOG_NAME, rs.getString("TABLE_CAT&

[ignite] branch master updated: IGNITE-10487: SQL: Tests for DML with partition pruning. This closes #5837.

2019-02-01 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 751ab2a  IGNITE-10487: SQL: Tests for DML with partition pruning. This 
closes #5837.
751ab2a is described below

commit 751ab2a488eeb5af32280125673907adb3ac9262
Author: tledkov-gridgain 
AuthorDate: Fri Feb 1 11:05:24 2019 +0300

IGNITE-10487: SQL: Tests for DML with partition pruning. This closes #5837.
---
 .../twostep/AbstractPartitionPruningBaseTest.java  | 565 +
 .../twostep/DmlSelectPartitionPruningSelfTest.java | 235 +
 .../h2/twostep/JoinPartitionPruningSelfTest.java   | 485 ++
 .../IgniteBinaryCacheQueryTestSuite.java   |   2 +
 4 files changed, 831 insertions(+), 456 deletions(-)

diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java
new file mode 100644
index 000..493b264
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java
@@ -0,0 +1,565 @@
+/*
+ * 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.twostep;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListSet;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxQueryEnlistRequest;
+import 
org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Base class for partition pruning tests.
+ */
+@SuppressWarnings("deprecation")
+@RunWith(JUnit4.class)
+public abstract class AbstractPartitionPruningBaseTest extends 
GridCommonAbstractTest {
+/** Number of intercepted requests. */
+private static final AtomicInteger INTERCEPTED_REQS = new AtomicInteger();
+
+/** Partitions tracked during query execution. */
+private static final ConcurrentSkipListSet INTERCEPTED_PARTS = 
new ConcurrentSkipListSet<>();
+
+/** Partitions tracked during query execution. */
+private static final ConcurrentSkipListSet INTERCEPTED_NODES 
= new ConcurrentSkipListSet<>();
+
+/** IP finder. */
+private static final TcpDiscoveryVmIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder().setShared(true);
+
+/** Memory. */
+protected static final String REGION_MEM = "mem";
+
+/** Disk. */
+protected static final String REGION_DISK = "disk";
+
+/** Client node name. */
+private static final String CLI_NAME = "cli";
+
+/** {@inheritDoc} */
+@Override protected void beforeTestsStarted() throws Exception {
+super.befo

[ignite] branch master updated: IGNITE-11134: SQL: Do not wrap key and value objects in GridH2KeyValueRowOnheap. This closes #5975.

2019-01-30 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 6821ef9  IGNITE-11134: SQL: Do not wrap key and value objects in 
GridH2KeyValueRowOnheap. This closes #5975.
6821ef9 is described below

commit 6821ef9bf8206fe4247127edc018ba9605a29289
Author: devozerov 
AuthorDate: Wed Jan 30 15:53:16 2019 +0300

IGNITE-11134: SQL: Do not wrap key and value objects in 
GridH2KeyValueRowOnheap. This closes #5975.
---
 .../query/h2/opt/GridH2KeyValueRowOnheap.java  | 80 --
 .../query/h2/opt/GridH2RowDescriptor.java  |  9 ++-
 2 files changed, 50 insertions(+), 39 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
index a260b4d..3aec288 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
@@ -18,12 +18,11 @@
 package org.apache.ignite.internal.processors.query.h2.opt;
 
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
+import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.processors.query.h2.H2Utils;
 import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.h2.message.DbException;
 import org.h2.value.Value;
 import org.h2.value.ValueNull;
 
@@ -44,12 +43,6 @@ public class GridH2KeyValueRowOnheap extends GridH2Row {
 protected final GridH2RowDescriptor desc;
 
 /** */
-private Value key;
-
-/** */
-private volatile Value val;
-
-/** */
 private Value[] valCache;
 
 /**
@@ -57,24 +50,11 @@ public class GridH2KeyValueRowOnheap extends GridH2Row {
  *
  * @param desc Row descriptor.
  * @param row Row.
- * @param keyType Key type.
- * @param valType Value type.
- * @throws IgniteCheckedException If failed.
  */
-public GridH2KeyValueRowOnheap(GridH2RowDescriptor desc,
-CacheDataRow row,
-int keyType,
-int valType) throws IgniteCheckedException {
+public GridH2KeyValueRowOnheap(GridH2RowDescriptor desc, CacheDataRow row) 
{
 super(row);
 
 this.desc = desc;
-
-CacheObjectValueContext coCtx = desc.indexing().objectContext();
-
-this.key = H2Utils.wrap(coCtx, row.key(), keyType);
-
-if (row.value() != null)
-this.val = H2Utils.wrap(coCtx, row.value(), valType);
 }
 
 /** {@inheritDoc} */
@@ -91,16 +71,16 @@ public class GridH2KeyValueRowOnheap extends GridH2Row {
 @Override public Value getValue(int col) {
 switch (col) {
 case KEY_COL:
-return key;
+return keyWrapped();
 
 case VAL_COL:
-return val;
+return valueWrapped();
 
 default:
 if (desc.isKeyAliasColumn(col))
-return key;
+return keyWrapped();
 else if (desc.isValueAliasColumn(col))
-return val;
+return valueWrapped();
 
 return getValue0(col - DEFAULT_COLUMNS_COUNT);
 }
@@ -118,18 +98,12 @@ public class GridH2KeyValueRowOnheap extends GridH2Row {
 if (v != null)
 return v;
 
-Object res = desc.columnValue(key.getObject(), val.getObject(), col);
+Object res = desc.columnValue(row.key(), row.value(), col);
 
 if (res == null)
 v = ValueNull.INSTANCE;
-else {
-try {
-v = H2Utils.wrap(desc.indexing().objectContext(), res, 
desc.fieldType(col));
-}
-catch (IgniteCheckedException e) {
-throw DbException.convert(e);
-}
-}
+else
+v = wrap(res, desc.fieldType(col));
 
 setCached(col, v);
 
@@ -171,16 +145,46 @@ public class GridH2KeyValueRowOnheap extends GridH2Row {
 valCache[colIdx] = val;
 }
 
+/**
+ * @return Wrapped key value.
+ */
+private Value keyWrapped() {
+return wrap(row.key(), desc.keyType());
+}
+
+/**
+ * @return Wrapped value value.
+ */
+private Value valueWrapped() {
+return wrap(row.value(), desc.valueType());
+}
+
+/**
+ * Wrap the given object into H2 value.
+ *
+ * @param val Value.
+ * @param type Type

[ignite] branch master updated: IGNITE-11119: Fixed flaky IgniteCacheQueryH2IndexingLeakTest. This closes #5958.

2019-01-30 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 29b5086  IGNITE-9: Fixed flaky IgniteCacheQueryH2IndexingLeakTest. 
This closes #5958.
29b5086 is described below

commit 29b50868a456676fd7e97a2b2bc2dec816fa0b49
Author: tledkov-gridgain 
AuthorDate: Wed Jan 30 15:46:08 2019 +0300

IGNITE-9: Fixed flaky IgniteCacheQueryH2IndexingLeakTest. This closes 
#5958.
---
 .../internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java
index 30ed4e0..589dfe1 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java
@@ -57,7 +57,7 @@ public class IgniteCacheQueryH2IndexingLeakTest extends 
GridCommonAbstractTest {
 private static final int THREAD_COUNT = 10;
 
 /** Timeout */
-private static final long STMT_CACHE_CLEANUP_TIMEOUT = 1000;
+private static final long STMT_CACHE_CLEANUP_TIMEOUT = 500;
 
 /** Orig cleanup period. */
 private static String origCacheCleanupPeriod;
@@ -183,7 +183,7 @@ public class IgniteCacheQueryH2IndexingLeakTest extends 
GridCommonAbstractTest {
 @Override public boolean apply() {
 return getStatementCacheSize(qryProc) == 0;
 }
-}, STMT_CACHE_CLEANUP_TIMEOUT * 2));
+}, STMT_CACHE_CLEANUP_TIMEOUT * 10));
 }
 }
 



[ignite] branch master updated: IGNITE-10160: SQL: Code to generate cluster-wide unique query ID. This closes #5872.

2019-01-30 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 048d74e  IGNITE-10160: SQL: Code to generate cluster-wide unique query 
ID. This closes #5872.
048d74e is described below

commit 048d74eb04c4ac77528b42a936f903a866738363
Author: Yuriy Gerzhedovich 
AuthorDate: Wed Jan 30 15:41:09 2019 +0300

IGNITE-10160: SQL: Code to generate cluster-wide unique query ID. This 
closes #5872.
---
 .../processors/query/GridRunningQueryInfo.java | 28 --
 .../internal/processors/query/QueryUtils.java  | 11 +
 .../processors/query/RunningQueryManager.java  | 13 +++---
 .../processors/query/h2/IgniteH2Indexing.java  |  2 +-
 .../processors/query/RunningQueriesTest.java   | 26 
 5 files changed, 74 insertions(+), 6 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
index 9e11cdf..e3b7e1b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.processors.query;
 
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
 
+import java.util.UUID;
+
 /**
  * Query descriptor.
  */
@@ -26,6 +28,9 @@ public class GridRunningQueryInfo {
 /** */
 private final long id;
 
+/** Originating Node ID. */
+private final UUID nodeId;
+
 /** */
 private final String qry;
 
@@ -45,7 +50,10 @@ public class GridRunningQueryInfo {
 private final boolean loc;
 
 /**
+ * Constructor.
+ *
  * @param id Query ID.
+ * @param nodeId Originating node ID.
  * @param qry Query text.
  * @param qryType Query type.
  * @param schemaName Schema name.
@@ -53,9 +61,18 @@ public class GridRunningQueryInfo {
  * @param cancel Query cancel.
  * @param loc Local query flag.
  */
-public GridRunningQueryInfo(Long id, String qry, GridCacheQueryType 
qryType, String schemaName, long startTime,
-GridQueryCancel cancel, boolean loc) {
+public GridRunningQueryInfo(
+Long id,
+UUID nodeId,
+String qry,
+GridCacheQueryType qryType,
+String schemaName,
+long startTime,
+GridQueryCancel cancel,
+boolean loc
+) {
 this.id = id;
+this.nodeId = nodeId;
 this.qry = qry;
 this.qryType = qryType;
 this.schemaName = schemaName;
@@ -72,6 +89,13 @@ public class GridRunningQueryInfo {
 }
 
 /**
+ * @return Global query ID.
+ */
+public String globalQueryId() {
+return QueryUtils.globalQueryId(nodeId, id);
+}
+
+/**
  * @return Query text.
  */
 public String query() {
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index 852468b..d7e9fdb 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -1449,6 +1449,17 @@ public class QueryUtils {
 }
 
 /**
+ * Get global query ID.
+ *
+ * @param nodeId Node ID.
+ * @param qryId Query ID.
+ * @return Global query ID.
+ */
+public static String globalQueryId(UUID nodeId, long qryId) {
+return nodeId + "_" + qryId;
+}
+
+/**
  * Private constructor.
  */
 private QueryUtils() {
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/RunningQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/RunningQueryManager.java
index 7c908be..0c7a5a2 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/RunningQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/RunningQueryManager.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicLong;
@@ -44,6 +45,9 @@ public class RunningQueryManager {
 /** Unique id for queries on single node. */
 private final AtomicLong qryIdGen = new AtomicLong();
 
+/** Local node ID. */
+private final UUID localNodeId;
+
 /** History size. */
 private final 

[ignite] branch master updated: IGNITE-10645: SQL: Avoid key/val ownership resolution of a field in runtime. This closes #5657.

2019-01-30 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new f350ada  IGNITE-10645: SQL: Avoid key/val ownership resolution of a 
field in runtime. This closes #5657.
f350ada is described below

commit f350ada7f8cd921396032e4bdbf87343cac07b82
Author: Pavel Kuznetsov 
AuthorDate: Wed Jan 30 12:26:11 2019 +0300

IGNITE-10645: SQL: Avoid key/val ownership resolution of a field in 
runtime. This closes #5657.
---
 .../internal/processors/query/QueryUtils.java  |  32 ++-
 .../query/property/QueryBinaryProperty.java|  60 +
 .../org/apache/ignite/client/FunctionalTest.java   |   5 +-
 .../cache/CacheBinaryKeyConcurrentQueryTest.java   |   3 +
 ...teCacheDistributedJoinCollocatedAndNotTest.java |   6 +-
 .../IgniteCacheJoinQueryWithAffinityKeyTest.java   |   2 +
 .../IgniteCacheSqlInsertValidationSelfTest.java| 286 +
 .../processors/cache/index/BasicIndexTest.java |   2 +
 ...achePartitionedAtomicColumnConstraintsTest.java |   3 +
 .../IgniteBinaryCacheQueryTestSuite.java   |   4 +-
 .../Cache/Query/CacheDmlQueriesTest.cs |   6 +-
 modules/platforms/python/tests/test_binary.py  |   1 -
 12 files changed, 338 insertions(+), 72 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index 0207eb5..852468b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -563,10 +563,6 @@ public class QueryUtils {
 Map precision  = qryEntity.getFieldsPrecision();
 Map scale = qryEntity.getFieldsScale();
 
-// We have to distinguish between empty and null keyFields when the 
key is not of SQL type -
-// when a key is not of SQL type, absence of a field in nonnull 
keyFields tell us that this field
-// is a value field, and null keyFields tells us that current 
configuration
-// does not tell us anything about this field's ownership.
 boolean hasKeyFields = (keyFields != null);
 
 boolean isKeyClsSqlType = isSqlType(d.keyClass());
@@ -580,23 +576,31 @@ public class QueryUtils {
 }
 }
 
+// We are creating binary properties for all the fields, even if field 
is of sql type (keyFieldName or
+// valueFieldName). In that case we rely on the fact, that binary 
property's methods value() and
+// setValue() will never get called, because there is no value to 
extract, key/val object itself is a
+// value.
 for (Map.Entry entry : fields.entrySet()) {
-Boolean isKeyField;
+String fieldName = entry.getKey();
+String fieldType = entry.getValue();
 
-if (isKeyClsSqlType) // We don't care about keyFields in this case 
- it might be null, or empty, or anything
+boolean isKeyField;
+
+if (isKeyClsSqlType)
+// Entire key is not field of itself, even if it is set in 
"keyFields".
 isKeyField = false;
 else
-isKeyField = (hasKeyFields ? 
keyFields.contains(entry.getKey()) : null);
+isKeyField = hasKeyFields && keyFields.contains(fieldName);
 
-boolean notNull = notNulls != null && 
notNulls.contains(entry.getKey());
+boolean notNull = notNulls != null && notNulls.contains(fieldName);
 
-Object dfltVal = dlftVals != null ? dlftVals.get(entry.getKey()) : 
null;
+Object dfltVal = dlftVals != null ? dlftVals.get(fieldName) : null;
 
-QueryBinaryProperty prop = buildBinaryProperty(ctx, entry.getKey(),
-U.classForName(entry.getValue(), Object.class, true),
+QueryBinaryProperty prop = buildBinaryProperty(ctx, fieldName,
+U.classForName(fieldType, Object.class, true),
 d.aliases(), isKeyField, notNull, dfltVal,
-precision == null ? -1 : 
precision.getOrDefault(entry.getKey(), -1),
-scale == null ? -1 : scale.getOrDefault(entry.getKey(), -1));
+precision == null ? -1 : precision.getOrDefault(fieldName, -1),
+scale == null ? -1 : scale.getOrDefault(fieldName, -1));
 
 d.addProperty(prop, false);
 }
@@ -799,7 +803,7 @@ public class QueryUtils {
  * @return Binary property.
  */
 public static QueryBinaryProperty buildBinaryProperty(GridKernalContext 
ctx, String pathStr,
-Class resType, Map aliases, @Nullable Boolean 
isKeyField, boolean notNull, Object dlftVal,
+Class resTyp

[ignite] branch master updated: IGNITE-11117: SQL: Moved partition model to core module. This closes #5956.

2019-01-30 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 0b00370  IGNITE-7: SQL: Moved partition model to core module. This 
closes #5956.
0b00370 is described below

commit 0b00370e6a34ce1d443490d3a73c9b860cacfebc
Author: devozerov 
AuthorDate: Wed Jan 30 12:03:38 2019 +0300

IGNITE-7: SQL: Moved partition model to core module. This closes #5956.
---
 .../affinity/PartitionAffinityFunctionType.java|  2 +-
 .../sql/optimizer}/affinity/PartitionAllNode.java  |  2 +-
 .../affinity/PartitionCompositeNode.java   |  2 +-
 .../affinity/PartitionCompositeNodeOperator.java   |  2 +-
 .../optimizer}/affinity/PartitionConstantNode.java |  2 +-
 .../optimizer}/affinity/PartitionGroupNode.java|  2 +-
 .../affinity/PartitionJoinCondition.java   |  2 +-
 .../optimizer}/affinity/PartitionJoinGroup.java|  2 +-
 .../sql/optimizer}/affinity/PartitionNode.java |  2 +-
 .../sql/optimizer}/affinity/PartitionNoneNode.java |  2 +-
 .../affinity/PartitionParameterNode.java   | 21 +-
 .../sql/optimizer/affinity/PartitionResolver.java} | 36 ++--
 .../sql/optimizer}/affinity/PartitionResult.java   |  2 +-
 .../optimizer}/affinity/PartitionSingleNode.java   |  2 +-
 .../sql/optimizer}/affinity/PartitionTable.java|  2 +-
 .../affinity/PartitionTableAffinityDescriptor.java |  2 +-
 .../optimizer}/affinity/PartitionTableModel.java   |  2 +-
 .../cache/query/GridCacheTwoStepQuery.java |  2 +-
 .../processors/query/h2/IgniteH2Indexing.java  |  6 ++-
 ...nConstantNode.java => H2PartitionResolver.java} | 41 +++---
 .../query/h2/affinity/PartitionExtractor.java  | 49 ++
 21 files changed, 87 insertions(+), 98 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionAffinityFunctionType.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAffinityFunctionType.java
similarity index 95%
copy from 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionAffinityFunctionType.java
copy to 
modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAffinityFunctionType.java
index 4c88fcb..66c20c0 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionAffinityFunctionType.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAffinityFunctionType.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.h2.affinity;
+package org.apache.ignite.internal.sql.optimizer.affinity;
 
 /**
  * Affinity function type.
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionAllNode.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAllNode.java
similarity index 96%
rename from 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionAllNode.java
rename to 
modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAllNode.java
index 30860f5..c625089 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionAllNode.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionAllNode.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.h2.affinity;
+package org.apache.ignite.internal.sql.optimizer.affinity;
 
 import org.apache.ignite.internal.util.typedef.internal.S;
 
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionCompositeNode.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionCompositeNode.java
similarity index 99%
rename from 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionCompositeNode.java
rename to 
modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionCompositeNode.java
index 45ceaaf..d724cf8 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionCompositeNode.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/sql/optimizer/affinity/PartitionCompositeNode.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.h2.affinity;
+package org.apache.ignite.internal.sql.optimizer.affinity;
 
 import org.apache.ignite.IgniteCheckedException;
 imp

[ignite] branch master updated: IGNITE-11115: Binary: avoid expensive ThreadLocal.set() calls on hot serialization/deserialization path. This closes #5955.

2019-01-30 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new 40977a8  IGNITE-5: Binary: avoid expensive ThreadLocal.set() calls 
on hot serialization/deserialization path. This closes #5955.
40977a8 is described below

commit 40977a8b487f71377555ab4fe0052dbc59011eb1
Author: devozerov 
AuthorDate: Wed Jan 30 11:42:32 2019 +0300

IGNITE-5: Binary: avoid expensive ThreadLocal.set() calls on hot 
serialization/deserialization path. This closes #5955.
---
 .../internal/binary/BinaryContextHolder.java   | 47 ++
 .../internal/binary/GridBinaryMarshaller.java  | 19 +++--
 2 files changed, 53 insertions(+), 13 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContextHolder.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContextHolder.java
new file mode 100644
index 000..b1e6ced
--- /dev/null
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContextHolder.java
@@ -0,0 +1,47 @@
+/*
+ * 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.binary;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Binary context holder. We use to avoid {@code ThreadLocal.clear()} and/or 
{{}}ThreadLocal.set()}} operations on
+ * every serialization/deserialization, as they may take considerable amount 
of CPU time (confirmed by benchmarks).
+ */
+public class BinaryContextHolder {
+/** Context. */
+private BinaryContext ctx;
+
+/**
+ * @return Context.
+ */
+@Nullable public BinaryContext get() {
+return ctx;
+}
+
+/**
+ * @param newCtx New context.
+ * @return Previous context.
+ */
+@Nullable public BinaryContext set(@Nullable BinaryContext newCtx) {
+BinaryContext oldCtx = ctx;
+
+ctx = newCtx;
+
+return oldCtx;
+}
+}
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
index aca48ea..decf369 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
@@ -33,14 +33,11 @@ import org.jetbrains.annotations.Nullable;
  */
 public class GridBinaryMarshaller {
 /** */
-public static final ThreadLocal KEEP_BINARIES = new 
ThreadLocal() {
-@Override protected Boolean initialValue() {
-return true;
-}
-};
+public static final ThreadLocal KEEP_BINARIES = 
ThreadLocal.withInitial(() -> true);
 
 /** Binary context in TLS store. */
-private static final ThreadLocal BINARY_CTX = new 
ThreadLocal<>();
+private static final ThreadLocal BINARY_CTX =
+ThreadLocal.withInitial(BinaryContextHolder::new);
 
 /** */
 public static final byte OPTM_MARSH = -2;
@@ -330,11 +327,7 @@ public class GridBinaryMarshaller {
  * @return Old binary context.
  */
 @Nullable private static BinaryContext pushContext(BinaryContext ctx) {
-BinaryContext old = BINARY_CTX.get();
-
-BINARY_CTX.set(ctx);
-
-return old;
+return BINARY_CTX.get().set(ctx);
 }
 
 /**
@@ -343,7 +336,7 @@ public class GridBinaryMarshaller {
  * @param oldCtx Old binary context.
  */
 public static void popContext(@Nullable BinaryContext oldCtx) {
-BINARY_CTX.set(oldCtx);
+BINARY_CTX.get().set(oldCtx);
 }
 
 /**
@@ -389,7 +382,7 @@ public class GridBinaryMarshaller {
  * @return Thread-bound context.
  */
 public static BinaryContext threadLocalContext() {
-BinaryContext ctx = GridBinaryMarshaller.BINARY_CTX.get();
+BinaryContext ctx = BINARY_CTX.get().get();
 
 if (ctx == null) {
 IgniteKernal ignite = IgnitionEx.localIgnite();



[ignite] branch master updated: IGNITE-10985: SQL: Avoid GridCacheVersion deserialization. This closes #5968.

2019-01-30 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
 new d0d6c98  IGNITE-10985: SQL: Avoid GridCacheVersion deserialization. 
This closes #5968.
d0d6c98 is described below

commit d0d6c98ebdd278fc5f2b41dcab35ad2028e8666e
Author: devozerov 
AuthorDate: Wed Jan 30 11:08:41 2019 +0300

IGNITE-10985: SQL: Avoid GridCacheVersion deserialization. This closes 
#5968.
---
 .../dht/GridDhtTxAbstractEnlistFuture.java |   4 +-
 .../cache/persistence/CacheDataRowAdapter.java | 130 -
 .../evict/PageAbstractEvictionTracker.java |   2 +-
 .../cache/persistence/tree/io/CacheVersionIO.java  |  25 
 .../processors/cache/tree/CacheDataRowStore.java   |  46 +++-
 .../processors/cache/tree/CacheDataTree.java   |  15 ++-
 .../internal/processors/cache/tree/DataRow.java|   8 +-
 .../cache/tree/mvcc/data/MvccDataRow.java  |   9 +-
 .../query/h2/database/H2PkHashIndex.java   |  11 ++
 .../processors/query/h2/database/H2RowFactory.java |  37 +++---
 10 files changed, 230 insertions(+), 57 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java
index 3f53b48..138e24d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java
@@ -732,7 +732,9 @@ public abstract class GridDhtTxAbstractEnlistFuture 
extends GridCacheFutureAd
 CacheDataRowAdapter.RowData.NO_KEY,
 row0.mvccCoordinatorVersion(),
 row0.mvccCounter(),
-row0.mvccOperationCounter());
+row0.mvccOperationCounter(),
+false
+);
 
 GridCacheMvccEntryInfo entry = new GridCacheMvccEntryInfo();
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
index 1889a99..c9d006f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
@@ -75,6 +75,9 @@ public class CacheDataRowAdapter implements CacheDataRow {
 @GridToStringInclude
 protected GridCacheVersion ver;
 
+/** Whether version is ready. */
+protected boolean verReady;
+
 /** */
 @GridToStringInclude
 protected int cacheId;
@@ -98,6 +101,8 @@ public class CacheDataRowAdapter implements CacheDataRow {
 this.val = val;
 this.ver = ver;
 this.expireTime = expireTime;
+
+verReady = true;
 }
 
 /**
@@ -108,7 +113,21 @@ public class CacheDataRowAdapter implements CacheDataRow {
  * @throws IgniteCheckedException If failed.
  */
 public final void initFromLink(CacheGroupContext grp, RowData rowData) 
throws IgniteCheckedException {
-initFromLink(grp, grp.shared(), grp.dataRegion().pageMemory(), 
rowData);
+initFromLink(grp, rowData, false);
+}
+
+
+/**
+ * Read row from data pages.
+ *
+ * @param grp Cache group.
+ * @param rowData Required row data.
+ * @param skipVer Whether version read should be skipped.
+ * @throws IgniteCheckedException If failed.
+ */
+public final void initFromLink(CacheGroupContext grp, RowData rowData, 
boolean skipVer)
+throws IgniteCheckedException {
+initFromLink(grp, grp.shared(), grp.dataRegion().pageMemory(), 
rowData, skipVer);
 }
 
 /**
@@ -119,13 +138,15 @@ public class CacheDataRowAdapter implements CacheDataRow {
  * @param sharedCtx Shared context.
  * @param pageMem Page memory.
  * @param rowData Row data.
+ * @param skipVer Whether version read should be skipped.
  * @throws IgniteCheckedException If failed.
  */
 public final void initFromLink(
 @Nullable CacheGroupContext grp,
 GridCacheSharedContext sharedCtx,
 PageMemory pageMem,
-RowData rowData
+RowData rowData,
+boolean skipVer
 ) throws IgniteCheckedException {
 // Group is null if try evict page, with persistence evictions should 
be disabled.
 assert grp != null || pageMem instanceof PageMemoryNoStoreImpl;
@@ -135,7 +156,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
 int grpId = grp != null ? grp.groupId

[ignite] branch ignite-10985 deleted (was 2f946d6)

2019-01-29 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch ignite-10985
in repository https://gitbox.apache.org/repos/asf/ignite.git.


 was 2f946d6  WIP.

This change permanently discards the following revisions:

 discard 2f946d6  WIP.
 discard e334d35  Data store.
 discard 894c5c1  WIP.
 discard d92c02c  Works somehow.
 discard 72ee531  Preparing.



[ignite] 02/05: Works somehow.

2019-01-29 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-10985
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit d92c02c4ed9a0d3913aac569f8346cba456344de
Author: devozerov 
AuthorDate: Tue Jan 29 17:55:12 2019 +0300

Works somehow.
---
 .../cache/persistence/CacheDataRowAdapter.java | 128 -
 .../evict/PageAbstractEvictionTracker.java |   2 +-
 .../cache/persistence/tree/io/CacheVersionIO.java  |  27 +
 .../processors/cache/tree/CacheDataTree.java   |   4 +-
 .../internal/processors/cache/tree/DataRow.java|   3 +-
 .../processors/query/h2/database/H2RowFactory.java |   3 +-
 .../query/h2/opt/GridH2KeyValueRowOnheap.java  |   6 +-
 7 files changed, 135 insertions(+), 38 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
index 1889a99..b87d287 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
@@ -75,6 +75,9 @@ public class CacheDataRowAdapter implements CacheDataRow {
 @GridToStringInclude
 protected GridCacheVersion ver;
 
+/** Whether version is ready. */
+protected boolean verReady;
+
 /** */
 @GridToStringInclude
 protected int cacheId;
@@ -98,6 +101,8 @@ public class CacheDataRowAdapter implements CacheDataRow {
 this.val = val;
 this.ver = ver;
 this.expireTime = expireTime;
+
+verReady = true;
 }
 
 /**
@@ -108,7 +113,21 @@ public class CacheDataRowAdapter implements CacheDataRow {
  * @throws IgniteCheckedException If failed.
  */
 public final void initFromLink(CacheGroupContext grp, RowData rowData) 
throws IgniteCheckedException {
-initFromLink(grp, grp.shared(), grp.dataRegion().pageMemory(), 
rowData);
+initFromLink(grp, rowData, false);
+}
+
+
+/**
+ * Read row from data pages.
+ *
+ * @param grp Cache group.
+ * @param rowData Required row data.
+ * @param skipVer Whether version read should be skipped.
+ * @throws IgniteCheckedException If failed.
+ */
+public final void initFromLink(CacheGroupContext grp, RowData rowData, 
boolean skipVer)
+throws IgniteCheckedException {
+initFromLink(grp, grp.shared(), grp.dataRegion().pageMemory(), 
rowData, skipVer);
 }
 
 /**
@@ -119,13 +138,15 @@ public class CacheDataRowAdapter implements CacheDataRow {
  * @param sharedCtx Shared context.
  * @param pageMem Page memory.
  * @param rowData Row data.
+ * @param skipVer Whether version read should be skipped.
  * @throws IgniteCheckedException If failed.
  */
 public final void initFromLink(
 @Nullable CacheGroupContext grp,
 GridCacheSharedContext sharedCtx,
 PageMemory pageMem,
-RowData rowData
+RowData rowData,
+boolean skipVer
 ) throws IgniteCheckedException {
 // Group is null if try evict page, with persistence evictions should 
be disabled.
 assert grp != null || pageMem instanceof PageMemoryNoStoreImpl;
@@ -135,7 +156,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
 int grpId = grp != null ? grp.groupId() : 0;
 IoStatisticsHolder statHolder = grp != null ? 
grp.statisticsHolderData() : IoStatisticsHolderNoOp.INSTANCE;
 
-doInitFromLink(link, sharedCtx, coctx, pageMem, grpId, statHolder, 
readCacheId, rowData, null);
+doInitFromLink(link, sharedCtx, coctx, pageMem, grpId, statHolder, 
readCacheId, rowData, null, skipVer);
 }
 
 /**
@@ -146,6 +167,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
  * @param sharedCtx Cache shared context.
  * @param pageMem Page memory.
  * @param rowData Required row data.
+ * @param skipVer Whether version read should be skipped.
  * @throws IgniteCheckedException If failed.
  */
 public final void initFromDataPage(
@@ -155,7 +177,8 @@ public class CacheDataRowAdapter implements CacheDataRow {
 @Nullable CacheGroupContext grp,
 GridCacheSharedContext sharedCtx,
 PageMemory pageMem,
-RowData rowData
+RowData rowData,
+boolean skipVer
 ) throws IgniteCheckedException {
 // Group is null if try evict page, with persistence evictions should 
be disabled.
 assert grp != null || pageMem instanceof PageMemoryNoStoreImpl;
@@ -166,14 +189,26 @@ public class CacheDataRowAdapter implements CacheDataRow {
 IoStatisticsHolder statHolder = grp != null ? 
grp.statisticsHolderData() : IoStatisticsHolderNoOp.INSTANCE;
 
 IncompleteObject incomplete

[ignite] 04/05: Data store.

2019-01-29 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-10985
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit e334d35a115b4a08e463628ac96259ed86fd2c3a
Author: devozerov 
AuthorDate: Tue Jan 29 18:20:26 2019 +0300

Data store.
---
 .../cache/IgniteCacheOffheapManager.java   | 13 ---
 .../cache/IgniteCacheOffheapManagerImpl.java   |  8 +
 .../dht/GridDhtTxAbstractEnlistFuture.java |  4 ++-
 .../cache/persistence/GridCacheOffheapManager.java | 13 +--
 .../processors/cache/tree/CacheDataRowStore.java   | 41 +++---
 .../internal/processors/cache/tree/DataRow.java|  5 +--
 .../cache/tree/mvcc/data/MvccDataRow.java  |  9 +++--
 .../query/h2/database/H2PkHashIndex.java   | 13 ++-
 .../processors/query/h2/database/H2RowFactory.java |  5 +--
 9 files changed, 66 insertions(+), 45 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
index b02bc9d..c0c81c6 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
@@ -1010,19 +1010,6 @@ public interface IgniteCacheOffheapManager {
 KeyCacheObject upper, Object x, MvccSnapshot snapshot) throws 
IgniteCheckedException;
 
 /**
- * @param cacheId Cache ID.
- * @param lower Lower bound.
- * @param upper Upper bound.
- * @param x Implementation specific argument, {@code null} always 
means that we need to return full detached data row.
- * @param snapshot Mvcc snapshot.
- * @param skipVer Whether version read should be skipped.
- * @return Data cursor.
- * @throws IgniteCheckedException If failed.
- */
-public GridCursor cursor(int cacheId, 
KeyCacheObject lower,
-KeyCacheObject upper, Object x, MvccSnapshot snapshot, boolean 
skipVer) throws IgniteCheckedException;
-
-/**
  * Destroys the tree associated with the store.
  *
  * @throws IgniteCheckedException If failed.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index e60a002..82c65ad 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -2759,15 +2759,9 @@ public class IgniteCacheOffheapManagerImpl implements 
IgniteCacheOffheapManager
 /** {@inheritDoc} */
 @Override public GridCursor cursor(int 
cacheId, KeyCacheObject lower,
 KeyCacheObject upper, Object x, MvccSnapshot snapshot) throws 
IgniteCheckedException {
-return cursor(cacheId, lower, upper, x, snapshot, false);
-}
-
-/** {@inheritDoc} */
-@Override public GridCursor cursor(int 
cacheId, KeyCacheObject lower,
-KeyCacheObject upper, Object x, MvccSnapshot snapshot, boolean 
skipVer) throws IgniteCheckedException {
 SearchRow lowerRow;
 SearchRow upperRow;
-// TODO: Use skiPver.
+
 if (grp.sharedGroup()) {
 assert cacheId != CU.UNDEFINED_CACHE_ID;
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java
index 3f53b48..138e24d 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxAbstractEnlistFuture.java
@@ -732,7 +732,9 @@ public abstract class GridDhtTxAbstractEnlistFuture 
extends GridCacheFutureAd
 CacheDataRowAdapter.RowData.NO_KEY,
 row0.mvccCoordinatorVersion(),
 row0.mvccCounter(),
-row0.mvccOperationCounter());
+row0.mvccOperationCounter(),
+false
+);
 
 GridCacheMvccEntryInfo entry = new GridCacheMvccEntryInfo();
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
index b93f1ff..ac7be6e 100644
--- 
a/modules/core/src/main/java/org

[ignite] 05/05: WIP.

2019-01-29 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-10985
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 2f946d69ed8bede5d170b97f5457581a8acb7910
Author: devozerov 
AuthorDate: Tue Jan 29 18:26:35 2019 +0300

WIP.
---
 .../internal/processors/cache/tree/CacheDataRowStore.java   | 11 ---
 .../internal/processors/cache/tree/CacheDataTree.java   | 13 -
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java
index 42f6c07..0c460ee 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataRowStore.java
@@ -34,9 +34,14 @@ public class CacheDataRowStore extends RowStore {
 private static ThreadLocal SKIP_VER = ThreadLocal.withInitial(() 
-> false);
 
 /**
- * Set skip version flag.
- *
- * @param skipVer Flag value.
+ * @return Skip version flag.
+ */
+public static boolean getSkipVersion() {
+return SKIP_VER.get();
+}
+
+/**
+ * @param skipVer Skip version flag.
  */
 public static void setSkipVersion(boolean skipVer) {
 SKIP_VER.set(skipVer);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
index 4349823..71c8a86 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/tree/CacheDataTree.java
@@ -223,6 +223,8 @@ public class CacheDataTree extends 
BPlusTree {
 long page = pageMem.acquirePage(grpId, pageId);
 
 try {
+boolean skipVer = CacheDataRowStore.getSkipVersion();
+
 long pageAddr = ((PageMemoryEx)pageMem).readLock(page, 
pageId, true, false);
 
 try {
@@ -247,7 +249,16 @@ public class CacheDataTree extends 
BPlusTree {
 if (c == null || c.applyMvcc(io, pageAddr, i, 
pageSize)) {
 DataRow row = mvccEnabled ? new 
MvccDataRow() : new DataRow();
 
-row.initFromDataPage(io, pageAddr, i, grp, 
shared, pageMem, rowData, true);
+row.initFromDataPage(
+io,
+pageAddr,
+i,
+grp,
+shared,
+pageMem,
+rowData,
+skipVer
+);
 
 rows[r++] = row;
 }



[ignite] branch ignite-10985 created (now 2f946d6)

2019-01-29 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a change to branch ignite-10985
in repository https://gitbox.apache.org/repos/asf/ignite.git.


  at 2f946d6  WIP.

This branch includes the following new commits:

 new 72ee531  Preparing.
 new d92c02c  Works somehow.
 new 894c5c1  WIP.
 new e334d35  Data store.
 new 2f946d6  WIP.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[ignite] 01/05: Preparing.

2019-01-29 Thread vozerov
This is an automated email from the ASF dual-hosted git repository.

vozerov pushed a commit to branch ignite-10985
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit 72ee531d01626dc1ec3a569cd400829b0941bfc1
Author: devozerov 
AuthorDate: Tue Jan 29 15:57:32 2019 +0300

Preparing.
---
 .../processors/query/h2/database/H2RowFactory.java | 35 ++
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
index 724de7e..5b4827b 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
@@ -54,18 +54,14 @@ public class H2RowFactory {
  * @throws IgniteCheckedException If failed.
  */
 public GridH2Row getRow(long link) throws IgniteCheckedException {
-// TODO Avoid extra garbage generation. In upcoming H2 1.4.193 Row 
will become an interface,
-// TODO we need to refactor all this to return CacheDataRowAdapter 
implementing Row here.
+CacheDataRowAdapter row = new CacheDataRowAdapter(link);
 
-final CacheDataRowAdapter rowBuilder = new CacheDataRowAdapter(link);
+row.initFromLink(
+cctx.group(),
+CacheDataRowAdapter.RowData.FULL // TODO: Appropriate data!
+);
 
-rowBuilder.initFromLink(cctx.group(), 
CacheDataRowAdapter.RowData.FULL);
-
-GridH2Row row = rowDesc.createRow(rowBuilder);
-
-assert row.version() != null;
-
-return row;
+return rowDesc.createRow(row);
 }
 
 /**
@@ -76,8 +72,21 @@ public class H2RowFactory {
  * @return Row.
  * @throws IgniteCheckedException If failed.
  */
-public GridH2Row getMvccRow(long link, long mvccCrdVer, long mvccCntr, int 
mvccOpCntr) throws IgniteCheckedException {
-return rowDesc.createRow(new MvccDataRow(cctx.group(),0, link,
-PageIdUtils.partId(PageIdUtils.pageId(link)),null, mvccCrdVer, 
mvccCntr, mvccOpCntr));
+public GridH2Row getMvccRow(long link, long mvccCrdVer, long mvccCntr, int 
mvccOpCntr)
+throws IgniteCheckedException {
+int partId = PageIdUtils.partId(PageIdUtils.pageId(link));
+
+MvccDataRow row = new MvccDataRow(
+cctx.group(),
+0,
+link,
+partId,
+null, // TODO: Appropriate data!
+mvccCrdVer,
+mvccCntr,
+mvccOpCntr
+);
+
+return rowDesc.createRow(row);
 }
 }



  1   2   3   4   5   6   7   8   9   10   >