Search in sources :

Example 21 with DefaultIdGeneratorFactory

use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.

the class RecordPropertyCursorTest method setup.

@BeforeEach
void setup() {
    idGeneratorFactory = new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName());
    neoStores = new StoreFactory(databaseLayout, Config.defaults(), idGeneratorFactory, pageCache, fs, getRecordFormats(), NullLogProvider.getInstance(), PageCacheTracer.NULL, writable(), Sets.immutable.empty()).openAllNeoStores(true);
    creator = new PropertyCreator(neoStores.getPropertyStore(), new PropertyTraverser(NULL), NULL, INSTANCE);
    owner = neoStores.getNodeStore().newRecord();
}
Also used : DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 22 with DefaultIdGeneratorFactory

use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.

the class PropertyPhysicalToLogicalConverterTest method before.

@BeforeEach
void before() {
    StoreFactory storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable());
    neoStores = storeFactory.openAllNeoStores(true);
    store = neoStores.getPropertyStore();
    converter = new PropertyPhysicalToLogicalConverter(store, NULL);
}
Also used : DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 23 with DefaultIdGeneratorFactory

use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.

the class ManyPropertyKeysIT method databaseWithManyPropertyKeys.

private GraphDatabaseAPI databaseWithManyPropertyKeys(int propertyKeyCount) throws IOException {
    var cacheTracer = PageCacheTracer.NULL;
    var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("databaseWithManyPropertyKeys"));
    StoreFactory storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fileSystem, immediate(), databaseLayout.getDatabaseName()), pageCache, fileSystem, NullLogProvider.getInstance(), cacheTracer, writable());
    NeoStores neoStores = storeFactory.openAllNeoStores(true);
    PropertyKeyTokenStore store = neoStores.getPropertyKeyTokenStore();
    for (int i = 0; i < propertyKeyCount; i++) {
        PropertyKeyTokenRecord record = new PropertyKeyTokenRecord((int) store.nextId(cursorContext));
        record.setInUse(true);
        Collection<DynamicRecord> nameRecords = store.allocateNameRecords(PropertyStore.encodeString(key(i)), cursorContext, INSTANCE);
        record.addNameRecords(nameRecords);
        record.setNameId((int) Iterables.first(nameRecords).getId());
        store.updateRecord(record, NULL);
    }
    neoStores.flush(cursorContext);
    neoStores.close();
    return database();
}
Also used : PropertyKeyTokenStore(org.neo4j.kernel.impl.store.PropertyKeyTokenStore) DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) NeoStores(org.neo4j.kernel.impl.store.NeoStores) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) CursorContext(org.neo4j.io.pagecache.context.CursorContext) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)

Example 24 with DefaultIdGeneratorFactory

use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.

the class RecordStorageEngineFactory method transactionMetaDataStore.

@Override
public MetadataProvider transactionMetaDataStore(FileSystemAbstraction fs, DatabaseLayout databaseLayout, Config config, PageCache pageCache, PageCacheTracer cacheTracer) {
    RecordFormats recordFormats = selectForStoreOrConfig(Config.defaults(), databaseLayout, fs, pageCache, NullLogProvider.getInstance(), cacheTracer);
    var readOnlyChecker = new DatabaseReadOnlyChecker.Default(new DbmsReadOnlyChecker.Default(config), databaseLayout.getDatabaseName());
    var idGeneratorFactory = readOnlyChecker.isReadOnly() ? new ScanOnOpenReadOnlyIdGeneratorFactory() : new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName());
    return new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, fs, recordFormats, NullLogProvider.getInstance(), cacheTracer, readOnlyChecker, immutable.empty()).openNeoStores(META_DATA).getMetaDataStore();
}
Also used : DbmsReadOnlyChecker(org.neo4j.configuration.helpers.DbmsReadOnlyChecker) ScanOnOpenReadOnlyIdGeneratorFactory(org.neo4j.internal.id.ScanOnOpenReadOnlyIdGeneratorFactory) RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory)

Example 25 with DefaultIdGeneratorFactory

use of org.neo4j.internal.id.DefaultIdGeneratorFactory in project neo4j by neo4j.

the class RecordStorageEngineFactory method schemaRuleMigrationAccess.

@Override
public SchemaRuleMigrationAccess schemaRuleMigrationAccess(FileSystemAbstraction fs, PageCache pageCache, Config config, DatabaseLayout databaseLayout, LogService logService, String recordFormats, PageCacheTracer cacheTracer, CursorContext cursorContext, MemoryTracker memoryTracker) {
    RecordFormats formats = selectForVersion(recordFormats);
    StoreFactory factory = new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, formats, logService.getInternalLogProvider(), cacheTracer, writable(), immutable.empty());
    NeoStores stores = factory.openNeoStores(true, StoreType.SCHEMA, StoreType.PROPERTY_KEY_TOKEN, StoreType.PROPERTY);
    try {
        stores.start(cursorContext);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return createMigrationTargetSchemaRuleAccess(stores, cursorContext, memoryTracker);
}
Also used : RecordFormats(org.neo4j.kernel.impl.store.format.RecordFormats) NeoStores(org.neo4j.kernel.impl.store.NeoStores) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory)

Aggregations

DefaultIdGeneratorFactory (org.neo4j.internal.id.DefaultIdGeneratorFactory)53 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)29 BeforeEach (org.junit.jupiter.api.BeforeEach)20 Config (org.neo4j.configuration.Config)18 Test (org.junit.jupiter.api.Test)15 NeoStores (org.neo4j.kernel.impl.store.NeoStores)14 Path (java.nio.file.Path)10 PageCache (org.neo4j.io.pagecache.PageCache)10 NullLogProvider (org.neo4j.logging.NullLogProvider)10 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)9 CursorContext (org.neo4j.io.pagecache.context.CursorContext)9 IdGeneratorFactory (org.neo4j.internal.id.IdGeneratorFactory)8 IOException (java.io.IOException)7 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)6 RecordFormats (org.neo4j.kernel.impl.store.format.RecordFormats)6 TokenHolders (org.neo4j.token.TokenHolders)6 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)5 DatabaseReadOnlyChecker.writable (org.neo4j.configuration.helpers.DatabaseReadOnlyChecker.writable)5 RecoveryCleanupWorkCollector.immediate (org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector.immediate)5 ArrayList (java.util.ArrayList)4