Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-6885

Fix wrong use of BytesWritable in FSEditLogOp#RenameOp

    Details

    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      After readField using BytesWritable, the data length should be writable.getLength(), instead of writable.getBytes().length which is the buffer length.
      This will cause returned Rename[] is longer than expected and may include some incorrect values (Currently they are Rename#NONE, and have not caused problem but code logic is incorrect).

      BytesWritable writable = new BytesWritable();
      writable.readFields(in);
      
      byte[] bytes = writable.getBytes();
      Rename[] options = new Rename[bytes.length];
      
      for (int i = 0; i < bytes.length; i++) {
        options[i] = Rename.valueOf(bytes[i]);
      }
      

        Attachments

          Activity

            People

            • Assignee:
              hitliuyi Yi Liu
              Reporter:
              hitliuyi Yi Liu
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: