Index: src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java (revision 1138246) +++ src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java (working copy) @@ -152,7 +152,7 @@ } /** figure out how many regions are currently being served. */ - private int getRegionCount() { + private int getRegionCount() throws IOException { int total = 0; for (HRegionServer server : getOnlineRegionServers()) { total += server.getOnlineRegions().size(); @@ -165,7 +165,7 @@ * number of online servers, then test if each server is +/- 1 of average * rounded up. */ - private void assertRegionsAreBalanced() { + private void assertRegionsAreBalanced() throws IOException { // TODO: Fix this test. Old balancer used to run with 'slop'. New // balancer does not. boolean success = false; @@ -229,7 +229,7 @@ /** * Wait until all the regions are assigned. */ - private void waitForAllRegionsAssigned() { + private void waitForAllRegionsAssigned() throws IOException { while (getRegionCount() < 22) { // while (!cluster.getMaster().allRegionsAssigned()) { LOG.debug("Waiting for there to be 22 regions, but there are " + getRegionCount() + " right now."); Index: src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (revision 1138246) +++ src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (working copy) @@ -445,7 +445,8 @@ return null; } - private void printOutRegions(final HRegionServer hrs, final String prefix) { + private void printOutRegions(final HRegionServer hrs, final String prefix) + throws IOException { List regions = hrs.getOnlineRegions(); for (HRegionInfo region: regions) { LOG.info(prefix + region.getRegionNameAsString()); Index: src/test/java/org/apache/hadoop/hbase/TestGlobalMemStoreSize.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/TestGlobalMemStoreSize.java (revision 1138246) +++ src/test/java/org/apache/hadoop/hbase/TestGlobalMemStoreSize.java (working copy) @@ -20,6 +20,8 @@ package org.apache.hadoop.hbase; import static org.junit.Assert.*; + +import java.io.IOException; import java.util.List; import java.util.ArrayList; import org.apache.commons.logging.Log; @@ -100,7 +102,7 @@ } /** figure out how many regions are currently being served. */ - private int getRegionCount() { + private int getRegionCount() throws IOException { int total = 0; for (HRegionServer server : getOnlineRegionServers()) { total += server.getOnlineRegions().size(); @@ -122,7 +124,7 @@ /** * Wait until all the regions are assigned. */ - private void waitForAllRegionsAssigned() { + private void waitForAllRegionsAssigned() throws IOException { while (getRegionCount() < totalRegionNum) { LOG.debug("Waiting for there to be "+totalRegionNum+" regions, but there are " + getRegionCount() + " right now."); try { Index: src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java (revision 1138246) +++ src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java (working copy) @@ -20,6 +20,8 @@ package org.apache.hadoop.hbase.master; import static org.junit.Assert.*; + +import java.io.IOException; import java.util.List; import java.util.NavigableSet; import java.util.Set; @@ -323,16 +325,18 @@ LOG.debug("\n\nTRR: " + msg + "\n"); } - private RegionServerThread getServerHostingMeta(MiniHBaseCluster cluster) { + private RegionServerThread getServerHostingMeta(MiniHBaseCluster cluster) + throws IOException { return getServerHosting(cluster, HRegionInfo.FIRST_META_REGIONINFO); } - private RegionServerThread getServerHostingRoot(MiniHBaseCluster cluster) { + private RegionServerThread getServerHostingRoot(MiniHBaseCluster cluster) + throws IOException { return getServerHosting(cluster, HRegionInfo.ROOT_REGIONINFO); } private RegionServerThread getServerHosting(MiniHBaseCluster cluster, - HRegionInfo region) { + HRegionInfo region) throws IOException { for (RegionServerThread rst : cluster.getRegionServerThreads()) { if (rst.getRegionServer().getOnlineRegions().contains(region)) { return rst; @@ -342,7 +346,7 @@ } private void assertRegionsAssigned(MiniHBaseCluster cluster, - Set expectedRegions) { + Set expectedRegions) throws IOException { int numFound = 0; for (RegionServerThread rst : cluster.getLiveRegionServerThreads()) { numFound += rst.getRegionServer().getNumberOfOnlineRegions(); @@ -371,7 +375,8 @@ } } - private NavigableSet getAllOnlineRegions(MiniHBaseCluster cluster) { + private NavigableSet getAllOnlineRegions(MiniHBaseCluster cluster) + throws IOException { NavigableSet online = new TreeSet(); for (RegionServerThread rst : cluster.getLiveRegionServerThreads()) { for (HRegionInfo region : rst.getRegionServer().getOnlineRegions()) { @@ -382,7 +387,7 @@ } private NavigableSet getDoubleAssignedRegions( - MiniHBaseCluster cluster) { + MiniHBaseCluster cluster) throws IOException { NavigableSet online = new TreeSet(); NavigableSet doubled = new TreeSet(); for (RegionServerThread rst : cluster.getLiveRegionServerThreads()) { Index: src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java (revision 1138246) +++ src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java (working copy) @@ -413,7 +413,8 @@ } } - private NavigableSet getAllOnlineRegions(MiniHBaseCluster cluster) { + private NavigableSet getAllOnlineRegions(MiniHBaseCluster cluster) + throws IOException { NavigableSet online = new TreeSet(); for (RegionServerThread rst : cluster.getLiveRegionServerThreads()) { for (HRegionInfo region : rst.getRegionServer().getOnlineRegions()) { Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1138246) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -1605,7 +1605,8 @@ @Override @QosPriority(priority=HIGH_QOS) public HRegionInfo getRegionInfo(final byte[] regionName) - throws NotServingRegionException { + throws NotServingRegionException, IOException { + checkOpen(); requestCount.incrementAndGet(); return getRegion(regionName).getRegionInfo(); } @@ -2121,9 +2122,9 @@ public int delete(final byte[] regionName, final List deletes) throws IOException { + checkOpen(); // Count of Deletes processed. int i = 0; - checkOpen(); HRegion region = null; try { region = getRegion(regionName); @@ -2243,6 +2244,7 @@ @Override public void bulkLoadHFile(String hfilePath, byte[] regionName, byte[] familyName) throws IOException { + checkOpen(); HRegion region = getRegion(regionName); region.bulkLoadHFile(hfilePath, familyName); } @@ -2277,6 +2279,7 @@ @QosPriority(priority=HIGH_QOS) public void openRegion(HRegionInfo region) throws IOException { + checkOpen(); if (this.regionsInTransitionInRS.contains(region.getEncodedNameAsBytes())) { throw new RegionAlreadyInTransitionException("open", region.getEncodedName()); } @@ -2297,6 +2300,7 @@ @QosPriority(priority=HIGH_QOS) public void openRegions(List regions) throws IOException { + checkOpen(); LOG.info("Received request to open " + regions.size() + " region(s)"); for (HRegionInfo region: regions) openRegion(region); } @@ -2312,6 +2316,7 @@ @QosPriority(priority=HIGH_QOS) public boolean closeRegion(HRegionInfo region, final boolean zk) throws IOException { + checkOpen(); LOG.info("Received close region: " + region.getRegionNameAsString()); boolean hasit = this.onlineRegions.containsKey(region.getEncodedName()); if (!hasit) { @@ -2359,6 +2364,7 @@ @QosPriority(priority=HIGH_QOS) public void flushRegion(HRegionInfo regionInfo) throws NotServingRegionException, IOException { + checkOpen(); LOG.info("Flushing " + regionInfo.getRegionNameAsString()); HRegion region = getRegion(regionInfo.getRegionName()); region.flushcache(); @@ -2374,6 +2380,7 @@ @Override public void splitRegion(HRegionInfo regionInfo, byte[] splitPoint) throws NotServingRegionException, IOException { + checkOpen(); HRegion region = getRegion(regionInfo.getRegionName()); region.flushcache(); region.forceSplit(splitPoint); @@ -2384,6 +2391,7 @@ @QosPriority(priority=HIGH_QOS) public void compactRegion(HRegionInfo regionInfo, boolean major) throws NotServingRegionException, IOException { + checkOpen(); HRegion region = getRegion(regionInfo.getRegionName()); if (major) { region.triggerMajorCompaction(); @@ -2425,7 +2433,8 @@ @Override @QosPriority(priority=HIGH_QOS) - public List getOnlineRegions() { + public List getOnlineRegions() throws IOException { + checkOpen(); List list = new ArrayList(onlineRegions.size()); for (Map.Entry e: this.onlineRegions.entrySet()) { list.add(e.getValue().getRegionInfo()); @@ -2717,6 +2726,7 @@ @Override @QosPriority(priority=HIGH_QOS) public HServerInfo getHServerInfo() throws IOException { + checkOpen(); return new HServerInfo(new HServerAddress(this.isa), this.startcode, this.webuiport); } @@ -2724,6 +2734,7 @@ @SuppressWarnings("unchecked") @Override public MultiResponse multi(MultiAction multi) throws IOException { + checkOpen(); MultiResponse response = new MultiResponse(); for (Map.Entry>> e : multi.actions.entrySet()) { byte[] regionName = e.getKey(); @@ -2824,6 +2835,7 @@ */ @Override public MultiPutResponse multiPut(MultiPut puts) throws IOException { + checkOpen(); MultiPutResponse resp = new MultiPutResponse(); // do each region as it's own. @@ -2962,6 +2974,7 @@ @Override public void replicateLogEntries(final HLog.Entry[] entries) throws IOException { + checkOpen(); if (this.replicationHandler == null) return; this.replicationHandler.replicateLogEntries(entries); } Index: src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java (revision 1138246) +++ src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java (working copy) @@ -288,7 +288,7 @@ * @return All regions online on this region server * @throws IOException e */ - public List getOnlineRegions(); + public List getOnlineRegions() throws IOException; /** * Method used when a master is taking the place of another failed one.