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

sk0x50 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 901b9168d6 IGNITE-20825 Fix 
ItDurableFinishTest.testCoordinatorMissedResponse  flakiness (#2835)
901b9168d6 is described below

commit 901b9168d6ddfc2044c6dca5e65072c6d5da1fa0
Author: Cyrill <[email protected]>
AuthorDate: Fri Nov 17 11:54:45 2023 +0300

    IGNITE-20825 Fix ItDurableFinishTest.testCoordinatorMissedResponse  
flakiness (#2835)
    
    Co-authored-by: Kirill Sizov <[email protected]>
---
 .../ignite/internal/table/ItDurableFinishTest.java | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItDurableFinishTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItDurableFinishTest.java
index 7060c8abef..606165ad51 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItDurableFinishTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItDurableFinishTest.java
@@ -27,6 +27,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
@@ -48,7 +50,6 @@ import org.apache.ignite.network.NetworkMessage;
 import org.apache.ignite.table.Tuple;
 import org.apache.ignite.tx.TransactionException;
 import org.jetbrains.annotations.Nullable;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -59,6 +60,8 @@ public class ItDurableFinishTest extends 
ClusterPerTestIntegrationTest {
 
     private static final String TABLE_NAME = "TEST_FINISH";
 
+    private final Collection<CompletableFuture<?>> futures = new ArrayList<>();
+
     private void createTestTableWith3Replicas() {
         String zoneSql = "create zone test_zone with partitions=1, replicas=3";
         String sql = "create table " + TABLE_NAME + " (key int primary key, 
val varchar(20))"
@@ -178,9 +181,12 @@ public class ItDurableFinishTest extends 
ClusterPerTestIntegrationTest {
     }
 
     @Test
-    @Disabled("https://issues.apache.org/jira/browse/IGNITE-20825";)
     void testCoordinatorMissedResponse() throws ExecutionException, 
InterruptedException {
         testFinishRow(this::coordinatorMissedResponse, this::commitRow);
+
+        for (CompletableFuture<?> future : futures) {
+            assertThat(future, willCompleteSuccessfully());
+        }
     }
 
     private void coordinatorMissedResponse(
@@ -197,15 +203,17 @@ public class ItDurableFinishTest extends 
ClusterPerTestIntegrationTest {
             if (networkMessage instanceof TxFinishReplicaRequest && 
!messageHandled.get()) {
                 messageHandled.set(true);
 
-                logger().info("Pausing message handling: {}.", networkMessage);
+                logger().info("Drop message [msg={}].", networkMessage);
 
-                CompletableFuture<NetworkMessage> finish = 
coordinatorMessaging.invoke(s, networkMessage, 3000);
-
-                assertThat(finish, willCompleteSuccessfully());
+                // Here we act as a man-in-the-middle: the finish request is 
intercepted and further routed to
+                // the commit partition as normal. The coordinator instead 
fails with a timeout (see DefaultMessagingService.invoke0)
+                // and has to retry the finish request according to the 
durable finish logic.
+                // The test checks that the second coordinator attempt to 
commit succeeds
+                // and the server is able to apply a COMMIT over COMMIT 
without exceptions.
 
-                finish.join();
+                CompletableFuture<NetworkMessage> finish = 
coordinatorMessaging.invoke(s, networkMessage, 3000);
 
-                logger().info("Continue message handling: {}.", 
networkMessage);
+                futures.add(finish);
 
                 return true;
             }

Reply via email to