use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.
the class MultipleIndexPopulatorTest method testPropertyUpdateFailure.
@Test
void testPropertyUpdateFailure() throws IndexEntryConflictException, FlipFailedKernelException {
IndexEntryUpdate<?> propertyUpdate = createIndexEntryUpdate(index1);
IndexUpdater indexUpdater1 = mock(IndexUpdater.class);
IndexPopulator indexPopulator1 = createIndexPopulator(indexUpdater1);
addPopulator(indexPopulator1, 1);
doThrow(getPopulatorException()).when(indexUpdater1).process(propertyUpdate);
IndexUpdater multipleIndexUpdater = multipleIndexPopulator.newPopulatingUpdater(mock(NodePropertyAccessor.class), NULL);
multipleIndexUpdater.process(propertyUpdate);
verify(indexUpdater1).close();
checkPopulatorFailure(indexPopulator1);
}
use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.
the class MultipleIndexPopulatorTest method testNonApplicableUpdaterDoNotUpdatePopulator.
@Test
void testNonApplicableUpdaterDoNotUpdatePopulator() throws IndexEntryConflictException, FlipFailedKernelException {
IndexUpdater indexUpdater1 = mock(IndexUpdater.class);
IndexPopulator indexPopulator1 = createIndexPopulator(indexUpdater1);
addPopulator(indexPopulator1, 2);
IndexUpdater multipleIndexUpdater = multipleIndexPopulator.newPopulatingUpdater(mock(NodePropertyAccessor.class), NULL);
IndexEntryUpdate<?> propertyUpdate = createIndexEntryUpdate(index1);
multipleIndexUpdater.process(propertyUpdate);
verifyNoInteractions(indexUpdater1);
}
use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.
the class IndexUpdaterMapTest method shouldRetrieveUpdaterFromIndexMapForExistingIndex.
@Test
void shouldRetrieveUpdaterFromIndexMapForExistingIndex() {
// given
indexMap.putIndexProxy(indexProxy1);
// when
IndexUpdater updater = updaterMap.getUpdater(schemaIndexDescriptor1, NULL);
// then
assertEquals(indexUpdater1, updater);
assertEquals(1, updaterMap.size());
}
use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.
the class IndexUpdaterMapTest method before.
@BeforeEach
void before() {
indexMap = new IndexMap();
indexProxy1 = mock(IndexProxy.class);
schemaIndexDescriptor1 = forSchema(forLabel(2, 3), PROVIDER_DESCRIPTOR).withName("a").materialise(0);
indexUpdater1 = mock(IndexUpdater.class);
when(indexProxy1.getDescriptor()).thenReturn(schemaIndexDescriptor1);
when(indexProxy1.newUpdater(any(IndexUpdateMode.class), any(CursorContext.class))).thenReturn(indexUpdater1);
indexProxy2 = mock(IndexProxy.class);
schemaIndexDescriptor = forSchema(forLabel(5, 6), PROVIDER_DESCRIPTOR).withName("b").materialise(1);
IndexUpdater indexUpdater2 = mock(IndexUpdater.class);
when(indexProxy2.getDescriptor()).thenReturn(schemaIndexDescriptor);
when(indexProxy2.newUpdater(any(IndexUpdateMode.class), any(CursorContext.class))).thenReturn(indexUpdater2);
updaterMap = new IndexUpdaterMap(indexMap, IndexUpdateMode.ONLINE);
}
use of org.neo4j.kernel.api.index.IndexUpdater in project neo4j by neo4j.
the class LuceneIndexAccessorIT method writeRandomThings.
private BitSet writeRandomThings(IndexAccessor index, IndexDescriptor descriptor) throws IndexEntryConflictException {
int rounds = 200;
int updatesPerRound = 200;
BitSet liveEntityIds = new BitSet(rounds * updatesPerRound);
MutableLong highEntityId = new MutableLong();
for (int i = 0; i < rounds; i++) {
try (IndexUpdater updater = index.newUpdater(IndexUpdateMode.RECOVERY, NULL)) {
for (int j = 0; j < updatesPerRound; j++) {
IndexEntryUpdate<?> update = randomUpdate(highEntityId, liveEntityIds, descriptor, random.random());
updater.process(update);
}
}
if (random.nextInt(100) == 0) {
index.force(NULL);
}
}
index.force(NULL);
return liveEntityIds;
}
Aggregations