Github user aweisberg commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/269#discussion_r219278572
--- Diff: src/java/org/apache/cassandra/dht/RangeStreamer.java ---
@@ -446,16 +447,14 @@ else if (useStrictConsistency)
//The old behavior where we might be asked to
fetch ranges we don't need shouldn't occur anymore.
//So it's an error if we don't find what we need.
if (oldEndpoints.isEmpty() &&
toFetch.isTransient())
- {
throw new AssertionError("If there are no
endpoints to fetch from then we must be transitioning from transient to full
for range " + toFetch);
- }
- if (!any(oldEndpoints, isSufficient))
+ if (toFetch.isFull() && (oldEndpoints.isEmpty()
|| oldEndpoints.get(0).isTransient()))
{
// need an additional replica
EndpointsForRange endpointsForRange =
sorted.apply(rangeAddresses.get(range));
// include all our filters, to ensure we
include a matching node
- Optional<Replica> fullReplica =
Iterables.<Replica>tryFind(endpointsForRange, and(isSufficient,
testSourceFilters)).toJavaUtil();
+ Optional<Replica> fullReplica =
Iterables.<Replica>tryFind(endpointsForRange, and(Replica::isFull,
testSourceFilters)).toJavaUtil();
--- End diff --
Sure you can switch to using Replica::isFull, but isSufficient is still
logically what we are looking for it just happens to be that nested this deep
we have already eliminated part of the expression. I don't think this makes it
clearer and it pairs nicely if you use isSufficient above.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]