Search in sources :

Example 1 with MapFile

use of org.neo4j.io.pagecache.randomharness.Command.MapFile in project neo4j by neo4j.

the class PageCacheHarnessTest method concurrentPageFaultingMustNotPutInterleavedDataIntoPages.

@Test(timeout = LONG_TIMEOUT_MILLIS)
public void concurrentPageFaultingMustNotPutInterleavedDataIntoPages() throws Exception {
    final int filePageCount = 11;
    final RecordFormat recordFormat = new PageCountRecordFormat();
    try (RandomPageCacheTestHarness harness = new RandomPageCacheTestHarness()) {
        harness.setConcurrencyLevel(11);
        harness.setUseAdversarialIO(false);
        harness.setCachePageCount(3);
        harness.setCachePageSize(pageCachePageSize);
        harness.setFilePageCount(filePageCount);
        harness.setFilePageSize(pageCachePageSize);
        harness.setInitialMappedFiles(1);
        harness.setCommandCount(10000);
        harness.setRecordFormat(recordFormat);
        harness.setFileSystem(fs);
        harness.disableCommands(FlushCache, FlushFile, MapFile, UnmapFile, WriteRecord, WriteMulti);
        harness.setPreparation((pageCache1, fs1, filesTouched) -> {
            File file = filesTouched.iterator().next();
            try (PagedFile pf = pageCache1.map(file, pageCachePageSize);
                PageCursor cursor = pf.io(0, PF_SHARED_WRITE_LOCK)) {
                for (int pageId = 0; pageId < filePageCount; pageId++) {
                    cursor.next();
                    recordFormat.fillWithRecords(cursor);
                }
            }
        });
        harness.run(LONG_TIMEOUT_MILLIS, MILLISECONDS);
    }
}
Also used : PagedFile(org.neo4j.io.pagecache.PagedFile) RandomPageCacheTestHarness(org.neo4j.io.pagecache.randomharness.RandomPageCacheTestHarness) RecordFormat(org.neo4j.io.pagecache.randomharness.RecordFormat) PageCountRecordFormat(org.neo4j.io.pagecache.randomharness.PageCountRecordFormat) StandardRecordFormat(org.neo4j.io.pagecache.randomharness.StandardRecordFormat) PageCountRecordFormat(org.neo4j.io.pagecache.randomharness.PageCountRecordFormat) FlushFile(org.neo4j.io.pagecache.randomharness.Command.FlushFile) PagedFile(org.neo4j.io.pagecache.PagedFile) MapFile(org.neo4j.io.pagecache.randomharness.Command.MapFile) File(java.io.File) UnmapFile(org.neo4j.io.pagecache.randomharness.Command.UnmapFile) PageCursor(org.neo4j.io.pagecache.PageCursor) Test(org.junit.Test)

Aggregations

File (java.io.File)1 Test (org.junit.Test)1 PageCursor (org.neo4j.io.pagecache.PageCursor)1 PagedFile (org.neo4j.io.pagecache.PagedFile)1 FlushFile (org.neo4j.io.pagecache.randomharness.Command.FlushFile)1 MapFile (org.neo4j.io.pagecache.randomharness.Command.MapFile)1 UnmapFile (org.neo4j.io.pagecache.randomharness.Command.UnmapFile)1 PageCountRecordFormat (org.neo4j.io.pagecache.randomharness.PageCountRecordFormat)1 RandomPageCacheTestHarness (org.neo4j.io.pagecache.randomharness.RandomPageCacheTestHarness)1 RecordFormat (org.neo4j.io.pagecache.randomharness.RecordFormat)1 StandardRecordFormat (org.neo4j.io.pagecache.randomharness.StandardRecordFormat)1