[0.89-fb] [HBASE-10270] Remove DataBlockEncoding from BlockCacheKey

Author: arjen

Summary:
When a block is added to the block cache its DataBlockEncoding type is stored on the BlockCacheKey. This block encoding is used in the calculation of the hashCode and as such matters when cache lookups are done. The reason the encoding is part of the key is because ScannerV2 expects data blocks where the EncodedScannerV2 expects encoded data blocks. Adding the encoding to the key implicitly defined the block type and caused a cache miss in case there was a mismatch between the block in cache and the scanner type.

However, this has the potential of double caching the same block (with different encoding) and in the case of the scan preloader a read is done without knowing the block type or the expected encoding, causing the preloader to miss encoded blocks already in cache. Removing the encoding from the key allows for a CompoundScannerV2, which can read all data blocks potentially saving IOPS when compacting recent data. Finally, removing the encoding from the BlockCacheKey and making it part of the read call makes more sense, allows keys to be shared between the BlockCache and BucketCache, allowing them to be more uniform and easier to deal with.

Test Plan: Ran the unit tests under org.apache.hadoop.hbase.io.

Reviewers: liyintang, aaiyer, rshroff

Reviewed By: liyintang

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1112436

Task ID: 2567910

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/0.89-fb@1555210 13f79535-47bb-0310-9956-ffa450edef68