HBASE-926 If no master, regionservers should hang out rather than fail on connection and shut themselves down

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/branches/0.18@705351 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-10-16 20:25:46 +00:00
parent cfa79319e5
commit 54e73589cb
3 changed files with 26 additions and 18 deletions

View File

@ -17,6 +17,8 @@ Release 0.18.1 - Unreleased
log java.io.IOException: Could not get block locations. Aborting...
HBASE-933 missing hbase.regions.slop in hbase-default.xml for 0.18 branch
(Rong-en Fan via Stack)
HBASE-926 If no master, regionservers should hang out rather than fail on
connection and shut themselves down
IMPROVEMENTS
HBASE-920 Make region balancing sloppier

View File

@ -294,11 +294,8 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
long now = System.currentTimeMillis();
if (lastMsg != 0 && (now - lastMsg) >= serverLeaseTimeout) {
// It has been way too long since we last reported to the master.
// Commit suicide.
LOG.fatal("unable to report to master for " + (now - lastMsg) +
" milliseconds - aborting server");
abort();
break;
LOG.warn("unable to report to master for " + (now - lastMsg) +
" milliseconds - retrying");
}
if ((now - lastMsg) >= msgInterval) {
HMsg outboundArray[] = null;
@ -403,12 +400,8 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
LOG.warn("Processing message (Retry: " + tries + ")", e);
tries++;
} else {
LOG.fatal("Exceeded max retries: " + this.numRetries, e);
if (!checkFileSystem()) {
continue;
}
// Something seriously wrong. Shutdown.
stop();
LOG.error("Exceeded max retries: " + this.numRetries, e);
checkFileSystem();
}
}
}
@ -701,17 +694,26 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
* Let the master know we're here
* Run initialization using parameters passed us by the master.
*/
private MapWritable reportForDuty(final Sleeper sleeper)
throws IOException {
private MapWritable reportForDuty(final Sleeper sleeper) {
if (LOG.isDebugEnabled()) {
LOG.debug("Telling master at " +
conf.get(MASTER_ADDRESS) + " that we are up");
}
// Do initial RPC setup. The final argument indicates that the RPC should retry indefinitely.
this.hbaseMaster = (HMasterRegionInterface)HbaseRPC.waitForProxy(
HMasterRegionInterface.class, HMasterRegionInterface.versionID,
new HServerAddress(conf.get(MASTER_ADDRESS)).getInetSocketAddress(),
this.conf, -1);
HMasterRegionInterface master = null;
while (!stopRequested.get() && master == null) {
try {
// Do initial RPC setup. The final argument indicates that the RPC
// should retry indefinitely.
master = (HMasterRegionInterface)HbaseRPC.waitForProxy(
HMasterRegionInterface.class, HMasterRegionInterface.versionID,
new HServerAddress(conf.get(MASTER_ADDRESS)).getInetSocketAddress(),
this.conf, -1);
} catch (IOException e) {
LOG.warn("Unable to connect to master. Retrying. Error was:", e);
sleeper.sleep();
}
}
this.hbaseMaster = master;
MapWritable result = null;
long lastMsg = 0;
while(!stopRequested.get()) {

View File

@ -59,6 +59,7 @@ public class TestHTable extends HBaseClusterTestCase implements HConstants {
* @throws IOException
*/
public void testHTable() throws IOException {
LOG.info("TEST: " + getName());
byte[] value = "value".getBytes(UTF8_ENCODING);
try {
@ -179,6 +180,7 @@ public class TestHTable extends HBaseClusterTestCase implements HConstants {
* For HADOOP-2579
*/
public void testTableNotFoundExceptionWithoutAnyTables() {
LOG.info("TEST: " + getName());
try {
new HTable(conf, "notATable");
fail("Should have thrown a TableNotFoundException");
@ -195,6 +197,7 @@ public class TestHTable extends HBaseClusterTestCase implements HConstants {
* For HADOOP-2579
*/
public void testTableNotFoundExceptionWithATable() {
LOG.info("TEST: " + getName());
try {
HBaseAdmin admin = new HBaseAdmin(conf);
HTableDescriptor testTableADesc =
@ -216,6 +219,7 @@ public class TestHTable extends HBaseClusterTestCase implements HConstants {
}
public void testGetRow() {
LOG.info("TEST: " + getName());
HTable table = null;
try {
HColumnDescriptor column2 =