use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class LuceneIndexAccessorIT method setUp.
@BeforeEach
void setUp() {
Path path = directory.directory("db");
config = Config.defaults();
readOnlyChecker = new DatabaseReadOnlyChecker.Default(config, DEFAULT_DATABASE_NAME);
indexProvider = new LuceneIndexProvider(directory.getFileSystem(), PERSISTENT, directoriesByProvider(path), new Monitors(), config, readOnlyChecker);
life.add(indexProvider);
life.start();
samplingConfig = new IndexSamplingConfig(config);
}
use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class LuceneSchemaIndexPopulatorTest method before.
@BeforeEach
void before() throws IOException {
directory = new ByteBuffersDirectory();
DirectoryFactory directoryFactory = new DirectoryFactory.Single(new DirectoryFactory.UncloseableDirectory(directory));
provider = new LuceneIndexProvider(fs, directoryFactory, directoriesByProvider(testDir.directory("folder")), new Monitors(), Config.defaults(), writable());
propertyAccessor = mock(NodePropertyAccessor.class);
IndexSamplingConfig samplingConfig = new IndexSamplingConfig(Config.defaults());
index = IndexPrototype.forSchema(forLabel(42, propertyKeyId), provider.getProviderDescriptor()).withName("index").materialise(0);
indexPopulator = provider.getPopulator(index, samplingConfig, heapBufferFactory(1024), INSTANCE, SIMPLE_TOKEN_LOOKUP);
indexPopulator.create();
}
use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class CheckerTestBase method context.
CheckerContext context(int numberOfThreads, ConsistencyFlags consistencyFlags, ConsistencySummaryStatistics inconsistenciesSummary) throws Exception {
if (context != null) {
return context;
}
// We do this as late as possible because of how it eagerly caches which indexes exist so if the test creates an index
// this lazy instantiation allows the context to pick it up
Config config = Config.defaults(neo4j_home, directory.homePath());
DependencyResolver dependencies = db.getDependencyResolver();
IndexProviderMap indexProviders = dependencies.resolveDependency(IndexProviderMap.class);
IndexingService indexingService = dependencies.resolveDependency(IndexingService.class);
IndexAccessors indexAccessors = new IndexAccessors(indexProviders, neoStores, new IndexSamplingConfig(config), new LookupAccessorsFromRunningDb(indexingService), PageCacheTracer.NULL, tokenHolders, neoStores.getMetaDataStore());
InconsistencyReport report = new InconsistencyReport(new InconsistencyMessageLogger(NullLog.getInstance()), inconsistenciesSummary);
monitor = mock(ConsistencyReporter.Monitor.class);
reporter = new ConsistencyReporter(report, monitor);
countsState = new CountsState(neoStores, cacheAccess, INSTANCE);
NodeBasedMemoryLimiter limiter = new NodeBasedMemoryLimiter(pageCache.pageSize() * pageCache.maxCachedPages(), Runtime.getRuntime().maxMemory(), Long.MAX_VALUE, CacheSlots.CACHE_LINE_SIZE_BYTES, nodeStore.getHighId(), 1);
ProgressMonitorFactory.MultiPartBuilder progress = ProgressMonitorFactory.NONE.multipleParts("Test");
ParallelExecution execution = new ParallelExecution(numberOfThreads, NOOP_EXCEPTION_HANDLER, IDS_PER_CHUNK);
context = new CheckerContext(neoStores, indexAccessors, execution, reporter, cacheAccess, tokenHolders, new RecordLoading(neoStores), countsState, limiter, progress, pageCache, PageCacheTracer.NULL, INSTANCE, DebugContext.NO_DEBUG, consistencyFlags);
context.initialize();
return context;
}
use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class SimpleIndexPopulatorCompatibility method shouldBeAbleToDropAClosedIndexPopulator.
@Test
public void shouldBeAbleToDropAClosedIndexPopulator() {
// GIVEN
IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults());
final IndexPopulator p = indexProvider.getPopulator(descriptor, indexSamplingConfig, heapBufferFactory(1024), INSTANCE, tokenNameLookup);
p.close(false, NULL);
// WHEN
p.drop();
// THEN - no exception should be thrown (it's been known to!)
}
use of org.neo4j.kernel.impl.api.index.IndexSamplingConfig in project neo4j by neo4j.
the class SimpleIndexPopulatorCompatibility method shouldReportInitialStateAsFailedIfPopulationFailed.
@Test
public void shouldReportInitialStateAsFailedIfPopulationFailed() throws Exception {
// GIVEN
IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults());
withPopulator(indexProvider.getPopulator(descriptor, indexSamplingConfig, heapBufferFactory(1024), INSTANCE, tokenNameLookup), p -> {
String failure = "The contrived failure";
// WHEN
p.markAsFailed(failure);
p.close(false, NULL);
// THEN
assertEquals(FAILED, indexProvider.getInitialState(descriptor, NULL));
}, false);
}
Aggregations