Search in sources :

Example 11 with FilesFacadeImpl

use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.

the class SqlCompilerTest method testInsertAsSelectTemporaryIOError.

@Test
public void testInsertAsSelectTemporaryIOError() throws Exception {
    AtomicBoolean inError = new AtomicBoolean(true);
    FilesFacade ff = new FilesFacadeImpl() {

        int pageCount = 0;

        @Override
        public long getMapPageSize() {
            return getPageSize();
        }

        @Override
        public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
            if (inError.get() && pageCount++ == 13) {
                return -1;
            }
            return super.mmap(fd, len, offset, flags, memoryTag);
        }
    };
    assertInsertAsSelectIOError(inError, ff);
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FilesFacade(io.questdb.std.FilesFacade) FilesFacadeImpl(io.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Example 12 with FilesFacadeImpl

use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.

the class SqlCompilerTest method testInsertAsSelectPersistentIOError.

@Test
public void testInsertAsSelectPersistentIOError() throws Exception {
    AtomicBoolean inError = new AtomicBoolean(true);
    FilesFacade ff = new FilesFacadeImpl() {

        int pageCount = 0;

        @Override
        public long getMapPageSize() {
            return getPageSize();
        }

        @Override
        public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
            if (inError.get() && pageCount++ > 12) {
                return -1;
            }
            return super.mmap(fd, len, offset, flags, memoryTag);
        }
    };
    assertInsertAsSelectIOError(inError, ff);
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FilesFacade(io.questdb.std.FilesFacade) FilesFacadeImpl(io.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Example 13 with FilesFacadeImpl

use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.

the class SqlCompilerTest method testCreateAsSelectIOError2.

@Test
public void testCreateAsSelectIOError2() throws Exception {
    String sql = "create table y as (" + "select rnd_symbol(4,4,4,2) a from long_sequence(10000)" + "), cast(a as STRING)";
    final FilesFacade ff = new FilesFacadeImpl() {

        int mapCount = 0;

        @Override
        public long getMapPageSize() {
            return getPageSize();
        }

        @Override
        public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
            // and then fails to close txMem
            if (mapCount++ > 2) {
                return -1;
            }
            return super.mmap(fd, len, offset, flags, memoryTag);
        }
    };
    assertFailure(ff, sql, "Could not create table. See log for details");
}
Also used : FilesFacade(io.questdb.std.FilesFacade) FilesFacadeImpl(io.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Example 14 with FilesFacadeImpl

use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.

the class SqlCompilerTest method testCreateAsSelectIOError.

@Test
public void testCreateAsSelectIOError() throws Exception {
    String sql = "create table y as (" + "select rnd_symbol(4,4,4,2) a from long_sequence(10000)" + "), cast(a as STRING)";
    final FilesFacade ff = new FilesFacadeImpl() {

        int mapCount = 0;

        @Override
        public long getMapPageSize() {
            return getPageSize();
        }

        @Override
        public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
            if (mapCount++ > 5) {
                return -1;
            }
            return super.mmap(fd, len, offset, flags, memoryTag);
        }
    };
    assertFailure(ff, sql, "Could not create table. See log for details");
}
Also used : FilesFacade(io.questdb.std.FilesFacade) FilesFacadeImpl(io.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Example 15 with FilesFacadeImpl

use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.

the class O3FailureTest method testPartitionedDataAppendOODataIndexed.

@Test
public void testPartitionedDataAppendOODataIndexed() throws Exception {
    counter.set(3);
    executeWithoutPool(O3FailureTest::testPartitionedDataAppendOODataIndexedFailRetry0, new FilesFacadeImpl() {

        @Override
        public long openRW(LPSZ name) {
            if (Chars.endsWith(name, "1970-01-06" + Files.SEPARATOR + "timestamp.d") && counter.decrementAndGet() == 0) {
                return -1;
            }
            return super.openRW(name);
        }
    });
}
Also used : LPSZ(io.questdb.std.str.LPSZ) FilesFacadeImpl(io.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Aggregations

FilesFacadeImpl (io.questdb.std.FilesFacadeImpl)48 Test (org.junit.Test)46 LPSZ (io.questdb.std.str.LPSZ)35 FilesFacade (io.questdb.std.FilesFacade)14 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 Path (io.questdb.std.str.Path)4 RecordCursorFactory (io.questdb.cairo.sql.RecordCursorFactory)3 AbstractGriffinTest (io.questdb.griffin.AbstractGriffinTest)3 SqlCompiler (io.questdb.griffin.SqlCompiler)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 MemoryMARW (io.questdb.cairo.vm.api.MemoryMARW)1 LineTcpSender (io.questdb.cutlass.line.LineTcpSender)1 SqlException (io.questdb.griffin.SqlException)1 BindVariableServiceImpl (io.questdb.griffin.engine.functions.bind.BindVariableServiceImpl)1 Rnd (io.questdb.std.Rnd)1 DateFormat (io.questdb.std.datetime.DateFormat)1 TimestampFormatCompiler (io.questdb.std.datetime.microtime.TimestampFormatCompiler)1 File (java.io.File)1