[ 
https://issues.apache.org/jira/browse/HBASE-18389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16091711#comment-16091711
 ] 

Xiang Li commented on HBASE-18389:
----------------------------------

Hi [~chia7712], thanks very much for your review and comments!

1. Regarding the links in the javadoc, corrected in patch 001 (will upload it 
shortly after). Sorry, my bad, I did not bring in the package name of KeyValue, 
so it could not be addressed. Corrected.

2. Regarding 
bq. Is it better to use the name "sizeOfByteArray" to replace 
"sizeOfPartOfByteArray" ?
Thanks for the suggestion! Yes, the function is to calculate the size of a byte 
array. But the reason why I added "PartOf" into the function name is to 
highlight that this function is not to calculate the whole byte array, but only 
a part of it, while sizeOf(byte[] b) is to calculate the whole byte array 
specifed as byte[] b. Does it make sense to you?

> Remove byte[] from formal parameter of sizeOf() of ClassSize, 
> ClassSize.MemoryLayout and ClassSize.UnsafeLayout
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-18389
>                 URL: https://issues.apache.org/jira/browse/HBASE-18389
>             Project: HBase
>          Issue Type: Bug
>          Components: util
>            Reporter: Xiang Li
>            Assignee: Xiang Li
>            Priority: Minor
>         Attachments: HBASE-18389.master.000.patch
>
>
> In ClassSize class and its internal static class, sizeOf() function has 2 
> formal parameters: byte[] b and int len. But the function's internal logic 
> does not use or refer to byte[] b. Could be removed.
> {code:title=hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java|borderStyle=solid}
> // Class of ClassSize
> public static long sizeOf(byte[] b, int len) {
>   return memoryLayout.sizeOf(b, len);
> }
> // Class of ClassSize.MemoryLayout
> long sizeOf(byte[] b, int len) {
>   return align(arrayHeaderSize() + len);
> }
> // Class of ClassSize.UnsafeLayout
> long sizeOf(byte[] b, int len) {
>   return align(arrayHeaderSize() + len * 
> UnsafeAccess.theUnsafe.ARRAY_BYTE_INDEX_SCALE);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to