use of org.apache.cassandra.repair.RepairRunnable.NeighborsAndRanges in project cassandra by apache.
the class NeighborsAndRangesTest method forceFilterCommonIncrementalRanges.
@Test
public void forceFilterCommonIncrementalRanges() {
CommonRange cr1 = new CommonRange(Sets.newHashSet(PARTICIPANT1, PARTICIPANT2), Collections.emptySet(), Sets.newHashSet(RANGE1));
CommonRange cr2 = new CommonRange(Sets.newHashSet(PARTICIPANT1, PARTICIPANT2, PARTICIPANT3), Collections.emptySet(), Sets.newHashSet(RANGE3));
CommonRange cr3 = new CommonRange(Sets.newHashSet(PARTICIPANT2, PARTICIPANT3), Collections.emptySet(), Sets.newHashSet(RANGE2));
// PARTICIPANT1 is excluded
Set<InetAddressAndPort> liveEndpoints = Sets.newHashSet(PARTICIPANT2, PARTICIPANT3);
List<CommonRange> initial = Lists.newArrayList(cr1, cr2, cr3);
List<CommonRange> expected = Lists.newArrayList(new CommonRange(Sets.newHashSet(PARTICIPANT2), Collections.emptySet(), Sets.newHashSet(RANGE1), true), new CommonRange(Sets.newHashSet(PARTICIPANT2, PARTICIPANT3), Collections.emptySet(), Sets.newHashSet(RANGE3), true), new CommonRange(Sets.newHashSet(PARTICIPANT2, PARTICIPANT3), Collections.emptySet(), Sets.newHashSet(RANGE2), false));
NeighborsAndRanges nr = new NeighborsAndRanges(true, liveEndpoints, initial);
List<CommonRange> actual = nr.filterCommonRanges(null, null);
Assert.assertEquals(expected, actual);
}
use of org.apache.cassandra.repair.RepairRunnable.NeighborsAndRanges in project cassandra by apache.
the class NeighborsAndRangesTest method filterCommonIncrementalRangesNotForced.
/**
* For non-forced repairs, common ranges should be passed through as-is
*/
@Test
public void filterCommonIncrementalRangesNotForced() {
CommonRange cr = new CommonRange(PARTICIPANTS, Collections.emptySet(), ALL_RANGES);
NeighborsAndRanges nr = new NeighborsAndRanges(false, PARTICIPANTS, Collections.singletonList(cr));
List<CommonRange> expected = Lists.newArrayList(cr);
List<CommonRange> actual = nr.filterCommonRanges(null, null);
Assert.assertEquals(expected, actual);
}
Aggregations