arjunashok commented on code in PR #17:
URL:
https://github.com/apache/cassandra-analytics/pull/17#discussion_r1420974122
##########
cassandra-analytics-core/src/test/java/org/apache/cassandra/spark/bulkwriter/TokenRangeMappingUtils.java:
##########
@@ -50,13 +51,36 @@ private TokenRangeMappingUtils()
public static TokenRangeMapping<RingInstance> buildTokenRangeMapping(final
int initialToken, final ImmutableMap<String, Integer> rfByDC, int
instancesPerDC)
{
+ return buildTokenRangeMapping(initialToken, rfByDC, instancesPerDC,
false, -1);
+ }
+ public static TokenRangeMapping<RingInstance>
buildTokenRangeMappingWithFailures(int initialToken,
+
ImmutableMap<String, Integer> rfByDC,
+
int instancesPerDC)
+ {
final List<RingInstance> instances = getInstances(initialToken,
rfByDC, instancesPerDC);
+ RingInstance instance = instances.remove(0);
+ RingEntry entry = instance.getRingInstance();
+ RingEntry newEntry = new RingEntry.Builder()
+ .datacenter(entry.datacenter())
+ .port(entry.port())
+ .address(entry.address())
+ .status(InstanceStatus.DOWN.name())
+ .state(entry.state())
+ .token(entry.token())
+ .fqdn(entry.fqdn())
+ .rack(entry.rack())
+ .owns(entry.owns())
+ .load(entry.load())
+ .hostId(entry.hostId())
+ .build();
+ RingInstance newInstance = new RingInstance(newEntry);
+ instances.add(0, newInstance);
ReplicationFactor replicationFactor = getReplicationFactor(rfByDC);
Map<String, Set<String>> writeReplicas =
- instances.stream()
- .collect(Collectors.groupingBy(RingInstance::getDataCenter,
-
Collectors.mapping(RingInstance::getNodeName, Collectors.toSet())));
+
instances.stream().collect(Collectors.groupingBy(RingInstance::getDataCenter,
+
Collectors.mapping(RingInstance::getNodeName,
+
Collectors.toSet())));
Review Comment:
This is a new file though
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]