From 6d2aaf8833bfced99269c749881b428b2638b564 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 20 Oct 2010 05:12:19 +0000 Subject: [PATCH] HBASE-3128 On assign, if ConnectException, reassign another server git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1024524 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../hbase/master/AssignmentManager.java | 13 ++------ .../hadoop/hbase/master/ServerManager.java | 33 ++++++++++--------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 62a470daf2a..2a6b7e4d3e3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1018,6 +1018,7 @@ Release 0.21.0 - Unreleased HBASE-3115 HBaseClient wastes 1 TCP packet per RPC HBASE-3076 Allow to disable automatic shipping of dependency jars for mapreduce jobs (Bruno Dumon) + HBASE-3128 On assign, if ConnectException, reassign another server NEW FEATURES HBASE-1961 HBase EC2 scripts 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 f594dfd8acc..05341aa079e 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java +++ b/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java @@ -729,7 +729,7 @@ public class AssignmentManager extends ZooKeeperListener { } catch (Throwable t) { LOG.warn("Failed assignment of " + state.getRegion().getRegionNameAsString() + " to " + - plan.getDestination(), t); + plan.getDestination() + ", trying to assign elsewhere instead", t); // Clean out plan we failed execute and one that doesn't look like it'll // succeed anyways; we need a new plan! this.regionPlans.remove(state.getRegion().getEncodedName()); @@ -873,18 +873,11 @@ public class AssignmentManager extends ZooKeeperListener { try { serverManager.sendRegionClose(regions.get(region), state.getRegion()); } catch (IOException e) { - if (e instanceof RemoteException) { - e = ((RemoteException)e).unwrapRemoteException(); - } - if (e instanceof NotServingRegionException) { - LOG.warn("Attempted to close region " + region.getRegionNameAsString() + - " but got an NSRE", e); - } - // For now call abort if unexpected exception -- seeing it up in hudson. + // For now call abort if unexpected exception -- radical, but will get fellas attention. // St.Ack 20101012 this.master.abort("Remote unexpected exception", e); } catch (Throwable t) { - // For now call abort if unexpected exception -- seeing it up in hudson. + // For now call abort if unexpected exception -- radical, but will get fellas attention. // St.Ack 20101012 this.master.abort("Unexpected exception", t); } diff --git a/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java b/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java index 29d02529edf..200e1e47e6f 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java +++ b/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java @@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.PleaseHoldException; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.Stoppable; import org.apache.hadoop.hbase.YouAreDeadException; +import org.apache.hadoop.hbase.ZooKeeperConnectionException; import org.apache.hadoop.hbase.client.HConnection; import org.apache.hadoop.hbase.client.HConnectionManager; import org.apache.hadoop.hbase.ipc.HRegionInterface; @@ -48,7 +49,6 @@ import org.apache.hadoop.hbase.master.handler.ServerShutdownHandler; import org.apache.hadoop.hbase.master.metrics.MasterMetrics; import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; import org.apache.hadoop.hbase.util.Threads; -import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.util.StringUtils; /** @@ -558,21 +558,24 @@ public class ServerManager { hri.closeRegion(region); } - private HRegionInterface getServerConnection(HServerInfo info) { - try { - HConnection connection = - HConnectionManager.getConnection(this.master.getConfiguration()); - HRegionInterface hri = serverConnections.get(info.getServerName()); - if (hri == null) { - LOG.debug("New connection to " + info.getServerName()); - hri = connection.getHRegionConnection(info.getServerAddress(), false); - serverConnections.put(info.getServerName(), hri); - } - return hri; - } catch (IOException e) { - LOG.error("Error connecting to region server", e); - throw new RuntimeException("Fatal error connection to RS", e); + /** + * @param info + * @return + * @throws IOException + * @throws RetriesExhaustedException wrapping a ConnectException if failed + * putting up proxy. + */ + private HRegionInterface getServerConnection(HServerInfo info) + throws IOException { + HConnection connection = + HConnectionManager.getConnection(this.master.getConfiguration()); + HRegionInterface hri = serverConnections.get(info.getServerName()); + if (hri == null) { + LOG.debug("New connection to " + info.getServerName()); + hri = connection.getHRegionConnection(info.getServerAddress(), false); + this.serverConnections.put(info.getServerName(), hri); } + return hri; } /**