use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class IndexingServiceIntegrationTest method dropIndexDirectlyOnIndexingServiceRaceWithCheckpoint.
@ParameterizedTest
@MethodSource("parameters")
void dropIndexDirectlyOnIndexingServiceRaceWithCheckpoint(GraphDatabaseSettings.SchemaIndex schemaIndex) throws Throwable {
setUp(schemaIndex);
IndexingService indexingService = getIndexingService(database);
CheckPointer checkPointer = getCheckPointer(database);
IndexDescriptor indexDescriptor;
try (Transaction tx = database.beginTx()) {
IndexDefinitionImpl indexDefinition = (IndexDefinitionImpl) tx.schema().indexFor(Label.label("label")).on("prop").create();
indexDescriptor = indexDefinition.getIndexReference();
tx.commit();
}
try (Transaction tx = database.beginTx()) {
tx.schema().awaitIndexesOnline(1, TimeUnit.HOURS);
tx.commit();
}
Race race = new Race();
race.addContestant(Race.throwing(() -> checkPointer.forceCheckPoint(new SimpleTriggerInfo("Test force"))));
race.addContestant(Race.throwing(() -> indexingService.dropIndex(indexDescriptor)));
race.go();
}
use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class DefaultSchemaIndexConfigTest method createIndex.
private void createIndex(GraphDatabaseService db) {
try (Transaction tx = db.beginTx()) {
IndexDefinitionImpl indexDefinition = (IndexDefinitionImpl) tx.schema().indexFor(LABEL_ONE).on(KEY).create();
index = indexDefinition.getIndexReference();
tx.commit();
}
try (Transaction tx = db.beginTx()) {
tx.schema().awaitIndexesOnline(2, TimeUnit.MINUTES);
tx.commit();
}
}
use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class IndexConfigMigrationIT method getIndexConfig.
@SuppressWarnings("SameParameterValue")
private static Map<String, Value> getIndexConfig(GraphDatabaseAPI db, Transaction tx, Label label) throws IndexNotFoundKernelException {
IndexDefinitionImpl indexDefinition = (IndexDefinitionImpl) single(tx.schema().getIndexes(label));
IndexDescriptor index = indexDefinition.getIndexReference();
IndexingService indexingService = getIndexingService(db);
IndexProxy indexProxy = indexingService.getIndexProxy(index);
return indexProxy.indexConfig();
}
use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class CompositeStringLengthValidationIT method createIndex.
private IndexDescriptor createIndex(String... keys) {
IndexDefinition indexDefinition;
try (Transaction tx = db.beginTx()) {
IndexCreator indexCreator = tx.schema().indexFor(LABEL);
for (String key : keys) {
indexCreator = indexCreator.on(key);
}
indexDefinition = indexCreator.create();
tx.commit();
}
try (Transaction tx = db.beginTx()) {
tx.schema().awaitIndexesOnline(30, SECONDS);
tx.commit();
}
return ((IndexDefinitionImpl) indexDefinition).getIndexReference();
}
use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class LabelScanNodeViewTracingIT method findTokenIndex.
private IndexDescriptor findTokenIndex() {
try (Transaction tx = database.beginTx()) {
var nodeIndex = stream(tx.schema().getIndexes().spliterator(), false).map(indexDef -> ((IndexDefinitionImpl) indexDef).getIndexReference()).filter(index -> index.isTokenIndex() && index.schema().entityType() == EntityType.NODE).findFirst();
assertTrue(nodeIndex.isPresent());
return nodeIndex.get();
}
}
Aggregations