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 A5CA0F64F for ; Wed, 1 May 2013 18:18:37 +0000 (UTC) Received: (qmail 17630 invoked by uid 500); 1 May 2013 18:18:37 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 17575 invoked by uid 500); 1 May 2013 18:18:37 -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 17568 invoked by uid 99); 1 May 2013 18:18:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 May 2013 18:18:37 +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, 01 May 2013 18:18:36 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2F8D623888FE; Wed, 1 May 2013 18:18:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1478134 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Date: Wed, 01 May 2013 18:18:16 -0000 To: commits@hbase.apache.org From: liyin@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130501181816.2F8D623888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: liyin Date: Wed May 1 18:18:15 2013 New Revision: 1478134 URL: http://svn.apache.org/r1478134 Log: [0.89-fb] [HBASE-8476] locateRegionInMeta should check the cache before doing the prefetch Author: aaiyer Summary: When we start a hbase client, all threads need to synchronize to avoid accessing the META region at the same time. However, we need to check if the region cache is populated before going to META. Without this, each thread will end up fetching entries from META, losing any possible optimisation for reducing the queries to META. Test Plan: pushed to titanshadow025 and see a much faster htable opens. run mr unit tests Reviewers: rshroff, manukranthk, liyintang, anshumansingh26 Reviewed By: anshumansingh26 CC: hbase-eng@, anshumansingh26 Differential Revision: https://phabricator.fb.com/D795230 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=1478134&r1=1478133&r2=1478134&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 Wed May 1 18:18:15 2013 @@ -1037,13 +1037,6 @@ public class HConnectionManager { // 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 (regionLockObject) { - // If the parent table is META, we may want to pre-fetch some - // region info into the global region cache for this table. - if (Bytes.equals(parentTable, HConstants.META_TABLE_NAME) && - (getRegionCachePrefetch(tableName)) ) { - prefetchRegionCache(tableName, row); - } - // Check the cache again for a hit in case some other thread made the // same query while we were waiting on the lock. If not supposed to // be using the cache, delete any existing cached location so it won't @@ -1057,6 +1050,13 @@ public class HConnectionManager { deleteCachedLocation(tableName, row, null); } + // If the parent table is META, we may want to pre-fetch some + // region info into the global region cache for this table. + if (Bytes.equals(parentTable, HConstants.META_TABLE_NAME) && + (getRegionCachePrefetch(tableName)) ) { + prefetchRegionCache(tableName, row); + } + // Query the root or meta region for the location of the meta region regionInfoRow = serverInterface.getClosestRowBefore( metaLocation.getRegionInfo().getRegionName(), metaKey,