diff --git a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java index 7a964a8553b..069bf2832cf 100644 --- a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java +++ b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/ProcedureExecutor.java @@ -1710,7 +1710,6 @@ public class ProcedureExecutor { public WorkerThread(final ThreadGroup group) { super(group, "ProcExecWrkr-" + workerId.incrementAndGet()); - setDaemon(true); } @Override @@ -1785,7 +1784,6 @@ public class ProcedureExecutor { public TimeoutExecutorThread(final ThreadGroup group) { super(group, "ProcExecTimeout"); - setDaemon(true); } @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java index 342d44144ae..d04956bfc2a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/ExecutorService.java @@ -178,7 +178,7 @@ public class ExecutorService { // name the threads for this threadpool ThreadFactoryBuilder tfb = new ThreadFactoryBuilder(); tfb.setNameFormat(this.name + "-%d"); - tfb.setDaemon(true); + // TODO: Should these executors be daemon threads? this.threadPoolExecutor.setThreadFactory(tfb.build()); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java index 51649e6e249..8f0688654ae 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java @@ -23,6 +23,7 @@ import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.master.LoadBalancer; import org.apache.hadoop.hbase.regionserver.HRegion; +import org.apache.hadoop.hbase.regionserver.Region; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.JVMClusterUtil; import org.apache.hadoop.hbase.util.Threads; @@ -195,6 +196,15 @@ public class TestRegionsOnMasterOptions { // still only carry system regions post crash. assertEquals(masterCount, mNewActualCount); } + // Disable balancer and wait till RIT done else cluster won't go down. + TEST_UTIL.getAdmin().balancerSwitch(false, true); + while (true) { + if (!TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager(). + isMetaRegionInTransition()) { + break; + } + Threads.sleep(10); + } } finally { LOG.info("Running shutdown of cluster"); TEST_UTIL.shutdownMiniCluster();