Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-13192

org.apache.hadoop.util.LineReader cannot handle multibyte delimiters correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.6.2
    • Fix Version/s: 2.8.0, 2.7.3, 2.6.5, 3.0.0-alpha1
    • Component/s: util
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      org.apache.hadoop.util.LineReader.readCustomLine() has a bug,
      when line is aaaabccc, recordDelimiter is aaab, the result should be a,ccc,
      show the code on line 310:
      for (; bufferPosn < bufferLength; ++bufferPosn) {
      if (buffer[bufferPosn] == recordDelimiterBytes[delPosn]) {
      delPosn++;
      if (delPosn >= recordDelimiterBytes.length)

      { bufferPosn++; break; }
      } else if (delPosn != 0) { bufferPosn--; delPosn = 0; }
      }

      shoud be :
      for (; bufferPosn < bufferLength; ++bufferPosn) {
      if (buffer[bufferPosn] == recordDelimiterBytes[delPosn]) {
      delPosn++;
      if (delPosn >= recordDelimiterBytes.length) { bufferPosn++; break; }

      } else if (delPosn != 0)

      { // ------------- change here ------------- start ---- bufferPosn -= delPosn; // ------------- change here ------------- end ---- delPosn = 0; }

      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                zhudebin binde
                Reporter:
                zhudebin binde
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 5m
                  5m
                  Remaining:
                  Remaining Estimate - 5m
                  5m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified