private void validateBlockType(HFileBlock block, BlockType expectedBlockType) throws IOException {
    if (expectedBlockType == null) {
      return;
    }
    BlockType actualBlockType = block.getBlockType();
    if (expectedBlockType.isData() && actualBlockType.isData()) {
      // We consider DATA to match ENCODED_DATA for the purpose of this
      // verification.
      return;
    }
    if (actualBlockType != expectedBlockType) {
      throw new IOException("Expected block type " + expectedBlockType + ", " + "but got "
        + actualBlockType + ": " + block + ", path=" + path);
    }
  }
Compares the actual type of a block retrieved from cache or disk with its expected type and
throws an exception in case of a mismatch. Expected block type of {@link BlockType#DATA} is
considered to match the actual block type [@link {@link BlockType#ENCODED_DATA} as well.
@param block             a block retrieved from cache or disk
@param expectedBlockType the expected block type, or null to skip the check
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java