Return-Path: Delivered-To: apmail-hadoop-hbase-dev-archive@minotaur.apache.org Received: (qmail 18667 invoked from network); 22 Sep 2009 16:30:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Sep 2009 16:30:40 -0000 Received: (qmail 96375 invoked by uid 500); 22 Sep 2009 16:30:40 -0000 Delivered-To: apmail-hadoop-hbase-dev-archive@hadoop.apache.org Received: (qmail 96329 invoked by uid 500); 22 Sep 2009 16:30:40 -0000 Mailing-List: contact hbase-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hbase-dev@hadoop.apache.org Delivered-To: mailing list hbase-dev@hadoop.apache.org Received: (qmail 96257 invoked by uid 99); 22 Sep 2009 16:30:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Sep 2009 16:30:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Sep 2009 16:30:37 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 059FE234C044 for ; Tue, 22 Sep 2009 09:30:16 -0700 (PDT) Message-ID: <327962181.1253637016003.JavaMail.jira@brutus> Date: Tue, 22 Sep 2009 09:30:16 -0700 (PDT) From: "stack (JIRA)" To: hbase-dev@hadoop.apache.org Subject: [jira] Updated: (HBASE-1856) HBASE-1765 broke MapReduce when using Result.list() In-Reply-To: <1425266358.1253608336005.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HBASE-1856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] stack updated HBASE-1856: ------------------------- Attachment: 1856.patch > HBASE-1765 broke MapReduce when using Result.list() > --------------------------------------------------- > > Key: HBASE-1856 > URL: https://issues.apache.org/jira/browse/HBASE-1856 > Project: Hadoop HBase > Issue Type: Bug > Affects Versions: 0.20.1, 0.21.0 > Reporter: Lars George > Priority: Critical > Fix For: 0.20.1 > > Attachments: 1856.patch > > > Not sure if it is just me, but using MR over HBase employing a TableReducer is not working. After the first row is read all subsequent rows get the same Result's of that very first row. After tracing this from the Map phase I found the culprit in Result and the HBASE-1765 delayed field parsing change. > This is the code I use in the reduce(): > {code} > @Override > protected void reduce(ImmutableBytesWritable key, Iterable values, > Context context) throws IOException, InterruptedException { > String skey = Bytes.toString(key.get()); > context.getCounter(CountersTotals.ROWS).increment(1); > for (Result result : values) { > for (KeyValue kv: result.list()) { > try { > if (LOG.isDebugEnabled()) LOG.debug("reduce: key -> " + skey + ", kv -> " + kv); > ... > {code} > Here is the current list() implementation: > {code} > public List list() { > if(this.kvs == null) { > readFields(); > } > return isEmpty()? null: Arrays.asList(sorted()); > } > {code} > The problem is that readFields(DataInput) does not clear kvs! > {code} > public void readFields(final DataInput in) > throws IOException { > familyMap = null; > row = null; > int totalBuffer = in.readInt(); > if(totalBuffer == 0) { > bytes = null; > return; > } > byte [] raw = new byte[totalBuffer]; > in.readFully(raw, 0, totalBuffer); > bytes = new ImmutableBytesWritable(raw, 0, totalBuffer); > } > {code} > The above is called by the MR framework's WritableSerialization for each map output. But since "kvs" is already set "list()" returns the old data! > I assume the only change needed is clearing kvs as well: > {code} > public void readFields(final DataInput in) > throws IOException { > familyMap = null; > row = null; > kvs = null; > .... > {code} > I'll test that now and report. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.