Search in sources :

Example 1 with SchemaCache

use of org.neo4j.internal.recordstorage.SchemaCache in project neo4j by neo4j.

the class MultiIndexPopulationConcurrentUpdatesIT method launchCustomIndexPopulation.

private void launchCustomIndexPopulation(GraphDatabaseSettings.SchemaIndex schemaIndex, Map<String, Integer> labelNameIdMap, int propertyId, Runnable customAction) throws Throwable {
    RecordStorageEngine storageEngine = getStorageEngine();
    try (Transaction transaction = db.beginTx()) {
        Config config = Config.defaults();
        KernelTransaction ktx = ((InternalTransaction) transaction).kernelTransaction();
        JobScheduler scheduler = getJobScheduler();
        NullLogProvider nullLogProvider = NullLogProvider.getInstance();
        IndexStoreViewFactory indexStoreViewFactory = mock(IndexStoreViewFactory.class);
        when(indexStoreViewFactory.createTokenIndexStoreView(any())).thenAnswer(invocation -> dynamicIndexStoreViewWrapper(customAction, storageEngine::newReader, invocation.getArgument(0), config, scheduler));
        IndexProviderMap providerMap = getIndexProviderMap();
        indexService = IndexingServiceFactory.createIndexingService(config, scheduler, providerMap, indexStoreViewFactory, ktx.tokenRead(), initialSchemaRulesLoader(storageEngine), nullLogProvider, nullLogProvider, IndexingService.NO_MONITOR, getSchemaState(), mock(IndexStatisticsStore.class), PageCacheTracer.NULL, INSTANCE, "", writable());
        indexService.start();
        rules = createIndexRules(schemaIndex, labelNameIdMap, propertyId);
        schemaCache = new SchemaCache(new StandardConstraintSemantics(), providerMap);
        schemaCache.load(iterable(rules));
        indexService.createIndexes(AUTH_DISABLED, rules);
        transaction.commit();
    }
}
Also used : JobScheduler(org.neo4j.scheduler.JobScheduler) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) Transaction(org.neo4j.graphdb.Transaction) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) RecordStorageEngine(org.neo4j.internal.recordstorage.RecordStorageEngine) Config(org.neo4j.configuration.Config) NullLogProvider(org.neo4j.logging.NullLogProvider) SchemaCache(org.neo4j.internal.recordstorage.SchemaCache) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) IndexProviderMap(org.neo4j.kernel.impl.api.index.IndexProviderMap) StandardConstraintSemantics(org.neo4j.kernel.impl.constraints.StandardConstraintSemantics) IndexStoreViewFactory(org.neo4j.kernel.impl.transaction.state.storeview.IndexStoreViewFactory)

Aggregations

Config (org.neo4j.configuration.Config)1 Transaction (org.neo4j.graphdb.Transaction)1 RecordStorageEngine (org.neo4j.internal.recordstorage.RecordStorageEngine)1 SchemaCache (org.neo4j.internal.recordstorage.SchemaCache)1 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)1 IndexProviderMap (org.neo4j.kernel.impl.api.index.IndexProviderMap)1 StandardConstraintSemantics (org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)1 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)1 IndexStoreViewFactory (org.neo4j.kernel.impl.transaction.state.storeview.IndexStoreViewFactory)1 NullLogProvider (org.neo4j.logging.NullLogProvider)1 JobScheduler (org.neo4j.scheduler.JobScheduler)1