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:
Xiang Li 2016-11-26 00:44:17 +08:00 committed by anoopsamjohn
parent d87df9209a
commit 346e904a21
1 changed files with 7 additions and 0 deletions

View File

@ -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();