Search in sources :

Example 1 with IndexBelongsToConstraintException

use of org.neo4j.kernel.api.exceptions.schema.IndexBelongsToConstraintException in project neo4j by neo4j.

the class Operations method indexDrop.

@Override
public void indexDrop(IndexDescriptor index) throws SchemaKernelException {
    if (index == IndexDescriptor.NO_INDEX) {
        throw new DropIndexFailureException("No index was specified.");
    }
    if (index.isTokenIndex()) {
        assertTokenAndRelationshipPropertyIndexesSupported("Failed to drop token lookup index.");
    }
    exclusiveSchemaLock(index.schema());
    exclusiveSchemaNameLock(index.getName());
    assertIndexExistsForDrop(index);
    if (index.isUnique()) {
        if (allStoreHolder.indexGetOwningUniquenessConstraintId(index) != null) {
            IndexBelongsToConstraintException cause = new IndexBelongsToConstraintException(index.schema());
            throw new DropIndexFailureException("Unable to drop index: " + cause.getUserMessage(token), cause);
        }
    }
    ktx.txState().indexDoDrop(index);
}
Also used : IndexBelongsToConstraintException(org.neo4j.kernel.api.exceptions.schema.IndexBelongsToConstraintException) DropIndexFailureException(org.neo4j.kernel.api.exceptions.schema.DropIndexFailureException)

Example 2 with IndexBelongsToConstraintException

use of org.neo4j.kernel.api.exceptions.schema.IndexBelongsToConstraintException in project neo4j by neo4j.

the class Operations method indexDrop.

@Override
public void indexDrop(String indexName) throws SchemaKernelException {
    exclusiveSchemaNameLock(indexName);
    IndexDescriptor index = allStoreHolder.indexGetForName(indexName);
    if (index == IndexDescriptor.NO_INDEX) {
        throw new DropIndexFailureException("Unable to drop index called `" + indexName + "`. There is no such index.");
    }
    if (index.isTokenIndex()) {
        assertTokenAndRelationshipPropertyIndexesSupported("Failed to drop token lookup index.");
    }
    exclusiveSchemaLock(index.schema());
    assertIndexExistsForDrop(index);
    if (index.isUnique()) {
        if (allStoreHolder.indexGetOwningUniquenessConstraintId(index) != null) {
            IndexBelongsToConstraintException cause = new IndexBelongsToConstraintException(indexName, index.schema());
            throw new DropIndexFailureException("Unable to drop index: " + cause.getUserMessage(token), cause);
        }
    }
    ktx.txState().indexDoDrop(index);
}
Also used : IndexBelongsToConstraintException(org.neo4j.kernel.api.exceptions.schema.IndexBelongsToConstraintException) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor) DropIndexFailureException(org.neo4j.kernel.api.exceptions.schema.DropIndexFailureException)

Aggregations

DropIndexFailureException (org.neo4j.kernel.api.exceptions.schema.DropIndexFailureException)2 IndexBelongsToConstraintException (org.neo4j.kernel.api.exceptions.schema.IndexBelongsToConstraintException)2 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)1