You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2023/04/08 07:10:22 UTC

[hbase] 01/02: HBASE-27720 TestClusterRestartFailover is flakey due to metrics assertion (#5110)

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

zhangduo pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit f8c234e8d07a3e1f4d2417a22ca84ff357dd48c5
Author: Nick Dimiduk <nd...@apache.org>
AuthorDate: Fri Apr 7 23:02:09 2023 -0400

    HBASE-27720 TestClusterRestartFailover is flakey due to metrics assertion (#5110)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
    (cherry picked from commit f36587c6486468f6b19f7419c9a263ed81d8bdc7)
---
 .../org/apache/hadoop/hbase/master/TestClusterRestartFailover.java  | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java
index 7b35e3328cc..7d2d05a032f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java
@@ -152,6 +152,12 @@ public class TestClusterRestartFailover extends AbstractTestRestartCluster {
     LOG.info("Setup cluster");
     UTIL.startMiniCluster(StartMiniClusterOption.builder().masterClass(HMasterForTest.class)
       .numMasters(1).numRegionServers(3).build());
+    // this test has been flaky. When it is rerun by surefire, the underlying minicluster isn't
+    // completely cleaned. specifically, the metrics system isn't reset. The result is an otherwise
+    // successful re-run is failed because there's 8 or 12 SCPcounts instead of the 4 that a
+    // single run of the test would otherwise produce. Thus, explicitly reset the metrics source
+    // each time we setup the cluster.
+    UTIL.getMiniHBaseCluster().getMaster().getMasterMetrics().getMetricsSource().init();
     LOG.info("Cluster is up");
     UTIL.waitFor(60000, () -> UTIL.getMiniHBaseCluster().getMaster().isInitialized());
     LOG.info("Master is up");