use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class FusionIndexUpdaterTest method verifyChangeWithCorrectUpdaterMixed.
private void verifyChangeWithCorrectUpdaterMixed(IndexUpdater expectRemoveFrom, IndexUpdater expectAddTo, Value[] beforeValues, Value[] afterValues) throws IndexEntryConflictException {
for (int beforeIndex = 0; beforeIndex < beforeValues.length; beforeIndex++) {
Value before = beforeValues[beforeIndex];
for (int afterIndex = 0; afterIndex < afterValues.length; afterIndex++) {
Value after = afterValues[afterIndex];
IndexEntryUpdate<LabelSchemaDescriptor> change = change(before, after);
fusionIndexUpdater.process(change);
if (expectRemoveFrom != expectAddTo) {
verify(expectRemoveFrom, times(afterIndex + 1)).process(remove(before));
verify(expectAddTo, times(beforeIndex + 1)).process(add(after));
} else {
verify(expectRemoveFrom).process(change(before, after));
}
}
}
}
use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class UniqueDatabaseIndexPopulatorTest method sampleIncludedUpdates.
@Test
void sampleIncludedUpdates() {
LabelSchemaDescriptor schemaDescriptor = forLabel(1, 1);
populator = newPopulator();
List<IndexEntryUpdate<?>> updates = Arrays.asList(add(1, schemaDescriptor, "foo"), add(2, schemaDescriptor, "bar"), add(3, schemaDescriptor, "baz"), add(4, schemaDescriptor, "qux"));
updates.forEach(populator::includeSample);
IndexSample sample = populator.sample(NULL);
assertEquals(new IndexSample(4, 4, 4), sample);
}
use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class MultiIndexPopulationConcurrentUpdatesIT method checkIndexIsOnline.
private void checkIndexIsOnline(int labelId) throws IndexNotFoundKernelException {
LabelSchemaDescriptor schema = SchemaDescriptor.forLabel(labelId, propertyId);
IndexDescriptor index = single(schemaCache.indexesForSchema(schema));
IndexProxy indexProxy = indexService.getIndexProxy(index);
assertSame(InternalIndexState.ONLINE, indexProxy.getState());
}
use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class MultiIndexPopulationConcurrentUpdatesIT method createIndexRules.
private IndexDescriptor[] createIndexRules(GraphDatabaseSettings.SchemaIndex schemaIndex, Map<String, Integer> labelNameIdMap, int propertyId) {
final IndexProviderMap indexProviderMap = getIndexProviderMap();
IndexProvider indexProvider = indexProviderMap.lookup(schemaIndex.providerName());
IndexProviderDescriptor providerDescriptor = indexProvider.getProviderDescriptor();
List<IndexDescriptor> list = new ArrayList<>();
for (Integer labelId : labelNameIdMap.values()) {
final LabelSchemaDescriptor schema = SchemaDescriptor.forLabel(labelId, propertyId);
IndexDescriptor index = IndexPrototype.forSchema(schema, providerDescriptor).withName("index_" + labelId).materialise(labelId);
index = indexProvider.completeConfiguration(index);
list.add(index);
}
return list.toArray(new IndexDescriptor[0]);
}
use of org.neo4j.internal.schema.LabelSchemaDescriptor in project neo4j by neo4j.
the class MultiIndexPopulationConcurrentUpdatesIT method waitIndexOnline.
private void waitIndexOnline(IndexingService indexService, int propertyId, int labelId) throws IndexNotFoundKernelException, IndexPopulationFailedKernelException, InterruptedException, IndexActivationFailedKernelException {
LabelSchemaDescriptor schema = SchemaDescriptor.forLabel(labelId, propertyId);
IndexDescriptor index = single(schemaCache.indexesForSchema(schema));
IndexProxy indexProxy = indexService.getIndexProxy(index);
indexProxy.awaitStoreScanCompleted(0, TimeUnit.MILLISECONDS);
while (indexProxy.getState() != InternalIndexState.ONLINE) {
Thread.sleep(10);
}
indexProxy.activate();
}
Aggregations