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 f240922349f IGNITE-22099 Delete TransactionDuplicateKeyException
(#11354)
f240922349f is described below
commit f240922349ff4ef406ddf0885b05e3557c69f9d1
Author: Andrey Nadyktov <[email protected]>
AuthorDate: Wed Jun 26 19:53:05 2024 +0300
IGNITE-22099 Delete TransactionDuplicateKeyException (#11354)
---
.../jdbc2/JdbcInsertStatementSelfTest.java | 36 ++++++++++++----
.../jdbc/thin/JdbcThinInsertStatementSelfTest.java | 37 +++++++++++-----
.../internal/processors/odbc/SqlListenerUtils.java | 3 --
.../internal/processors/query/QueryUtils.java | 6 ---
.../TransactionDuplicateKeyException.java | 45 --------------------
.../main/resources/META-INF/classnames.properties | 1 -
.../internal/processors/query/h2/dml/DmlUtils.java | 8 ++--
.../metric/SqlStatisticsUserQueriesFastTest.java | 5 +--
.../cache/IgniteCacheInsertSqlQuerySelfTest.java | 42 +++++++++++++------
.../IgniteCacheSqlInsertValidationSelfTest.java | 5 +--
.../IgniteInsertNullableDuplicatesSqlTest.java | 49 +++++++++++-----------
11 files changed, 115 insertions(+), 122 deletions(-)
diff --git
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java
index 5ee18354c91..6b39ccb587d 100644
---
a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java
+++
b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java
@@ -26,6 +26,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.concurrent.Callable;
import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.internal.util.lang.RunnableX;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.GridTestUtils;
import org.junit.Test;
@@ -154,18 +155,35 @@ public class JdbcInsertStatementSelfTest extends
JdbcAbstractDmlStatementSelfTes
}
/**
- *
+ * Checks whether it's impossible to insert duplicate in single key
statement.
*/
@Test
- public void testDuplicateKeys() {
- jcache(0).put("p2", new Person(2, "Joe", "Black", 35));
+ public void testDuplicateSingleKey() {
+ doTestDuplicate(
+ () -> stmt.execute(SQL),
+ "insert into Person(_key, id, firstName, lastName, age, data)
values " +
+ "('p2', 2, 'Joe', 'Black', 35, RAWTOHEX('Black'))"
+ );
+ }
- Throwable reason = GridTestUtils.assertThrows(log, new
Callable<Object>() {
- /** {@inheritDoc} */
- @Override public Object call() throws Exception {
- return stmt.execute(SQL);
- }
- }, SQLException.class, null);
+ /**
+ * Checks whether it's impossible to insert duplicate in multiple keys
statement.
+ */
+ @Test
+ public void testDuplicateMultipleKeys() {
+ doTestDuplicate(
+ () -> jcache(0).put("p2", new Person(2, "Joe", "Black", 35)),
+ SQL
+ );
+ }
+
+ /**
+ *
+ */
+ private void doTestDuplicate(RunnableX initClosure, String sql) {
+ initClosure.run();
+
+ Throwable reason = GridTestUtils.assertThrows(log, () ->
stmt.execute(sql), SQLException.class, null);
reason = reason.getCause();
diff --git
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinInsertStatementSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinInsertStatementSelfTest.java
index 44f3ddad44f..c9f46abc2b3 100644
---
a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinInsertStatementSelfTest.java
+++
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinInsertStatementSelfTest.java
@@ -23,8 +23,8 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.concurrent.Callable;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.lang.RunnableX;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.ListeningTestLogger;
import org.apache.ignite.testframework.LogListener;
@@ -190,11 +190,33 @@ public class JdbcThinInsertStatementSelfTest extends
JdbcThinAbstractDmlStatemen
}
/**
- *
+ * Checks whether it's impossible to insert duplicate in single key
statement.
+ */
+ @Test
+ public void testDuplicateSingleKey() throws InterruptedException {
+ doTestDuplicate(
+ () -> stmt.execute(SQL),
+ "insert into Person(_key, id, firstName, lastName, age) values " +
+ "('p2', 2, 'Joe', 'Black', 35)"
+ );
+ }
+
+ /**
+ * Checks whether it's impossible to insert duplicate in multiple keys
statement.
*/
@Test
- public void testDuplicateKeys() throws InterruptedException {
- jcache(0).put("p2", new Person(2, "Joe", "Black", 35));
+ public void testDuplicateMultipleKeys() throws InterruptedException {
+ doTestDuplicate(
+ () -> jcache(0).put("p2", new Person(2, "Joe", "Black", 35)),
+ SQL
+ );
+ }
+
+ /**
+ *
+ */
+ private void doTestDuplicate(RunnableX initClosure, String sql) throws
InterruptedException {
+ initClosure.run();
LogListener lsnr = LogListener
.matches("Failed to execute SQL query")
@@ -202,12 +224,7 @@ public class JdbcThinInsertStatementSelfTest extends
JdbcThinAbstractDmlStatemen
srvLog.registerListener(lsnr);
- GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
- /** {@inheritDoc} */
- @Override public Object call() throws Exception {
- return stmt.execute(SQL);
- }
- }, SQLException.class,
+ GridTestUtils.assertThrowsAnyCause(log, () -> stmt.execute(sql),
SQLException.class,
"Failed to INSERT some keys because they are already in cache
[keys=[p2]]");
assertFalse(lsnr.check(1000L));
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java
index 891496426a5..de53c276ac5 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java
@@ -31,7 +31,6 @@ import org.apache.ignite.internal.binary.GridBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.transactions.TransactionDuplicateKeyException;
import org.jetbrains.annotations.Nullable;
/**
@@ -295,8 +294,6 @@ public abstract class SqlListenerUtils {
public static int exceptionToSqlErrorCode(Throwable e) {
if (e instanceof QueryCancelledException)
return IgniteQueryErrorCode.QUERY_CANCELED;
- if (e instanceof TransactionDuplicateKeyException)
- return IgniteQueryErrorCode.DUPLICATE_KEY;
if (e instanceof IgniteSQLException)
return ((IgniteSQLException)e).statusCode();
else
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 27c73d6a3f9..e4efdd3b38b 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
@@ -71,7 +71,6 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.transactions.TransactionDuplicateKeyException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -1590,11 +1589,6 @@ public class QueryUtils {
code = ((IgniteSQLException)e).statusCode();
}
- else if (e instanceof TransactionDuplicateKeyException) {
- code = IgniteQueryErrorCode.DUPLICATE_KEY;
-
- sqlState = IgniteQueryErrorCode.codeToSqlState(code);
- }
else {
sqlState = SqlStateCode.INTERNAL_ERROR;
diff --git
a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionDuplicateKeyException.java
b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionDuplicateKeyException.java
deleted file mode 100644
index 55ee86734a6..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionDuplicateKeyException.java
+++ /dev/null
@@ -1,45 +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.transactions;
-
-/**
- * Exception thrown whenever transaction tries to inserts entry with same mvcc
version more than once.
- */
-public class TransactionDuplicateKeyException extends TransactionException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates new duplicate ket exception with given error message.
- *
- * @param msg Error message.\
- * @param cause Optional nested exception (can be {@code null}).
- */
- public TransactionDuplicateKeyException(String msg, Exception cause) {
- super(msg, cause);
- }
-
- /**
- * Creates new duplicate ket exception with given error message.
- *
- * @param msg Error message.
- */
- public TransactionDuplicateKeyException(String msg) {
- super(msg);
- }
-}
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties
b/modules/core/src/main/resources/META-INF/classnames.properties
index 7a45d5841c8..70e1e4eab8c 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -2417,7 +2417,6 @@ org.apache.ignite.stream.StreamVisitor
org.apache.ignite.stream.StreamVisitor$1
org.apache.ignite.transactions.TransactionConcurrency
org.apache.ignite.transactions.TransactionDeadlockException
-org.apache.ignite.transactions.TransactionDuplicateKeyException
org.apache.ignite.transactions.TransactionException
org.apache.ignite.transactions.TransactionHeuristicException
org.apache.ignite.transactions.TransactionIsolation
diff --git
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java
index e5d3d4e90b2..1cfd895fac4 100644
---
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java
+++
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java
@@ -51,7 +51,6 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.transactions.TransactionDuplicateKeyException;
import org.h2.util.DateTimeUtils;
import org.h2.util.LocalDateTimeUtils;
import org.h2.value.Value;
@@ -196,6 +195,8 @@ public class DmlUtils {
private static long dmlDoInsert(UpdatePlan plan, Iterable<List<?>> cursor,
int pageSize) throws IgniteCheckedException {
GridCacheContext cctx = plan.cacheContext();
+ final String errMsg = "Failed to INSERT some keys because they are
already in cache [keys=";
+
// If we have just one item to put, just do so
if (plan.rowCount() == 1) {
IgniteBiTuple t = plan.processRow(cursor.iterator().next());
@@ -208,7 +209,7 @@ public class DmlUtils {
if (cctx.cache().putIfAbsent(t.getKey(), t.getValue()))
return 1;
else
- throw new TransactionDuplicateKeyException("Duplicate key
during INSERT [key=" + t.getKey() + ']');
+ throw new IgniteSQLException(errMsg + '[' + t.getKey() +
"]]", DUPLICATE_KEY);
}
}
else {
@@ -226,8 +227,7 @@ public class DmlUtils {
SQLException resEx = snd.error();
if (!F.isEmpty(snd.failedKeys())) {
- String msg = "Failed to INSERT some keys because they are
already in cache " +
- "[keys=" + snd.failedKeys() + ']';
+ String msg = errMsg + snd.failedKeys() + ']';
SQLException dupEx = new SQLException(msg,
SqlStateCode.CONSTRAINT_VIOLATION);
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/metric/SqlStatisticsUserQueriesFastTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/metric/SqlStatisticsUserQueriesFastTest.java
index 36101662046..e5f957cb5b0 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/metric/SqlStatisticsUserQueriesFastTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/metric/SqlStatisticsUserQueriesFastTest.java
@@ -30,7 +30,6 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.running.RunningQueryManager;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.transactions.TransactionDuplicateKeyException;
import org.junit.Test;
import static org.apache.ignite.internal.util.IgniteUtils.resolveIgnitePath;
@@ -147,8 +146,8 @@ public class SqlStatisticsUserQueriesFastTest extends
UserQueriesTestBase {
assertMetricsIncrementedOnlyOnReducer(() ->
GridTestUtils.assertThrowsAnyCause(
log,
() -> cache.query(new SqlFieldsQuery("INSERT INTO TAB VALUES(5, 'I
will NOT be inserted')")).getAll(),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT"),
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache"),
"failed");
}
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
index c0dba13e968..cfe59d025eb 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.cache;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.UUID;
-import java.util.concurrent.Callable;
+import java.util.function.Consumer;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.SqlFieldsQuery;
@@ -172,25 +172,41 @@ public class IgniteCacheInsertSqlQuerySelfTest extends
IgniteCacheAbstractInsert
}
/**
- *
+ * Checks whether it's impossible to insert duplicate in single key
statement.
*/
@Test
- public void testDuplicateKeysException() {
+ public void testDuplicateSingleKey() {
+ doTestDuplicate(
+ p -> p.query(new SqlFieldsQuery("insert into Integer(_key, _val)
values (1, ?), " +
+ "(?, 5), (5, 6)").setArgs(2, 3)),
+ new SqlFieldsQuery("insert into Integer(_key, _val) values (?,
?)").setArgs(3, 5)
+ );
+ }
+
+ /**
+ * Checks whether it's impossible to insert duplicate in multiple keys
statement.
+ */
+ @Test
+ public void testDuplicateMultipleKeys() {
+ doTestDuplicate(
+ p -> p.put(3, 5),
+ new SqlFieldsQuery("insert into Integer(_key, _val) values (1, ?),
" +
+ "(?, 4), (5, 6)").setArgs(2, 3)
+ );
+ }
+
+ /**
+ *
+ */
+ private void doTestDuplicate(Consumer<IgniteCache<Integer, Integer>>
initAction, SqlFieldsQuery sql) {
final IgniteCache<Integer, Integer> p = ignite(0).cache("I2I");
p.clear();
- p.put(3, 5);
-
- GridTestUtils.assertThrows(log, new Callable<Void>() {
- /** {@inheritDoc} */
- @Override public Void call() throws Exception {
- p.query(new SqlFieldsQuery("insert into Integer(_key, _val)
values (1, ?), " +
- "(?, 4), (5, 6)").setArgs(2, 3));
+ initAction.accept(p);
- return null;
- }
- }, CacheException.class, "Failed to INSERT some keys because they are
already in cache [keys=[3]]");
+ GridTestUtils.assertThrows(log, () -> p.query(sql),
CacheException.class,
+ "Failed to INSERT some keys because they are already in cache
[keys=[3]]");
assertEquals(2, (int)p.get(1));
assertEquals(5, (int)p.get(3));
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlInsertValidationSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlInsertValidationSelfTest.java
index 94113a73559..c3cb6546f75 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlInsertValidationSelfTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlInsertValidationSelfTest.java
@@ -36,7 +36,6 @@ import
org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonT
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder;
import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.transactions.TransactionDuplicateKeyException;
import org.junit.Test;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -149,8 +148,8 @@ public class IgniteCacheSqlInsertValidationSelfTest extends
AbstractIndexingComm
GridTestUtils.assertThrows(log(),
() -> execute("INSERT INTO FORGOTTEN_KEY_FLDS(FK1, FK2, FV1, FV2)
VALUES (8,9,10,11)"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
}
/**
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteInsertNullableDuplicatesSqlTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteInsertNullableDuplicatesSqlTest.java
index ecfa5df71e7..caf1c2c67fd 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteInsertNullableDuplicatesSqlTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteInsertNullableDuplicatesSqlTest.java
@@ -28,7 +28,6 @@ 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.internal.util.typedef.F;
-import org.apache.ignite.transactions.TransactionDuplicateKeyException;
import org.junit.Test;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
@@ -69,13 +68,13 @@ public class IgniteInsertNullableDuplicatesSqlTest extends
AbstractIndexingCommo
assertThrows(log,
() -> sql("insert into test (id1, id2, val) values (1, null, 1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
assertThrows(log,
() -> sql("insert into test (id1, val) values (1, 1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
assertEquals(sql("SELECT * FROM test").getAll().size(), 1);
}
@@ -90,18 +89,18 @@ public class IgniteInsertNullableDuplicatesSqlTest extends
AbstractIndexingCommo
assertThrows(log,
() -> sql("insert into test (id1, val) values (null, 1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
assertThrows(log,
() -> sql("insert into test (id2, val) values (null, 1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
assertThrows(log,
() -> sql("insert into test (id2, id1, val) values (null, null,
1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
assertEquals(sql("SELECT * FROM test").getAll().size(), 1);
}
@@ -115,8 +114,8 @@ public class IgniteInsertNullableDuplicatesSqlTest extends
AbstractIndexingCommo
sql("insert into test (val) values (1);");
assertThrows(log,
() -> sql("insert into test (val) values (1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
}
/**
@@ -131,13 +130,13 @@ public class IgniteInsertNullableDuplicatesSqlTest
extends AbstractIndexingCommo
assertThrows(log,
() -> sql("insert into test (id1, val) values (0, 1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in
cache");
assertThrows(log,
() -> sql("insert into test (val) values (2);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in
cache");
List<List<?>> sql = sql("select * from test order by val
asc;").getAll();
@@ -183,13 +182,13 @@ public class IgniteInsertNullableDuplicatesSqlTest
extends AbstractIndexingCommo
assertThrows(log,
() -> sql("insert into test (id1, val) values (0, 1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in
cache");
assertThrows(log,
() -> sql("insert into test (val) values (2);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in
cache");
List<List<?>> sql = sql("select * from test order by val
asc;").getAll();
@@ -232,13 +231,13 @@ public class IgniteInsertNullableDuplicatesSqlTest
extends AbstractIndexingCommo
assertThrows(log,
() -> sql("insert into test (id1, id2, val) values (1, null, 1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
assertThrows(log,
() -> sql("insert into test (id1, val) values (1, 1);"),
- TransactionDuplicateKeyException.class,
- "Duplicate key during INSERT");
+ IgniteSQLException.class,
+ "Failed to INSERT some keys because they are already in cache");
assertEquals(sql("SELECT * FROM test").getAll().size(), 1);
}