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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.6.2
    • 2.8.0, 2.7.3, 2.6.5, 3.0.0-alpha1
    • util
    • None
    • 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

              zhudebin devinzhu
              zhudebin devinzhu
              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