public static int validateBlockAddition(Cacheable existing, Cacheable newBlock,
    BlockCacheKey cacheKey) {
    int comparison = compareCacheBlock(existing, newBlock, false);
    if (comparison != 0) {
      throw new RuntimeException(
        "Cached block contents differ, which should not have happened." + "cacheKey:" + cacheKey);
    }
    if ((existing instanceof HFileBlock) && (newBlock instanceof HFileBlock)) {
      comparison = ((HFileBlock) existing).getNextBlockOnDiskSize()
        - ((HFileBlock) newBlock).getNextBlockOnDiskSize();
    }
    return comparison;
  }
Validate that the existing and newBlock are the same without including the nextBlockMetadata,
if not, throw an exception. If they are the same without the nextBlockMetadata, return the
comparison.
@param existing block that is existing in the cache.
@param newBlock block that is trying to be cached.
@param cacheKey the cache key of the blocks.
@return comparison of the existing block to the newBlock.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java