Package org.apache.cassandra.dht
Class RangeStreamer
- java.lang.Object
-
- org.apache.cassandra.dht.RangeStreamer
-
public class RangeStreamer extends java.lang.Object
Assists in streaming ranges to this node.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RangeStreamer.AllowedSourcesFilter
Source filter which only includes endpoints contained within a provided set.static class
RangeStreamer.ExcludeLocalDatacenterFilter
Source filter which excludes nodes from local DC.static class
RangeStreamer.ExcludeLocalNodeFilter
Source filter which excludes the current node from source calculationsstatic class
RangeStreamer.FailureDetectorSourceFilter
Source filter which excludes any endpoints that are not alive according to a failure detector.static class
RangeStreamer.FetchReplica
static class
RangeStreamer.SingleDatacenterFilter
Source filter which excludes any endpoints that are not in a specific data center.static interface
RangeStreamer.SourceFilter
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.base.Predicate<Replica>
ALIVE_PREDICATE
-
Constructor Summary
Constructors Constructor Description RangeStreamer(TokenMetadata metadata, java.util.Collection<Token> tokens, InetAddressAndPort address, StreamOperation streamOperation, boolean useStrictConsistency, IEndpointSnitch snitch, StreamStateStore stateStore, boolean connectSequentially, int connectionsPerHost)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRanges(java.lang.String keyspaceName, ReplicaCollection<?> replicas)
Add ranges to be streamed for given keyspace.void
addSourceFilter(RangeStreamer.SourceFilter filter)
static EndpointsByReplica
calculateRangesToFetchWithPreferredEndpoints(java.util.function.BiFunction<InetAddressAndPort,EndpointsForRange,EndpointsForRange> snitchGetSortedListByProximity, AbstractReplicationStrategy strat, ReplicaCollection<?> fetchRanges, boolean useStrictConsistency, TokenMetadata tmdBefore, TokenMetadata tmdAfter, java.lang.String keyspace, java.util.Collection<RangeStreamer.SourceFilter> sourceFilters)
Get a map of all ranges and the source that will be cleaned up once this bootstrapped node is added for the given ranges.static com.google.common.collect.Multimap<InetAddressAndPort,RangeStreamer.FetchReplica>
convertPreferredEndpointsToWorkMap(EndpointsByReplica preferredEndpoints)
The preferred endpoint list is the wrong format because it is keyed by Replica (this node) rather than the source endpoint we will fetch from which streaming wants.StreamResultFuture
fetchAsync()
-
-
-
Field Detail
-
ALIVE_PREDICATE
public static com.google.common.base.Predicate<Replica> ALIVE_PREDICATE
-
-
Constructor Detail
-
RangeStreamer
public RangeStreamer(TokenMetadata metadata, java.util.Collection<Token> tokens, InetAddressAndPort address, StreamOperation streamOperation, boolean useStrictConsistency, IEndpointSnitch snitch, StreamStateStore stateStore, boolean connectSequentially, int connectionsPerHost)
-
-
Method Detail
-
addSourceFilter
public void addSourceFilter(RangeStreamer.SourceFilter filter)
-
addRanges
public void addRanges(java.lang.String keyspaceName, ReplicaCollection<?> replicas)
Add ranges to be streamed for given keyspace.- Parameters:
keyspaceName
- keyspace namereplicas
- ranges to be streamed
-
calculateRangesToFetchWithPreferredEndpoints
public static EndpointsByReplica calculateRangesToFetchWithPreferredEndpoints(java.util.function.BiFunction<InetAddressAndPort,EndpointsForRange,EndpointsForRange> snitchGetSortedListByProximity, AbstractReplicationStrategy strat, ReplicaCollection<?> fetchRanges, boolean useStrictConsistency, TokenMetadata tmdBefore, TokenMetadata tmdAfter, java.lang.String keyspace, java.util.Collection<RangeStreamer.SourceFilter> sourceFilters)
Get a map of all ranges and the source that will be cleaned up once this bootstrapped node is added for the given ranges. For each range, the list should only contain a single source. This allows us to consistently migrate data without violating consistency.
-
convertPreferredEndpointsToWorkMap
public static com.google.common.collect.Multimap<InetAddressAndPort,RangeStreamer.FetchReplica> convertPreferredEndpointsToWorkMap(EndpointsByReplica preferredEndpoints)
The preferred endpoint list is the wrong format because it is keyed by Replica (this node) rather than the source endpoint we will fetch from which streaming wants.
-
fetchAsync
public StreamResultFuture fetchAsync()
-
-