Search in sources :

Example 46 with DefaultIdGeneratorFactory

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

the class ShortStringPropertyEncodeTest method setupStore.

@BeforeEach
void setupStore() {
    neoStores = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fileSystem, immediate(), databaseLayout.getDatabaseName()), pageCache, fileSystem, NullLogProvider.getInstance(), NULL, writable()).openNeoStores(true, StoreType.PROPERTY, StoreType.PROPERTY_ARRAY, StoreType.PROPERTY_STRING);
    propertyStore = neoStores.getPropertyStore();
}
Also used : DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 47 with DefaultIdGeneratorFactory

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

the class RelationshipGroupGetterTest method openStore.

@BeforeEach
void openStore() {
    LogProvider logProvider = NullLogProvider.getInstance();
    StoreFactory storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, logProvider, PageCacheTracer.NULL, writable());
    stores = storeFactory.openNeoStores(true, StoreType.RELATIONSHIP_GROUP, StoreType.NODE, StoreType.NODE_LABEL);
    groupStore = spy(stores.getRelationshipGroupStore());
    NodeStore nodeStore = stores.getNodeStore();
    groupRecords = new DirectRecordAccess<>(groupStore, Loaders.relationshipGroupLoader(groupStore, NULL));
    nodeRecords = new DirectRecordAccess<>(nodeStore, Loaders.nodeLoader(nodeStore, NULL));
    groupGetter = new RelationshipGroupGetter(groupStore, NULL);
}
Also used : LogProvider(org.neo4j.logging.LogProvider) NullLogProvider(org.neo4j.logging.NullLogProvider) NodeStore(org.neo4j.kernel.impl.store.NodeStore) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 48 with DefaultIdGeneratorFactory

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

the class OnlineIndexUpdatesTest method setUp.

