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 C030310A4E for ; Fri, 27 Dec 2013 19:18:43 +0000 (UTC) Received: (qmail 84819 invoked by uid 500); 27 Dec 2013 19:18:43 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 84790 invoked by uid 500); 27 Dec 2013 19:18:43 -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 84783 invoked by uid 99); 27 Dec 2013 19:18:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Dec 2013 19:18:43 +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; Fri, 27 Dec 2013 19:18:41 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4739A2388860; Fri, 27 Dec 2013 19:18:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1553722 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Date: Fri, 27 Dec 2013 19:18:20 -0000 To: commits@hbase.apache.org From: liyin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131227191820.4739A2388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: liyin Date: Fri Dec 27 19:18:19 2013 New Revision: 1553722 URL: http://svn.apache.org/r1553722 Log: [HBASE-10236] Avoid creating extra connection when locating a region Author: gauravm Summary: In Swift, I found that inside locateRegionInMeta(), we create a connection to meta, before checking if the region's location is in the cache. Most of the time, we expect a hit, hence most of the time, we end up creating a useless connection object. In swift, a lot of these objects caused the thread pool to get exhausted while starting up. This might not be a problem in trunk, but still it seems like an improvement. Test Plan: Unit Tests Reviewers: liyintang, aaiyer, rshroff, manukranthk, adela, fan Reviewed By: fan CC: hbase-eng@ Differential Revision: https://phabricator.fb.com/D1110985 Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1553722&r1=1553721&r2=1553722&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Fri Dec 27 19:18:19 2013 @@ -1039,9 +1039,6 @@ public class HConnectionManager { } didTry = true; - HRegionInterface serverInterface = - getHRegionConnection(metaLocation.getServerAddress()); - 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 @@ -1067,7 +1064,10 @@ public class HConnectionManager { prefetchRegionCache(tableName, row); } - // Query the root or meta region for the location of the meta region + HRegionInterface serverInterface = + getHRegionConnection(metaLocation.getServerAddress()); + + // Query the root or meta region for the location of the meta region regionInfoRow = serverInterface.getClosestRowBefore( metaLocation.getRegionInfo().getRegionName(), metaKey, HConstants.CATALOG_FAMILY);