Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 71CF010A2A for ; Wed, 2 Apr 2014 20:50:08 +0000 (UTC) Received: (qmail 92561 invoked by uid 500); 2 Apr 2014 20:50:07 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 92280 invoked by uid 500); 2 Apr 2014 20:50:05 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 92088 invoked by uid 99); 2 Apr 2014 20:50:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2014 20:50:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2014 20:50:00 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0757123889F7; Wed, 2 Apr 2014 20:49:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1584169 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/client/TableServers.java test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java Date: Wed, 02 Apr 2014 20:49:27 -0000 To: commits@hbase.apache.org From: liyin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140402204928.0757123889F7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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;