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

sanpwc 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 a55597d220 IGNITE-18003 ItTablesApiTest#testCreateDropTable fixed. 
(#1266)
a55597d220 is described below

commit a55597d2207bf055380fa65d4e569b3bd6ac8c03
Author: Denis Chudov <moongll...@gmail.com>
AuthorDate: Thu Nov 3 18:24:19 2022 +0200

    IGNITE-18003 ItTablesApiTest#testCreateDropTable fixed. (#1266)
---
 .../org/apache/ignite/internal/index/IndexManager.java |  4 ++--
 .../apache/ignite/internal/index/IndexManagerTest.java |  3 ++-
 .../ignite/internal/runner/app/ItTablesApiTest.java    |  1 -
 .../internal/table/distributed/TableManager.java       | 18 ++++++++++++++++++
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
 
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
index 2ca2fcb2ea..519e008384 100644
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
+++ 
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
@@ -325,7 +325,7 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
             return failedFuture(new NodeStoppingException());
         }
 
-        return tableManager.tableAsync(evt.oldValue().tableId())
+        return tableManager.tableAsync(evt.storageRevision(), 
evt.oldValue().tableId())
                 .thenAccept(table -> {
                     if (table != null) { // in case of DROP TABLE the table 
will be removed first
                         table.unregisterIndex(idxId);
@@ -383,7 +383,7 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
                 index.descriptor().columns().toArray(STRING_EMPTY_ARRAY)
         );
 
-        return tableManager.tableAsync(tableId)
+        return tableManager.tableAsync(causalityToken, tableId)
                 .thenAccept(table -> {
                     if (index instanceof HashIndex) {
                         table.registerHashIndex(tableIndexView.id(), 
tableIndexView.uniq(), tableRowConverter::convert);
diff --git 
a/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
 
b/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
index 01f458b487..ef80dd7774 100644
--- 
a/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
+++ 
b/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
@@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -125,7 +126,7 @@ public class IndexManagerTest {
 
         TableManager tableManagerMock = mock(TableManager.class);
 
-        when(tableManagerMock.tableAsync(any(UUID.class)))
+        when(tableManagerMock.tableAsync(anyLong(), any(UUID.class)))
                 
.thenReturn(CompletableFuture.completedFuture(mock(TableImpl.class)));
 
         indexManager = new IndexManager(tablesConfig, 
mock(SchemaManager.class), tableManagerMock);
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 000e8d5a39..ba9eb80043 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
@@ -393,7 +393,6 @@ public class ItTablesApiTest extends IgniteAbstractTest {
      *
      * @throws Exception If failed.
      */
-    @Disabled("https://issues.apache.org/jira/browse/IGNITE-18003";)
     @Test
     public void testCreateDropTable() throws Exception {
         clusterNodes.forEach(ign -> 
assertNull(ign.tables().table(TABLE_NAME)));
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
index 6fd811df83..93f8142ecd 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
@@ -1548,6 +1548,24 @@ public class TableManager extends Producer<TableEvent, 
TableEventParameters> imp
                 .thenApply(Function.identity());
     }
 
+    /**
+     * Asynchronously gets the table using causality token.
+     *
+     * @param causalityToken Causality token.
+     * @param id Table id.
+     * @return Future.
+     */
+    public CompletableFuture<TableImpl> tableAsync(long causalityToken, UUID 
id) {
+        if (!busyLock.enterBusy()) {
+            throw new IgniteException(new NodeStoppingException());
+        }
+        try {
+            return tablesByIdVv.get(causalityToken).thenApply(tablesById -> 
tablesById.get(id));
+        } finally {
+            busyLock.leaveBusy();
+        }
+    }
+
     /** {@inheritDoc} */
     @Override
     public CompletableFuture<TableImpl> tableAsync(UUID id) {

Reply via email to