[
https://issues.apache.org/jira/browse/HBASE-27940?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
chenglei updated HBASE-27940:
-----------------------------
Description:
After HBASE-27053, checksum is removed from the {{HFileBlock}} {{ByteBuff}} in
{{FSReaderImpl.readBlockDataInternal}} once the checksum is verified, so
{{HFileBlock.buf}} does not include checksum, but for
{{BlockIndexReader.readMultiLevelIndexRoot}}, after read root index entries ,
it still subtract the checksum to check if the midkey metadat exists, the :
{code:java}
public void readMultiLevelIndexRoot(HFileBlock blk, final int numEntries)
throws IOException {
DataInputStream in = readRootIndex(blk, numEntries);
// after reading the root index the checksum bytes have to
// be subtracted to know if the mid key exists.
int checkSumBytes = blk.totalChecksumBytes();
if ((in.available() - checkSumBytes) < MID_KEY_METADATA_SIZE) {
// No mid-key metadata available.
return;
}
midLeafBlockOffset = in.readLong();
midLeafBlockOnDiskSize = in.readInt();
midKeyEntry = in.readInt();
}
{code}
was:
After HBASE-27053, checksum is removed from the {{HFileBlock}} {{ByteBuff}} in
{{FSReaderImpl.readBlockDataInternal}} once the checksum is verified, so
{{HFileBlock.buf}} does not include checksum, but for
{{BlockIndexReader.readMultiLevelIndexRoot}}, after read root index entries ,
it still subtract the checksum to check if the midkey exists:
{code:java}
public void readMultiLevelIndexRoot(HFileBlock blk, final int numEntries)
throws IOException {
DataInputStream in = readRootIndex(blk, numEntries);
// after reading the root index the checksum bytes have to
// be subtracted to know if the mid key exists.
int checkSumBytes = blk.totalChecksumBytes();
if ((in.available() - checkSumBytes) < MID_KEY_METADATA_SIZE) {
// No mid-key metadata available.
return;
}
midLeafBlockOffset = in.readLong();
midLeafBlockOnDiskSize = in.readInt();
midKeyEntry = in.readInt();
}
{code}
> Midkey metadata in root index block would always be ignored by
> BlockIndexReader.readMultiLevelIndexRoot
> -------------------------------------------------------------------------------------------------------
>
> Key: HBASE-27940
> URL: https://issues.apache.org/jira/browse/HBASE-27940
> Project: HBase
> Issue Type: Bug
> Components: HFile
> Affects Versions: 3.0.0-alpha-4, 2.4.17, 2.5.5, 4.0.0-alpha-1
> Reporter: chenglei
> Priority: Major
>
> After HBASE-27053, checksum is removed from the {{HFileBlock}} {{ByteBuff}}
> in {{FSReaderImpl.readBlockDataInternal}} once the checksum is verified, so
> {{HFileBlock.buf}} does not include checksum, but for
> {{BlockIndexReader.readMultiLevelIndexRoot}}, after read root index entries ,
> it still subtract the checksum to check if the midkey metadat exists, the :
> {code:java}
> public void readMultiLevelIndexRoot(HFileBlock blk, final int numEntries)
> throws IOException {
> DataInputStream in = readRootIndex(blk, numEntries);
> // after reading the root index the checksum bytes have to
> // be subtracted to know if the mid key exists.
> int checkSumBytes = blk.totalChecksumBytes();
> if ((in.available() - checkSumBytes) < MID_KEY_METADATA_SIZE) {
> // No mid-key metadata available.
> return;
> }
> midLeafBlockOffset = in.readLong();
> midLeafBlockOnDiskSize = in.readInt();
> midKeyEntry = in.readInt();
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)