public class ReplicaPlans
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ReplicaPlans.Selector |
Modifier and Type | Field and Description |
---|---|
static ReplicaPlans.Selector |
writeAll
Select all nodes, transient or otherwise, as targets for the operation.
|
static ReplicaPlans.Selector |
writeNormal
Select all full nodes, live or down, as write targets.
|
Constructor and Description |
---|
ReplicaPlans() |
Modifier and Type | Method and Description |
---|---|
static java.util.Collection<InetAddressAndPort> |
filterBatchlogEndpoints(java.lang.String localRack,
com.google.common.collect.Multimap<java.lang.String,InetAddressAndPort> endpoints,
java.util.function.Consumer<java.util.List<?>> shuffle,
java.util.function.Predicate<InetAddressAndPort> isAlive,
java.util.function.Function<java.lang.Integer,java.lang.Integer> indexPicker) |
static ReplicaPlan.ForTokenWrite |
forBatchlogWrite(boolean isAny)
Requires that the provided endpoints are alive.
|
static ReplicaPlan.ForTokenWrite |
forForwardingCounterWrite(Keyspace keyspace,
Token token,
Replica replica)
A forwarding counter write is always sent to a single owning coordinator for the range, by the original coordinator
(if it is not itself an owner)
|
static ReplicaPlan.ForTokenWrite |
forLocalBatchlogWrite() |
static ReplicaPlan.ForPaxosWrite |
forPaxos(Keyspace keyspace,
DecoratedKey key,
ConsistencyLevel consistencyForPaxos)
Construct the plan for a paxos round - NOT the write or read consistency level for either the write or comparison,
but for the paxos linearisation agreement.
|
static ReplicaPlan.ForRangeRead |
forRangeRead(Keyspace keyspace,
ConsistencyLevel consistencyLevel,
AbstractBounds<PartitionPosition> range,
int vnodeCount)
Construct a plan for reading the provided range at the provided consistency level.
|
static ReplicaPlan.ForTokenRead |
forRead(Keyspace keyspace,
Token token,
ConsistencyLevel consistencyLevel,
SpeculativeRetryPolicy retry)
Construct a plan for reading the provided token at the provided consistency level.
|
static ReplicaPlan.ForTokenWrite |
forReadRepair(Token token,
ReplicaPlan.ForRead<?> readPlan) |
static ReplicaPlan.ForRangeRead |
forSingleReplicaRead(Keyspace keyspace,
AbstractBounds<PartitionPosition> range,
Replica replica,
int vnodeCount)
Construct a plan for reading from a single node - this permits no speculation or read-repair
|
static ReplicaPlan.ForTokenRead |
forSingleReplicaRead(Keyspace keyspace,
Token token,
Replica replica)
Construct a plan for reading from a single node - this permits no speculation or read-repair
|
static ReplicaPlan.ForTokenWrite |
forSingleReplicaWrite(Keyspace keyspace,
Token token,
Replica replica)
Construct a ReplicaPlan for writing to exactly one node, with CL.ONE.
|
static ReplicaPlan.ForTokenWrite |
forWrite(Keyspace keyspace,
ConsistencyLevel consistencyLevel,
EndpointsForToken natural,
EndpointsForToken pending,
java.util.function.Predicate<Replica> isAlive,
ReplicaPlans.Selector selector) |
static ReplicaPlan.ForTokenWrite |
forWrite(Keyspace keyspace,
ConsistencyLevel consistencyLevel,
ReplicaLayout.ForTokenWrite liveAndDown,
java.util.function.Predicate<Replica> isAlive,
ReplicaPlans.Selector selector) |
static ReplicaPlan.ForTokenWrite |
forWrite(Keyspace keyspace,
ConsistencyLevel consistencyLevel,
ReplicaLayout.ForTokenWrite liveAndDown,
ReplicaLayout.ForTokenWrite live,
ReplicaPlans.Selector selector) |
static ReplicaPlan.ForTokenWrite |
forWrite(Keyspace keyspace,
ConsistencyLevel consistencyLevel,
ReplicaLayout.ForTokenWrite liveAndDown,
ReplicaPlans.Selector selector) |
static ReplicaPlan.ForTokenWrite |
forWrite(Keyspace keyspace,
ConsistencyLevel consistencyLevel,
Token token,
ReplicaPlans.Selector selector) |
static boolean |
isSufficientLiveReplicasForRead(Keyspace keyspace,
ConsistencyLevel consistencyLevel,
Endpoints<?> liveReplicas) |
static ReplicaPlan.ForRangeRead |
maybeMerge(Keyspace keyspace,
ConsistencyLevel consistencyLevel,
ReplicaPlan.ForRangeRead left,
ReplicaPlan.ForRangeRead right)
Take two range read plans for adjacent ranges, and check if it is OK (and worthwhile) to combine them into a single plan
|
static ReplicaPlans.Selector |
writeReadRepair(ReplicaPlan.ForRead<?> readPlan)
TODO: Transient Replication C-14404/C-14665
TODO: We employ this even when there is no monotonicity to guarantee,
e.g.
|
public static final ReplicaPlans.Selector writeAll
public static final ReplicaPlans.Selector writeNormal
public static boolean isSufficientLiveReplicasForRead(Keyspace keyspace, ConsistencyLevel consistencyLevel, Endpoints<?> liveReplicas)
public static ReplicaPlan.ForTokenWrite forSingleReplicaWrite(Keyspace keyspace, Token token, Replica replica)
public static ReplicaPlan.ForTokenWrite forForwardingCounterWrite(Keyspace keyspace, Token token, Replica replica)
public static ReplicaPlan.ForTokenWrite forLocalBatchlogWrite()
public static ReplicaPlan.ForTokenWrite forBatchlogWrite(boolean isAny) throws UnavailableException
isAny
- if batch consistency level is ANY, in which case a local node will be pickedUnavailableException
public static java.util.Collection<InetAddressAndPort> filterBatchlogEndpoints(java.lang.String localRack, com.google.common.collect.Multimap<java.lang.String,InetAddressAndPort> endpoints, java.util.function.Consumer<java.util.List<?>> shuffle, java.util.function.Predicate<InetAddressAndPort> isAlive, java.util.function.Function<java.lang.Integer,java.lang.Integer> indexPicker)
public static ReplicaPlan.ForTokenWrite forReadRepair(Token token, ReplicaPlan.ForRead<?> readPlan) throws UnavailableException
UnavailableException
public static ReplicaPlan.ForTokenWrite forWrite(Keyspace keyspace, ConsistencyLevel consistencyLevel, Token token, ReplicaPlans.Selector selector) throws UnavailableException
UnavailableException
public static ReplicaPlan.ForTokenWrite forWrite(Keyspace keyspace, ConsistencyLevel consistencyLevel, EndpointsForToken natural, EndpointsForToken pending, java.util.function.Predicate<Replica> isAlive, ReplicaPlans.Selector selector) throws UnavailableException
UnavailableException
public static ReplicaPlan.ForTokenWrite forWrite(Keyspace keyspace, ConsistencyLevel consistencyLevel, ReplicaLayout.ForTokenWrite liveAndDown, ReplicaPlans.Selector selector) throws UnavailableException
UnavailableException
public static ReplicaPlan.ForTokenWrite forWrite(Keyspace keyspace, ConsistencyLevel consistencyLevel, ReplicaLayout.ForTokenWrite liveAndDown, java.util.function.Predicate<Replica> isAlive, ReplicaPlans.Selector selector) throws UnavailableException
UnavailableException
public static ReplicaPlan.ForTokenWrite forWrite(Keyspace keyspace, ConsistencyLevel consistencyLevel, ReplicaLayout.ForTokenWrite liveAndDown, ReplicaLayout.ForTokenWrite live, ReplicaPlans.Selector selector) throws UnavailableException
UnavailableException
public static ReplicaPlans.Selector writeReadRepair(ReplicaPlan.ForRead<?> readPlan)
public static ReplicaPlan.ForPaxosWrite forPaxos(Keyspace keyspace, DecoratedKey key, ConsistencyLevel consistencyForPaxos) throws UnavailableException
UnavailableException
public static ReplicaPlan.ForTokenRead forSingleReplicaRead(Keyspace keyspace, Token token, Replica replica)
public static ReplicaPlan.ForRangeRead forSingleReplicaRead(Keyspace keyspace, AbstractBounds<PartitionPosition> range, Replica replica, int vnodeCount)
public static ReplicaPlan.ForTokenRead forRead(Keyspace keyspace, Token token, ConsistencyLevel consistencyLevel, SpeculativeRetryPolicy retry)
public static ReplicaPlan.ForRangeRead forRangeRead(Keyspace keyspace, ConsistencyLevel consistencyLevel, AbstractBounds<PartitionPosition> range, int vnodeCount)
public static ReplicaPlan.ForRangeRead maybeMerge(Keyspace keyspace, ConsistencyLevel consistencyLevel, ReplicaPlan.ForRangeRead left, ReplicaPlan.ForRangeRead right)
Copyright © 2009-2020 The Apache Software Foundation