Package org.apache.cassandra.dht
Class RangeStreamer
- java.lang.Object
-
- org.apache.cassandra.dht.RangeStreamer
-
public class RangeStreamer extends java.lang.ObjectAssists in streaming ranges to this node.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRangeStreamer.AllowedSourcesFilterSource filter which only includes endpoints contained within a provided set.static classRangeStreamer.ExcludeLocalNodeFilterSource filter which excludes the current node from source calculationsstatic classRangeStreamer.FailureDetectorSourceFilterSource filter which excludes any endpoints that are not alive according to a failure detector.static classRangeStreamer.FetchReplicastatic classRangeStreamer.SingleDatacenterFilterSource filter which excludes any endpoints that are not in a specific data center.static interfaceRangeStreamer.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 voidaddRanges(java.lang.String keyspaceName, ReplicaCollection<?> replicas)Add ranges to be streamed for given keyspace.voidaddSourceFilter(RangeStreamer.SourceFilter filter)static EndpointsByReplicacalculateRangesToFetchWithPreferredEndpoints(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.StreamResultFuturefetchAsync()
-
-
-
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()
-
-