Search in sources :

Example 26 with Journal

use of com.questdb.store.Journal in project questdb by bluestreak01.

the class JournalServerAgent method createReader.

private <T> void createReader(int index, JournalKey<T> key) throws JournalException {
    Journal journal = readers.getQuiet(index);
    if (journal == null) {
        readers.extendAndSet(index, journal = server.getFactory().reader(key));
    }
    JournalDeltaProducer producer = producers.getQuiet(index);
    if (producer == null) {
        producers.extendAndSet(index, new JournalDeltaProducer(journal));
    }
}
Also used : JournalDeltaProducer(com.questdb.net.ha.producer.JournalDeltaProducer) Journal(com.questdb.store.Journal)

Example 27 with Journal

use of com.questdb.store.Journal in project questdb by bluestreak01.

the class JournalServerAgent method removeReader.

private void removeReader(int index) {
    Journal journal = readers.getQuiet(index);
    if (journal != null) {
        journal.close();
        if (index < readers.size()) {
            readers.setQuick(index, null);
        }
    }
    JournalDeltaProducer producer = producers.getQuiet(index);
    if (producer != null) {
        producer.free();
        if (index < producers.size()) {
            producers.setQuick(index, null);
        }
    }
}
Also used : JournalDeltaProducer(com.questdb.net.ha.producer.JournalDeltaProducer) Journal(com.questdb.store.Journal)

Aggregations

Journal (com.questdb.store.Journal)27 Test (org.junit.Test)24 AbstractTest (com.questdb.test.tools.AbstractTest)23 JournalMetadata (com.questdb.store.factory.configuration.JournalMetadata)14 JournalStructure (com.questdb.store.factory.configuration.JournalStructure)9 RetryLockException (com.questdb.ex.RetryLockException)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 CyclicBarrier (java.util.concurrent.CyclicBarrier)5 FactoryFullException (com.questdb.ex.FactoryFullException)4 JournalLockedException (com.questdb.ex.JournalLockedException)4 JournalException (com.questdb.std.ex.JournalException)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 JournalDeltaProducer (com.questdb.net.ha.producer.JournalDeltaProducer)2 RecordSource (com.questdb.ql.RecordSource)2 Rnd (com.questdb.std.Rnd)2 File (java.io.File)2 BootstrapEnv (com.questdb.BootstrapEnv)1 ServerConfiguration (com.questdb.ServerConfiguration)1 Record (com.questdb.common.Record)1 RecordCursor (com.questdb.common.RecordCursor)1