@InterfaceAudience.Private public class BlockCacheUtil extends Object
| Modifier and Type | Class and Description | 
|---|---|
(package private) static class  | 
BlockCacheUtil.CachedBlockCountsPerFile
Little data structure to hold counts for a file. 
 | 
static class  | 
BlockCacheUtil.CachedBlocksByFile
Use one of these to keep a running account of cached blocks by file. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
private static org.apache.hbase.thirdparty.com.google.gson.Gson | 
GSON
Needed generating JSON. 
 | 
private static org.slf4j.Logger | 
LOG  | 
static long | 
NANOS_PER_SECOND  | 
| Constructor and Description | 
|---|
BlockCacheUtil()  | 
| Modifier and Type | Method and Description | 
|---|---|
private static int | 
compareCacheBlock(Cacheable left,
                 Cacheable right,
                 boolean includeNextBlockMetadata)  | 
static BlockCacheUtil.CachedBlocksByFile | 
getLoadedCachedBlocksByFile(org.apache.hadoop.conf.Configuration conf,
                           BlockCache bc)
Get a  
BlockCacheUtil.CachedBlocksByFile instance and load it up by iterating content in
 BlockCache. | 
static boolean | 
shouldReplaceExistingCacheBlock(BlockCache blockCache,
                               BlockCacheKey cacheKey,
                               Cacheable newBlock)
Because of the region splitting, it's possible that the split key locate in the middle of a
 block. 
 | 
static String | 
toJSON(BlockCache bc)  | 
static String | 
toJSON(BlockCacheUtil.CachedBlocksByFile cbsbf)  | 
static String | 
toJSON(String filename,
      NavigableSet<CachedBlock> blocks)  | 
static String | 
toString(CachedBlock cb,
        long now)  | 
static String | 
toStringMinusFileName(CachedBlock cb,
                     long now)  | 
static int | 
validateBlockAddition(Cacheable existing,
                     Cacheable newBlock,
                     BlockCacheKey cacheKey)
Validate that the existing and newBlock are the same without including the nextBlockMetadata,
 if not, throw an exception. 
 | 
private static final org.slf4j.Logger LOG
public static final long NANOS_PER_SECOND
private static final org.apache.hbase.thirdparty.com.google.gson.Gson GSON
public BlockCacheUtil()
public static String toString(CachedBlock cb, long now)
cb - public static String toJSON(String filename, NavigableSet<CachedBlock> blocks) throws IOException
filename and counts of blocksIOExceptionpublic static String toJSON(BlockCacheUtil.CachedBlocksByFile cbsbf) throws IOException
cbsf aggregatedIOExceptionpublic static String toJSON(BlockCache bc) throws IOException
bc content.IOExceptionpublic static String toStringMinusFileName(CachedBlock cb, long now)
cb - bc as a String minus the filename.public static BlockCacheUtil.CachedBlocksByFile getLoadedCachedBlocksByFile(org.apache.hadoop.conf.Configuration conf, BlockCache bc)
BlockCacheUtil.CachedBlocksByFile instance and load it up by iterating content in
 BlockCache.conf - Used to read configurationsbc - Block Cache to iterate.private static int compareCacheBlock(Cacheable left, Cacheable right, boolean includeNextBlockMetadata)
public static int validateBlockAddition(Cacheable existing, Cacheable newBlock, BlockCacheKey cacheKey)
existing - block that is existing in the cache.newBlock - block that is trying to be cached.cacheKey - the cache key of the blocks.public static boolean shouldReplaceExistingCacheBlock(BlockCache blockCache, BlockCacheKey cacheKey, Cacheable newBlock)
blockCache - BlockCache to checkcacheKey - the block cache keynewBlock - the new block which try to put into the block cache.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.