Package com.github.ambry.router
Class UndeleteOperationTracker
- java.lang.Object
-
- com.github.ambry.router.UndeleteOperationTracker
-
public class UndeleteOperationTracker extends java.lang.Object
An implementation ofOperationTracker
. It internally maintains the status of a corresponding operation, and returns information that decides if the operation should continue or terminate. This OperationTracker only works forUndeleteOperation
. Since anUndeleteOperation
requires a global quorum for success, a map of datacenter to number of success requests is used to keep track of how many success requests tracker has seen in each datacenter. Once it reaches quorum in all the datacenter, it returns true for success. Or if any datacenter see failure requests reach the quorum, it return true for failure.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
cloudReplicaInPoolOrFlightCount
protected int
cloudReplicaParallelism
protected boolean
cloudReplicasPresent
protected int
cloudReplicaSuccessCount
protected int
cloudReplicaSuccessTarget
protected java.lang.String
datacenterName
protected int
disabledCount
protected int
diskDownCount
protected int
diskReplicaInPoolOrFlightCount
protected int
diskReplicaParallelism
protected boolean
diskReplicasPresent
protected int
diskReplicaSuccessCount
protected int
diskReplicaSuccessTarget
protected int
failedCount
protected int
inflightCount
protected com.github.ambry.clustermap.ReplicaType
inFlightReplicaType
protected com.github.ambry.clustermap.ReplicaId
lastReturnedByIterator
protected java.lang.String
originatingDcName
protected int
originatingDcNotFoundCount
protected int
originatingDcNotFoundFailureThreshold
protected java.util.LinkedList<com.github.ambry.clustermap.ReplicaId>
replicaPool
protected int
totalNotFoundCount
protected int
totalReplicaCount
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<com.github.ambry.clustermap.ReplicaId>
getReplicaIterator()
boolean
hasFailed()
boolean
hasFailedOnNotFound()
boolean
hasSucceeded()
The dynamic success target is introduced mainly for following use case: In the intermediate state of "move replica", when decommission of old replicas is initiated(but hasn't transited to INACTIVE yet), the PUT requests should be rejected on old replicas.boolean
isDone()
void
onResponse(com.github.ambry.clustermap.ReplicaId replicaId, TrackedRequestFinalState trackedRequestFinalState)
-
-
-
Field Detail
-
datacenterName
protected final java.lang.String datacenterName
-
originatingDcName
protected final java.lang.String originatingDcName
-
diskReplicaSuccessTarget
protected final int diskReplicaSuccessTarget
-
diskReplicaParallelism
protected final int diskReplicaParallelism
-
cloudReplicaSuccessTarget
protected final int cloudReplicaSuccessTarget
-
cloudReplicaParallelism
protected final int cloudReplicaParallelism
-
cloudReplicasPresent
protected final boolean cloudReplicasPresent
-
diskReplicasPresent
protected final boolean diskReplicasPresent
-
originatingDcNotFoundFailureThreshold
protected final int originatingDcNotFoundFailureThreshold
-
totalReplicaCount
protected final int totalReplicaCount
-
replicaPool
protected final java.util.LinkedList<com.github.ambry.clustermap.ReplicaId> replicaPool
-
inflightCount
protected int inflightCount
-
diskReplicaSuccessCount
protected int diskReplicaSuccessCount
-
cloudReplicaSuccessCount
protected int cloudReplicaSuccessCount
-
diskReplicaInPoolOrFlightCount
protected int diskReplicaInPoolOrFlightCount
-
cloudReplicaInPoolOrFlightCount
protected int cloudReplicaInPoolOrFlightCount
-
failedCount
protected int failedCount
-
disabledCount
protected int disabledCount
-
originatingDcNotFoundCount
protected int originatingDcNotFoundCount
-
totalNotFoundCount
protected int totalNotFoundCount
-
diskDownCount
protected int diskDownCount
-
lastReturnedByIterator
protected com.github.ambry.clustermap.ReplicaId lastReturnedByIterator
-
inFlightReplicaType
protected com.github.ambry.clustermap.ReplicaType inFlightReplicaType
-
-
Method Detail
-
onResponse
public void onResponse(com.github.ambry.clustermap.ReplicaId replicaId, TrackedRequestFinalState trackedRequestFinalState)
-
hasSucceeded
public boolean hasSucceeded()
The dynamic success target is introduced mainly for following use case: In the intermediate state of "move replica", when decommission of old replicas is initiated(but hasn't transited to INACTIVE yet), the PUT requests should be rejected on old replicas. For frontends, they are seeing both old and new replicas(lets say 3 old and 3 new) and the success target should be 6 - 1 = 5. In the aforementioned scenario, PUT request failed on 3 old replicas. It seems we should fail whole PUT operation because number of remaining requests is already less than success target. From another point of view, however, PUT request is highly likely to succeed on 3 new replicas and we actually could consider it success without generating "slip put" (which makes PUT latency worse). The reason is, if new PUTs already succeeded on at least 2 new replicas, read-after-write should always succeed because frontends are always able to see new replicas and subsequent READ/DELETE/TtlUpdate request should succeed on at least 2 aforementioned new replicas.
-
hasFailed
public boolean hasFailed()
-
hasFailedOnNotFound
public boolean hasFailedOnNotFound()
-
isDone
public boolean isDone()
-
getReplicaIterator
public java.util.Iterator<com.github.ambry.clustermap.ReplicaId> getReplicaIterator()
-
-