org.apache.hadoop.hbase.io.hfile
Class CacheConfig

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.CacheConfig

public class CacheConfig
extends Object

Stores all of the cache objects and configuration for a single HFile.


Field Summary
static String CACHE_BLOCKS_ON_WRITE_KEY
          Configuration key to cache data blocks on write.
static String CACHE_BLOOM_BLOCKS_ON_WRITE_KEY
          Configuration key to cache compound bloom filter blocks on write.
static String CACHE_DATA_BLOCKS_COMPRESSED_KEY
          TODO: Implement this (jgray) Configuration key to cache data blocks in compressed format.
static String CACHE_INDEX_BLOCKS_ON_WRITE_KEY
          Configuration key to cache leaf and intermediate-level index blocks on write.
static boolean DEFAULT_CACHE_BLOOMS_ON_WRITE
           
static boolean DEFAULT_CACHE_DATA_ON_READ
           
static boolean DEFAULT_CACHE_DATA_ON_WRITE
           
static boolean DEFAULT_CACHE_INDEXES_ON_WRITE
           
static boolean DEFAULT_COMPRESSED_CACHE
           
static boolean DEFAULT_EVICT_ON_CLOSE
           
static boolean DEFAULT_IN_MEMORY
           
static String EVICT_BLOCKS_ON_CLOSE_KEY
          Configuration key to evict all blocks of a given file from the block cache when the file is closed.
 
Constructor Summary
CacheConfig(CacheConfig cacheConf)
          Constructs a cache configuration copied from the specified configuration.
CacheConfig(org.apache.hadoop.conf.Configuration conf)
          Create a cache configuration using the specified configuration object and defaults for family level settings.
CacheConfig(org.apache.hadoop.conf.Configuration conf, HColumnDescriptor family)
          Create a cache configuration using the specified configuration object and family descriptor.
 
Method Summary
 BlockCache getBlockCache()
          Returns the block cache.
 boolean isBlockCacheEnabled()
          Checks whether the block cache is enabled.
 boolean isInMemory()
           
 void setCacheDataOnWrite(boolean cacheDataOnWrite)
          Only used for testing.
 void setEvictOnClose(boolean evictOnClose)
          Only used for testing.
 boolean shouldCacheBlockOnRead(BlockType.BlockCategory category)
          Should we cache a block of a particular category? We always cache important blocks such as index blocks, as long as the block cache is available.
 boolean shouldCacheBloomsOnWrite()
           
 boolean shouldCacheCompressed()
           
 boolean shouldCacheDataOnRead()
          Returns whether the blocks of this HFile should be cached on read or not.
 boolean shouldCacheDataOnWrite()
           
 boolean shouldCacheIndexesOnWrite()
           
 boolean shouldEvictOnClose()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CACHE_BLOCKS_ON_WRITE_KEY

public static final String CACHE_BLOCKS_ON_WRITE_KEY
Configuration key to cache data blocks on write. There are separate switches for bloom blocks and non-root index blocks.

See Also:
Constant Field Values

CACHE_INDEX_BLOCKS_ON_WRITE_KEY

public static final String CACHE_INDEX_BLOCKS_ON_WRITE_KEY
Configuration key to cache leaf and intermediate-level index blocks on write.

See Also:
Constant Field Values

CACHE_BLOOM_BLOCKS_ON_WRITE_KEY

public static final String CACHE_BLOOM_BLOCKS_ON_WRITE_KEY
Configuration key to cache compound bloom filter blocks on write.

See Also:
Constant Field Values

CACHE_DATA_BLOCKS_COMPRESSED_KEY

public static final String CACHE_DATA_BLOCKS_COMPRESSED_KEY
TODO: Implement this (jgray) Configuration key to cache data blocks in compressed format.

See Also:
Constant Field Values

EVICT_BLOCKS_ON_CLOSE_KEY

public static final String EVICT_BLOCKS_ON_CLOSE_KEY
Configuration key to evict all blocks of a given file from the block cache when the file is closed.

See Also:
Constant Field Values

DEFAULT_CACHE_DATA_ON_READ

public static final boolean DEFAULT_CACHE_DATA_ON_READ
See Also:
Constant Field Values

DEFAULT_CACHE_DATA_ON_WRITE

public static final boolean DEFAULT_CACHE_DATA_ON_WRITE
See Also:
Constant Field Values

DEFAULT_IN_MEMORY

public static final boolean DEFAULT_IN_MEMORY
See Also:
Constant Field Values

DEFAULT_CACHE_INDEXES_ON_WRITE

public static final boolean DEFAULT_CACHE_INDEXES_ON_WRITE
See Also:
Constant Field Values

DEFAULT_CACHE_BLOOMS_ON_WRITE

public static final boolean DEFAULT_CACHE_BLOOMS_ON_WRITE
See Also:
Constant Field Values

DEFAULT_EVICT_ON_CLOSE

public static final boolean DEFAULT_EVICT_ON_CLOSE
See Also:
Constant Field Values

DEFAULT_COMPRESSED_CACHE

public static final boolean DEFAULT_COMPRESSED_CACHE
See Also:
Constant Field Values
Constructor Detail

CacheConfig

public CacheConfig(org.apache.hadoop.conf.Configuration conf,
                   HColumnDescriptor family)
Create a cache configuration using the specified configuration object and family descriptor.

Parameters:
conf - hbase configuration
family - column family configuration

CacheConfig

public CacheConfig(org.apache.hadoop.conf.Configuration conf)
Create a cache configuration using the specified configuration object and defaults for family level settings.

Parameters:
conf - hbase configuration

CacheConfig

public CacheConfig(CacheConfig cacheConf)
Constructs a cache configuration copied from the specified configuration.

Parameters:
cacheConf -
Method Detail

isBlockCacheEnabled

public boolean isBlockCacheEnabled()
Checks whether the block cache is enabled.


getBlockCache

public BlockCache getBlockCache()
Returns the block cache.

Returns:
the block cache, or null if caching is completely disabled

shouldCacheDataOnRead

public boolean shouldCacheDataOnRead()
Returns whether the blocks of this HFile should be cached on read or not.

Returns:
true if blocks should be cached on read, false if not

shouldCacheBlockOnRead

public boolean shouldCacheBlockOnRead(BlockType.BlockCategory category)
Should we cache a block of a particular category? We always cache important blocks such as index blocks, as long as the block cache is available.


isInMemory

public boolean isInMemory()
Returns:
true if blocks in this file should be flagged as in-memory

shouldCacheDataOnWrite

public boolean shouldCacheDataOnWrite()
Returns:
true if data blocks should be written to the cache when an HFile is written, false if not

setCacheDataOnWrite

public void setCacheDataOnWrite(boolean cacheDataOnWrite)
Only used for testing.

Parameters:
cacheDataOnWrite - whether data blocks should be written to the cache when an HFile is written

shouldCacheIndexesOnWrite

public boolean shouldCacheIndexesOnWrite()
Returns:
true if index blocks should be written to the cache when an HFile is written, false if not

shouldCacheBloomsOnWrite

public boolean shouldCacheBloomsOnWrite()
Returns:
true if bloom blocks should be written to the cache when an HFile is written, false if not

shouldEvictOnClose

public boolean shouldEvictOnClose()
Returns:
true if blocks should be evicted from the cache when an HFile reader is closed, false if not

setEvictOnClose

public void setEvictOnClose(boolean evictOnClose)
Only used for testing.

Parameters:
evictOnClose - whether blocks should be evicted from the cache when an HFile reader is closed

shouldCacheCompressed

public boolean shouldCacheCompressed()
Returns:
true if blocks should be compressed in the cache, false if not

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.