Package org.apache.hadoop.hbase.io.hfile
Class BlockCacheKey
java.lang.Object
org.apache.hadoop.hbase.io.hfile.BlockCacheKey
- All Implemented Interfaces:
Serializable,HeapSize
Cache Key for use with implementations of
BlockCache- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate BlockTypeprivate final intstatic final longprivate final intprivate final booleanprivate final longprivate final intprivate static final longprivate final FilePathStringPool -
Constructor Summary
ConstructorsConstructorDescriptionBlockCacheKey(String hfileName, long offset) Constructs a new BlockCacheKey with the file name and offset only.BlockCacheKey(String hfileName, long offset, boolean isPrimaryReplica, BlockType blockType) Constructs a new BlockCacheKey with the file name, offset, replica and type only.BlockCacheKey(String hfileName, String cfName, String regionName, long offset, boolean isPrimaryReplica, BlockType blockType, boolean archived) Construct a new BlockCacheKey, with file, column family and region information.BlockCacheKey(org.apache.hadoop.fs.Path hfilePath, long offset, boolean isPrimaryReplica, BlockType blockType) Construct a new BlockCacheKey using a file path. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the column family name portion of this cache key.Returns the hfileName portion of this cache key.longReturns the region name portion of this cache key.inthashCode()longheapSize()With the compressed format using integer file IDs, the heap size is significantly reduced.booleanbooleanvoidsetBlockType(BlockType blockType) toString()
-
Field Details
-
serialVersionUID
- See Also:
-
hfileNameId
-
stringPool
-
regionId
-
cfId
-
offset
-
blockType
-
isPrimaryReplicaBlock
-
archived
-
FIXED_OVERHEAD
-
-
Constructor Details
-
BlockCacheKey
Constructs a new BlockCacheKey with the file name and offset only. To be used for cache lookups only, DO NOT use this for creating keys when inserting into the cache. Use either the overriding constructors with the path parameter or the region and cf parameters, otherwise, region cache metrics won't be recorded properly.- Parameters:
hfileName- The name of the HFile this block belongs to.offset- Offset of the block into the file
-
BlockCacheKey
Constructs a new BlockCacheKey with the file name, offset, replica and type only. To be used for cache lookups only, DO NOT use this for creating keys when inserting into the cache. Use either the overriding constructors with the path parameter or the region and cf parameters, otherwise, region cache metrics won't be recorded properly.- Parameters:
hfileName- The name of the HFile this block belongs to.offset- Offset of the block into the fileisPrimaryReplica- Whether this is from primary replicablockType- Type of block
-
BlockCacheKey
public BlockCacheKey(String hfileName, String cfName, String regionName, long offset, boolean isPrimaryReplica, BlockType blockType, boolean archived) Construct a new BlockCacheKey, with file, column family and region information. This should be used when inserting keys into the cache, so that region cache metrics are recorded properly.- Parameters:
hfileName- The name of the HFile this block belongs to.cfName- The column family nameregionName- The region nameoffset- Offset of the block into the fileisPrimaryReplica- Whether this is from primary replicablockType- Type of block
-
BlockCacheKey
public BlockCacheKey(org.apache.hadoop.fs.Path hfilePath, long offset, boolean isPrimaryReplica, BlockType blockType) Construct a new BlockCacheKey using a file path. File, column family and region information will be extracted from the passed path. This should be used when inserting keys into the cache, so that region cache metrics are recorded properly.- Parameters:
hfilePath- The path to the HFileoffset- Offset of the block into the fileisPrimaryReplica- Whether this is from primary replicablockType- Type of block
-
-
Method Details
-
hashCode
-
equals
-
toString
-
heapSize
With the compressed format using integer file IDs, the heap size is significantly reduced. We now only store a 4-byte integer instead of the full file name string. -
getHfileName
Returns the hfileName portion of this cache key.- Returns:
- The file name
-
getRegionName
Returns the region name portion of this cache key.- Returns:
- The region name
-
getCfName
Returns the column family name portion of this cache key.- Returns:
- The column family name
-
isPrimary
-
getOffset
-
getBlockType
-
setBlockType
-
isArchived
-