HBASE-6389 Revert, the patch breaks TestZooKeeper

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1363179 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-07-18 23:51:25 +00:00
parent 9c5b6c5033
commit 5586daa4de
3 changed files with 12 additions and 22 deletions

View File

@ -582,12 +582,12 @@ public class ServerManager {
* Wait for the region servers to report in. * Wait for the region servers to report in.
* We will wait until one of this condition is met: * We will wait until one of this condition is met:
* - the master is stopped * - the master is stopped
* - the 'hbase.master.wait.on.regionservers.timeout' is reached
* - the 'hbase.master.wait.on.regionservers.maxtostart' number of * - the 'hbase.master.wait.on.regionservers.maxtostart' number of
* region servers is reached * region servers is reached
* - the 'hbase.master.wait.on.regionservers.mintostart' is reached AND * - the 'hbase.master.wait.on.regionservers.mintostart' is reached AND
* there have been no new region server in for * there have been no new region server in for
* 'hbase.master.wait.on.regionservers.interval' time AND * 'hbase.master.wait.on.regionservers.interval' time
* the 'hbase.master.wait.on.regionservers.timeout' is reached
* *
* @throws InterruptedException * @throws InterruptedException
*/ */
@ -596,18 +596,11 @@ public class ServerManager {
final long interval = this.master.getConfiguration(). final long interval = this.master.getConfiguration().
getLong("hbase.master.wait.on.regionservers.interval", 1500); getLong("hbase.master.wait.on.regionservers.interval", 1500);
final long timeout = this.master.getConfiguration(). final long timeout = this.master.getConfiguration().
getLong("hbase.master.wait.on.regionservers.timeout", 4500); getLong("hbase.master.wait.on.regionservers.timeout", 4500);
final int minToStart = this.master.getConfiguration(). final int minToStart = this.master.getConfiguration().
getInt("hbase.master.wait.on.regionservers.mintostart", 1); getInt("hbase.master.wait.on.regionservers.mintostart", 1);
int maxToStart = this.master.getConfiguration(). final int maxToStart = this.master.getConfiguration().
getInt("hbase.master.wait.on.regionservers.maxtostart", Integer.MAX_VALUE); getInt("hbase.master.wait.on.regionservers.maxtostart", Integer.MAX_VALUE);
if (maxToStart < minToStart) {
LOG.warn(String.format(
"The value of 'hbase.master.wait.on.regionservers.maxtostart' (%d)" +
" is set less than 'hbase.master.wait.on.regionservers.mintostart'" +
" (%d), ignoring.", maxToStart, minToStart));
maxToStart = Integer.MAX_VALUE;
}
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
final long startTime = now; final long startTime = now;
@ -618,8 +611,9 @@ public class ServerManager {
int oldCount = 0; int oldCount = 0;
while ( while (
!this.master.isStopped() && !this.master.isStopped() &&
slept < timeout &&
count < maxToStart && count < maxToStart &&
(lastCountChange+interval > now || timeout > slept || count < minToStart) (lastCountChange+interval > now || count < minToStart)
){ ){
// Log some info at every interval time or if there is a change // Log some info at every interval time or if there is a change

View File

@ -655,9 +655,8 @@ public class HBaseTestingUtility {
// These settings will make the server waits until this exact number of // These settings will make the server waits until this exact number of
// regions servers are connected. // regions servers are connected.
String count = String.valueOf(numSlaves); conf.setInt("hbase.master.wait.on.regionservers.mintostart", numSlaves);
conf.setIfUnset("hbase.master.wait.on.regionservers.mintostart", count); conf.setInt("hbase.master.wait.on.regionservers.maxtostart", numSlaves);
conf.setIfUnset("hbase.master.wait.on.regionservers.maxtostart", count);
Configuration c = new Configuration(this.conf); Configuration c = new Configuration(this.conf);
this.hbaseCluster = new MiniHBaseCluster(c, numMasters, numSlaves); this.hbaseCluster = new MiniHBaseCluster(c, numMasters, numSlaves);

View File

@ -69,11 +69,8 @@ public class TestRSKilledWhenMasterInitializing {
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
// Set it so that this test runs with my custom master // Set it so that this test runs with my custom master
Configuration conf = TESTUTIL.getConfiguration(); TESTUTIL.getConfiguration().setClass(HConstants.MASTER_IMPL,
conf.setClass(HConstants.MASTER_IMPL, TestingMaster.class, HMaster.class); TestingMaster.class, HMaster.class);
conf.setInt("hbase.master.wait.on.regionservers.mintostart", 3);
conf.setInt("hbase.master.wait.on.regionservers.maxtostart", 4);
// Start up the cluster. // Start up the cluster.
TESTUTIL.startMiniCluster(NUM_MASTERS, NUM_RS); TESTUTIL.startMiniCluster(NUM_MASTERS, NUM_RS);
} }