This is an automated email from the ASF dual-hosted git repository.
av 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 f967969c919 IGNITE-21628 Transactional SQL commands removal (#11281)
f967969c919 is described below
commit f967969c919eef78de1ec400ecd3e4a3cbab4fe4
Author: Ilya Shishkov <[email protected]>
AuthorDate: Thu Apr 4 18:50:17 2024 +0300
IGNITE-21628 Transactional SQL commands removal (#11281)
---
.../internal/jdbc/thin/JdbcThinConnection.java | 28 +--
.../jdbc/thin/JdbcThinDatabaseMetadata.java | 9 +-
.../internal/processors/query/EnlistOperation.java | 100 --------
.../org/apache/ignite/internal/sql/SqlParser.java | 15 +-
.../sql/command/SqlBeginTransactionCommand.java | 46 ----
.../sql/command/SqlCommitTransactionCommand.java | 46 ----
.../sql/command/SqlRollbackTransactionCommand.java | 46 ----
.../main/resources/META-INF/classnames.properties | 1 -
.../sql/SqlParserMultiStatementSelfTest.java | 46 +---
.../SqlParserTransactionalKeywordsSelfTest.java | 100 --------
.../processors/query/h2/CommandProcessor.java | 6 -
.../query/h2/GridSubqueryJoinOptimizer.java | 2 -
.../internal/processors/query/h2/QueryParser.java | 8 +-
.../query/h2/sql/GridSqlQueryParser.java | 93 +------
.../query/h2/sql/GridSqlQuerySplitter.java | 27 --
.../processors/query/h2/sql/GridSqlSelect.java | 44 ----
.../query/h2/twostep/msg/GridH2QueryRequest.java | 36 +--
.../msg/GridH2SelectForUpdateTxDetails.java | 273 ---------------------
.../h2/twostep/msg/GridH2ValueMessageFactory.java | 1 -
.../processors/query/SqlQueryHistorySelfTest.java | 4 +-
.../query/h2/sql/GridQueryParsingTest.java | 4 +-
.../query/h2/sql/SqlUnsupportedSelfTest.java | 19 ++
.../IgniteBinaryCacheQueryTestSuite.java | 2 -
23 files changed, 60 insertions(+), 896 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
index 562c53a280f..6a4668a0001 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
@@ -493,18 +493,19 @@ public class JdbcThinConnection implements Connection {
@Override public void setAutoCommit(boolean autoCommit) throws
SQLException {
ensureNotClosed();
- // Do nothing if resulting value doesn't actually change.
- if (autoCommit != this.autoCommit) {
- doCommit();
+ this.autoCommit = autoCommit;
- this.autoCommit = autoCommit;
- }
+ if (!autoCommit)
+ LOG.warning("Transactions are not supported.");
}
/** {@inheritDoc} */
@Override public boolean getAutoCommit() throws SQLException {
ensureNotClosed();
+ if (!autoCommit)
+ LOG.warning("Transactions are not supported.");
+
return autoCommit;
}
@@ -515,7 +516,7 @@ public class JdbcThinConnection implements Connection {
if (autoCommit)
throw new SQLException("Transaction cannot be committed explicitly
in auto-commit mode.");
- doCommit();
+ LOG.warning("Transactions are not supported.");
}
/** {@inheritDoc} */
@@ -525,20 +526,7 @@ public class JdbcThinConnection implements Connection {
if (autoCommit)
throw new SQLException("Transaction cannot be rolled back
explicitly in auto-commit mode.");
- try (Statement s = createStatement()) {
- s.execute("ROLLBACK");
- }
- }
-
- /**
- * Send to the server {@code COMMIT} command.
- *
- * @throws SQLException if failed.
- */
- private void doCommit() throws SQLException {
- try (Statement s = createStatement()) {
- s.execute("COMMIT");
- }
+ LOG.warning("Transactions are not supported.");
}
/** {@inheritDoc} */
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
index 4334ecfd37c..22644053c30 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
@@ -47,7 +47,6 @@ import
org.apache.ignite.internal.processors.odbc.jdbc.JdbcTableMeta;
import
org.apache.ignite.internal.processors.query.schema.management.IndexDescriptor;
import static java.sql.Connection.TRANSACTION_NONE;
-import static java.sql.Connection.TRANSACTION_REPEATABLE_READ;
import static java.sql.ResultSet.CONCUR_READ_ONLY;
import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
@@ -640,19 +639,17 @@ public class JdbcThinDatabaseMetadata implements
DatabaseMetaData {
/** {@inheritDoc} */
@Override public int getDefaultTransactionIsolation() throws SQLException {
- return conn.igniteVersion().greaterThanEqual(2, 5, 0) ?
TRANSACTION_REPEATABLE_READ :
- TRANSACTION_NONE;
+ return TRANSACTION_NONE;
}
/** {@inheritDoc} */
@Override public boolean supportsTransactions() throws SQLException {
- return conn.igniteVersion().greaterThanEqual(2, 5, 0);
+ return false;
}
/** {@inheritDoc} */
@Override public boolean supportsTransactionIsolationLevel(int level)
throws SQLException {
- return conn.igniteVersion().greaterThanEqual(2, 5, 0) &&
- TRANSACTION_REPEATABLE_READ == level;
+ return false;
}
/** {@inheritDoc} */
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/EnlistOperation.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/EnlistOperation.java
deleted file mode 100644
index 631bf1899d9..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/EnlistOperation.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query;
-
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Operations on entries which could be performed during transaction.
- * Operations are used during SQL statements execution, but does not define
exact SQL statements semantics.
- * It is better to treat them independently and having their own semantics.
- */
-public enum EnlistOperation {
- /**
- * This operation creates entry if it does not exist or raises visible
failure otherwise.
- */
- INSERT(GridCacheOperation.CREATE),
- /**
- * This operation creates entry if it does not exist or modifies existing
one otherwise.
- */
- UPSERT(GridCacheOperation.UPDATE),
- /**
- * This operation modifies existing entry or does nothing if entry does
not exist.
- */
- UPDATE(GridCacheOperation.UPDATE),
- /**
- * This operation deletes existing entry or does nothing if entry does not
exist.
- */
- DELETE(GridCacheOperation.DELETE),
- /**
- * This operation locks existing entry protecting it from updates by other
transactions
- * or does notrhing if entry does not exist.
- */
- LOCK(null),
- /**
- * This operation applies entry transformer.
- */
- TRANSFORM(GridCacheOperation.UPDATE);
-
- /** */
- private final GridCacheOperation cacheOp;
-
- /** */
- EnlistOperation(GridCacheOperation cacheOp) {
- this.cacheOp = cacheOp;
- }
-
- /**
- * @return Corresponding Cache operation.
- */
- public GridCacheOperation cacheOperation() {
- return cacheOp;
- }
-
- /** */
- public boolean isDeleteOrLock() {
- return this == DELETE || this == LOCK;
- }
-
- /** */
- public boolean isInvoke() {
- return this == TRANSFORM;
- }
-
- /**
- * Indicates that an operation cannot create new row.
- */
- public boolean noCreate() {
- // has no meaning for LOCK
- assert this != LOCK;
-
- return this == UPDATE || this == DELETE;
- }
-
- /** Enum values. */
- private static final EnlistOperation[] VALS = values();
-
- /**
- * @param ord Ordinal value.
- * @return Enum value.
- */
- @Nullable public static EnlistOperation fromOrdinal(int ord) {
- return ord < 0 || ord >= VALS.length ? null : VALS[ord];
- }
-}
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 024fbd9d957..5ac0e57046a 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
@@ -21,10 +21,8 @@ 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.SqlAnalyzeCommand;
-import org.apache.ignite.internal.sql.command.SqlBeginTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlBulkLoadCommand;
import org.apache.ignite.internal.sql.command.SqlCommand;
-import org.apache.ignite.internal.sql.command.SqlCommitTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlCreateIndexCommand;
import org.apache.ignite.internal.sql.command.SqlCreateUserCommand;
import org.apache.ignite.internal.sql.command.SqlDropIndexCommand;
@@ -38,7 +36,6 @@ import
org.apache.ignite.internal.sql.command.SqlKillScanQueryCommand;
import org.apache.ignite.internal.sql.command.SqlKillServiceCommand;
import org.apache.ignite.internal.sql.command.SqlKillTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlRefreshStatitsicsCommand;
-import org.apache.ignite.internal.sql.command.SqlRollbackTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlSetStreamingCommand;
import org.jetbrains.annotations.Nullable;
@@ -278,7 +275,8 @@ public class SqlParser {
skipIfMatchesOptionalKeyword(lex, WORK);
- return new SqlBeginTransactionCommand();
+ throw new SqlStrictParseException("BEGIN command is not supported",
IgniteQueryErrorCode.UNSUPPORTED_OPERATION,
+ SqlParserUtils.errorUnsupported(lex));
}
/**
@@ -289,7 +287,8 @@ public class SqlParser {
private SqlCommand processCommit() {
skipIfMatchesOptionalKeyword(lex, TRANSACTION);
- return new SqlCommitTransactionCommand();
+ throw new SqlStrictParseException("COMMIT command is not supported",
IgniteQueryErrorCode.UNSUPPORTED_OPERATION,
+ SqlParserUtils.errorUnsupported(lex));
}
/**
@@ -431,7 +430,8 @@ public class SqlParser {
private SqlCommand processRollback() {
skipIfMatchesOptionalKeyword(lex, TRANSACTION);
- return new SqlRollbackTransactionCommand();
+ throw new SqlStrictParseException("ROLLBACK command is not supported",
IgniteQueryErrorCode.UNSUPPORTED_OPERATION,
+ SqlParserUtils.errorUnsupported(lex));
}
/**
@@ -442,7 +442,8 @@ public class SqlParser {
private SqlCommand processStart() {
skipIfMatchesKeyword(lex, TRANSACTION);
- return new SqlBeginTransactionCommand();
+ throw new SqlStrictParseException("START command is not supported",
IgniteQueryErrorCode.UNSUPPORTED_OPERATION,
+ SqlParserUtils.errorUnsupported(lex));
}
/**
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlBeginTransactionCommand.java
b/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlBeginTransactionCommand.java
deleted file mode 100644
index e890cc4cbf3..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlBeginTransactionCommand.java
+++ /dev/null
@@ -1,46 +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.sql.command;
-
-import org.apache.ignite.internal.sql.SqlLexer;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * BEGIN [TRANSACTION] command.
- */
-public class SqlBeginTransactionCommand implements SqlCommand {
- /** {@inheritDoc} */
- @Override public SqlCommand parse(SqlLexer lex) {
- return this;
- }
-
- /** {@inheritDoc} */
- @Override public String schemaName() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void schemaName(String schemaName) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(SqlBeginTransactionCommand.class, this);
- }
-}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlCommitTransactionCommand.java
b/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlCommitTransactionCommand.java
deleted file mode 100644
index da14dea0365..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlCommitTransactionCommand.java
+++ /dev/null
@@ -1,46 +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.sql.command;
-
-import org.apache.ignite.internal.sql.SqlLexer;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * COMMIT command.
- */
-public class SqlCommitTransactionCommand implements SqlCommand {
- /** {@inheritDoc} */
- @Override public SqlCommand parse(SqlLexer lex) {
- return this;
- }
-
- /** {@inheritDoc} */
- @Override public String schemaName() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void schemaName(String schemaName) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(SqlCommitTransactionCommand.class, this);
- }
-}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlRollbackTransactionCommand.java
b/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlRollbackTransactionCommand.java
deleted file mode 100644
index 341b794ccd6..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/sql/command/SqlRollbackTransactionCommand.java
+++ /dev/null
@@ -1,46 +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.sql.command;
-
-import org.apache.ignite.internal.sql.SqlLexer;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * ROLLBACK command.
- */
-public class SqlRollbackTransactionCommand implements SqlCommand {
- /** {@inheritDoc} */
- @Override public SqlCommand parse(SqlLexer lex) {
- return this;
- }
-
- /** {@inheritDoc} */
- @Override public String schemaName() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void schemaName(String schemaName) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(SqlRollbackTransactionCommand.class, this);
- }
-}
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties
b/modules/core/src/main/resources/META-INF/classnames.properties
index 02083690995..91172e8f904 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1633,7 +1633,6 @@
org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionL
org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionSetAndUnlockProcessor
org.apache.ignite.internal.processors.pool.PoolProcessor$2
org.apache.ignite.internal.processors.pool.PoolProcessor$3
-org.apache.ignite.internal.processors.query.EnlistOperation
org.apache.ignite.internal.processors.query.GridQueryFieldMetadata
org.apache.ignite.internal.processors.query.GridQueryProcessor$2
org.apache.ignite.internal.processors.query.GridQueryProcessor$3
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserMultiStatementSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserMultiStatementSelfTest.java
index 840a880300e..20fe284f30c 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserMultiStatementSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserMultiStatementSelfTest.java
@@ -17,10 +17,9 @@
package org.apache.ignite.internal.sql;
-import org.apache.ignite.internal.sql.command.SqlBeginTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlCommand;
-import org.apache.ignite.internal.sql.command.SqlCommitTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlCreateIndexCommand;
+import org.apache.ignite.internal.sql.command.SqlDropUserCommand;
import org.junit.Test;
/**
@@ -32,7 +31,7 @@ public class SqlParserMultiStatementSelfTest extends
SqlParserAbstractSelfTest {
*/
@Test
public void testEmptyStatements() {
- String sql = ";;;CREATE INDEX TEST on TABLE1(id) ; ; BEGIN ;;;";
+ String sql = ";;;CREATE INDEX TEST on TABLE1(id) ; ; DROP USER test
;;;";
SqlParser parser = new SqlParser("schema", sql);
@@ -44,12 +43,12 @@ public class SqlParserMultiStatementSelfTest extends
SqlParserAbstractSelfTest {
assertTrue(create instanceof SqlCreateIndexCommand);
assertEquals("CREATE INDEX TEST on TABLE1(id)",
parser.lastCommandSql());
- assertEquals(" ; BEGIN ;;;", parser.remainingSql());
+ assertEquals(" ; DROP USER test ;;;", parser.remainingSql());
SqlCommand begin = parser.nextCommand();
- assertTrue(begin instanceof SqlBeginTransactionCommand);
- assertEquals("BEGIN", parser.lastCommandSql());
+ assertTrue(begin instanceof SqlDropUserCommand);
+ assertEquals("DROP USER test", parser.lastCommandSql());
assertEquals(";;", parser.remainingSql());
SqlCommand emptyCmd = parser.nextCommand();
@@ -95,39 +94,4 @@ public class SqlParserMultiStatementSelfTest extends
SqlParserAbstractSelfTest {
assertEquals(null, parser.lastCommandSql());
assertEquals(null, parser.remainingSql());
}
-
- /**
- * Check that comments between statements work.
- */
- @Test
- public void testEmptyTransaction() {
- String beginSql = "BEGIN ;" + " \n";
- String noteSql = " -- Let's start an empty transaction; $1M idea!\n";
- String commitSql = "COMMIT;" + ";;";
-
- String sql = beginSql +
- noteSql +
- commitSql;
-
- SqlParser parser = new SqlParser("schema", sql);
-
- SqlCommand begin = parser.nextCommand();
-
- assertTrue(begin instanceof SqlBeginTransactionCommand);
-
- assertEquals("BEGIN", parser.lastCommandSql());
- assertEquals(" \n" + noteSql + commitSql, parser.remainingSql());
-
- SqlCommand commit = parser.nextCommand();
-
- assertTrue(commit instanceof SqlCommitTransactionCommand);
- assertEquals("COMMIT", parser.lastCommandSql());
- assertEquals(";;", parser.remainingSql());
-
- SqlCommand emptyCmd = parser.nextCommand();
-
- assertEquals(null, emptyCmd);
- assertEquals(null, parser.lastCommandSql());
- assertEquals(null, parser.remainingSql());
- }
}
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserTransactionalKeywordsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserTransactionalKeywordsSelfTest.java
deleted file mode 100644
index cd453c6a872..00000000000
---
a/modules/core/src/test/java/org/apache/ignite/internal/sql/SqlParserTransactionalKeywordsSelfTest.java
+++ /dev/null
@@ -1,100 +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.sql;
-
-import org.apache.ignite.internal.sql.command.SqlBeginTransactionCommand;
-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.junit.Test;
-
-/**
- * Tests for processing of keywords BEGIN, COMMIT, ROLLBACK, START.
- */
-public class SqlParserTransactionalKeywordsSelfTest extends
SqlParserAbstractSelfTest {
- /**
- * Test parsing of different forms of BEGIN/START.
- */
- @Test
- public void testBegin() {
- assertBegin("begin");
- assertBegin("BEGIN");
- assertBegin("BEGIN work");
- assertBegin("begin Transaction");
- assertBegin("StarT TransactioN");
-
- assertParseError(null, "begin index", "Unexpected token: \"INDEX\"");
- assertParseError(null, "start work", "Unexpected token: \"WORK\"
(expected: \"TRANSACTION\")");
- assertParseError(null, "start", "Unexpected end of command (expected:
\"TRANSACTION\")");
- }
-
- /**
- * Test parsing of different forms of COMMIT.
- */
- @Test
- public void testCommit() {
- assertCommit("commit");
- assertCommit("COMMIT transaction");
-
- assertParseError(null, "commit index", "Unexpected token: \"INDEX\"");
- }
-
- /**
- * Test parsing of different forms of ROLLBACK.
- */
- @Test
- public void testRollback() {
- assertRollback("rollback");
- assertRollback("ROLLBACK transaction");
-
- assertParseError(null, "rollback index", "Unexpected token:
\"INDEX\"");
- }
-
- /**
- * Test that given SQL is parsed as a BEGIN command.
- * @param sql command.
- */
- private static void assertBegin(String sql) {
- assertTrue(parse(sql) instanceof SqlBeginTransactionCommand);
- }
-
- /**
- * Test that given SQL is parsed as a BEGIN command.
- * @param sql command.
- */
- private static void assertCommit(String sql) {
- assertTrue(parse(sql) instanceof SqlCommitTransactionCommand);
- }
-
- /**
- * Test that given SQL is parsed as a BEGIN command.
- * @param sql command.
- */
- private static void assertRollback(String sql) {
- assertTrue(parse(sql) instanceof SqlRollbackTransactionCommand);
- }
-
- /**
- * Parse single SQL command.
- * @param sql command.
- * @return parsed command.
- */
- private static SqlCommand parse(String sql) {
- return new SqlParser(null, sql).nextCommand();
- }
-}
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 0020d6ba868..263e10207eb 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
@@ -64,14 +64,11 @@ import
org.apache.ignite.internal.processors.query.h2.sql.GridSqlDropTable;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlStatement;
import
org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
import org.apache.ignite.internal.sql.SqlCommandProcessor;
-import org.apache.ignite.internal.sql.command.SqlBeginTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlBulkLoadCommand;
import org.apache.ignite.internal.sql.command.SqlCommand;
-import org.apache.ignite.internal.sql.command.SqlCommitTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlCreateIndexCommand;
import org.apache.ignite.internal.sql.command.SqlDropIndexCommand;
import org.apache.ignite.internal.sql.command.SqlIndexColumn;
-import org.apache.ignite.internal.sql.command.SqlRollbackTransactionCommand;
import org.apache.ignite.internal.sql.command.SqlSetStreamingCommand;
import org.apache.ignite.internal.util.lang.IgniteClosureX;
import org.apache.ignite.internal.util.typedef.F;
@@ -194,9 +191,6 @@ public class CommandProcessor extends SqlCommandProcessor {
/** {@inheritDoc} */
@Override public boolean isCommandSupported(SqlCommand cmd) {
return super.isCommandSupported(cmd)
- || cmd instanceof SqlBeginTransactionCommand
- || cmd instanceof SqlCommitTransactionCommand
- || cmd instanceof SqlRollbackTransactionCommand
|| cmd instanceof SqlBulkLoadCommand
|| cmd instanceof SqlSetStreamingCommand;
}
diff --git
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridSubqueryJoinOptimizer.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridSubqueryJoinOptimizer.java
index 3e45770fca4..875284dd631 100644
---
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridSubqueryJoinOptimizer.java
+++
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridSubqueryJoinOptimizer.java
@@ -270,7 +270,6 @@ public class GridSubqueryJoinOptimizer {
* <p>
* We call query simple if it is select query (not union) and it has
neither having nor grouping,
* has no distinct clause, has no aggregations, has no limits, no sorting,
no offset clause.
- * Also it is not SELECT FOR UPDATE.
*
* @param subQry Sub query.
* @return {@code true} if it is simple query.
@@ -284,7 +283,6 @@ public class GridSubqueryJoinOptimizer {
boolean simple = F.isEmpty(select.sort())
&& select.offset() == null
&& select.limit() == null
- && !select.isForUpdate()
&& !select.distinct()
&& select.havingColumn() < 0
&& F.isEmpty(select.groupColumns());
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 abe10324d88..949568b53fe 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
@@ -75,7 +75,7 @@ public class QueryParser {
/** A pattern for commands having internal implementation in Ignite. */
private static final Pattern INTERNAL_CMD_RE = Pattern.compile(
"^(create|drop)\\s+index|^analyze\\s|^refresh\\sstatistics|^drop\\sstatistics|^alter\\s+table|^copy"
+
- "|^set|^begin|^commit|^rollback|^(create|alter|drop)\\s+user" +
+
"|^set|^begin|^start|^commit|^rollback|^(create|alter|drop)\\s+user" +
"|^kill\\s+(query|scan|continuous|compute|service|transaction|client)|show|help|grant|revoke",
Pattern.CASE_INSENSITIVE);
@@ -349,6 +349,8 @@ public class QueryParser {
throw new IgniteSQLException("Explains of update queries
are not supported.",
IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
+ GridSqlQueryParser.failIfSelectForUpdateQuery(prepared);
+
// Get remaining query and check if it is allowed.
SqlFieldsQuery remainingQry = null;
@@ -477,10 +479,6 @@ public class QueryParser {
// node stripes in parallel and then merged through reduce
process.
boolean splitNeeded = !loc || locSplit;
- if (GridSqlQueryParser.isForUpdateQuery(prepared))
- throw new IgniteSQLException("SELECT FOR UPDATE queries
are not supported.",
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
-
GridCacheTwoStepQuery twoStepQry = null;
if (splitNeeded) {
diff --git
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index 6df5a2949c4..fd0d76e216b 100644
---
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -104,7 +104,6 @@ import org.h2.table.TableFilter;
import org.h2.table.TableView;
import org.h2.value.DataType;
import org.h2.value.Value;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static
org.apache.ignite.internal.processors.query.h2.sql.GridSqlOperationType.AND;
@@ -149,9 +148,6 @@ public class GridSqlQueryParser {
/** */
private static final Getter<Select, Boolean> SELECT_IS_FOR_UPDATE =
getter(Select.class, "isForUpdate");
- /** */
- private static final Getter<Select, Boolean> SELECT_IS_GROUP_QUERY =
getter(Select.class, "isGroupQuery");
-
/** */
private static final Getter<SelectUnion, Boolean> UNION_IS_FOR_UPDATE =
getter(SelectUnion.class, "isForUpdate");
@@ -545,9 +541,6 @@ public class GridSqlQueryParser {
*/
private int parsingSubQryExpression;
- /** Whether this is SELECT FOR UPDATE. */
- private boolean selectForUpdate;
-
/**
* @param useOptimizedSubqry If we have to find correct order for table
filters in FROM clause.
* Relies on uniqueness of table filter aliases.
@@ -609,9 +602,8 @@ public class GridSqlQueryParser {
/**
* @param p Prepared.
- * @return Whether {@code p} is an {@code SELECT FOR UPDATE} query.
*/
- public static boolean isForUpdateQuery(Prepared p) {
+ public static void failIfSelectForUpdateQuery(Prepared p) {
boolean union;
if (p.getClass() == Select.class)
@@ -619,7 +611,7 @@ public class GridSqlQueryParser {
else if (p.getClass() == SelectUnion.class)
union = true;
else
- return false;
+ return;
boolean forUpdate = (!union && SELECT_IS_FOR_UPDATE.get((Select)p)) ||
(union && UNION_IS_FOR_UPDATE.get((SelectUnion)p));
@@ -629,7 +621,9 @@ public class GridSqlQueryParser {
IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
}
- return forUpdate;
+ if (forUpdate)
+ throw new IgniteSQLException("SELECT FOR UPDATE is not supported.",
+ IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
}
/**
@@ -734,8 +728,6 @@ public class GridSqlQueryParser {
TableFilter filter = select.getTopTableFilter();
- boolean isForUpdate = SELECT_IS_FOR_UPDATE.get(select);
-
do {
assert0(filter != null, select);
assert0(filter.getNestedJoin() == null, select);
@@ -767,42 +759,6 @@ public class GridSqlQueryParser {
res.from(from);
- if (isForUpdate) {
- if (!(from instanceof GridSqlTable ||
- (from instanceof GridSqlAlias && from.size() == 1 &&
from.child() instanceof GridSqlTable))) {
- throw new IgniteSQLException("SELECT FOR UPDATE with joins is
not supported.",
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
- }
-
- GridSqlTable gridTbl = from instanceof GridSqlTable ?
(GridSqlTable)from :
- ((GridSqlAlias)from).child();
-
- GridH2Table tbl = gridTbl.dataTable();
-
- if (tbl == null) {
- throw new IgniteSQLException("SELECT FOR UPDATE query must
involve Ignite table.",
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
- }
-
- if (select.getLimit() != null || select.getOffset() != null) {
- throw new IgniteSQLException("LIMIT/OFFSET clauses are not
supported for SELECT FOR UPDATE.",
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
- }
-
- if (SELECT_IS_GROUP_QUERY.get(select)) {
- throw new IgniteSQLException("SELECT FOR UPDATE with
aggregates and/or GROUP BY is not supported.",
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
- }
-
- if (select.isDistinct())
- throw new IgniteSQLException("DISTINCT clause is not supported
for SELECT FOR UPDATE.",
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
-
- if (SplitterUtils.hasSubQueries(res))
- throw new IgniteSQLException("Sub queries are not supported
for SELECT FOR UPDATE.",
- IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
- }
-
ArrayList<Expression> expressions = select.getExpressions();
for (int i = 0; i < expressions.size(); i++)
@@ -818,8 +774,6 @@ public class GridSqlQueryParser {
if (havingIdx >= 0)
res.havingColumn(havingIdx);
- res.forUpdate(isForUpdate);
-
processSortOrder(select.getSortOrder(), res);
res.limit(parseExpression(select.getLimit(), false));
@@ -1793,29 +1747,6 @@ public class GridSqlQueryParser {
return stmt instanceof Merge || stmt instanceof Insert || stmt
instanceof Update || stmt instanceof Delete;
}
- /**
- * @param stmt Prepared.
- * @return Target table.
- */
- @NotNull public static GridH2Table dmlTable(@NotNull Prepared stmt) {
- Table table;
-
- if (stmt.getClass() == Insert.class)
- table = INSERT_TABLE.get((Insert)stmt);
- else if (stmt.getClass() == Merge.class)
- table = MERGE_TABLE.get((Merge)stmt);
- else if (stmt.getClass() == Delete.class)
- table = DELETE_FROM.get((Delete)stmt).getTable();
- else if (stmt.getClass() == Update.class)
- table = UPDATE_TARGET.get((Update)stmt).getTable();
- else
- throw new IgniteException("Unsupported statement: " + stmt);
-
- assert table instanceof GridH2Table : table;
-
- return (GridH2Table)table;
- }
-
/**
* Check if query may be run locally on all caches mentioned in the query.
*
@@ -1823,9 +1754,6 @@ public class GridSqlQueryParser {
* to run distributed query.
*/
public boolean isLocalQuery() {
- if (selectForUpdate)
- return false;
-
for (Object o : h2ObjToGridObj.values()) {
if (o instanceof GridSqlAlias)
o = GridSqlAlias.unwrap((GridSqlAst)o);
@@ -1962,8 +1890,6 @@ public class GridSqlQueryParser {
if (optimizedTableFilterOrder != null)
collectOptimizedTableFiltersOrder((Query)stmt);
- selectForUpdate = isForUpdateQuery(stmt);
-
return parseQuery((Query)stmt);
}
@@ -2001,18 +1927,13 @@ public class GridSqlQueryParser {
IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
}
- /**
- * @return H2 to Grid objects map.
- */
- public Map<Object, Object> objectsMap() {
- return h2ObjToGridObj;
- }
-
/**
* @param qry Query.
* @return Parsed query AST.
*/
private GridSqlQuery parseQuery(Query qry) {
+ failIfSelectForUpdateQuery(qry);
+
if (qry instanceof Select)
return parseSelect((Select)qry);
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 40c487d8266..818d5e009a1 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
@@ -36,7 +36,6 @@ import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
-import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.h2.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.query.h2.H2PooledConnection;
import org.apache.ignite.internal.processors.query.h2.H2StatementCache;
@@ -44,13 +43,11 @@ import
org.apache.ignite.internal.processors.query.h2.H2Utils;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.h2.QueryTable;
import
org.apache.ignite.internal.processors.query.h2.affinity.PartitionExtractor;
-import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
import org.apache.ignite.internal.processors.query.h2.opt.QueryContext;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.h2.command.Prepared;
import org.h2.command.dml.Query;
-import org.h2.table.Column;
import static
org.apache.ignite.internal.processors.query.h2.opt.join.CollocationModel.isCollocated;
import static
org.apache.ignite.internal.processors.query.h2.sql.GridSqlConst.TRUE;
@@ -1288,30 +1285,6 @@ public class GridSqlQuerySplitter {
mapSqlQrys.add(map);
}
- /**
- * Retrieves _KEY column from SELECT. This column is used for SELECT FOR
UPDATE statements.
- *
- * @param sel Select statement.
- * @return Key column alias.
- */
- public static GridSqlAlias keyColumn(GridSqlSelect sel) {
- GridSqlAst from = sel.from();
-
- GridSqlTable tbl = from instanceof GridSqlTable ? (GridSqlTable)from :
- ((GridSqlElement)from).child();
-
- GridH2Table gridTbl = tbl.dataTable();
-
- Column h2KeyCol = gridTbl.getColumn(QueryUtils.KEY_COL);
-
- GridSqlColumn keyCol = new GridSqlColumn(h2KeyCol, tbl,
h2KeyCol.getName());
- keyCol.resultType(GridSqlType.fromColumn(h2KeyCol));
-
- GridSqlAlias al = SplitterUtils.alias(QueryUtils.KEY_FIELD_NAME,
keyCol);
-
- return al;
- }
-
/**
* @param sqlQry Query.
* @param qryAst Select AST.
diff --git
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
index b3f0645e7e5..6fab17abd6f 100644
---
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
+++
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlSelect.java
@@ -60,9 +60,6 @@ public class GridSqlSelect extends GridSqlQuery {
/** */
private int havingCol = -1;
- /** */
- private boolean isForUpdate;
-
/** Used only for SELECT based on UPDATE.
* It cannot be lazy when updated columns are used in the conditions.
* In this case index based on these columns may be chosen to scan and
some rows may be updated
@@ -183,9 +180,6 @@ public class GridSqlSelect extends GridSqlQuery {
getSortLimitSQL(buff);
- if (isForUpdate)
- buff.append(delim).append("FOR UPDATE");
-
return buff.toString();
}
@@ -382,20 +376,6 @@ public class GridSqlSelect extends GridSqlQuery {
return this;
}
- /**
- * @return Whether this statement is {@code FOR UPDATE}.
- */
- public boolean isForUpdate() {
- return isForUpdate;
- }
-
- /**
- * @param forUpdate Whether this statement is {@code FOR UPDATE}.
- */
- public void forUpdate(boolean forUpdate) {
- isForUpdate = forUpdate;
- }
-
/**
* @return Index of HAVING column.
*/
@@ -425,30 +405,6 @@ public class GridSqlSelect extends GridSqlQuery {
aliases.add((GridSqlAlias)from);
}
- /**
- * @return Copy of this select for SELECT FOR UPDATE specific tasks.
- */
- public GridSqlSelect copySelectForUpdate() {
- assert isForUpdate && !distinct && havingCol < 0 && grpCols == null;
// Not supported by SFU.
-
- GridSqlSelect copy = new GridSqlSelect();
-
- copy.from(from())
- .where(where());
-
- int vis = visibleColumns();
-
- for (int i = 0; i < columns(false).size(); i++)
- copy.addColumn(column(i), i < vis);
-
- if (!sort().isEmpty()) {
- for (GridSqlSortColumn sortCol : sort())
- copy.addSort(sortCol);
- }
-
- return copy;
- }
-
/**
* @param canBeLazy see {@link #canBeLazy()}.
*/
diff --git
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
index f7a64443c02..28b56a7445b 100644
---
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
+++
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2QueryRequest.java
@@ -158,9 +158,6 @@ public class GridH2QueryRequest implements Message,
GridCacheQueryMarshallable {
/** */
private MvccSnapshot mvccSnapshot;
- /** TX details holder for {@code SELECT FOR UPDATE}, or {@code null} if
not applicable. */
- private GridH2SelectForUpdateTxDetails txReq;
-
/** Id of the query assigned by {@link RunningQueryManager} on originator
node. */
private long qryId;
@@ -192,7 +189,6 @@ public class GridH2QueryRequest implements Message,
GridCacheQueryMarshallable {
paramsBytes = req.paramsBytes;
schemaName = req.schemaName;
mvccSnapshot = req.mvccSnapshot;
- txReq = req.txReq;
qryId = req.qryId;
explicitTimeout = req.explicitTimeout;
}
@@ -445,20 +441,6 @@ public class GridH2QueryRequest implements Message,
GridCacheQueryMarshallable {
return this;
}
- /**
- * @return TX details holder for {@code SELECT FOR UPDATE}, or {@code
null} if not applicable.
- */
- public GridH2SelectForUpdateTxDetails txDetails() {
- return txReq;
- }
-
- /**
- * @param txReq TX details holder for {@code SELECT FOR UPDATE}, or {@code
null} if not applicable.
- */
- public void txDetails(GridH2SelectForUpdateTxDetails txReq) {
- this.txReq = txReq;
- }
-
/**
* @param flags Flags.
* @param dataPageScanEnabled {@code true} If data page scan enabled,
{@code false} if not, and {@code null} if not set.
@@ -682,18 +664,12 @@ public class GridH2QueryRequest implements Message,
GridCacheQueryMarshallable {
writer.incrementState();
case 13:
- if (!writer.writeMessage("txReq", txReq))
- return false;
-
- writer.incrementState();
-
- case 14:
if (!writer.writeBoolean("explicitTimeout", explicitTimeout))
return false;
writer.incrementState();
- case 15:
+ case 14:
if (!writer.writeLong("qryId", qryId))
return false;
@@ -816,14 +792,6 @@ public class GridH2QueryRequest implements Message,
GridCacheQueryMarshallable {
reader.incrementState();
case 13:
- txReq = reader.readMessage("txReq");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 14:
explicitTimeout = reader.readBoolean("explicitTimeout");
if (!reader.isLastRead())
@@ -831,7 +799,7 @@ public class GridH2QueryRequest implements Message,
GridCacheQueryMarshallable {
reader.incrementState();
- case 15:
+ case 14:
qryId = reader.readLong("qryId");
if (!reader.isLastRead())
diff --git
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2SelectForUpdateTxDetails.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2SelectForUpdateTxDetails.java
deleted file mode 100644
index 5c9f5d69cb1..00000000000
---
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2SelectForUpdateTxDetails.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.twostep.msg;
-
-import java.nio.ByteBuffer;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.lang.IgniteUuid;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-
-/**
- * TX details holder for {@link GridH2QueryRequest}.
- */
-public class GridH2SelectForUpdateTxDetails implements Message {
- /** */
- private static final long serialVersionUID = 8166491041528984454L;
-
- /** */
- private long threadId;
-
- /** */
- private IgniteUuid futId;
-
- /** */
- private int miniId;
-
- /** */
- private GridCacheVersion lockVer;
-
- /** */
- private int taskNameHash;
-
- /** */
- private boolean clientFirst;
-
- /** */
- private long timeout;
-
- /**
- * Default constructor.
- */
- GridH2SelectForUpdateTxDetails() {
- // No-op.
- }
-
- /**
- * @param threadId Thread id.
- * @param futId Future id.
- * @param miniId Mini fture id.
- * @param lockVer Lock version.
- * @param taskNameHash Task name hash.
- * @param clientFirst {@code True} if this is the first client request.
- * @param timeout Tx timeout.
- */
- public GridH2SelectForUpdateTxDetails(long threadId, IgniteUuid futId, int
miniId,
- GridCacheVersion lockVer, int taskNameHash, boolean clientFirst, long
timeout) {
- this.threadId = threadId;
- this.futId = futId;
- this.miniId = miniId;
- this.lockVer = lockVer;
- this.taskNameHash = taskNameHash;
- this.clientFirst = clientFirst;
- this.timeout = timeout;
- }
-
- /**
- * @return Thread id.
- */
- public long threadId() {
- return threadId;
- }
-
- /**
- * @return Future id.
- */
- public IgniteUuid futureId() {
- return futId;
- }
-
- /**
- * @return Mini fture id.
- */
- public int miniId() {
- return miniId;
- }
-
- /**
- * @return Lock version.
- */
- public GridCacheVersion version() {
- return lockVer;
- }
-
- /**
- * @return Task name hash.
- */
- public int taskNameHash() {
- return taskNameHash;
- }
-
- /**
- * @return {@code True} if this is the first client request in transaction.
- */
- public boolean firstClientRequest() {
- return clientFirst;
- }
-
- /**
- * @return Tx timeout.
- */
- public long timeout() {
- return timeout;
- }
-
- /** {@inheritDoc} */
- @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- writer.setBuffer(buf);
-
- if (!writer.isHeaderWritten()) {
- if (!writer.writeHeader(directType(), fieldsCount()))
- return false;
-
- writer.onHeaderWritten();
- }
-
- switch (writer.state()) {
- case 0:
- if (!writer.writeBoolean("clientFirst", clientFirst))
- return false;
-
- writer.incrementState();
-
- case 1:
- if (!writer.writeIgniteUuid("futId", futId))
- return false;
-
- writer.incrementState();
-
- case 2:
- if (!writer.writeMessage("lockVer", lockVer))
- return false;
-
- writer.incrementState();
-
- case 3:
- if (!writer.writeInt("miniId", miniId))
- return false;
-
- writer.incrementState();
-
- case 4:
- if (!writer.writeInt("taskNameHash", taskNameHash))
- return false;
-
- writer.incrementState();
-
- case 5:
- if (!writer.writeLong("threadId", threadId))
- return false;
-
- writer.incrementState();
-
- case 6:
- if (!writer.writeLong("timeout", timeout))
- return false;
-
- writer.incrementState();
-
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- reader.setBuffer(buf);
-
- if (!reader.beforeMessageRead())
- return false;
-
- switch (reader.state()) {
- case 0:
- clientFirst = reader.readBoolean("clientFirst");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 1:
- futId = reader.readIgniteUuid("futId");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 2:
- lockVer = reader.readMessage("lockVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 3:
- miniId = reader.readInt("miniId");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 4:
- taskNameHash = reader.readInt("taskNameHash");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 5:
- threadId = reader.readLong("threadId");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 6:
- timeout = reader.readLong("timeout");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- }
-
- return reader.afterMessageRead(GridH2SelectForUpdateTxDetails.class);
- }
-
- /** {@inheritDoc} */
- @Override public short directType() {
- return -57;
- }
-
- /** {@inheritDoc} */
- @Override public byte fieldsCount() {
- return 7;
- }
-
- /** {@inheritDoc} */
- @Override public void onAckReceived() {
- // No-op.
- }
-}
diff --git
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
index ff955ec94fe..58fa2fc0679 100644
---
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
+++
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2ValueMessageFactory.java
@@ -63,7 +63,6 @@ public class GridH2ValueMessageFactory implements
MessageFactoryProvider {
factory.register((short)-54, QueryTable::new);
factory.register((short)-55, GridH2DmlRequest::new);
factory.register((short)-56, GridH2DmlResponse::new);
- factory.register((short)-57, GridH2SelectForUpdateTxDetails::new);
}
/** {@inheritDoc} */
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlQueryHistorySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlQueryHistorySelfTest.java
index 0b4bb85a29c..4257c84b147 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlQueryHistorySelfTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlQueryHistorySelfTest.java
@@ -177,7 +177,7 @@ public class SqlQueryHistorySelfTest extends
GridCommonAbstractTest {
List<String> cmds = Arrays.asList(
"create table TST(id int PRIMARY KEY, name varchar)",
"insert into TST(id) values(1)",
- "commit"
+ "select * from TST where id=1"
);
try (Connection conn = GridTestUtils.connect(queryNode(), null);
Statement stmt = conn.createStatement()) {
@@ -256,7 +256,7 @@ public class SqlQueryHistorySelfTest extends
GridCommonAbstractTest {
List<String> cmds = Arrays.asList(
"create table TST(id int PRIMARY KEY, name varchar)",
"insert into TST(id) values(1)",
- "commit"
+ "drop table TST"
);
cmds.forEach((cmd) ->
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index 3b833fea74a..ec08ff5dac1 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -195,7 +195,9 @@ public class GridQueryParsingTest extends
AbstractIndexingCommonTest {
checkQuery("select * from Person");
checkQuery("select distinct * from Person");
checkQuery("select p.name, date from Person p");
- checkQuery("select p.name, date from Person p for update");
+
+ assertParseThrows("select p.name, date from Person p for update",
IgniteSQLException.class,
+ "SELECT FOR UPDATE is not supported.");
checkQuery("select * from Person p, sch2.Address a");
checkQuery("select * from Person, sch2.Address");
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/SqlUnsupportedSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/SqlUnsupportedSelfTest.java
index 456504665ee..cf891a054dd 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/SqlUnsupportedSelfTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/SqlUnsupportedSelfTest.java
@@ -259,6 +259,25 @@ public class SqlUnsupportedSelfTest extends
AbstractIndexingCommonTest {
assertSqlUnsupported("REVOKE SELECT ON test FROM PUBLIC");
assertSqlUnsupported("SELECT * FROM TEST FOR UPDATE");
+
+ assertTxCommandsUnsupported();
+ }
+
+ /**
+ *
+ */
+ private void assertTxCommandsUnsupported() {
+ assertSqlUnsupported("BEGIN");
+ assertSqlUnsupported("BEGIN TRANSACTION");
+ assertSqlUnsupported("BEGIN WORK");
+
+ assertSqlUnsupported("START TRANSACTION");
+
+ assertSqlUnsupported("ROLLBACK");
+ assertSqlUnsupported("ROLLBACK TRANSACTION");
+
+ assertSqlUnsupported("COMMIT");
+ assertSqlUnsupported("COMMIT TRANSACTION");
}
/**
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
index 78bf0750314..d1e124e6038 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
@@ -152,7 +152,6 @@ import
org.apache.ignite.internal.sql.SqlParserDropIndexSelfTest;
import org.apache.ignite.internal.sql.SqlParserKillQuerySelfTest;
import org.apache.ignite.internal.sql.SqlParserMultiStatementSelfTest;
import org.apache.ignite.internal.sql.SqlParserSetStreamingSelfTest;
-import org.apache.ignite.internal.sql.SqlParserTransactionalKeywordsSelfTest;
import org.apache.ignite.sqltests.CheckWarnJoinPartitionedTables;
import org.apache.ignite.sqltests.PartitionedSqlTest;
import org.apache.ignite.sqltests.ReplicatedSqlCustomPartitionsTest;
@@ -184,7 +183,6 @@ import org.junit.runners.Suite;
SqlParserCreateIndexSelfTest.class,
SqlParserDropIndexSelfTest.class,
- SqlParserTransactionalKeywordsSelfTest.class,
SqlParserBulkLoadSelfTest.class,
SqlParserSetStreamingSelfTest.class,
SqlParserKillQuerySelfTest.class,