From 0be3011b5f3b4d8d5adebd9193eac975f35fc845 Mon Sep 17 00:00:00 2001 From: larsh Date: Wed, 25 Apr 2012 20:43:35 +0000 Subject: [PATCH] HBASE-5873 TimeOut Monitor thread should be started after atleast one region server registers. git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1330551 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/hadoop/hbase/master/AssignmentManager.java | 7 +++++-- src/main/java/org/apache/hadoop/hbase/master/HMaster.java | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java b/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java index 744b37b9f5b..7881321ce14 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java +++ b/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java @@ -214,8 +214,6 @@ public class AssignmentManager extends ZooKeeperListener { conf.getInt("hbase.master.assignment.timeoutmonitor.period", 10000), master, serverManager, conf.getInt("hbase.master.assignment.timeoutmonitor.timeout", 1800000)); - Threads.setDaemonThreadRunning(timeoutMonitor.getThread(), - master.getServerName() + ".timeoutMonitor"); this.zkTable = new ZKTable(this.master.getZooKeeper()); this.maximumAssignmentAttempts = this.master.getConfiguration().getInt("hbase.assignment.maximum.attempts", 10); @@ -224,6 +222,11 @@ public class AssignmentManager extends ZooKeeperListener { this.masterMetrics = metrics;// can be null only with tests. } + void startTimeOutMonitor() { + Threads.setDaemonThreadRunning(timeoutMonitor.getThread(), master.getServerName() + + ".timeoutMonitor"); + } + /** * Compute the average load across all region servers. * Currently, this uses a very naive computation - just uses the number of diff --git a/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index b2fdb6a0a2f..81e9023909b 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -567,6 +567,7 @@ Server { } } + this.assignmentManager.startTimeOutMonitor(); Set onlineServers = new HashSet(serverManager .getOnlineServers().keySet()); // TODO: Should do this in background rather than block master startup