Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 989DB17831 for ; Wed, 21 Oct 2015 10:07:34 +0000 (UTC) Received: (qmail 48578 invoked by uid 500); 21 Oct 2015 10:07:28 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 48487 invoked by uid 500); 21 Oct 2015 10:07:28 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 48191 invoked by uid 99); 21 Oct 2015 10:07:28 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Oct 2015 10:07:28 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id AB1752C033A for ; Wed, 21 Oct 2015 10:07:27 +0000 (UTC) Date: Wed, 21 Oct 2015 10:07:27 +0000 (UTC) From: "Heng Chen (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HBASE-14662) Fix NPE in HFileOutputFormat2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-14662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Heng Chen updated HBASE-14662: ------------------------------ Description: When i dig in HBASE-14659, i run testWritingPEData. There are a lot of NPE thrown and testcase run a long time. The reason is that, in {{HFileOutputFormat2}} {code} HRegionLocation loc = null; String tableName = conf.get(OUTPUT_TABLE_NAME_CONF_KEY); try (Connection connection = ConnectionFactory.createConnection(conf); RegionLocator locator = connection.getRegionLocator(TableName.valueOf(tableName))) { loc = locator.getRegionLocation(rowKey); } catch (Throwable e) { LOG.warn("there's something wrong when locating rowkey: " + Bytes.toString(rowKey), e); loc = null; } {code} Because we did not set {{OUTPUT_TABLE_NAME_CONF_KEY}}, So tableName is null, So NPE thrown. And connection will be created which RegionLocator use to find region location. Because zk is not start in this testcase, So it will retry many times. But all this actions are not required, we can skip create connection by check whether tableName is null was: When i dig in HBASE-14659, i run testWritingPEData. There are a lot of NPE thrown and testcase run a long time. The reason is that, in {{HFileOutputFormat2}} {code} HRegionLocation loc = null; String tableName = conf.get(OUTPUT_TABLE_NAME_CONF_KEY); try (Connection connection = ConnectionFactory.createConnection(conf); RegionLocator locator = connection.getRegionLocator(TableName.valueOf(tableName))) { loc = locator.getRegionLocation(rowKey); } catch (Throwable e) { LOG.warn("there's something wrong when locating rowkey: " + Bytes.toString(rowKey), e); loc = null; } {code} Because we did not set {{OUTPUT_TABLE_NAME_CONF_KEY}}, So tableName is null, So NPE thrown. And RegionLocator will create connection which RegionLocator use to find region location. Because zk is not start in this testcase, So it will retry many times. But all this actions are not required, we can skip create connection by check whether tableName is null > Fix NPE in HFileOutputFormat2 > ----------------------------- > > Key: HBASE-14662 > URL: https://issues.apache.org/jira/browse/HBASE-14662 > Project: HBase > Issue Type: Sub-task > Reporter: Heng Chen > Attachments: HBASE-14662.patch > > > When i dig in HBASE-14659, i run testWritingPEData. There are a lot of NPE thrown and testcase run a long time. > The reason is that, in {{HFileOutputFormat2}} > {code} > HRegionLocation loc = null; > String tableName = conf.get(OUTPUT_TABLE_NAME_CONF_KEY); > try (Connection connection = ConnectionFactory.createConnection(conf); > RegionLocator locator = > connection.getRegionLocator(TableName.valueOf(tableName))) { > loc = locator.getRegionLocation(rowKey); > } catch (Throwable e) { > LOG.warn("there's something wrong when locating rowkey: " + > Bytes.toString(rowKey), e); > loc = null; > } > {code} > Because we did not set {{OUTPUT_TABLE_NAME_CONF_KEY}}, So tableName is null, So NPE thrown. > And connection will be created which RegionLocator use to find region location. Because zk is not start in this testcase, So it will retry many times. > But all this actions are not required, we can skip create connection by check whether tableName is null -- This message was sent by Atlassian JIRA (v6.3.4#6332)