You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sd...@apache.org on 2022/12/30 12:17:07 UTC

[ignite-3] branch main updated: IGNITE-18451 Node stop may hang if an index is not created yet (#1486)

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

sdanilov 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 78ecc7ac6a IGNITE-18451 Node stop may hang if an index is not created yet (#1486)
78ecc7ac6a is described below

commit 78ecc7ac6a1acebbf58134880d3f542d6da9ea54
Author: Roman Puchkovskiy <ro...@gmail.com>
AuthorDate: Fri Dec 30 16:17:01 2022 +0400

    IGNITE-18451 Node stop may hang if an index is not created yet (#1486)
---
 .../src/main/java/org/apache/ignite/lang/ErrorGroups.java     |  3 +++
 .../main/java/org/apache/ignite/internal/table/TableImpl.java | 11 +++++++++++
 .../ignite/internal/table/distributed/TableManager.java       |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java b/modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java
index 209c701299..cdf5b0b696 100755
--- a/modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/ErrorGroups.java
@@ -60,6 +60,9 @@ public class ErrorGroups {
 
         /** Column not found. */
         public static final int COLUMN_NOT_FOUND_ERR = TABLE_ERR_GROUP.registerErrorCode(4);
+
+        /** Table is stopping. */
+        public static final int TABLE_STOPPING_ERR = TABLE_ERR_GROUP.registerErrorCode(5);
     }
 
     /** Client error group. */
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/TableImpl.java b/modules/table/src/main/java/org/apache/ignite/internal/table/TableImpl.java
index 78c4c097ab..78d7945661 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/TableImpl.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/TableImpl.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.table.distributed.IndexLocker;
 import org.apache.ignite.internal.table.distributed.SortedIndexLocker;
 import org.apache.ignite.internal.table.distributed.TableSchemaAwareIndexStorage;
 import org.apache.ignite.internal.tx.LockManager;
+import org.apache.ignite.lang.ErrorGroups;
 import org.apache.ignite.lang.IgniteInternalException;
 import org.apache.ignite.network.ClusterNode;
 import org.apache.ignite.table.KeyValueView;
@@ -371,6 +372,16 @@ public class TableImpl implements Table {
         allOf(toWait.toArray(CompletableFuture[]::new)).join();
     }
 
+    /**
+     * Prepares this table for being closed.
+     */
+    public void beforeClose() {
+        pkId.completeExceptionally(new IgniteInternalException(
+                ErrorGroups.Table.TABLE_STOPPING_ERR,
+                "Table is being stopped: tableId=" + tableId()
+        ));
+    }
+
     @FunctionalInterface
     private interface IndexLockerFactory {
         /** Creates the index decorator for given partition. */
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 691674520c..3152571069 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
@@ -965,6 +965,8 @@ public class TableManager extends Producer<TableEvent, TableEventParameters> imp
      */
     private void cleanUpTablesResources(Map<UUID, TableImpl> tables) {
         for (TableImpl table : tables.values()) {
+            table.beforeClose();
+
             List<Runnable> stopping = new ArrayList<>();
 
             AtomicReference<Exception> exception = new AtomicReference<>();