Author: liyin Date: Wed Apr 2 20:49:27 2014 New Revision: 1584169 URL: http://svn.apache.org/r1584169 Log: [HBASE-9930] Bug fix in HConnectionManager isMeta function.
Author: manukranthk Summary: Catching an exception and finally removing the element from the isMeta stack. Test Plan: Tested on tsh053. We should probably replace this stack using a boolean being passed throughout the interface/or a better design to identify the fact that we are looking for the meta table and that it needs to be prioritized. Reviewers: adela, gauravm Reviewed By: gauravm CC: hbase-eng@ Differential Revision: https://phabricator.fb.com/D1232327 Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java?rev=1584169&r1=1584168&r2=1584169&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/TableServers.java Wed Apr 2 20:49:27 2014 @@ -988,30 +988,36 @@ private HRegionLocation locateMetaInRoot } didTry = true; HBaseThriftRPC.isMeta.get().push(true); - Result regionInfoRow = null; - // This block guards against two threads trying to load the meta - // region at the same time. The first will load the meta region and - // the second will use the value that the first one found. - synchronized (metaRegionLock) { - if (useCache) { - location = getCachedLocation(tableName, row); - if (location != null) { - return location; + try { + Result regionInfoRow = null; + // This block guards against two threads trying to load the meta + // region at the same time. The first will load the meta region and + // the second will use the value that the first one found. + synchronized (metaRegionLock) { + if (useCache) { + location = getCachedLocation(tableName, row); + if (location != null) { + return location; + } + } else { + LOG.debug("Deleting the client location cache."); + deleteCachedLocation(tableName, row, null); } - } else { - LOG.debug("Deleting the client location cache."); - deleteCachedLocation(tableName, row, null); - } - HRegionInterface serverInterface = getHRegionConnection(metaLocation - .getServerAddress()); + HRegionInterface serverInterface = getHRegionConnection(metaLocation + .getServerAddress()); - // Query the root for the location of the meta region - regionInfoRow = serverInterface.getClosestRowBefore(metaLocation - .getRegionInfo().getRegionName(), metaKey, - HConstants.CATALOG_FAMILY); - location = getLocationFromRow(regionInfoRow, tableName, - parentTable, row); - cacheLocation(tableName, location); + // Query the root for the location of the meta region + regionInfoRow = serverInterface.getClosestRowBefore(metaLocation + .getRegionInfo().getRegionName(), metaKey, + HConstants.CATALOG_FAMILY); + location = getLocationFromRow(regionInfoRow, tableName, + parentTable, row); + cacheLocation(tableName, location); + } + } catch (Throwable t) { + throw t; + } finally { + HBaseThriftRPC.isMeta.get().pop(); } return location; } catch (TableNotFoundException e) { @@ -1049,7 +1055,6 @@ private HRegionLocation locateMetaInRoot throw e; } } finally { - HBaseThriftRPC.isMeta.get().pop(); updateFailureInfoForServer(server, fInfo, didTry, couldNotCommunicateWithServer, retryDespiteFastFailMode); } Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java?rev=1584169&r1=1584168&r2=1584169&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java (original) +++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java Wed Apr 2 20:49:27 2014 @@ -5,7 +5,6 @@ import static org.junit.Assert.*; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; @@ -13,8 +12,6 @@ import java.util.Random; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HBaseTestingUtility; -import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; @@ -24,7 +21,6 @@ import org.apache.hadoop.hbase.io.hfile. import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.HRegionUtilities; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.hbase.util.RegionserverUtils; import org.junit.After; import org.junit.Before; import org.junit.Test;
