use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class TestArrayStore method before.
@BeforeEach
void before() {
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fileSystem, immediate(), databaseLayout.getDatabaseName());
StoreFactory factory = new StoreFactory(databaseLayout, Config.defaults(), idGeneratorFactory, pageCache, fileSystem, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable());
neoStores = factory.openAllNeoStores(true);
arrayStore = neoStores.getPropertyStore().getArrayStore();
}
use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class TestGrowingFileMemoryMapping method shouldGrowAFileWhileContinuingToMemoryMapNewRegions.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldGrowAFileWhileContinuingToMemoryMapNewRegions() {
// given
final int NUMBER_OF_RECORDS = 1000000;
Config config = Config.defaults();
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(testDirectory.getFileSystem(), immediate(), databaseLayout.getDatabaseName());
StoreFactory storeFactory = new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, testDirectory.getFileSystem(), NullLogProvider.getInstance(), NULL, writable());
NeoStores neoStores = storeFactory.openAllNeoStores(true);
NodeStore nodeStore = neoStores.getNodeStore();
// when
int iterations = 2 * NUMBER_OF_RECORDS;
long startingId = nodeStore.nextId(CursorContext.NULL);
long nodeId = startingId;
for (int i = 0; i < iterations; i++) {
NodeRecord record = new NodeRecord(nodeId).initialize(false, 0, false, i, 0);
record.setInUse(true);
nodeStore.updateRecord(record, CursorContext.NULL);
nodeId = nodeStore.nextId(CursorContext.NULL);
}
// then
NodeRecord record = new NodeRecord(0).initialize(false, 0, false, 0, 0);
for (int i = 0; i < iterations; i++) {
record.setId(startingId + i);
nodeStore.getRecord(i, record, NORMAL, CursorContext.NULL);
assertTrue(record.inUse(), "record[" + i + "] should be in use");
assertThat(record.getNextRel()).as("record[" + i + "] should have nextRelId of " + i).isEqualTo(i);
}
neoStores.close();
}
use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class TokenStoreTestTemplate method setUp.
@BeforeEach
void setUp() throws IOException {
Path file = dir.file("label-tokens.db");
Path idFile = dir.file("label-tokens.db.id");
Path namesFile = dir.file("label-tokens.db.names");
Path namesIdFile = dir.file("label-tokens.db.names.id");
IdGeneratorFactory generatorFactory = new DefaultIdGeneratorFactory(fs, immediate(), DEFAULT_DATABASE_NAME);
LogProvider logProvider = NullLogProvider.getInstance();
RecordFormats formats = RecordFormatSelector.defaultFormat();
Config config = Config.defaults();
nameStore = new DynamicStringStore(namesFile, namesIdFile, config, IdType.LABEL_TOKEN_NAME, generatorFactory, pageCache, logProvider, TokenStore.NAME_STORE_BLOCK_SIZE, formats.dynamic(), formats.storeVersion(), writable(), DEFAULT_DATABASE_NAME, immutable.empty());
store = instantiateStore(file, idFile, generatorFactory, pageCache, logProvider, nameStore, formats, config);
nameStore.initialise(true, NULL);
store.initialise(true, NULL);
nameStore.start(NULL);
store.start(NULL);
}
use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class RecordStoreConsistentReadTest method setUp.
@BeforeEach
void setUp() {
nextReadIsInconsistent = new AtomicBoolean();
pageCache = pageCacheExtension.getPageCache(fs, config().withInconsistentReads(nextReadIsInconsistent));
StoreFactory factory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable());
neoStores = factory.openAllNeoStores(true);
initialiseStore(neoStores);
}
use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.
the class AbstractDynamicStoreTest method newTestableDynamicStore.
private AbstractDynamicStore newTestableDynamicStore() {
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs, immediate(), DEFAULT_DATABASE_NAME);
AbstractDynamicStore store = new AbstractDynamicStore(storeFile, idFile, Config.defaults(), IdType.ARRAY_BLOCK, idGeneratorFactory, pageCache, NullLogProvider.getInstance(), "test", BLOCK_SIZE, formats.dynamic(), formats.storeVersion(), DatabaseReadOnlyChecker.writable(), DEFAULT_DATABASE_NAME, immutable.empty()) {
@Override
public String getTypeDescriptor() {
return "TestDynamicStore";
}
};
store.initialise(true, NULL);
return store;
}
Aggregations