Class UndeleteOperationTracker


  • public class UndeleteOperationTracker
    extends java.lang.Object
    An implementation of OperationTracker. 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 for UndeleteOperation. Since an UndeleteOperation 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 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()