Class RangeRelocator

java.lang.Object
org.apache.cassandra.service.RangeRelocator

public class RangeRelocator extends Object
  • Constructor Details

    • RangeRelocator

      public RangeRelocator()
  • Method Details

    • calculateRangesToStreamWithEndpoints

      public static RangesByEndpoint calculateRangesToStreamWithEndpoints(RangesAtEndpoint streamRanges, AbstractReplicationStrategy strat, TokenMetadata tmdBefore, TokenMetadata tmdAfter)
      calculating endpoints to stream current ranges to if needed in some situations node will handle current ranges as part of the new ranges
    • 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 Future<StreamState> stream()
    • streamsNeeded

      public boolean streamsNeeded()