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.");
}
}
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);
}
}
Aggregations