Search in sources :

Example 1 with IndexActivationFailedKernelException

use of org.neo4j.kernel.api.exceptions.index.IndexActivationFailedKernelException in project neo4j by neo4j.

the class IndexingService method activateIndex.

public void activateIndex(long indexId) throws IndexNotFoundKernelException, IndexActivationFailedKernelException, IndexPopulationFailedKernelException {
    try {
        if (// don't do this during recovery.
        state == State.RUNNING) {
            IndexProxy index = getIndexProxy(indexId);
            index.awaitStoreScanCompleted();
            index.activate();
        }
    } catch (InterruptedException e) {
        Thread.interrupted();
        throw new IndexActivationFailedKernelException(e, "Unable to activate index, thread was interrupted.");
    }
}
Also used : IndexActivationFailedKernelException(org.neo4j.kernel.api.exceptions.index.IndexActivationFailedKernelException)

Example 2 with IndexActivationFailedKernelException

use of org.neo4j.kernel.api.exceptions.index.IndexActivationFailedKernelException in project neo4j by neo4j.

the class NeoStoreTransactionApplierTest method shouldApplyUpdateIndexRuleSchemaRuleCommandToTheStoreThrowingIndexProblem.

@Test
public void shouldApplyUpdateIndexRuleSchemaRuleCommandToTheStoreThrowingIndexProblem() throws IOException, IndexNotFoundKernelException, IndexPopulationFailedKernelException, IndexActivationFailedKernelException {
    // given
    final BatchTransactionApplier applier = newIndexApplier();
    doThrow(new IndexNotFoundKernelException("")).when(indexingService).activateIndex(anyLong());
    final DynamicRecord record = DynamicRecord.dynamicRecord(21, true);
    final Collection<DynamicRecord> recordsAfter = Arrays.asList(record);
    final IndexRule rule = constraintIndexRule(0, 1, 2, new SchemaIndexProvider.Descriptor("K", "X.Y"), 42L);
    final Command.SchemaRuleCommand command = new Command.SchemaRuleCommand(Collections.<DynamicRecord>emptyList(), recordsAfter, rule);
    // when
    try {
        apply(applier, command::handle, transactionToApply);
        fail("should have thrown");
    } catch (Exception e) {
        // then
        assertTrue(e.getCause() instanceof IndexNotFoundKernelException);
    }
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) IndexRule(org.neo4j.kernel.impl.store.record.IndexRule) SchemaIndexProvider(org.neo4j.kernel.api.index.SchemaIndexProvider) RelationshipTypeTokenCommand(org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand) LabelTokenCommand(org.neo4j.kernel.impl.transaction.command.Command.LabelTokenCommand) PropertyKeyTokenCommand(org.neo4j.kernel.impl.transaction.command.Command.PropertyKeyTokenCommand) IndexNotFoundKernelException(org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException) BatchTransactionApplier(org.neo4j.kernel.impl.api.BatchTransactionApplier) IndexNotFoundKernelException(org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException) IndexPopulationFailedKernelException(org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException) IOException(java.io.IOException) IndexActivationFailedKernelException(org.neo4j.kernel.api.exceptions.index.IndexActivationFailedKernelException) Test(org.junit.Test)

Aggregations

IndexActivationFailedKernelException (org.neo4j.kernel.api.exceptions.index.IndexActivationFailedKernelException)2 IOException (java.io.IOException)1 Test (org.junit.Test)1 IndexNotFoundKernelException (org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException)1 IndexPopulationFailedKernelException (org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException)1 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)1 BatchTransactionApplier (org.neo4j.kernel.impl.api.BatchTransactionApplier)1 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)1 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)1 LabelTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.LabelTokenCommand)1 PropertyKeyTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.PropertyKeyTokenCommand)1 RelationshipTypeTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand)1