Class ChunkCreator
java.lang.Object
org.apache.hadoop.hbase.regionserver.ChunkCreator
Does the management of memstoreLAB chunk creations. A monotonically incrementing id is associated
with every chunk
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Types of chunks, based on their sizesprivate class
A pool ofChunk
instances. -
Field Summary
Modifier and TypeFieldDescriptionprivate AtomicInteger
(package private) static boolean
private final int
private ChunkCreator.MemStoreChunkPool
private int
private ChunkCreator.MemStoreChunkPool
(package private) static ChunkCreator
private static final org.slf4j.Logger
private final boolean
static final int
-
Constructor Summary
ConstructorDescriptionChunkCreator
(int chunkSize, boolean offheap, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager, float indexChunkSizePercentage) -
Method Summary
Modifier and TypeMethodDescription(package private) void
(package private) void
(package private) static void
private Chunk
createChunk
(boolean pool, ChunkCreator.ChunkType chunkType, int size) Creates the chunk either onheap or offheapprivate Chunk
createChunkForPool
(ChunkCreator.ChunkType chunkType, int chunkSize) (package private) Chunk
getChunk()
Creates and inits a data chunk.(package private) Chunk
getChunk
(int id) (package private) Chunk
getChunk
(ChunkCreator.ChunkType chunkType) Creates and inits a chunk with specific type.(package private) Chunk
getChunk
(ChunkCreator.ChunkType chunkType, int size) Creates and inits a chunk.(package private) int
(package private) int
getChunkSize
(ChunkCreator.ChunkType chunkType) (package private) ChunkCreator.MemStoreChunkPool
(package private) ChunkCreator.MemStoreChunkPool
static ChunkCreator
(package private) Chunk
getJumboChunk
(int jumboSize) Creates and inits a chunk of a special size, bigger than a regular chunk size.(package private) int
(package private) int
getMaxCount
(ChunkCreator.ChunkType chunkType) (package private) int
(package private) int
getPoolSize
(ChunkCreator.ChunkType chunkType) static ChunkCreator
initialize
(int chunkSize, boolean offheap, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager, float indexChunkSizePercent) Initializes the instance of ChunkCreatorprivate ChunkCreator.MemStoreChunkPool
initializePool
(String label, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, int chunkSize, ChunkCreator.ChunkType chunkType, HeapMemoryManager heapMemoryManager) private void
initializePools
(int chunkSize, long globalMemStoreSize, float poolSizePercentage, float indexChunkSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager) (package private) boolean
isChunkInPool
(int chunkId) (package private) boolean
(package private) int
(package private) void
putbackChunks
(Set<Integer> chunks) (package private) Chunk
removeChunk
(int chunkId) private void
removeChunks
(Set<Integer> chunkIDs)
-
Field Details
-
LOG
-
chunkID
-
SIZEOF_CHUNK_HEADER
- See Also:
-
chunkIdMap
-
offheap
-
instance
-
chunkPoolDisabled
-
dataChunksPool
-
chunkSize
-
indexChunkSize
-
indexChunksPool
-
-
Constructor Details
-
ChunkCreator
ChunkCreator(int chunkSize, boolean offheap, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager, float indexChunkSizePercentage)
-
-
Method Details
-
initializePools
private void initializePools(int chunkSize, long globalMemStoreSize, float poolSizePercentage, float indexChunkSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager) -
initialize
public static ChunkCreator initialize(int chunkSize, boolean offheap, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, HeapMemoryManager heapMemoryManager, float indexChunkSizePercent) Initializes the instance of ChunkCreator- Parameters:
chunkSize
- the chunkSizeoffheap
- indicates if the chunk is to be created offheap or notglobalMemStoreSize
- the global memstore sizepoolSizePercentage
- pool size percentageinitialCountPercentage
- the initial count of the chunk pool if anyheapMemoryManager
- the heapmemory manager- Returns:
- singleton MSLABChunkCreator
-
getInstance
-
getChunk
Creates and inits a data chunk. The default implementation.- Returns:
- the chunk that was initialized
-
getChunk
Creates and inits a chunk with specific type.- Returns:
- the chunk that was initialized
-
getChunk
Creates and inits a chunk.- Parameters:
size
- the size of the chunk to be allocated, in bytes- Returns:
- the chunk that was initialized
-
getJumboChunk
Creates and inits a chunk of a special size, bigger than a regular chunk size. Such a chunk will never come from pool and will always be on demand allocated.- Parameters:
jumboSize
- the special size to be used- Returns:
- the chunk that was initialized
-
createChunk
Creates the chunk either onheap or offheap- Parameters:
pool
- indicates if the chunks have to be created which will be used by the PoolchunkType
- whether the requested chunk is data chunk or index chunk.size
- the size of the chunk to be allocated, in bytes- Returns:
- the chunk
-
createChunkForPool
-
getChunk
-
isOffheap
boolean isOffheap() -
removeChunks
-
removeChunk
-
numberOfMappedChunks
int numberOfMappedChunks() -
clearChunkIds
void clearChunkIds() -
clearDisableFlag
-
initializePool
private ChunkCreator.MemStoreChunkPool initializePool(String label, long globalMemStoreSize, float poolSizePercentage, float initialCountPercentage, int chunkSize, ChunkCreator.ChunkType chunkType, HeapMemoryManager heapMemoryManager) -
getMaxCount
int getMaxCount() -
getMaxCount
-
getPoolSize
int getPoolSize() -
getPoolSize
-
isChunkInPool
-
clearChunksInPool
void clearChunksInPool() -
getChunkSize
int getChunkSize() -
getChunkSize
-
putbackChunks
-
getIndexChunksPool
-
getDataChunksPool
-