@BeforeEach
void setUp() throws IOException {
    life = new LifeSupport();
    Config config = Config.defaults();
    NullLogProvider nullLogProvider = NullLogProvider.getInstance();
    StoreFactory storeFactory = new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(fileSystem, immediate(), databaseLayout.getDatabaseName()), pageCache, fileSystem, nullLogProvider, NULL, writable());
    neoStores = storeFactory.openAllNeoStores(true);
    GBPTreeCountsStore counts = new GBPTreeCountsStore(pageCache, databaseLayout.countStore(), fileSystem, immediate(), new CountsComputer(neoStores, pageCache, NULL, databaseLayout, INSTANCE, NullLog.getInstance()), writable(), NULL, GBPTreeCountsStore.NO_MONITOR, databaseLayout.getDatabaseName(), 1_000);
    life.add(wrapInLifecycle(counts));
    nodeStore = neoStores.getNodeStore();
    relationshipStore = neoStores.getRelationshipStore();
    PropertyStore propertyStore = neoStores.getPropertyStore();
    schemaCache = new SchemaCache(new StandardConstraintRuleAccessor(), index -> index);
    propertyPhysicalToLogicalConverter = new PropertyPhysicalToLogicalConverter(neoStores.getPropertyStore(), CursorContext.NULL);
    life.start();
    propertyCreator = new PropertyCreator(neoStores.getPropertyStore(), new PropertyTraverser(CursorContext.NULL), CursorContext.NULL, INSTANCE);
    recordAccess = new DirectRecordAccess<>(neoStores.getPropertyStore(), Loaders.propertyLoader(propertyStore, CursorContext.NULL));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) LifecycleAdapter(org.neo4j.kernel.lifecycle.LifecycleAdapter) NodeCommand(org.neo4j.internal.recordstorage.Command.NodeCommand) CursorContext(org.neo4j.io.pagecache.context.CursorContext) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Config(org.neo4j.configuration.Config) Value(org.neo4j.values.storable.Value) NO_NEXT_RELATIONSHIP(org.neo4j.kernel.impl.store.record.Record.NO_NEXT_RELATIONSHIP) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) NullLogProvider(org.neo4j.logging.NullLogProvider) DatabaseLayout(org.neo4j.io.layout.DatabaseLayout) Collections.singletonList(java.util.Collections.singletonList) NO_LABELS_FIELD(org.neo4j.kernel.impl.store.record.Record.NO_LABELS_FIELD) InlineNodeLabels(org.neo4j.kernel.impl.store.InlineNodeLabels) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) CountsComputer(org.neo4j.kernel.impl.store.CountsComputer) NullLog(org.neo4j.logging.NullLog) PageCache(org.neo4j.io.pagecache.PageCache) DatabaseReadOnlyChecker.writable(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker.writable) IndexEntryUpdate(org.neo4j.storageengine.api.IndexEntryUpdate) Neo4jLayoutExtension(org.neo4j.test.extension.Neo4jLayoutExtension) Test(org.junit.jupiter.api.Test) INSTANCE(org.neo4j.memory.EmptyMemoryTracker.INSTANCE) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) IndexPrototype(org.neo4j.internal.schema.IndexPrototype) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) NodeStore(org.neo4j.kernel.impl.store.NodeStore) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor) NODE(org.neo4j.common.EntityType.NODE) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) CountsStore(org.neo4j.counts.CountsStore) NULL(org.neo4j.io.pagecache.tracing.PageCacheTracer.NULL) Values(org.neo4j.values.storable.Values) StandardConstraintRuleAccessor(org.neo4j.storageengine.api.StandardConstraintRuleAccessor) RelationshipStore(org.neo4j.kernel.impl.store.RelationshipStore) NeoStores(org.neo4j.kernel.impl.store.NeoStores) Inject(org.neo4j.test.extension.Inject) GBPTreeCountsStore(org.neo4j.internal.counts.GBPTreeCountsStore) NO_NEXT_PROPERTY(org.neo4j.kernel.impl.store.record.Record.NO_NEXT_PROPERTY) PropertyCommand(org.neo4j.internal.recordstorage.Command.PropertyCommand) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) SchemaDescriptor.fulltext(org.neo4j.internal.schema.SchemaDescriptor.fulltext) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore) Lifecycle(org.neo4j.kernel.lifecycle.Lifecycle) PageCacheExtension(org.neo4j.test.extension.pagecache.PageCacheExtension) Iterator(java.util.Iterator) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) IOException(java.io.IOException) RELATIONSHIP(org.neo4j.common.EntityType.RELATIONSHIP) RecoveryCleanupWorkCollector.immediate(org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector.immediate) AfterEach(org.junit.jupiter.api.AfterEach) PrimitiveRecord(org.neo4j.kernel.impl.store.record.PrimitiveRecord) FulltextSchemaDescriptor(org.neo4j.internal.schema.FulltextSchemaDescriptor) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) Config(org.neo4j.configuration.Config) CountsComputer(org.neo4j.kernel.impl.store.CountsComputer) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) GBPTreeCountsStore(org.neo4j.internal.counts.GBPTreeCountsStore) NullLogProvider(org.neo4j.logging.NullLogProvider) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore) StandardConstraintRuleAccessor(org.neo4j.storageengine.api.StandardConstraintRuleAccessor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 49 with DefaultIdGeneratorFactory

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

the class PropertyCreatorTest method startStore.

@BeforeEach
void startStore() {
    neoStores = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fileSystem, immediate(), databaseLayout.getDatabaseName()), pageCache, fileSystem, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable()).openNeoStores(true, StoreType.PROPERTY, StoreType.PROPERTY_STRING, StoreType.PROPERTY_ARRAY);
    propertyStore = neoStores.getPropertyStore();
    records = new DirectRecordAccess<>(propertyStore, Loaders.propertyLoader(propertyStore, NULL));
    var pageCacheTracer = new DefaultPageCacheTracer();
    cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("propertyStore"));
    creator = new PropertyCreator(propertyStore, new PropertyTraverser(NULL), cursorContext, INSTANCE);
}
Also used : DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) CursorContext(org.neo4j.io.pagecache.context.CursorContext) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 50 with DefaultIdGeneratorFactory

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

the class PropertyDeleterTest method startStore.

private void startStore(boolean log) {
    Config config = Config.defaults(GraphDatabaseInternalSettings.log_inconsistent_data_deletion, log);
    idGeneratorFactory = new DefaultIdGeneratorFactory(directory.getFileSystem(), immediate(), "db");
    neoStores = new StoreFactory(DatabaseLayout.ofFlat(directory.homePath()), config, idGeneratorFactory, pageCache, directory.getFileSystem(), NullLogProvider.getInstance(), PageCacheTracer.NULL, writable()).openAllNeoStores(true);
    propertyStore = neoStores.getPropertyStore();
    propertyCreator = new PropertyCreator(propertyStore, traverser, NULL, INSTANCE);
    deleter = new PropertyDeleter(traverser, this.neoStores, new TokenNameLookup() {

        @Override
        public String labelGetName(int labelId) {
            return "" + labelId;
        }

        @Override
        public String relationshipTypeGetName(int relationshipTypeId) {
            return "" + relationshipTypeId;
        }

        @Override
        public String propertyKeyGetName(int propertyKeyId) {
            return "" + propertyKeyId;
        }
    }, logProvider, config, NULL, INSTANCE);
}
Also used : TokenNameLookup(org.neo4j.common.TokenNameLookup) Config(org.neo4j.configuration.Config) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) 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