use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class IndexStatisticsTest method shouldProvideIndexStatisticsWhenIndexIsBuiltViaPopulationAndConcurrentAdditions.
@Test
public void shouldProvideIndexStatisticsWhenIndexIsBuiltViaPopulationAndConcurrentAdditions() throws Exception {
// given some initial data
int initialNodes = repeatCreateNamedPeopleFor(NAMES.length * CREATION_MULTIPLIER).length;
// when populating while creating
NewIndexDescriptor index = createIndex("Person", "name");
final UpdatesTracker updatesTracker = executeCreations(index, CREATION_MULTIPLIER);
awaitOnline(index);
// then
int seenWhilePopulating = initialNodes + updatesTracker.createdDuringPopulation();
double expectedSelectivity = UNIQUE_NAMES / seenWhilePopulating;
assertCorrectIndexSelectivity(expectedSelectivity, indexSelectivity(index));
assertCorrectIndexSize(seenWhilePopulating, indexSize(index));
assertCorrectIndexUpdates(updatesTracker.createdAfterPopulation(), indexUpdates(index));
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class IndexStatisticsTest method shouldProvideIndexStatisticsForDataCreatedWhenPopulationBeforeTheIndexIsOnline.
@Test
public void shouldProvideIndexStatisticsForDataCreatedWhenPopulationBeforeTheIndexIsOnline() throws KernelException {
// given
createSomePersons();
// when
NewIndexDescriptor index = awaitOnline(createIndex("Person", "name"));
// then
assertEquals(0.75d, indexSelectivity(index), DOUBLE_ERROR_TOLERANCE);
assertEquals(4L, indexSize(index));
assertEquals(0L, indexUpdates(index));
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class IndexIT method addIndexRuleInATransaction.
@Test
public void addIndexRuleInATransaction() throws Exception {
// GIVEN
SchemaWriteOperations schemaWriteOperations = schemaWriteOperationsInNewTransaction();
// WHEN
NewIndexDescriptor expectedRule = schemaWriteOperations.indexCreate(SchemaBoundary.map(descriptor));
commit();
// THEN
ReadOperations readOperations = readOperationsInNewTransaction();
assertEquals(asSet(expectedRule), asSet(readOperations.indexesGetForLabel(labelId)));
assertEquals(expectedRule, readOperations.indexGetForLabelAndPropertyKey(descriptor));
commit();
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class IndexPopulationJobTest method newIndexPopulationJob.
private IndexPopulationJob newIndexPopulationJob(FailedIndexProxyFactory failureDelegateFactory, IndexPopulator populator, FlippableIndexProxy flipper, IndexStoreView storeView, LogProvider logProvider, boolean constraint) throws TransactionFailureException {
NewIndexDescriptor descriptor = indexDescriptor(FIRST, name, constraint);
long indexId = 0;
flipper.setFlipTarget(mock(IndexProxyFactory.class));
MultipleIndexPopulator multiPopulator = new MultipleIndexPopulator(storeView, logProvider);
IndexPopulationJob job = new IndexPopulationJob(storeView, multiPopulator, NO_MONITOR, stateHolder::clear);
job.addPopulator(populator, indexId, descriptor, PROVIDER_DESCRIPTOR, format(":%s(%s)", FIRST.name(), name), flipper, failureDelegateFactory);
return job;
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class IndexPopulationJobTest method inMemoryPopulator.
private IndexPopulator inMemoryPopulator(boolean constraint) throws TransactionFailureException {
IndexSamplingConfig samplingConfig = new IndexSamplingConfig(Config.empty());
NewIndexDescriptor descriptor = indexDescriptor(FIRST, name, constraint);
return new InMemoryIndexProvider().getPopulator(21, descriptor, samplingConfig);
}
Aggregations