use of org.apache.cassandra.utils.memory.HeapPool in project cassandra by apache.
the class Memtable method createMemtableAllocatorPool.
private static MemtablePool createMemtableAllocatorPool() {
long heapLimit = DatabaseDescriptor.getMemtableHeapSpaceInMiB() << 20;
long offHeapLimit = DatabaseDescriptor.getMemtableOffheapSpaceInMiB() << 20;
final float cleaningThreshold = DatabaseDescriptor.getMemtableCleanupThreshold();
final MemtableCleaner cleaner = ColumnFamilyStore::flushLargestMemtable;
switch(DatabaseDescriptor.getMemtableAllocationType()) {
case unslabbed_heap_buffers_logged:
return new HeapPool.Logged(heapLimit, cleaningThreshold, cleaner);
case unslabbed_heap_buffers:
return new HeapPool(heapLimit, cleaningThreshold, cleaner);
case heap_buffers:
return new SlabPool(heapLimit, 0, cleaningThreshold, cleaner);
case offheap_buffers:
return new SlabPool(heapLimit, offHeapLimit, cleaningThreshold, cleaner);
case offheap_objects:
return new NativePool(heapLimit, offHeapLimit, cleaningThreshold, cleaner);
default:
throw new AssertionError();
}
}
Aggregations