Search in sources :

Example 6 with JournalRuntimeException

use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.

the class Files method makeTempDir.

public static File makeTempDir() {
    File result;
    try {
        result = File.createTempFile("questdb", "");
        deleteOrException(result);
        mkDirsOrException(result);
    } catch (Exception e) {
        throw new JournalRuntimeException("Exception when creating temp dir", e);
    }
    return result;
}
Also used : JournalRuntimeException(com.questdb.common.JournalRuntimeException) File(java.io.File) JournalException(com.questdb.std.ex.JournalException) JournalRuntimeException(com.questdb.common.JournalRuntimeException) IOException(java.io.IOException)

Example 7 with JournalRuntimeException

use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.

the class JournalIterators method createRanges.

private static <T> ObjList<JournalIteratorRange> createRanges(Journal<T> journal) {
    final int partitionCount = journal.getPartitionCount();
    ObjList<JournalIteratorRange> ranges = new ObjList<>(partitionCount);
    try {
        for (int i = 0; i < partitionCount; i++) {
            Partition<T> p = journal.getPartition(i, true);
            long size = p.size();
            if (size > 0) {
                ranges.add(new JournalIteratorRange(p.getPartitionIndex(), 0, size - 1));
            }
        }
    } catch (JournalException e) {
        throw new JournalRuntimeException(e);
    }
    return ranges;
}
Also used : ObjList(com.questdb.std.ObjList) JournalException(com.questdb.std.ex.JournalException) JournalRuntimeException(com.questdb.common.JournalRuntimeException)

Example 8 with JournalRuntimeException

use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.

the class JournalIterators method incrementBufferedIterator.

public static <T> JournalPeekingIterator<T> incrementBufferedIterator(Journal<T> journal) {
    try {
        long lo = journal.getMaxRowID();
        journal.refresh();
        return new JournalBufferedIterator<>(journal, createRanges(journal, journal.incrementRowID(lo)));
    } catch (JournalException e) {
        throw new JournalRuntimeException(e);
    }
}
Also used : JournalException(com.questdb.std.ex.JournalException) JournalRuntimeException(com.questdb.common.JournalRuntimeException)

Example 9 with JournalRuntimeException

use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.

the class JournalIterators method incrementIterator.

public static <T> JournalPeekingIterator<T> incrementIterator(Journal<T> journal) {
    try {
        long lo = journal.getMaxRowID();
        journal.refresh();
        return new JournalIteratorImpl<>(journal, createRanges(journal, journal.incrementRowID(lo)));
    } catch (JournalException e) {
        throw new JournalRuntimeException(e);
    }
}
Also used : JournalException(com.questdb.std.ex.JournalException) JournalRuntimeException(com.questdb.common.JournalRuntimeException)

Example 10 with JournalRuntimeException

use of com.questdb.common.JournalRuntimeException in project questdb by bluestreak01.

the class JournalWriter method close.

@Override
public final void close() {
    if (open) {
        if (closeInterceptor != null && !closeInterceptor.canClose(this)) {
            return;
        }
        try {
            if (isCommitOnClose()) {
                commit();
            }
            if (partitionCleaner != null) {
                purgeTempPartitions();
                partitionCleaner.halt();
                partitionCleaner = null;
            }
            super.close();
            if (writeLock != null) {
                LockManager.release(writeLock);
                writeLock = null;
            }
            Misc.free(discardSink);
            Misc.free(discardTxtRaf);
        } catch (JournalException e) {
            throw new JournalRuntimeException(e);
        }
    }
}
Also used : IncompatibleJournalException(com.questdb.ex.IncompatibleJournalException) JournalException(com.questdb.std.ex.JournalException) JournalRuntimeException(com.questdb.common.JournalRuntimeException)

Aggregations

JournalRuntimeException (com.questdb.common.JournalRuntimeException)41 JournalException (com.questdb.std.ex.JournalException)30 KVIndex (com.questdb.store.KVIndex)9 IOException (java.io.IOException)6 IndexCursor (com.questdb.store.IndexCursor)5 Partition (com.questdb.store.Partition)5 ObjList (com.questdb.std.ObjList)4 FixedColumn (com.questdb.store.FixedColumn)2 File (java.io.File)2 MappedByteBuffer (java.nio.MappedByteBuffer)2 BootstrapEnv (com.questdb.BootstrapEnv)1 ServerConfiguration (com.questdb.ServerConfiguration)1 NumericException (com.questdb.common.NumericException)1 ImportColumnCountException (com.questdb.ex.ImportColumnCountException)1 ImportNameException (com.questdb.ex.ImportNameException)1 IncompatibleJournalException (com.questdb.ex.IncompatibleJournalException)1 JournalIOException (com.questdb.ex.JournalIOException)1 Quote (com.questdb.model.Quote)1 ClientConfig (com.questdb.net.ha.config.ClientConfig)1 ImportedColumnMetadata (com.questdb.parser.ImportedColumnMetadata)1