use of org.neo4j.io.pagecache.PageSwapperFactory in project neo4j by neo4j.
the class SingleFilePageSwapperTest method mustUnlockFileWhenThePageSwapperIsClosed.
@Test
@DisabledOnOs(OS.WINDOWS)
void mustUnlockFileWhenThePageSwapperIsClosed() throws Exception {
PageSwapperFactory factory = createSwapperFactory(fileSystem);
Path file = testDir.file("file");
((StoreChannel) fileSystem.write(file)).close();
createSwapper(factory, file, 4, NO_CALLBACK, false).close();
try (StoreFileChannel channel = fileSystem.write(file);
FileLock fileLock = channel.tryLock()) {
assertThat(fileLock).isNotNull();
}
}
use of org.neo4j.io.pagecache.PageSwapperFactory in project neo4j by neo4j.
the class SingleFilePageSwapperTest method reportExternalIoOnSwapIn.
@Test
void reportExternalIoOnSwapIn() throws IOException {
byte[] bytes = new byte[] { 1, 2, 3, 4 };
try (StoreChannel channel = getFs().write(getPath())) {
channel.writeAll(wrap(bytes));
}
PageSwapperFactory factory = createSwapperFactory(getFs());
CountingIOController controller = new CountingIOController();
try (var swapper = createSwapper(factory, getPath(), 4, null, false, false, true, controller)) {
long target = createPage(4);
int numberOfReads = 12;
for (int i = 0; i < numberOfReads; i++) {
assertEquals(4, swapper.read(0, target));
}
assertEquals(numberOfReads, controller.getExternalIOCounter());
}
}
Aggregations