HBASE-17086: Add comments to explain why Cell#getTagsLength() returns an int, rather than a short
Signed-off-by: anoopsamjohn <anoopsamjohn@gmail.com>
This commit is contained in:
parent
d87df9209a
commit
346e904a21
|
@ -170,6 +170,7 @@ public interface Cell {
|
|||
int getValueLength();
|
||||
|
||||
/**
|
||||
* Contiguous raw bytes representing tags that may start at any index in the containing array.
|
||||
* @return the tags byte array
|
||||
*/
|
||||
byte[] getTagsArray();
|
||||
|
@ -180,6 +181,12 @@ public interface Cell {
|
|||
int getTagsOffset();
|
||||
|
||||
/**
|
||||
* HBase internally uses 2 bytes to store tags length in Cell.
|
||||
* As the tags length is always a non-negative number, to make good use of the sign bit,
|
||||
* the max of tags length is defined as {@link TagUtil#MAX_TAGS_LENGTH}, which is 2 * Short.MAX_VALUE + 1 = 65535.
|
||||
* As a result, the return type is int, because a short is not capable of handling that.
|
||||
* Please note that even if the return type is int, the max tags length is far less than Integer.MAX_VALUE.
|
||||
*
|
||||
* @return the total length of the tags in the Cell.
|
||||
*/
|
||||
int getTagsLength();
|
||||
|
|
Loading…
Reference in New Issue