use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class O3FailureTest method testPartitionedDataAppendOOPrependOODataMapVarContended.
@Test
public void testPartitionedDataAppendOOPrependOODataMapVarContended() throws Exception {
counter.set(3);
executeWithPool(0, O3FailureTest::testPartitionedDataAppendOOPrependOODataFailRetry0, new FilesFacadeImpl() {
private long theFd = 0;
@Override
public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
if (theFd == fd) {
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-06" + Files.SEPARATOR + "m.d") && counter.decrementAndGet() == 0) {
theFd = fd;
}
return fd;
}
});
}
use of io.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class O3FailureTest method testColumnTopMidAppend.
@Test
public void testColumnTopMidAppend() throws Exception {
counter.set(3);
executeWithoutPool(O3FailureTest::testColumnTopMidAppendColumnFailRetry0, new FilesFacadeImpl() {
@Override
public long openRW(LPSZ name) {
if (Chars.endsWith(name, "1970-01-07" + Files.SEPARATOR + "v12.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 testColumnTopMidMergeBlankFailRetryOpenRwContended.
@Test
public void testColumnTopMidMergeBlankFailRetryOpenRwContended() 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 + "m.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 testPartitionedDataAppendOODataContended.
@Test
public void testPartitionedDataAppendOODataContended() throws Exception {
counter.set(4);
executeWithPool(0, 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 AlterTableCommitLagTest method setMaxUncommittedRowsFailsToSwapMetadataUntilWriterReopen.
@Test
public void setMaxUncommittedRowsFailsToSwapMetadataUntilWriterReopen() throws Exception {
assertMemoryLeak(() -> {
try (TableModel tbl = new TableModel(configuration, "X", PartitionBy.DAY)) {
CairoTestUtils.create(tbl.timestamp("ts").col("i", ColumnType.INT).col("l", ColumnType.LONG));
ff = new FilesFacadeImpl() {
@Override
public boolean rename(LPSZ from, LPSZ to) {
if (Chars.endsWith(to, TableUtils.META_FILE_NAME)) {
return false;
}
return super.rename(from, to);
}
};
String alterCommand = "ALTER TABLE X SET PARAM maxUncommittedRows = 11111";
try {
compiler.compile(alterCommand, sqlExecutionContext);
Assert.fail("Alter table should fail");
} catch (CairoError e) {
TestUtils.assertContains(e.getFlyweightMessage(), "could not rename");
}
try (TableReader ignored = engine.getReader(AllowAllCairoSecurityContext.INSTANCE, "X")) {
Assert.fail();
} catch (CairoException ignored) {
}
// Now try with success.
engine.releaseAllWriters();
ff = new FilesFacadeImpl();
compiler.compile(alterCommand, sqlExecutionContext);
assertSql("SELECT maxUncommittedRows FROM tables() WHERE name = 'X'", "maxUncommittedRows\n11111\n");
}
});
}
Aggregations