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

weichiu 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 2bac85f6e7 HDDS-4113. Intermittent failure in 
TestSCMSafeModeManager#testPipelinesNotCreatedUntilPreCheckPasses. (#5356)
2bac85f6e7 is described below

commit 2bac85f6e72cf564918e390ea352279d48665a7e
Author: Sadanand Shenoy <[email protected]>
AuthorDate: Mon Sep 25 22:34:38 2023 +0530

    HDDS-4113. Intermittent failure in 
TestSCMSafeModeManager#testPipelinesNotCreatedUntilPreCheckPasses. (#5356)
    
    Co-authored-by: Sadanand Shenoy <[email protected]>
---
 .../hdds/scm/safemode/TestSCMSafeModeManager.java  | 23 ++++++----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java
index 3f23123488..ad59d323eb 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java
@@ -41,7 +41,6 @@ import org.apache.hadoop.hdds.scm.HddsTestUtils;
 import org.apache.hadoop.hdds.scm.container.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.MockNodeManager;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
-import org.apache.hadoop.hdds.scm.exceptions.SCMException;
 import org.apache.hadoop.hdds.scm.ha.SCMHAManagerStub;
 import org.apache.hadoop.hdds.scm.ha.SCMContext;
 import org.apache.hadoop.hdds.scm.ha.SCMServiceManager;
@@ -58,7 +57,6 @@ import org.apache.hadoop.hdds.server.events.EventPublisher;
 import org.apache.hadoop.hdds.server.events.EventQueue;
 import org.apache.ozone.test.GenericTestUtils;
 
-import org.apache.ozone.test.tag.Unhealthy;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -639,7 +637,6 @@ public class TestSCMSafeModeManager {
   }
 
   @Test
-  @Unhealthy("The test is failing, enable after fixing it")
   public void testPipelinesNotCreatedUntilPreCheckPasses()
       throws Exception {
     int numOfDns = 5;
@@ -682,6 +679,10 @@ public class TestSCMSafeModeManager {
     // Assert SCM is in Safe mode.
     assertTrue(scmSafeModeManager.getInSafeMode());
 
+    // stop background pipeline creator as we manually create
+    // pipeline below
+    pipelineManager.getBackgroundPipelineCreator().stop();
+
     // Register all DataNodes except last one and assert SCM is in safe mode.
     for (int i = 0; i < numOfDns - 1; i++) {
       queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT,
@@ -700,20 +701,8 @@ public class TestSCMSafeModeManager {
     assertTrue(scmSafeModeManager.getPreCheckComplete());
     assertTrue(scmSafeModeManager.getInSafeMode());
 
-    /* There is a race condition where the background pipeline creation
-     * task creates the pipeline before the following create call.
-     * So wrapping it with try..catch.
-     */
-    Pipeline pipeline;
-    try {
-      pipeline = pipelineManager.createPipeline(
-          RatisReplicationConfig.getInstance(
-              ReplicationFactor.THREE));
-    } catch (SCMException ex) {
-      pipeline = pipelineManager.getPipelines(
-          RatisReplicationConfig.getInstance(
-              ReplicationFactor.THREE)).get(0);
-    }
+    Pipeline pipeline = pipelineManager.createPipeline(
+        RatisReplicationConfig.getInstance(ReplicationFactor.THREE));
 
     // Mark pipeline healthy
     pipeline = pipelineManager.getPipeline(pipeline.getId());


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

Reply via email to