You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/12/04 14:58:33 UTC

[GitHub] [hbase] Apache9 commented on pull request #3904: HBASE-26527 ArrayIndexOutOfBoundsException in KeyValueUtil.copyToNewK…

Apache9 commented on pull request #3904:
URL: https://github.com/apache/hbase/pull/3904#issuecomment-986040911


   Checked the code in KeyValueUtils, there is a method getSerializedSize
   
   ```
     public static int getSerializedSize(Cell cell, boolean withTags) {
       if (withTags) {
         return cell.getSerializedSize();
       }
       if (cell instanceof ExtendedCell) {
         return ((ExtendedCell) cell).getSerializedSize(withTags);
       }
       return length(cell.getRowLength(), cell.getFamilyLength(), cell.getQualifierLength(),
         cell.getValueLength(), cell.getTagsLength(), withTags);
     }
   ```
   
   It seems that if withTags is true, we will always call cell.getSerializedSize directly. I guess this is why we use getSerializedSize there.
   
   So let's add some comments to say that, the byte array is not used for serializaing, as it will copy all the fields such as column family, qualifier, etc, so it is not suitable to call getSerializedSize here, we should calculate it with all the fields.
   
   Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org