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 4ABE898BE for ; Fri, 23 Mar 2012 21:32:07 +0000 (UTC) Received: (qmail 61170 invoked by uid 500); 23 Mar 2012 21:32:07 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 61143 invoked by uid 500); 23 Mar 2012 21:32:07 -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 61136 invoked by uid 99); 23 Mar 2012 21:32:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2012 21:32:07 +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, 23 Mar 2012 21:32:04 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 20DDE238896F for ; Fri, 23 Mar 2012 21:31:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1304611 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/client/MetaScanner.java Date: Fri, 23 Mar 2012 21:31:42 -0000 To: commits@hbase.apache.org From: tedyu@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120323213143.20DDE238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tedyu Date: Fri Mar 23 21:31:42 2012 New Revision: 1304611 URL: http://svn.apache.org/viewvc?rev=1304611&view=rev Log: HBASE-5466 Opening a table also opens the metatable and never closes it (Ashley Taylor) Modified: hbase/branches/0.90/CHANGES.txt hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/MetaScanner.java Modified: hbase/branches/0.90/CHANGES.txt URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1304611&r1=1304610&r2=1304611&view=diff ============================================================================== --- hbase/branches/0.90/CHANGES.txt (original) +++ hbase/branches/0.90/CHANGES.txt Fri Mar 23 21:31:42 2012 @@ -7,6 +7,7 @@ Release 0.90.7 - Unreleased same region with Src and Destination as same RS. (Ram) HBASE-5593 Reverse DNS resolution in regionServerStartup() does not strip trailing dot (David S. Wang) + HBASE-5466 Opening a table also opens the metatable and never closes it (Ashley Taylor) IMPROVEMENT HBASE-5588 Deprecate/remove AssignmentManager#clearRegionFromTransition Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/MetaScanner.java URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/MetaScanner.java?rev=1304611&r1=1304610&r2=1304611&view=diff ============================================================================== --- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/MetaScanner.java (original) +++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/MetaScanner.java Fri Mar 23 21:31:42 2012 @@ -142,25 +142,31 @@ public class MetaScanner { byte[] searchRow = HRegionInfo.createRegionName(tableName, row, HConstants.NINES, false); - - HTable metaTable = new HTable(configuration, HConstants.META_TABLE_NAME); - Result startRowResult = metaTable.getRowOrBefore(searchRow, - HConstants.CATALOG_FAMILY); - if (startRowResult == null) { - throw new TableNotFoundException("Cannot find row in .META. for table: " - + Bytes.toString(tableName) + ", row=" + Bytes.toStringBinary(searchRow)); - } - byte[] value = startRowResult.getValue(HConstants.CATALOG_FAMILY, - HConstants.REGIONINFO_QUALIFIER); - if (value == null || value.length == 0) { - throw new IOException("HRegionInfo was null or empty in Meta for " + - Bytes.toString(tableName) + ", row=" + Bytes.toStringBinary(searchRow)); + HTable metaTable = null; + try { + metaTable = new HTable(configuration, HConstants.META_TABLE_NAME); + Result startRowResult = metaTable.getRowOrBefore(searchRow, + HConstants.CATALOG_FAMILY); + if (startRowResult == null) { + throw new TableNotFoundException("Cannot find row in .META. for table: " + + Bytes.toString(tableName) + ", row=" + Bytes.toStringBinary(searchRow)); + } + byte[] value = startRowResult.getValue(HConstants.CATALOG_FAMILY, + HConstants.REGIONINFO_QUALIFIER); + if (value == null || value.length == 0) { + throw new IOException("HRegionInfo was null or empty in Meta for " + + Bytes.toString(tableName) + ", row=" + Bytes.toStringBinary(searchRow)); + } + HRegionInfo regionInfo = Writables.getHRegionInfo(value); + + byte[] rowBefore = regionInfo.getStartKey(); + startRow = HRegionInfo.createRegionName(tableName, rowBefore, + HConstants.ZEROES, false); + } finally { + if (metaTable != null) { + metaTable.close(); + } } - HRegionInfo regionInfo = Writables.getHRegionInfo(value); - - byte[] rowBefore = regionInfo.getStartKey(); - startRow = HRegionInfo.createRegionName(tableName, rowBefore, - HConstants.ZEROES, false); } else if (tableName == null || tableName.length == 0) { // Full META scan startRow = HConstants.EMPTY_START_ROW;