From 25ae7a7b20024556d7a611911f726895758c3387 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 13 Oct 2010 05:39:11 +0000 Subject: [PATCH] HBASE-3100 stop splitting in TestMergeTable, and add debug git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1022003 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/hadoop/hbase/ipc/HRegionInterface.java | 3 ++- .../hadoop/hbase/master/AssignmentManager.java | 15 ++++++++++++--- .../apache/hadoop/hbase/master/ServerManager.java | 8 ++++---- .../hbase/master/handler/OpenedRegionHandler.java | 10 +++++++--- .../apache/hadoop/hbase/util/TestMergeTable.java | 2 ++ 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java b/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java index ee5dd8f8517..bb35527ec42 100644 --- a/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java +++ b/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java @@ -312,9 +312,10 @@ public interface HRegionInterface extends HBaseRPCProtocolVersion, Stoppable, Ab * Closes the specified region. * @param region region to close * @return true if closing region, false if not + * @throws IOException */ public boolean closeRegion(final HRegionInfo region) - throws NotServingRegionException; + throws IOException; // Region administrative methods 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 636b0e70cad..0523426bf30 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java +++ b/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java @@ -67,6 +67,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZooKeeperListener; import org.apache.hadoop.hbase.zookeeper.ZKUtil.NodeAndData; import org.apache.hadoop.io.Writable; +import org.apache.hadoop.ipc.RemoteException; import org.apache.zookeeper.KeeperException; import com.google.common.util.concurrent.ThreadFactoryBuilder; @@ -786,9 +787,17 @@ public class AssignmentManager extends ZooKeeperListener { // Send CLOSE RPC try { serverManager.sendRegionClose(regions.get(region), state.getRegion()); - } catch (NotServingRegionException e) { - LOG.warn("Attempted to close region " + region.getRegionNameAsString() + - " but got an NSRE", e); + } 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. + // 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. // St.Ack 20101012 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 eedf9c4712f..a8344e20908 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java +++ b/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java @@ -31,14 +31,12 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.hbase.Chore; import org.apache.hadoop.hbase.HMsg; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HServerAddress; import org.apache.hadoop.hbase.HServerInfo; import org.apache.hadoop.hbase.HServerLoad; -import org.apache.hadoop.hbase.NotServingRegionException; import org.apache.hadoop.hbase.PleaseHoldException; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.Stoppable; @@ -50,6 +48,8 @@ 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; /** * The ServerManager class manages info about region servers - HServerInfo, @@ -542,10 +542,10 @@ public class ServerManager { * @param server server to open a region * @param regionName region to open * @return true if server acknowledged close, false if not - * @throws NotServingRegionException + * @throws IOException */ public void sendRegionClose(HServerInfo server, HRegionInfo region) - throws NotServingRegionException { + throws IOException { HRegionInterface hri = getServerConnection(server); if(hri == null) { LOG.warn("Attempting to send CLOSE RPC to server " + diff --git a/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java b/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java index 7f65fe99917..d507f0ff2c7 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java +++ b/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java @@ -19,6 +19,8 @@ */ package org.apache.hadoop.hbase.master.handler; +import java.io.IOException; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HRegionInfo; @@ -35,9 +37,7 @@ import org.apache.zookeeper.KeeperException; */ public class OpenedRegionHandler extends EventHandler implements TotesHRegionInfo { private static final Log LOG = LogFactory.getLog(OpenedRegionHandler.class); - private final AssignmentManager assignmentManager; - private final RegionTransitionData data; private final HRegionInfo regionInfo; private final HServerInfo serverInfo; private final OpenedPriority priority; @@ -60,8 +60,12 @@ public class OpenedRegionHandler extends EventHandler implements TotesHRegionInf AssignmentManager assignmentManager, RegionTransitionData data, HRegionInfo regionInfo, HServerInfo serverInfo) { super(server, EventType.RS_ZK_REGION_OPENED); + try { + throw new IOException("IGNORE"); + } catch (IOException e) { + e.printStackTrace(); + } this.assignmentManager = assignmentManager; - this.data = data; this.regionInfo = regionInfo; this.serverInfo = serverInfo; if(regionInfo.isRootRegion()) { diff --git a/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java b/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java index 5a9e89fdf93..fee4779e407 100644 --- a/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java +++ b/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java @@ -74,6 +74,8 @@ public class TestMergeTable { // Set maximum regionsize down. UTIL.getConfiguration().setLong("hbase.hregion.max.filesize", 64L * 1024L * 1024L); + // Make it so we don't compact and then split. + UTIL.getConfiguration().setInt("hbase.hstore.compactionThreshold", 30); // Startup hdfs. Its in here we'll be putting our manually made regions. UTIL.startMiniDFSCluster(1); // Create hdfs hbase rootdir.