cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aweisberg <...@git.apache.org>
Subject [GitHub] cassandra pull request #269: Review tr range movements
Date Tue, 18 Sep 2018 18:35:29 GMT
Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/269#discussion_r218547170
  
    --- Diff: src/java/org/apache/cassandra/dht/RangeStreamer.java ---
    @@ -600,39 +628,38 @@ public StreamResultFuture fetchAsync()
                 sources.asMap().forEach((source, fetchReplicas) -> {
     
                     // filter out already streamed ranges
    -                RangesAtEndpoint available = stateStore.getAvailableRanges(keyspace,
StorageService.instance.getTokenMetadata().partitioner);
    +                Pair<Set<Range<Token>>, Set<Range<Token>>>
available = stateStore.getAvailableRanges(keyspace, metadata.partitioner);
     
                     Predicate<FetchReplica> isAvailable = fetch -> {
    -                    Replica availableRange =  available.byRange().get(fetch.local.range());
    -                    if (availableRange == null)
    +                    boolean isInFull = available.left.contains(fetch.local.range());
    +                    boolean isInTrans = available.right.contains(fetch.local.range());
    +
    +                    if (!isInFull && !isInTrans)
                             //Range is unavailable
                             return false;
    +
    +                    assert isInFull != isInTrans : "Range can't be simultaneously full
and transient: " + isInFull + " " + isInTrans;
    +
                         if (fetch.local.isFull())
                             //For full, pick only replicas with matching transientness
    -                        return availableRange.isFull() == fetch.remote.isFull();
    +                        return isInFull == fetch.remote.isFull();
     
                         // Any transient or full will do
                         return true;
                     };
     
                     List<FetchReplica> remaining = fetchReplicas.stream().filter(not(isAvailable)).collect(Collectors.toList());
     
    -                if (remaining.size() < available.size())
    +                if (remaining.size() < available.left.size() + available.right.size())
                     {
                         List<FetchReplica> skipped = fetchReplicas.stream().filter(isAvailable).collect(Collectors.toList());
                         logger.info("Some ranges of {} are already available. Skipping streaming
those ranges. Skipping {}. Fully available {} Transiently available {}",
    -                                fetchReplicas, skipped, available.filter(Replica::isFull).ranges(),
available.filter(Replica::isTransient).ranges());
    +                                fetchReplicas, skipped, available.left, available.right);
                     }
     
                     if (logger.isTraceEnabled())
                         logger.trace("{}ing from {} ranges {}", description, source, StringUtils.join(remaining,
", "));
     
    -                //At the other end the distinction between full and transient is ignored
it just used the transient status
    --- End diff --
    
    Is it clearer with this comment removed?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message