HBASE-2613 Remove the code around MSG_CALL_SERVER_STARTUP
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@948632 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
38d4e7e377
commit
982a15f227
|
@ -642,6 +642,7 @@ Release 0.21.0 - Unreleased
|
|||
was we had in 0.20
|
||||
HBASE-2538 Work on repository order in pom (adding fbmirror to top,
|
||||
ibiblio on bottom)
|
||||
HBASE-2613 Remove the code around MSG_CALL_SERVER_STARTUP
|
||||
|
||||
NEW FEATURES
|
||||
HBASE-1961 HBase EC2 scripts
|
||||
|
|
|
@ -38,8 +38,6 @@ public class HMsg implements Writable {
|
|||
new HMsg(Type.MSG_REGIONSERVER_QUIESCE);
|
||||
public static final HMsg REGIONSERVER_STOP =
|
||||
new HMsg(Type.MSG_REGIONSERVER_STOP);
|
||||
public static final HMsg CALL_SERVER_STARTUP =
|
||||
new HMsg(Type.MSG_CALL_SERVER_STARTUP);
|
||||
public static final HMsg [] EMPTY_HMSG_ARRAY = new HMsg[0];
|
||||
|
||||
/**
|
||||
|
@ -62,9 +60,6 @@ public class HMsg implements Writable {
|
|||
/** Compact the specified region */
|
||||
MSG_REGION_COMPACT,
|
||||
|
||||
/** Region server is unknown to master. Restart */
|
||||
MSG_CALL_SERVER_STARTUP,
|
||||
|
||||
/** Master tells region server to stop */
|
||||
MSG_REGIONSERVER_STOP,
|
||||
|
||||
|
|
|
@ -297,10 +297,10 @@ public class ServerManager implements HConstants {
|
|||
HServerInfo storedInfo = this.serversToServerInfo.get(info.getServerName());
|
||||
if (storedInfo == null) {
|
||||
LOG.warn("Received report from unknown server -- telling it " +
|
||||
"to " + HMsg.CALL_SERVER_STARTUP + ": " + info.getServerName());
|
||||
"to " + HMsg.REGIONSERVER_STOP + ": " + info.getServerName());
|
||||
// The HBaseMaster may have been restarted.
|
||||
// Tell the RegionServer to start over and call regionServerStartup()
|
||||
return new HMsg[] {HMsg.CALL_SERVER_STARTUP};
|
||||
// Tell the RegionServer to abort!
|
||||
return new HMsg[] {HMsg.REGIONSERVER_STOP};
|
||||
} else if (storedInfo.getStartCode() != info.getStartCode()) {
|
||||
// This state is reachable if:
|
||||
//
|
||||
|
|
|
@ -488,35 +488,6 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
LOG.info(msgs[i].toString());
|
||||
this.connection.unsetRootRegionLocation();
|
||||
switch(msgs[i].getType()) {
|
||||
case MSG_CALL_SERVER_STARTUP:
|
||||
// We the MSG_CALL_SERVER_STARTUP on startup but we can also
|
||||
// get it when the master is panicking because for instance
|
||||
// the HDFS has been yanked out from under it. Be wary of
|
||||
// this message.
|
||||
if (checkFileSystem()) {
|
||||
closeAllRegions();
|
||||
try {
|
||||
hlog.closeAndDelete();
|
||||
} catch (Exception e) {
|
||||
LOG.error("error closing and deleting HLog", e);
|
||||
}
|
||||
try {
|
||||
serverInfo.setStartCode(System.currentTimeMillis());
|
||||
hlog = setupHLog();
|
||||
} catch (IOException e) {
|
||||
this.abortRequested = true;
|
||||
this.stopRequested.set(true);
|
||||
e = RemoteExceptionHandler.checkIOException(e);
|
||||
LOG.fatal("error restarting server", e);
|
||||
break;
|
||||
}
|
||||
reportForDuty();
|
||||
restart = true;
|
||||
} else {
|
||||
LOG.fatal("file system available check failed. " +
|
||||
"Shutting down server.");
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_REGIONSERVER_STOP:
|
||||
stopRequested.set(true);
|
||||
|
@ -921,8 +892,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
return isOnline;
|
||||
}
|
||||
|
||||
private HLog setupHLog() throws RegionServerRunningException,
|
||||
IOException {
|
||||
private HLog setupHLog() throws IOException {
|
||||
Path oldLogDir = new Path(rootDir, HREGION_OLDLOGDIR_NAME);
|
||||
Path logdir = new Path(rootDir, HLog.getHLogDirectoryName(this.serverInfo));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* Copyright 2010 The Apache Software Foundation
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase.master;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HServerAddress;
|
||||
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
||||
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestMasterWrongRS {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(TestMasterWrongRS.class);
|
||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAllTests() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(3);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterAllTests() throws IOException {
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test when region servers start reporting with the wrong address
|
||||
* or start code. Currently the decision is to shut them down.
|
||||
* See HBASE-2613
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testRsReportsWrongServerName() throws Exception {
|
||||
MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
|
||||
HRegionServer firstServer = cluster.getRegionServer(0);
|
||||
HRegionServer secondServer = cluster.getRegionServer(1);
|
||||
firstServer.getHServerInfo().setStartCode(12345);
|
||||
// Sleep while the region server pings back
|
||||
Thread.sleep(2000);
|
||||
assertTrue(firstServer.isOnline());
|
||||
assertEquals(2, cluster.getLiveRegionServerThreads().size());
|
||||
|
||||
secondServer.getHServerInfo().setServerAddress(new HServerAddress("0.0.0.0", 60010));
|
||||
Thread.sleep(2000);
|
||||
assertTrue(secondServer.isOnline());
|
||||
assertEquals(1, cluster.getLiveRegionServerThreads().size());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue