You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jd...@apache.org on 2010/05/27 01:09:09 UTC
svn commit: r948632 - in /hbase/trunk: ./
src/main/java/org/apache/hadoop/hbase/
src/main/java/org/apache/hadoop/hbase/master/
src/main/java/org/apache/hadoop/hbase/regionserver/
src/test/java/org/apache/hadoop/hbase/master/
Author: jdcryans
Date: Wed May 26 23:09:09 2010
New Revision: 948632
URL: http://svn.apache.org/viewvc?rev=948632&view=rev
Log:
HBASE-2613 Remove the code around MSG_CALL_SERVER_STARTUP
Added:
hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterWrongRS.java
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/HMsg.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=948632&r1=948631&r2=948632&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed May 26 23:09:09 2010
@@ -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
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/HMsg.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/HMsg.java?rev=948632&r1=948631&r2=948632&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/HMsg.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/HMsg.java Wed May 26 23:09:09 2010
@@ -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,
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=948632&r1=948631&r2=948632&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java Wed May 26 23:09:09 2010
@@ -297,10 +297,10 @@ public class ServerManager implements HC
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:
//
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=948632&r1=948631&r2=948632&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Wed May 26 23:09:09 2010
@@ -488,35 +488,6 @@ public class HRegionServer implements HC
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 HC
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()) {
Added: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterWrongRS.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterWrongRS.java?rev=948632&view=auto
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterWrongRS.java (added)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterWrongRS.java Wed May 26 23:09:09 2010
@@ -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());
+ }
+}