Search in sources :

Example 1 with MemtableAndTupleStoreManagerPair

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;
}
Also used : MemtableAndTupleStoreManagerPair(org.bboxdb.storage.entity.MemtableAndTupleStoreManagerPair)

Example 2 with MemtableAndTupleStoreManagerPair

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;
        }
    }
}
Also used : MemtableAndTupleStoreManagerPair(org.bboxdb.storage.entity.MemtableAndTupleStoreManagerPair) TupleStoreManager(org.bboxdb.storage.tuplestore.manager.TupleStoreManager)

Example 3 with MemtableAndTupleStoreManagerPair

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());
}
Also used : MemtableAndTupleStoreManagerPair(org.bboxdb.storage.entity.MemtableAndTupleStoreManagerPair) Memtable(org.bboxdb.storage.memtable.Memtable)

Aggregations

MemtableAndTupleStoreManagerPair (org.bboxdb.storage.entity.MemtableAndTupleStoreManagerPair)3 Memtable (org.bboxdb.storage.memtable.Memtable)1 TupleStoreManager (org.bboxdb.storage.tuplestore.manager.TupleStoreManager)1