Class RangeRelocator


  • public class RangeRelocator
    extends java.lang.Object
    • Constructor Detail

      • RangeRelocator

        public RangeRelocator()
    • Method Detail

      • calculateToFromStreams

        public void calculateToFromStreams()
      • calculateStreamAndFetchRanges

        public static Pair<RangesAtEndpoint,​RangesAtEndpoint> calculateStreamAndFetchRanges​(RangesAtEndpoint currentRanges,
                                                                                                  RangesAtEndpoint updatedRanges)
        Calculate pair of ranges to stream/fetch for given two range collections (current ranges for keyspace and ranges after move to new token) With transient replication the added wrinkle is that if a range transitions from full to transient then we need to stream the range despite the fact that we are retaining it as transient. Some replica somewhere needs to transition from transient to full and we will be the source. If the range is transient and is transitioning to full then always fetch even if the range was already transient since a transiently replicated obviously needs to fetch data to become full. This why there is a continue after checking for instersection because intersection is not sufficient reason to do the subtraction since we might need to stream/fetch data anyways.
        Parameters:
        currentRanges - collection of the ranges by current token
        updatedRanges - collection of the ranges after token is changed
        Returns:
        pair of ranges to stream/fetch for given current and updated range collections
      • stream

        public java.util.concurrent.Future<StreamState> stream()
      • streamsNeeded

        public boolean streamsNeeded()