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

ibessonov 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 967b4ff98f7 IGNITE-26918 Fix a race in the restart partitions with 
cleanup logic (#6924)
967b4ff98f7 is described below

commit 967b4ff98f7ffd7e10a1ba0fb8731e70af7550ee
Author: Mirza Aliev <[email protected]>
AuthorDate: Mon Nov 10 17:15:52 2025 +0400

    IGNITE-26918 Fix a race in the restart partitions with cleanup logic (#6924)
---
 .../recovery/partitions/restart/ItRestartPartitionsTest.java        | 2 --
 .../partition/replicator/PartitionReplicaLifecycleManager.java      | 4 ++--
 ...tDisasterRecoveryControllerRestartPartitionsWithCleanupTest.java | 5 +----
 .../org/apache/ignite/internal/table/distributed/TableManager.java  | 2 +-
 .../table/distributed/disaster/DisasterRecoveryManager.java         | 6 +++---
 .../ignite/internal/disaster/ItDisasterRecoveryManagerTest.java     | 2 +-
 6 files changed, 8 insertions(+), 13 deletions(-)

diff --git 
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/recovery/partitions/restart/ItRestartPartitionsTest.java
 
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/recovery/partitions/restart/ItRestartPartitionsTest.java
index 5bc25e0e335..f4715dda55d 100644
--- 
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/recovery/partitions/restart/ItRestartPartitionsTest.java
+++ 
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/recovery/partitions/restart/ItRestartPartitionsTest.java
@@ -31,7 +31,6 @@ import java.util.Set;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.internal.cli.CliIntegrationTest;
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.DisabledIf;
 
@@ -171,7 +170,6 @@ public abstract class ItRestartPartitionsTest extends 
CliIntegrationTest {
     }
 
     @Test
-    @Disabled("https://issues.apache.org/jira/browse/IGNITE-26918";)
     public void testRestartAllPartitionsWithCleanup() throws 
InterruptedException {
         awaitPartitionsToBeHealthy(ZONE, Set.of());
 
diff --git 
a/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java
 
b/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java
index 17a2f376a15..64f145861f0 100644
--- 
a/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java
+++ 
b/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java
@@ -1622,7 +1622,7 @@ public class PartitionReplicaLifecycleManager extends
                     .thenCompose(v -> {
                         try {
                             return replicaMgr.stopReplica(zonePartitionId)
-                                    .thenCompose(replicaWasStopped -> {
+                                    .thenComposeAsync(replicaWasStopped -> {
                                         
afterReplicaStopAction.accept(replicaWasStopped);
 
                                         if (!replicaWasStopped) {
@@ -1632,7 +1632,7 @@ public class PartitionReplicaLifecycleManager extends
                                         
replicationGroupIds.remove(zonePartitionId);
 
                                         return 
fireEvent(afterReplicaStoppedEvent, eventParameters);
-                                    });
+                                    }, ioExecutor);
                         } catch (NodeStoppingException e) {
                             return nullCompletedFuture();
                         }
diff --git 
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/recovery/ItDisasterRecoveryControllerRestartPartitionsWithCleanupTest.java
 
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/recovery/ItDisasterRecoveryControllerRestartPartitionsWithCleanupTest.java
index 60f1afc66fd..0673043ed7f 100644
--- 
a/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/recovery/ItDisasterRecoveryControllerRestartPartitionsWithCleanupTest.java
+++ 
b/modules/rest/src/integrationTest/java/org/apache/ignite/internal/rest/recovery/ItDisasterRecoveryControllerRestartPartitionsWithCleanupTest.java
@@ -46,7 +46,6 @@ import 
org.apache.ignite.internal.ClusterPerClassIntegrationTest;
 import org.apache.ignite.internal.rest.api.recovery.RestartPartitionsRequest;
 import 
org.apache.ignite.internal.rest.api.recovery.RestartZonePartitionsRequest;
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.DisabledIf;
 
@@ -70,7 +69,7 @@ public class 
ItDisasterRecoveryControllerRestartPartitionsWithCleanupTest extend
     HttpClient client;
 
     @BeforeAll
-    public void setUp() throws InterruptedException {
+    public void setUp() {
         sql(String.format(
                 "CREATE ZONE \"%s\" (REPLICAS %s) storage profiles ['%s']",
                 FIRST_ZONE,
@@ -199,7 +198,6 @@ public class 
ItDisasterRecoveryControllerRestartPartitionsWithCleanupTest extend
     }
 
     @Test
-    @Disabled("https://issues.apache.org/jira/browse/IGNITE-26918";)
     public void testRestartPartitionsWithCleanupAllPartitions() throws 
InterruptedException {
         awaitPartitionsToBeHealthy(FIRST_ZONE, Set.of());
 
@@ -213,7 +211,6 @@ public class 
ItDisasterRecoveryControllerRestartPartitionsWithCleanupTest extend
     }
 
     @Test
-    @Disabled("https://issues.apache.org/jira/browse/IGNITE-26918";)
     public void testRestartTablePartitionsWithCleanupAllPartitions() throws 
InterruptedException {
         awaitPartitionsToBeHealthy(FIRST_ZONE, Set.of());
 
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 7a9f2f176c2..eabbd7b9f5d 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
@@ -848,7 +848,7 @@ public class TableManager implements IgniteTablesInternal, 
IgniteComponent {
                                                     parameters.causalityToken()
                                             )
                                     ),
-                                    ioExecutor))
+                                    ioExecutor).thenCompose(identity()))
                             .toArray(CompletableFuture[]::new);
 
                     return allOf(futures);
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
index 24f8303f5c1..7e3f10014b9 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
@@ -1195,9 +1195,9 @@ public class DisasterRecoveryManager implements 
IgniteComponent, SystemViewProvi
     private CompletableFuture<Void> processNewRequest(DisasterRecoveryRequest 
request, long revision) {
         UUID operationId = request.operationId();
 
-        CompletableFuture<Void> operationFuture = new CompletableFuture<Void>()
-                .whenComplete((v, throwable) -> 
ongoingOperationsById.remove(operationId))
-                .orTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+        CompletableFuture<Void> operationFuture = new 
CompletableFuture<Void>().orTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+
+        operationFuture.whenComplete((v, throwable) -> 
ongoingOperationsById.remove(operationId));
 
         byte[] serializedRequest = VersionedSerialization.toBytes(request, 
DisasterRecoveryRequestSerializer.INSTANCE);
 
diff --git 
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
 
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
index 77f6517c6a1..3c3a78d4580 100644
--- 
a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
+++ 
b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoveryManagerTest.java
@@ -986,7 +986,7 @@ public class ItDisasterRecoveryManagerTest extends 
ClusterPerTestIntegrationTest
 
         IgniteImpl nodeToCleanup = findZoneNodeConformingOptions(testZone, 
primaryReplica, raftLeader);
 
-        CompletableFuture<Void> restartPartitionsWithCleanupFuture = 
node.disasterRecoveryManager().restartPartitionsWithCleanup(
+        CompletableFuture<Void> restartPartitionsWithCleanupFuture = 
nodeToCleanup.disasterRecoveryManager().restartPartitionsWithCleanup(
                 Set.of(nodeToCleanup.name()),
                 testZone,
                 Set.of(0)

Reply via email to