This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 86ad10f411 IGNITE-21172 Fix incorrect error code usage (#3453)
86ad10f411 is described below

commit 86ad10f4113ab70c8b07e855f7c3f61cc49eb2a9
Author: Andrew V. Mashenkov <[email protected]>
AuthorDate: Tue Mar 26 14:02:23 2024 +0300

    IGNITE-21172 Fix incorrect error code usage (#3453)
---
 .../ignite/internal/runner/app/ItTablesApiTest.java    | 18 ++++++++++++++++++
 .../runner/app/client/ItThinClientConnectionTest.java  |  4 ++--
 .../table/distributed/schema/SchemaVersionsImpl.java   |  4 ++--
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
index 18dd0bae29..db079f00be 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItTablesApiTest.java
@@ -22,6 +22,7 @@ import static 
java.util.concurrent.CompletableFuture.supplyAsync;
 import static 
org.apache.ignite.internal.IndexTestUtils.waitForIndexToAppearInAnyState;
 import static 
org.apache.ignite.internal.sql.engine.util.SqlTestUtils.assertThrowsSqlException;
 import static 
org.apache.ignite.internal.test.WatchListenerInhibitor.metastorageEventsInhibitor;
+import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrows;
 import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
 import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.testNodeName;
 import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutureExceptionMatcher.willThrowWithCauseOrSuppressed;
@@ -54,6 +55,8 @@ import 
org.apache.ignite.internal.testframework.IgniteAbstractTest;
 import org.apache.ignite.internal.testframework.TestIgnitionManager;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.lang.ErrorGroups.Sql;
+import org.apache.ignite.lang.TableNotFoundException;
+import org.apache.ignite.table.RecordView;
 import org.apache.ignite.table.Table;
 import org.apache.ignite.table.Tuple;
 import org.junit.jupiter.api.AfterEach;
@@ -430,6 +433,21 @@ public class ItTablesApiTest extends IgniteAbstractTest {
         ignite1Inhibitor.stopInhibit();
     }
 
+    @Test
+    public void usingTableAfterDrop() {
+        Ignite ignite0 = clusterNodes.get(0);
+        Table tbl = createTable(ignite0, TABLE_NAME);
+        RecordView<Tuple> view = tbl.recordView();
+
+        sql(ignite0, "DROP TABLE " + TABLE_NAME);
+
+        assertThrows(
+                TableNotFoundException.class,
+                () -> view.insert(null, Tuple.create().set("key", 
1L).set("valInt", 1).set("valStr", "1")),
+                "Table does not exist or was dropped concurrently"
+        );
+    }
+
     /**
      * Creates table.
      *
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientConnectionTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientConnectionTest.java
index ae06464b80..b7b09eb91e 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientConnectionTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientConnectionTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.runner.app.client;
 
+import static org.apache.ignite.lang.ErrorGroups.Table.TABLE_NOT_FOUND_ERR;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.startsWith;
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -26,7 +27,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 import java.util.List;
 import org.apache.ignite.client.IgniteClient;
 import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
-import org.apache.ignite.lang.ErrorGroups.Client;
 import org.apache.ignite.lang.IgniteException;
 import org.apache.ignite.network.ClusterNode;
 import org.apache.ignite.sql.IgniteSql;
@@ -87,6 +87,6 @@ public class ItThinClientConnectionTest extends 
ItAbstractThinClientTest {
         sql.execute(null, "DROP TABLE DELME");
 
         IgniteException ex = assertThrows(IgniteException.class, () -> 
table.recordView(Integer.class).delete(null, 1));
-        assertEquals(Client.TABLE_ID_NOT_FOUND_ERR, ex.code(), 
ex.getMessage());
+        assertEquals(TABLE_NOT_FOUND_ERR, ex.code(), ex.getMessage());
     }
 }
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/schema/SchemaVersionsImpl.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/schema/SchemaVersionsImpl.java
index eeb6071b50..26d100bba3 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/schema/SchemaVersionsImpl.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/schema/SchemaVersionsImpl.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.table.distributed.schema;
 
-import static org.apache.ignite.lang.ErrorGroups.Client.TABLE_ID_NOT_FOUND_ERR;
+import static org.apache.ignite.lang.ErrorGroups.Table.TABLE_NOT_FOUND_ERR;
 
 import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
@@ -64,7 +64,7 @@ public class SchemaVersionsImpl implements SchemaVersions {
                     if (table == null) {
                         String message = "Table does not exist or was dropped 
concurrently: " + tableId;
 
-                        throw new TableNotFoundException(UUID.randomUUID(), 
TABLE_ID_NOT_FOUND_ERR, message, null);
+                        throw new TableNotFoundException(UUID.randomUUID(), 
TABLE_NOT_FOUND_ERR, message, null);
                     }
 
                     return table;

Reply via email to