[0.89-fb] [HBASE-10291] Per-column family L2 cache metrics

Author: arjen

Summary:
This diff adds per-column family L2 cache metrics. In order to make this happen the following needed to change:

The L2 cache deals with raw block data. However, in order to keep the size metrics for different CF's and block types valid the cache needs to know about the block type. In the BlockCache this is achieved by making the HFileBlock implement SchemaAware and augment the HFileBlock with the appropriate data before adding it to the cache. In order to do the same with the L2 cache RawHFileBlocks were added, and the BucketEntry was made to implement SchemaAware.

This led to an interesting problem, as the L2 cache is possibly used by readers and writers who do not have the SchemaAware data. In order to work around this a lightweight facade wrapping CacheConfig and the L2 cache can be instantiated and passed down instead of the actual L2 cahce. This L2CacheAgent is SchemaAware and can add the schema data to the RawHFileBlock's before handing them over to the cache. I feel the L2CacheAgent is still a work in progress as it could potentially centralize the cache policy and allow all cache decisions to be removed from HFile- and block readers and writers.

Depends on D1112436

Test Plan: Added and ran the unit tests, deployed a jar to one of the shadow clusters and observed the stats for a while.

Reviewers: liyintang, aaiyer, manukranthk

Reviewed By: liyintang

CC: hbase-eng@

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

Task ID: 2567910

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