use of org.bboxdb.storage.entity.MemtableAndTupleStoreManagerPair in project bboxdb by jnidzwetzki.
the class DiskStorage method takeNextUnflushedMemtable.
/**
* Get the next memtable to flush
* @return
* @throws InterruptedException
*/
public MemtableAndTupleStoreManagerPair takeNextUnflushedMemtable() throws InterruptedException {
final MemtableAndTupleStoreManagerPair memtable = memtablesToFlush.take();
// Update performance counter
unflushedMemtablesTotal.labels(performanceCounterLabel).dec();
unflushedMemtablesBytes.labels(performanceCounterLabel).dec(memtable.getMemtable().getSize());
return memtable;
}
use of org.bboxdb.storage.entity.MemtableAndTupleStoreManagerPair in project bboxdb by jnidzwetzki.
the class MemtableWriterRunnable method runThread.
/**
* Start the flush thread
*/
@Override
protected void runThread() {
while (!Thread.currentThread().isInterrupted()) {
try {
final MemtableAndTupleStoreManagerPair memtableAndSSTableManager = storage.takeNextUnflushedMemtable();
final Memtable memtable = memtableAndSSTableManager.getMemtable();
final TupleStoreManager sstableManager = memtableAndSSTableManager.getTupleStoreManager();
flushMemtableToDisk(memtable, sstableManager);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
}
}
use of org.bboxdb.storage.entity.MemtableAndTupleStoreManagerPair in project bboxdb by jnidzwetzki.
the class TupleStoreManager method initNewMemtable.
/**
* Open a new memtable and schedule the old memtable for flushing
* @throws StorageManagerException
*/
public synchronized void initNewMemtable() {
final Memtable memtable = new Memtable(tupleStoreName, configuration.getMemtableEntriesMax(), configuration.getMemtableSizeMax());
memtable.acquire();
memtable.init();
final Memtable oldMemtable = tupleStoreInstances.activateNewMemtable(memtable);
if (oldMemtable != null) {
final MemtableAndTupleStoreManagerPair memtableTask = new MemtableAndTupleStoreManagerPair(oldMemtable, this);
storage.scheduleMemtableFlush(memtableTask);
}
logger.debug("Activated a new memtable: {}", memtable.getInternalName());
}
Aggregations