@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 int |
DEFAULT_MAX |
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 int |
getMaxCachedBlocksByFile(org.apache.hadoop.conf.Configuration conf) |
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)
Returns JSON string of
bc content. |
static String |
toJSON(BlockCacheUtil.CachedBlocksByFile cbsbf)
Returns JSON string of
cbsf aggregated |
static String |
toJSON(String filename,
NavigableSet<CachedBlock> blocks)
Returns A JSON String of
filename and counts of blocks |
static String |
toString(CachedBlock cb,
long now)
n * @return The block content as String.
|
static String |
toStringMinusFileName(CachedBlock cb,
long now)
n * @return The block content of
bc as a String minus the filename. |
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
private static final int DEFAULT_MAX
public BlockCacheUtil()
public static String toString(CachedBlock cb, long now)
public static String toJSON(String filename, NavigableSet<CachedBlock> blocks) throws IOException
filename
and counts of blocks
IOException
public static String toJSON(BlockCacheUtil.CachedBlocksByFile cbsbf) throws IOException
cbsf
aggregatedIOException
public static String toJSON(BlockCache bc) throws IOException
bc
content.IOException
public static String toStringMinusFileName(CachedBlock cb, long now)
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.public static int getMaxCachedBlocksByFile(org.apache.hadoop.conf.Configuration conf)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.