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();
}
}
Aggregations