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

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

commit 9e56eb7979daf9595f4558f7c402f56f861965f4
Author: amashenkov <[email protected]>
AuthorDate: Wed Mar 20 17:53:01 2024 +0300

    Add test. Fix invalid error code.
---
 .../ignite/internal/runner/app/ItTablesApiTest.java    | 18 ++++++++++++++++++
 .../table/distributed/schema/SchemaVersionsImpl.java   |  4 ++--
 2 files changed, 20 insertions(+), 2 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 97b7dbc49b..1888ed35f8 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,7 +55,9 @@ 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.sql.Session;
+import org.apache.ignite.table.RecordView;
 import org.apache.ignite.table.Table;
 import org.apache.ignite.table.Tuple;
 import org.junit.jupiter.api.AfterEach;
@@ -431,6 +434,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/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 40d7b56a14..f3858f62fe 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