use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class O3FailureTest method testColumnTopMidMergeBlankFailRetryOpenRw2Contended.
@Test
public void testColumnTopMidMergeBlankFailRetryOpenRw2Contended() throws Exception {
counter.set(3);
executeWithPool(0, O3FailureTest::testColumnTopMidMergeBlankColumnFailRetry0, new FilesFacadeImpl() {
@Override
public long openRW(LPSZ name) {
if (Chars.endsWith(name, "1970-01-06" + Files.SEPARATOR + "b.d") && counter.decrementAndGet() == 0) {
return -1;
}
return super.openRW(name);
}
});
}
use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class O3FailureTest method testOOOFollowedByAnotherOOO.
@Test
public void testOOOFollowedByAnotherOOO() throws Exception {
counter.set(1);
final AtomicBoolean restoreDiskSpace = new AtomicBoolean(false);
executeWithPool(0, (engine, compiler, sqlExecutionContext) -> testOooFollowedByAnotherOOO0(engine, compiler, sqlExecutionContext, restoreDiskSpace), new FilesFacadeImpl() {
long theFd = 0;
boolean armageddon = false;
@Override
public boolean close(long fd) {
if (fd == theFd) {
theFd = 0;
}
return super.close(fd);
}
@Override
public long openRW(LPSZ name) {
long fd = super.openRW(name);
if (Chars.endsWith(name, "x" + Files.SEPARATOR + "1970-01-01.1" + Files.SEPARATOR + "m.d")) {
if (counter.decrementAndGet() == 0) {
theFd = fd;
}
}
return fd;
}
@Override
public boolean allocate(long fd, long size) {
if (restoreDiskSpace.get()) {
return super.allocate(fd, size);
}
if (armageddon) {
return false;
}
if (fd == theFd) {
theFd = 0;
armageddon = true;
return false;
}
return super.allocate(fd, size);
}
});
}
use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class O3FailureTest method testColumnTopMidMergeBlankFailRetryMergeFixMapRWContended.
@Test
public void testColumnTopMidMergeBlankFailRetryMergeFixMapRWContended() throws Exception {
counter.set(1);
executeWithPool(0, 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;
}
});
}
use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class O3FailureTest method testPartitionedDataAppendOOData.
@Test
public void testPartitionedDataAppendOOData() throws Exception {
counter.set(4);
executeWithoutPool(O3FailureTest::testPartitionedDataAppendOODataFailRetry0, new FilesFacadeImpl() {
private final AtomicInteger mapCounter = new AtomicInteger(2);
private long theFd = 0;
@Override
public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
if (theFd == fd && mapCounter.decrementAndGet() == 0) {
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, "ts.d") && counter.decrementAndGet() == 0) {
theFd = fd;
}
return fd;
}
});
}
use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class LineTcpConnectionContextTest method testCairoExceptionOnAddColumn.
@Test
public void testCairoExceptionOnAddColumn() throws Exception {
String table = "columnEx";
runInContext(new FilesFacadeImpl() {
@Override
public long openRW(LPSZ name) {
if (Chars.endsWith(name, "broken.d")) {
return -1;
}
return super.openRW(name);
}
}, () -> {
recvBuffer = table + ",location=us-midwest temperature=82 1465839830100400200\n" + table + ",location=us-midwest temperature=83 1465839830100500200\n" + table + ",location=us-eastcoast temperature=81,broken=23 1465839830101400200\n" + table + ",location=us-midwest temperature=85 1465839830102300200\n" + table + ",location=us-eastcoast temperature=89 1465839830102400200\n" + table + ",location=us-eastcoast temperature=80 1465839830102400200\n" + table + ",location=us-westcost temperature=82 1465839830102500200\n";
do {
handleContextIO();
Assert.assertFalse(disconnected);
} while (recvBuffer.length() > 0);
closeContext();
String expected = "location\ttemperature\ttimestamp\n" + "us-midwest\t82.0\t2016-06-13T17:43:50.100400Z\n" + "us-midwest\t83.0\t2016-06-13T17:43:50.100500Z\n" + "us-midwest\t85.0\t2016-06-13T17:43:50.102300Z\n" + "us-eastcoast\t89.0\t2016-06-13T17:43:50.102400Z\n" + "us-eastcoast\t80.0\t2016-06-13T17:43:50.102400Z\n" + "us-westcost\t82.0\t2016-06-13T17:43:50.102500Z\n";
assertTable(expected, table);
}, null, null);
}
Aggregations