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

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new e0974f2054 HDDS-9706. Intermittent failure in 
TestOzoneManagerHAWithStoppedNodes#testOMRatisSnapshot. (#5645)
e0974f2054 is described below

commit e0974f205442ae1d9d8cec4f553106006f0fcfa7
Author: Devesh Kumar Singh <[email protected]>
AuthorDate: Wed Nov 22 21:16:12 2023 +0530

    HDDS-9706. Intermittent failure in 
TestOzoneManagerHAWithStoppedNodes#testOMRatisSnapshot. (#5645)
---
 .../ozone/om/TestOzoneManagerHAWithAllRunning.java | 82 +++++++++++++++++++++
 .../om/TestOzoneManagerHAWithStoppedNodes.java     | 83 ----------------------
 2 files changed, 82 insertions(+), 83 deletions(-)

diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithAllRunning.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithAllRunning.java
index 5d3fb22298..8d933912c5 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithAllRunning.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithAllRunning.java
@@ -1014,4 +1014,86 @@ class TestOzoneManagerHAWithAllRunning extends 
TestOzoneManagerHA {
     Assertions.assertTrue(removeAcl);
   }
 
+  @Test
+  void testOMRatisSnapshot() throws Exception {
+    String userName = "user" + RandomStringUtils.randomNumeric(5);
+    String adminName = "admin" + RandomStringUtils.randomNumeric(5);
+    String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
+    String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
+
+    VolumeArgs createVolumeArgs = VolumeArgs.newBuilder()
+        .setOwner(userName)
+        .setAdmin(adminName)
+        .build();
+
+    ObjectStore objectStore = getObjectStore();
+    objectStore.createVolume(volumeName, createVolumeArgs);
+    OzoneVolume retVolumeinfo = objectStore.getVolume(volumeName);
+
+    retVolumeinfo.createBucket(bucketName);
+    OzoneBucket ozoneBucket = retVolumeinfo.getBucket(bucketName);
+
+    String leaderOMNodeId = OmFailoverProxyUtil
+        .getFailoverProxyProvider(objectStore.getClientProxy())
+        .getCurrentProxyOMNodeId();
+
+    OzoneManager ozoneManager = getCluster().getOzoneManager(leaderOMNodeId);
+
+    // Send commands to ratis to increase the log index so that ratis
+    // triggers a snapshot on the state machine.
+
+    long appliedLogIndex = 0;
+    while (appliedLogIndex <= getSnapshotThreshold()) {
+      createKey(ozoneBucket);
+      appliedLogIndex = ozoneManager.getOmRatisServer()
+          .getLastAppliedTermIndex().getIndex();
+    }
+
+    GenericTestUtils.waitFor(() -> {
+      try {
+        if (ozoneManager.getRatisSnapshotIndex() > 0) {
+          return true;
+        }
+      } catch (IOException ex) {
+        Assertions.fail("test failed during transactionInfo read");
+      }
+      return false;
+    }, 1000, 100000);
+
+    ozoneManager.awaitDoubleBufferFlush();
+    // The current lastAppliedLogIndex on the state machine should be greater
+    // than or equal to the saved snapshot index.
+    long smLastAppliedIndex =
+        ozoneManager.getOmRatisServer().getLastAppliedTermIndex().getIndex();
+    long ratisSnapshotIndex = ozoneManager.getRatisSnapshotIndex();
+    assertTrue(smLastAppliedIndex >= ratisSnapshotIndex,
+        "LastAppliedIndex on OM State Machine ("
+            + smLastAppliedIndex + ") is less than the saved snapshot index("
+            + ratisSnapshotIndex + ").");
+
+    // Add more transactions to Ratis to trigger another snapshot
+    while (appliedLogIndex <= (smLastAppliedIndex + getSnapshotThreshold())) {
+      createKey(ozoneBucket);
+      appliedLogIndex = ozoneManager.getOmRatisServer()
+          .getLastAppliedTermIndex().getIndex();
+    }
+
+    GenericTestUtils.waitFor(() -> {
+      try {
+        if (ozoneManager.getRatisSnapshotIndex() > 0) {
+          return true;
+        }
+      } catch (IOException ex) {
+        Assertions.fail("test failed during transactionInfo read");
+      }
+      return false;
+    }, 1000, 100000);
+
+    // The new snapshot index must be greater than the previous snapshot index
+    long ratisSnapshotIndexNew = ozoneManager.getRatisSnapshotIndex();
+    assertTrue(ratisSnapshotIndexNew > ratisSnapshotIndex,
+        "Latest snapshot index must be greater than previous " +
+            "snapshot indices");
+
+  }
 }
diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithStoppedNodes.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithStoppedNodes.java
index be642579cb..1a65d5d065 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithStoppedNodes.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerHAWithStoppedNodes.java
@@ -51,7 +51,6 @@ import org.junit.jupiter.api.Order;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestMethodOrder;
 
-import java.io.IOException;
 import java.net.ConnectException;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -237,88 +236,6 @@ public class TestOzoneManagerHAWithStoppedNodes extends 
TestOzoneManagerHA {
     assertNotEquals(firstProxyNodeId, newProxyNodeId);
   }
 
-  @Test
-  void testOMRatisSnapshot() throws Exception {
-    String userName = "user" + RandomStringUtils.randomNumeric(5);
-    String adminName = "admin" + RandomStringUtils.randomNumeric(5);
-    String volumeName = "volume" + RandomStringUtils.randomNumeric(5);
-    String bucketName = "bucket" + RandomStringUtils.randomNumeric(5);
-
-    VolumeArgs createVolumeArgs = VolumeArgs.newBuilder()
-        .setOwner(userName)
-        .setAdmin(adminName)
-        .build();
-
-    ObjectStore objectStore = getObjectStore();
-    objectStore.createVolume(volumeName, createVolumeArgs);
-    OzoneVolume retVolumeinfo = objectStore.getVolume(volumeName);
-
-    retVolumeinfo.createBucket(bucketName);
-    OzoneBucket ozoneBucket = retVolumeinfo.getBucket(bucketName);
-
-    String leaderOMNodeId = OmFailoverProxyUtil
-        .getFailoverProxyProvider(objectStore.getClientProxy())
-        .getCurrentProxyOMNodeId();
-
-    OzoneManager ozoneManager = getCluster().getOzoneManager(leaderOMNodeId);
-
-    // Send commands to ratis to increase the log index so that ratis
-    // triggers a snapshot on the state machine.
-
-    long appliedLogIndex = 0;
-    while (appliedLogIndex <= getSnapshotThreshold()) {
-      createKey(ozoneBucket);
-      appliedLogIndex = ozoneManager.getOmRatisServer()
-          .getLastAppliedTermIndex().getIndex();
-    }
-
-    GenericTestUtils.waitFor(() -> {
-      try {
-        if (ozoneManager.getRatisSnapshotIndex() > 0) {
-          return true;
-        }
-      } catch (IOException ex) {
-        Assertions.fail("test failed during transactionInfo read");
-      }
-      return false;
-    }, 1000, 100000);
-
-    // The current lastAppliedLogIndex on the state machine should be greater
-    // than or equal to the saved snapshot index.
-    long smLastAppliedIndex =
-        ozoneManager.getOmRatisServer().getLastAppliedTermIndex().getIndex();
-    long ratisSnapshotIndex = ozoneManager.getRatisSnapshotIndex();
-    assertTrue(smLastAppliedIndex >= ratisSnapshotIndex,
-        "LastAppliedIndex on OM State Machine ("
-        + smLastAppliedIndex + ") is less than the saved snapshot index("
-        + ratisSnapshotIndex + ").");
-
-    // Add more transactions to Ratis to trigger another snapshot
-    while (appliedLogIndex <= (smLastAppliedIndex + getSnapshotThreshold())) {
-      createKey(ozoneBucket);
-      appliedLogIndex = ozoneManager.getOmRatisServer()
-          .getLastAppliedTermIndex().getIndex();
-    }
-
-    GenericTestUtils.waitFor(() -> {
-      try {
-        if (ozoneManager.getRatisSnapshotIndex() > 0) {
-          return true;
-        }
-      } catch (IOException ex) {
-        Assertions.fail("test failed during transactionInfo read");
-      }
-      return false;
-    }, 1000, 100000);
-
-    // The new snapshot index must be greater than the previous snapshot index
-    long ratisSnapshotIndexNew = ozoneManager.getRatisSnapshotIndex();
-    assertTrue(ratisSnapshotIndexNew > ratisSnapshotIndex,
-        "Latest snapshot index must be greater than previous " +
-            "snapshot indices");
-
-  }
-
   @Test
   @Order(Integer.MAX_VALUE)
   void testOMRestart() throws Exception {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to