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

dingwei2019 edited comment on HBASE-26016 at 6/19/21, 3:51 AM:
---------------------------------------------------------------

the problem is because the max offset is equal to the start of last datablock, 
but  the last LEAF_INDEX and BLOOM_CHUNK is just behind of the last datablock.

{color:#172b4d}_long offset = trailer.getFirstDataBlockOffset(),_{color}
 {color:#172b4d} _max = trailer.getLastDataBlockOffset();_{color}
 {color:#172b4d}_HFileBlock block;_{color}
 {color:#172b4d}_while (offset <= max) {_{color}
 {color:#172b4d} _block = reader.readBlock(offset, -1, /* cacheBlock */ false, 
/* pread */ false,_{color}
 {color:#172b4d} _/* isCompaction */ false, /* updateCacheMetrics */ false, 
null, null);_{color}
 {color:#172b4d} _offset += block.getOnDiskSizeWithHeader();_{color}
 {color:#172b4d} _out.println(block);_{color}
 {color:#172b4d}_}_{color}

 

{color:#172b4d}_so it was better to adjust max to the beginning of 
loadonopenblock. see the below:_{color}

{color:#172b4d}_long offset = trailer.getFirstDataBlockOffset(),_
_max = {color:#ff8b00}trailer.getLoadOnOpenDataOffset();{color}_
_HFileBlock block;_
{color:#ff8b00}_while (offset < max) {_{color}
_block = reader.readBlock(offset, -1, /* cacheBlock */ false, /* pread */ 
false,_
_/* isCompaction */ false, /* updateCacheMetrics */ false, null, null);_
_offset += block.getOnDiskSizeWithHeader();_
_out.println(block);_
_}_{color}


was (Author: dingwei2019):
the problem is because the max offset is equal to the start of last datablock, 
but  the last LEAF_INDEX and BLOOM_CHUNK is just behind of the last datablock.

{color:#172b4d}_long offset = trailer.getFirstDataBlockOffset(),_{color}
{color:#172b4d} _max = trailer.getLastDataBlockOffset();_{color}
{color:#172b4d}_HFileBlock block;_{color}
{color:#172b4d}_while (offset <= max) {_{color}
{color:#172b4d} _block = reader.readBlock(offset, -1, /* cacheBlock */ false, 
/* pread */ false,_{color}
{color:#172b4d} _/* isCompaction */ false, /* updateCacheMetrics */ false, 
null, null);_{color}
{color:#172b4d} _offset += block.getOnDiskSizeWithHeader();_{color}
{color:#172b4d} _out.println(block);_{color}
{color:#172b4d}_}_{color}

> HFilePrettyPrinter tool can not print the last LEAF_INDEX block or 
> BLOOM_CHUNK.
> -------------------------------------------------------------------------------
>
>                 Key: HBASE-26016
>                 URL: https://issues.apache.org/jira/browse/HBASE-26016
>             Project: HBase
>          Issue Type: Bug
>          Components: regionserver
>    Affects Versions: 2.1.0, 2.3.2, 2.4.4
>            Reporter: dingwei2019
>            Assignee: dingwei2019
>            Priority: Minor
>
> when i use pretty printer tool to print the headers of block, i can not get 
> the last LEAF_INDEX block and BLOOM_CHUNK. the last info of the tools is blow:
>  
>  _[blockType=DATA, fileOffset=246617457, headerSize=33, 
> onDiskSizeWithoutHeader=66485, uncompressedSizeWithoutHeader=66465, 
> prevBlockOffset=246550939, isUseHBaseChecksum=true, checksumType=CRC32C, 
> bytesPerChecksum=16384, onDiskDataSizeWithHeader=66498, 
> getOnDiskSizeWithHeader=66518, totalChecksumBytes=20, isUnpacked=true, 
> buf=[SingleByteBuff[pos=0, lim=66518, cap= 66551]], 
> dataBeginsWith=\x00\x00\x00,\x00\x00\x03\xE8\x00\x1A0000000000000000000816, 
> fileContext=[usesHBaseChecksum=true, checksumType=CRC32C, 
> bytesPerChecksum=16384, blocksize=65536, encoding=NONE, includesMvcc=true, 
> includesTags=false, compressAlgo=NONE, compressTags=false, 
> cryptoContext=[cipher=NONE keyHash=NONE], 
> name=0d519e7318414362a56e4f41bf63ccd4, 
> cellComparator=org.apache.hadoop.hbase.CellComparatorImpl@38b972d7], 
> nextBlockOnDiskSize=66518]_
> _[blockType=DATA, fileOffset=246683975, headerSize=33, 
> onDiskSizeWithoutHeader=66485, uncompressedSizeWithoutHeader=66465, 
> prevBlockOffset=246617457, isUseHBaseChecksum=true, checksumType=CRC32C, 
> bytesPerChecksum=16384, onDiskDataSizeWithHeader=66498, 
> getOnDiskSizeWithHeader=66518, totalChecksumBytes=20, isUnpacked=true, 
> buf=[SingleByteBuff[pos=0, lim=66518, cap= 66551]], 
> dataBeginsWith=\x00\x00\x00,\x00\x00\x03\xE8\x00\x1A0000000000000000000816, 
> fileContext=[usesHBaseChecksum=true, checksumType=CRC32C, 
> bytesPerChecksum=16384, blocksize=65536, encoding=NONE, includesMvcc=true, 
> includesTags=false, compressAlgo=NONE, compressTags=false, 
> cryptoContext=[cipher=NONE keyHash=NONE], 
> name=0d519e7318414362a56e4f41bf63ccd4, 
> cellComparator=org.apache.hadoop.hbase.CellComparatorImpl@38b972d7], 
> nextBlockOnDiskSize=51744]_
> _[blockType=DATA, fileOffset=246750493, headerSize=33, 
> onDiskSizeWithoutHeader=51711, uncompressedSizeWithoutHeader=51695, 
> prevBlockOffset=246683975, isUseHBaseChecksum=true, checksumType=CRC32C, 
> bytesPerChecksum=16384, onDiskDataSizeWithHeader=51728, 
> getOnDiskSizeWithHeader=51744, totalChecksumBytes=16, isUnpacked=true, 
> buf=[SingleByteBuff[pos=0, lim=51744, cap= 51777]], 
> dataBeginsWith=\x00\x00\x00,\x00\x00\x03\xE8\x00\x1A0000000000000000000816, 
> fileContext=[usesHBaseChecksum=true, checksumType=CRC32C, 
> bytesPerChecksum=16384, blocksize=65536, encoding=NONE, includesMvcc=true, 
> includesTags=false, compressAlgo=NONE, compressTags=false, 
> cryptoContext=[cipher=NONE keyHash=NONE], 
> name=0d519e7318414362a56e4f41bf63ccd4, 
> cellComparator=org.apache.hadoop.hbase.CellComparatorImpl@38b972d7], 
> nextBlockOnDiskSize=20585]_



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to