Search in sources :

Example 16 with IndexPopulator

use of org.neo4j.kernel.api.index.IndexPopulator in project neo4j by neo4j.

the class MultipleIndexPopulatorTest method testFailByPopulationRemovesPopulator.

@Test
public void testFailByPopulationRemovesPopulator() throws IOException {
    IndexPopulator populator1 = createIndexPopulator();
    IndexPopulator populator2 = createIndexPopulator();
    IndexPopulation population1 = addPopulator(populator1, 1);
    IndexPopulation population2 = addPopulator(populator2, 2);
    multipleIndexPopulator.fail(population1, getPopulatorException());
    multipleIndexPopulator.fail(population2, getPopulatorException());
    checkPopulatorFailure(populator1);
    checkPopulatorFailure(populator2);
    assertFalse(multipleIndexPopulator.hasPopulators());
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) IndexPopulation(org.neo4j.kernel.impl.api.index.MultipleIndexPopulator.IndexPopulation) Test(org.junit.Test)

Example 17 with IndexPopulator

use of org.neo4j.kernel.api.index.IndexPopulator in project neo4j by neo4j.

the class MultipleIndexPopulatorTest method testMultiplePopulatorCreationFailure.

@Test
public void testMultiplePopulatorCreationFailure() throws IOException {
    IndexPopulator indexPopulator1 = createIndexPopulator();
    IndexPopulator indexPopulator2 = createIndexPopulator();
    IndexPopulator indexPopulator3 = createIndexPopulator();
    doThrow(getPopulatorException()).when(indexPopulator1).create();
    doThrow(getPopulatorException()).when(indexPopulator3).create();
    addPopulator(indexPopulator1, 1);
    addPopulator(indexPopulator2, 2);
    addPopulator(indexPopulator3, 3);
    multipleIndexPopulator.create();
    checkPopulatorFailure(indexPopulator1);
    checkPopulatorFailure(indexPopulator3);
    verify(indexPopulator2).create();
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) Test(org.junit.Test)

Example 18 with IndexPopulator

use of org.neo4j.kernel.api.index.IndexPopulator in project neo4j by neo4j.

the class MultipleIndexPopulatorTest method testMultiplePopulatorsCreation.

@Test
public void testMultiplePopulatorsCreation() throws Exception {
    IndexPopulator indexPopulator1 = createIndexPopulator();
    IndexPopulator indexPopulator2 = createIndexPopulator();
    addPopulator(indexPopulator1, 1);
    addPopulator(indexPopulator2, 2);
    multipleIndexPopulator.create();
    verify(indexPopulator1).create();
    verify(indexPopulator2).create();
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) Test(org.junit.Test)

Example 19 with IndexPopulator

use of org.neo4j.kernel.api.index.IndexPopulator in project neo4j by neo4j.

the class MultipleIndexPopulatorTest method testCancelPopulation.

@Test
public void testCancelPopulation() throws IOException {
    IndexPopulator indexPopulator1 = createIndexPopulator();
    IndexPopulator indexPopulator2 = createIndexPopulator();
    addPopulator(indexPopulator1, 1);
    addPopulator(indexPopulator2, 2);
    multipleIndexPopulator.cancel();
    verify(indexStoreView, times(2)).replaceIndexCounts(anyLong(), eq(0L), eq(0L), eq(0L));
    verify(indexPopulator1).close(false);
    verify(indexPopulator2).close(false);
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) Test(org.junit.Test)

Example 20 with IndexPopulator

use of org.neo4j.kernel.api.index.IndexPopulator in project neo4j by neo4j.

the class MultipleIndexPopulatorTest method closeMultipleIndexPopulator.

@Test
public void closeMultipleIndexPopulator() throws IOException, IndexEntryConflictException {
    IndexPopulator indexPopulator1 = createIndexPopulator();
    IndexPopulator indexPopulator2 = createIndexPopulator();
    addPopulator(indexPopulator1, 1);
    addPopulator(indexPopulator2, 2);
    doThrow(getPopulatorException()).when(indexPopulator2).close(true);
    multipleIndexPopulator.close(true);
    verify(indexPopulator1).close(true);
    checkPopulatorFailure(indexPopulator2);
}
Also used : IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator) Test(org.junit.Test)

Aggregations

IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)45 Test (org.junit.Test)37 IndexEntryUpdate (org.neo4j.kernel.api.index.IndexEntryUpdate)11 PropertyAccessor (org.neo4j.kernel.api.index.PropertyAccessor)8 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)7 IndexSamplingConfig (org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig)7 NeoStoreIndexStoreView (org.neo4j.kernel.impl.transaction.state.storeview.NeoStoreIndexStoreView)7 NodeUpdates (org.neo4j.kernel.api.index.NodeUpdates)6 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)6 NewIndexDescriptor (org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor)6 BatchInserter (org.neo4j.unsafe.batchinsert.BatchInserter)5 ExecutorService (java.util.concurrent.ExecutorService)3 LabelSchemaDescriptor (org.neo4j.kernel.api.schema_new.LabelSchemaDescriptor)3 IndexPopulation (org.neo4j.kernel.impl.api.index.MultipleIndexPopulator.IndexPopulation)3 NeoStores (org.neo4j.kernel.impl.store.NeoStores)3 NodeStore (org.neo4j.kernel.impl.store.NodeStore)3 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)3 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)3 IntPredicate (java.util.function.IntPredicate)2 NodeLabelUpdate (org.neo4j.kernel.api.labelscan.NodeLabelUpdate)2