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

Fix wrong use of BytesWritable in FSEditLogOp#RenameOp

    XMLWordPrintableJSON

Details

    • 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

        1. HDFS-6885.001.patch
          0.8 kB
          Yi Liu

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: