You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by aa...@apache.org on 2021/11/24 13:58:56 UTC

[hadoop] branch branch-3.2 updated: HDFS-16336. De-flake TestRollingUpgrade#testRollback (#3686)

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

aajisaka pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new af452d2  HDFS-16336. De-flake TestRollingUpgrade#testRollback (#3686)
af452d2 is described below

commit af452d2fc5342d8fe2fc4a797566464509ae9a43
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Wed Nov 24 19:24:11 2021 +0530

    HDFS-16336. De-flake TestRollingUpgrade#testRollback (#3686)
    
    Signed-off-by: Akira Ajisaka <aa...@apache.org>
    (cherry picked from commit e8566b38129bcef687506742b3d7d35e8e4947a9)
---
 .../java/org/apache/hadoop/hdfs/TestRollingUpgrade.java   | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
index 46fab47..106def8 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeoutException;
 
 import javax.management.AttributeNotFoundException;
 import javax.management.InstanceNotFoundException;
@@ -325,7 +326,7 @@ public class TestRollingUpgrade {
       out.write(data, 0, data.length);
       out.close();
 
-      checkMxBeanIsNull();
+      waitForNullMxBean();
       startRollingUpgrade(foo, bar, file, data, cluster);
       checkMxBean();
       cluster.getFileSystem().rollEdits();
@@ -356,6 +357,18 @@ public class TestRollingUpgrade {
     }
   }
 
+  private void waitForNullMxBean() throws TimeoutException, InterruptedException {
+    GenericTestUtils.waitFor(() -> {
+      try {
+        checkMxBeanIsNull();
+        return true;
+      } catch (Throwable t) {
+        LOG.error("Something went wrong.", t);
+        return false;
+      }
+    }, 100, 8000, "RollingUpgradeStatus is already set");
+  }
+
   private static void startRollingUpgrade(Path foo, Path bar,
       Path file, byte[] data,
       MiniDFSCluster cluster) throws IOException {

---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org