Yi Liu created HDFS-6885:
----------------------------

             Summary: Fix wrong use of BytesWritable in FSEditLogOp#RenameOp
                 Key: HDFS-6885
                 URL: https://issues.apache.org/jira/browse/HDFS-6885
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: namenode
            Reporter: Yi Liu
            Assignee: Yi Liu
            Priority: Minor


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 (They are Rename#NONE, and have not caused problem but 
code is incorrect). 
{code}
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]);
}
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to