Class OfflinePushStatus


  • public class OfflinePushStatus
    extends java.lang.Object
    Class stores all the statuses and history of one offline push.
    • Field Detail

      • HELIX_RESOURCE_NOT_CREATED

        public static final java.lang.String HELIX_RESOURCE_NOT_CREATED
        See Also:
        Constant Field Values
      • HELIX_ASSIGNMENT_COMPLETED

        public static final java.lang.String HELIX_ASSIGNMENT_COMPLETED
        See Also:
        Constant Field Values
    • Constructor Detail

      • OfflinePushStatus

        public OfflinePushStatus​(java.lang.String kafkaTopic,
                                 int numberOfPartition,
                                 int replicationFactor,
                                 OfflinePushStrategy strategy)
    • Method Detail

      • updateStatus

        public void updateStatus​(ExecutionStatus newStatus,
                                 java.util.Optional<java.lang.String> newStatusDetails)
      • getStartTimeSec

        protected long getStartTimeSec()
      • validatePushStatusTransition

        public boolean validatePushStatusTransition​(ExecutionStatus newStatus)
        Judge whether current status could be transferred to the new status.

        Push's state machine:

        • NOT_STARTED->STARTED
        • NOT_STARTED->ERROR
        • STARTED->STARTED
        • STARTED->COMPLETED
        • STARTED->ERROR
        • STARTED->END_OF_PUSH_RECEIVED
        • END_OF_PUSH_RECEIVED->COMPLETED
        • END_OF_PUSH_RECEIVED->ERROR
        • COMPLETED->ARCHIVED
        • ERROR->ARCHIVED
        Parameters:
        newStatus -
        Returns:
      • setPartitionStatus

        public void setPartitionStatus​(PartitionStatus partitionStatus)
      • setPartitionStatus

        public void setPartitionStatus​(PartitionStatus partitionStatus,
                                       boolean updateDetails)
      • getIncrementalPushStatus

        public java.util.Map<java.lang.Integer,​java.util.Map<java.lang.CharSequence,​java.lang.Integer>> getIncrementalPushStatus​(PartitionAssignment partitionAssignment,
                                                                                                                                             java.lang.String incrementalPushVersion)
        Returns map of partitionId -> list of status history for all working replicas of that partition
      • getLatestIncrementalPushVersion

        public java.lang.String getLatestIncrementalPushVersion​(PartitionAssignment partitionAssignment)
      • hasFatalDataValidationError

        public boolean hasFatalDataValidationError()
      • getKafkaTopic

        public java.lang.String getKafkaTopic()
      • getNumberOfPartition

        public int getNumberOfPartition()
      • getReplicationFactor

        public int getReplicationFactor()
      • setCurrentStatus

        public void setCurrentStatus​(ExecutionStatus currentStatus)
      • getOptionalStatusDetails

        public java.util.Optional<java.lang.String> getOptionalStatusDetails()
      • getStatusDetails

        public java.lang.String getStatusDetails()
        Necessary for the JSON serde
      • setStatusDetails

        public void setStatusDetails​(java.lang.String statusDetails)
        Necessary for the JSON serde
      • getStatusHistory

        public java.util.List<StatusSnapshot> getStatusHistory()
      • setStatusHistory

        public void setStatusHistory​(java.util.List<StatusSnapshot> statusHistory)
      • setPartitionStatuses

        public void setPartitionStatuses​(java.util.List<PartitionStatus> partitionStatuses)
      • getIncrementalPushVersion

        public java.lang.String getIncrementalPushVersion()
      • setIncrementalPushVersion

        public void setIncrementalPushVersion​(java.lang.String incrementalPushVersion)
      • getSuccessfulPushDurationInSecs

        public long getSuccessfulPushDurationInSecs()
      • setSuccessfulPushDurationInSecs

        public void setSuccessfulPushDurationInSecs​(long successfulPushDurationInSecs)
      • getProgress

        public java.util.Map<java.lang.String,​java.lang.Long> getProgress()
        Returns:
        a map which's id is replica id and value is the offset that replica already consumed.
      • getPartitionStatuses

        public java.util.Collection<PartitionStatus> getPartitionStatuses()
      • getPartitionStatus

        public PartitionStatus getPartitionStatus​(int partitionId)
      • isReadyToStartBufferReplay

        public boolean isReadyToStartBufferReplay​(boolean isDataRecovery)
        Checks whether at least one replica of each partition has returned ExecutionStatus.END_OF_PUSH_RECEIVED This is intended for OfflinePushStatus instances which belong to Hybrid Stores, though there should be no negative side-effects if called on an instance tied to a non-hybrid store, as the logic should consistently return false in that case.
        Returns:
        true if at least one replica of each partition has consumed an EOP control message, false otherwise
      • getPushProperties

        public java.util.Map<java.lang.String,​java.lang.String> getPushProperties()
      • setPushProperties

        public void setPushProperties​(java.util.Map<java.lang.String,​java.lang.String> pushProperties)
      • getStatusUpdateTimestamp

        public java.lang.Long getStatusUpdateTimestamp()
        Returns:
        the UNIX Epoch time corresponding to the earliest time in which getStatusHistory() contained an ExecutionStatus equal to the getCurrentStatus(), or null if not available.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object