Github user aweisberg commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/269#discussion_r220336800
--- Diff: src/java/org/apache/cassandra/dht/RangeStreamer.java ---
@@ -424,62 +440,58 @@ else if (useStrictConsistency)
EndpointsForRange sources;
if (useStrictConsistency)
{
- //Start with two sets of who replicates the range
before and who replicates it after
- EndpointsForRange newEndpoints =
strat.calculateNaturalReplicas(toFetch.range().right, tmdAfter);
- logger.debug("Old endpoints {}", oldEndpoints);
- logger.debug("New endpoints {}", newEndpoints);
-
+ EndpointsForRange strictEndpoints;
//Due to CASSANDRA-5953 we can have a higher RF then
we have endpoints.
//So we need to be careful to only be strict when
endpoints == RF
if (oldEndpoints.size() ==
strat.getReplicationFactor().allReplicas)
{
- Set<InetAddressAndPort> endpointsStillReplicated
= newEndpoints.endpoints();
+ //Start with two sets of who replicates the range
before and who replicates it after
+ EndpointsForRange newEndpoints =
strat.calculateNaturalReplicas(toFetch.range().right, tmdAfter);
+ logger.debug("Old endpoints {}", oldEndpoints);
+ logger.debug("New endpoints {}", newEndpoints);
+
// Remove new endpoints from old endpoints based
on address
- oldEndpoints = oldEndpoints.filter(r ->
!endpointsStillReplicated.contains(r.endpoint()));
- oldEndpoints.filter(testSourceFilters);
+ strictEndpoints =
oldEndpoints.without(newEndpoints.endpoints());
- if (oldEndpoints.size() > 1)
- throw new AssertionError("Expected <= 1
endpoint but found " + oldEndpoints);
+ //We have to check the source filters here to see
if they will remove any replicas
+ //required for strict consistency
+ if (!all(strictEndpoints, testSourceFilters))
+ throw new IllegalStateException("Necessary
replicas for strict consistency were removed by source filters: " +
buildErrorMessage(sourceFilters, strictEndpoints));
+
+ if (strictEndpoints.size() > 1)
--- End diff --
This no longer asserts what it did before if you are filtering before we
get to this assertion.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]