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
This commit is contained in:
Michael Stack 2010-10-20 05:12:19 +00:00
parent a7d61ec5b5
commit 6d2aaf8833
3 changed files with 22 additions and 25 deletions

View File

@ -1018,6 +1018,7 @@ Release 0.21.0 - Unreleased
HBASE-3115 HBaseClient wastes 1 TCP packet per RPC HBASE-3115 HBaseClient wastes 1 TCP packet per RPC
HBASE-3076 Allow to disable automatic shipping of dependency jars HBASE-3076 Allow to disable automatic shipping of dependency jars
for mapreduce jobs (Bruno Dumon) for mapreduce jobs (Bruno Dumon)
HBASE-3128 On assign, if ConnectException, reassign another server
NEW FEATURES NEW FEATURES
HBASE-1961 HBase EC2 scripts HBASE-1961 HBase EC2 scripts

View File

@ -729,7 +729,7 @@ public class AssignmentManager extends ZooKeeperListener {
} catch (Throwable t) { } catch (Throwable t) {
LOG.warn("Failed assignment of " + LOG.warn("Failed assignment of " +
state.getRegion().getRegionNameAsString() + " to " + 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 // Clean out plan we failed execute and one that doesn't look like it'll
// succeed anyways; we need a new plan! // succeed anyways; we need a new plan!
this.regionPlans.remove(state.getRegion().getEncodedName()); this.regionPlans.remove(state.getRegion().getEncodedName());
@ -873,18 +873,11 @@ public class AssignmentManager extends ZooKeeperListener {
try { try {
serverManager.sendRegionClose(regions.get(region), state.getRegion()); serverManager.sendRegionClose(regions.get(region), state.getRegion());
} catch (IOException e) { } catch (IOException e) {
if (e instanceof RemoteException) { // For now call abort if unexpected exception -- radical, but will get fellas attention.
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.
// St.Ack 20101012 // St.Ack 20101012
this.master.abort("Remote unexpected exception", e); this.master.abort("Remote unexpected exception", e);
} catch (Throwable t) { } 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 // St.Ack 20101012
this.master.abort("Unexpected exception", t); this.master.abort("Unexpected exception", t);
} }

View File

@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.PleaseHoldException;
import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.Server;
import org.apache.hadoop.hbase.Stoppable; import org.apache.hadoop.hbase.Stoppable;
import org.apache.hadoop.hbase.YouAreDeadException; 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.HConnection;
import org.apache.hadoop.hbase.client.HConnectionManager; import org.apache.hadoop.hbase.client.HConnectionManager;
import org.apache.hadoop.hbase.ipc.HRegionInterface; 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.master.metrics.MasterMetrics;
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException;
import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
/** /**
@ -558,21 +558,24 @@ public class ServerManager {
hri.closeRegion(region); hri.closeRegion(region);
} }
private HRegionInterface getServerConnection(HServerInfo info) { /**
try { * @param info
HConnection connection = * @return
HConnectionManager.getConnection(this.master.getConfiguration()); * @throws IOException
HRegionInterface hri = serverConnections.get(info.getServerName()); * @throws RetriesExhaustedException wrapping a ConnectException if failed
if (hri == null) { * putting up proxy.
LOG.debug("New connection to " + info.getServerName()); */
hri = connection.getHRegionConnection(info.getServerAddress(), false); private HRegionInterface getServerConnection(HServerInfo info)
serverConnections.put(info.getServerName(), hri); throws IOException {
} HConnection connection =
return hri; HConnectionManager.getConnection(this.master.getConfiguration());
} catch (IOException e) { HRegionInterface hri = serverConnections.get(info.getServerName());
LOG.error("Error connecting to region server", e); if (hri == null) {
throw new RuntimeException("Fatal error connection to RS", e); LOG.debug("New connection to " + info.getServerName());
hri = connection.getHRegionConnection(info.getServerAddress(), false);
this.serverConnections.put(info.getServerName(), hri);
} }
return hri;
} }
/** /**