Package com.linkedin.venice.pushmonitor
Class OfflinePushStatus
- java.lang.Object
-
- com.linkedin.venice.pushmonitor.OfflinePushStatus
-
public class OfflinePushStatus extends java.lang.Object
Class stores all the statuses and history of one offline push.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HELIX_ASSIGNMENT_COMPLETED
static java.lang.String
HELIX_RESOURCE_NOT_CREATED
-
Constructor Summary
Constructors Constructor Description OfflinePushStatus(java.lang.String kafkaTopic, int numberOfPartition, int replicationFactor, OfflinePushStrategy strategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OfflinePushStatus
clonePushStatus()
boolean
equals(java.lang.Object o)
ExecutionStatus
getCurrentStatus()
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 partitionjava.lang.String
getIncrementalPushVersion()
java.lang.String
getKafkaTopic()
java.lang.String
getLatestIncrementalPushVersion(PartitionAssignment partitionAssignment)
int
getNumberOfPartition()
java.util.Optional<java.lang.String>
getOptionalStatusDetails()
PartitionStatus
getPartitionStatus(int partitionId)
java.util.Collection<PartitionStatus>
getPartitionStatuses()
java.util.Map<java.lang.String,java.lang.Long>
getProgress()
java.util.Map<java.lang.String,java.lang.String>
getPushProperties()
int
getReplicationFactor()
protected long
getStartTimeSec()
java.lang.String
getStatusDetails()
Necessary for the JSON serdejava.util.List<StatusSnapshot>
getStatusHistory()
java.lang.Long
getStatusUpdateTimestamp()
OfflinePushStrategy
getStrategy()
long
getSuccessfulPushDurationInSecs()
boolean
hasFatalDataValidationError()
int
hashCode()
boolean
isReadyToStartBufferReplay(boolean isDataRecovery)
Checks whether at least one replica of each partition has returnedExecutionStatus.END_OF_PUSH_RECEIVED
This is intended forOfflinePushStatus
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.void
setCurrentStatus(ExecutionStatus currentStatus)
void
setIncrementalPushVersion(java.lang.String incrementalPushVersion)
void
setPartitionStatus(PartitionStatus partitionStatus)
void
setPartitionStatus(PartitionStatus partitionStatus, boolean updateDetails)
void
setPartitionStatuses(java.util.List<PartitionStatus> partitionStatuses)
void
setPushProperties(java.util.Map<java.lang.String,java.lang.String> pushProperties)
void
setStatusDetails(java.lang.String statusDetails)
Necessary for the JSON serdevoid
setStatusHistory(java.util.List<StatusSnapshot> statusHistory)
void
setSuccessfulPushDurationInSecs(long successfulPushDurationInSecs)
java.lang.String
toString()
void
updateStatus(ExecutionStatus newStatus)
void
updateStatus(ExecutionStatus newStatus, java.util.Optional<java.lang.String> newStatusDetails)
boolean
validatePushStatusTransition(ExecutionStatus newStatus)
Judge whether current status could be transferred to the new status.
-
-
-
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)
-
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()
-
getStrategy
public OfflinePushStrategy getStrategy()
-
getCurrentStatus
public ExecutionStatus getCurrentStatus()
-
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)
-
clonePushStatus
public OfflinePushStatus clonePushStatus()
-
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 returnedExecutionStatus.END_OF_PUSH_RECEIVED
This is intended forOfflinePushStatus
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 anExecutionStatus
equal to thegetCurrentStatus()
, or null if not available.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-