Return-Path: X-Original-To: apmail-hadoop-mapreduce-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 37C51105E5 for ; Thu, 17 Sep 2015 15:46:21 +0000 (UTC) Received: (qmail 17149 invoked by uid 500); 17 Sep 2015 15:46:05 -0000 Delivered-To: apmail-hadoop-mapreduce-issues-archive@hadoop.apache.org Received: (qmail 17089 invoked by uid 500); 17 Sep 2015 15:46:05 -0000 Mailing-List: contact mapreduce-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mapreduce-issues@hadoop.apache.org Delivered-To: mailing list mapreduce-issues@hadoop.apache.org Received: (qmail 17077 invoked by uid 99); 17 Sep 2015 15:46:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Sep 2015 15:46:05 +0000 Date: Thu, 17 Sep 2015 15:46:05 +0000 (UTC) From: "Hudson (JIRA)" To: mapreduce-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (MAPREDUCE-6481) LineRecordReader may give incomplete record and wrong position/key information for uncompressed input sometimes. 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/MAPREDUCE-6481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14803105#comment-14803105 ] Hudson commented on MAPREDUCE-6481: ----------------------------------- FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #408 (See [https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/408/]) MAPREDUCE-6481. LineRecordReader may give incomplete record and wrong position/key information for uncompressed input sometimes. Contributed by Zhihai Xu (jlowe: rev 58d1a02b8d66b1d2a6ac2158be32bd35ad2e69bd) * hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/UncompressedSplitLineReader.java * hadoop-mapreduce-project/CHANGES.txt * hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestLineRecordReader.java * hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/LineReader.java * hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestLineRecordReader.java > LineRecordReader may give incomplete record and wrong position/key information for uncompressed input sometimes. > ---------------------------------------------------------------------------------------------------------------- > > Key: MAPREDUCE-6481 > URL: https://issues.apache.org/jira/browse/MAPREDUCE-6481 > Project: Hadoop Map/Reduce > Issue Type: Bug > Components: mrv2 > Affects Versions: 2.7.0 > Reporter: zhihai xu > Assignee: zhihai xu > Priority: Critical > Fix For: 2.8.0 > > Attachments: MAPREDUCE-6481.000.patch > > > LineRecordReader may give incomplete record and wrong position/key information for uncompressed input sometimes. > There are two issues: > # LineRecordReader may give incomplete record: some characters cut off at the end of record. > # LineRecordReader may give wrong position/key information. > The first issue only happens for Custom Delimiter, which is caused by the following code at {{LineReader#readCustomLine}}: > {code} > if (appendLength > 0) { > if (ambiguousByteCount > 0) { > str.append(recordDelimiterBytes, 0, ambiguousByteCount); > //appending the ambiguous characters (refer case 2.2) > bytesConsumed += ambiguousByteCount; > ambiguousByteCount=0; > } > str.append(buffer, startPosn, appendLength); > txtLength += appendLength; > } > {code} > If {{appendLength}} is 0 and {{ambiguousByteCount}} is not 0, this bug will be triggered. For example, input is "123456789aab", Custom Delimiter is "ab", bufferSize is 10 and splitLength is 12, the correct record should be "123456789a" with length 10, but we get incomplete record "123456789" with length 9 from current code. > The second issue can happen for both Custom Delimiter and Default Delimiter, which is caused by the code in {{UncompressedSplitLineReader#readLine}}. {{UncompressedSplitLineReader#readLine}} may report wrong size information at some corner cases. The reason is {{unusedBytes}} in the following code: > {code} > bytesRead += unusedBytes; > unusedBytes = bufferSize - getBufferPosn(); > bytesRead -= unusedBytes; > {code} > If the last bytes read (bufferLength) is less than bufferSize, the previous {{unusedBytes}} will be wrong, which should be {{bufferLength}} - {{bufferPosn}} instead of bufferSize - {{bufferPosn}}. It will return larger value. > For example, input is "1234567890ab12ab345", Custom Delimiter is "ab", bufferSize is 10 and two splits:first splitLength is 15 and second splitLength 4: > the current code will give the following result: > First record: Key:0 Value:"1234567890" > Second record: Key:12 Value:"12" > Third Record: Key:21 Value:"345" > You can see the Key for the third record is wrong, it should be 16 instead of 21. It is due to wrong {{unusedBytes}}. {{fillBuffer}} read 10 bytes for the first time, for the second times, it only read 5 bytes, which is 5 bytes less than the bufferSize. That is why the key we get is 5 bytes larger than the correct one. -- This message was sent by Atlassian JIRA (v6.3.4#6332)