From dd474ef199378612bc71c37735e47de1b8eb6488 Mon Sep 17 00:00:00 2001 From: zhangduo Date: Sun, 21 Oct 2018 16:09:46 +0800 Subject: [PATCH] HBASE-21334 TestMergeTableRegionsProcedure is flakey --- .../MasterProcedureTestingUtility.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureTestingUtility.java index af4dd261049..452a501c587 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureTestingUtility.java @@ -510,13 +510,18 @@ public class MasterProcedureTestingUtility { // Sometimes there are other procedures still executing (including asynchronously spawned by // procId) and due to KillAndToggleBeforeStoreUpdate flag ProcedureExecutor is stopped before // store update. Let all pending procedures finish normally. - if (!procExec.isRunning()) { - LOG.warn("ProcedureExecutor not running, may have been stopped by pending procedure due to" - + " KillAndToggleBeforeStoreUpdate flag."); - ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, false); - restartMasterProcedureExecutor(procExec); - ProcedureTestingUtility.waitNoProcedureRunning(procExec); + ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, false); + // check 3 times to confirm that the procedure executor has not been killed + for (int i = 0; i < 3; i++) { + if (!procExec.isRunning()) { + LOG.warn("ProcedureExecutor not running, may have been stopped by pending procedure due" + + " to KillAndToggleBeforeStoreUpdate flag."); + restartMasterProcedureExecutor(procExec); + break; + } + Thread.sleep(1000); } + ProcedureTestingUtility.waitNoProcedureRunning(procExec); } assertEquals(true, procExec.isRunning());