Search in sources :

Example 6 with LPSZ

use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.

the class O3FailureTest method testColumnTopMidMergeBlankFailRetryOpenRw.

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

        @Override
        public long openRW(LPSZ name) {
            if (Chars.endsWith(name, "1970-01-06" + Files.SEPARATOR + "m.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)

Example 7 with LPSZ

use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.

the class O3FailureTest method testColumnTopLastDataOOODataFailRetryMapRoContended.

@Test
public void testColumnTopLastDataOOODataFailRetryMapRoContended() throws Exception {
    counter.set(1);
    executeWithPool(0, (compiler, sqlExecutionContext, sqlExecutionContext2) -> testColumnTopLastDataOOODataFailRetry0(sqlExecutionContext, sqlExecutionContext2), new FilesFacadeImpl() {

        long theFd = 0;

        @Override
        public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
            if (fd == theFd && flags == Files.MAP_RO) {
                theFd = 0;
                return -1;
            }
            return super.mmap(fd, len, offset, flags, memoryTag);
        }

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

Example 8 with LPSZ

use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.

the class O3FailureTest method testColumnTopMidDataMergeDataFailRetryReadTopContended.

@Test
public void testColumnTopMidDataMergeDataFailRetryReadTopContended() throws Exception {
    counter.set(2);
    executeWithPool(0, (compiler, sqlExecutionContext, sqlExecutionContext2) -> testColumnTopMidDataMergeDataFailRetry0(sqlExecutionContext, sqlExecutionContext2), new FilesFacadeImpl() {

        long theFd;

        @Override
        public long openRO(LPSZ name) {
            long fd = super.openRO(name);
            if (Chars.endsWith(name, "1970-01-07" + Files.SEPARATOR + "v2.top") && counter.decrementAndGet() == 0) {
                theFd = fd;
            }
            return fd;
        }

        @Override
        public long read(long fd, long address, long len, long offset) {
            if (fd == theFd) {
                theFd = 0;
                return 5;
            }
            return super.read(fd, address, len, offset);
        }
    });
}
Also used : LPSZ(io.questdb.std.str.LPSZ) FilesFacadeImpl(io.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Example 9 with LPSZ

use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.

the class O3FailureTest method testColumnTopMidMergeBlankFailRetryMergeFixMapRW.

@Test
public void testColumnTopMidMergeBlankFailRetryMergeFixMapRW() throws Exception {
    counter.set(1);
    executeWithoutPool(O3FailureTest::testColumnTopMidMergeBlankColumnFailRetry0, new FilesFacadeImpl() {

        long theFd = 0;

        @Override
        public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
            if (fd != theFd) {
                return super.mmap(fd, len, offset, flags, memoryTag);
            }
            theFd = 0;
            return -1;
        }

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

Example 10 with LPSZ

use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.

the class O3FailureTest method testOutOfFileHandles.

@Test
public void testOutOfFileHandles() throws Exception {
    counter.set(1536);
    executeWithPool(4, O3FailureTest::testOutOfFileHandles0, new FilesFacadeImpl() {

        @Override
        public boolean close(long fd) {
            counter.incrementAndGet();
            return super.close(fd);
        }

        @Override
        public long openAppend(LPSZ name) {
            if (counter.decrementAndGet() < 0) {
                return -1;
            }
            return super.openAppend(name);
        }

        @Override
        public long openRO(LPSZ name) {
            if (counter.decrementAndGet() < 0) {
                return -1;
            }
            return super.openRO(name);
        }

        @Override
        public long openRW(LPSZ name) {
            if (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

LPSZ (io.questdb.std.str.LPSZ)50 Test (org.junit.Test)49 FilesFacadeImpl (io.questdb.std.FilesFacadeImpl)35 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)11 RecordCursor (io.questdb.cairo.sql.RecordCursor)8 Record (io.questdb.cairo.sql.Record)7 Path (io.questdb.std.str.Path)5 FilesFacade (io.questdb.std.FilesFacade)3 RecordCursorFactory (io.questdb.cairo.sql.RecordCursorFactory)1 MemoryCMARW (io.questdb.cairo.vm.api.MemoryCMARW)1 MemoryMA (io.questdb.cairo.vm.api.MemoryMA)1 TestMicroClock (io.questdb.test.tools.TestMicroClock)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1