Package com.linkedin.venice.helix
Class VeniceOfflinePushMonitorAccessor
- java.lang.Object
-
- com.linkedin.venice.helix.VeniceOfflinePushMonitorAccessor
-
- All Implemented Interfaces:
OfflinePushAccessor
public class VeniceOfflinePushMonitorAccessor extends java.lang.Object implements OfflinePushAccessor
Venice implementation ofOfflinePushAccessor
. All the statuses would be stored on Zookeeper and this class provides the ways to read/write/create/remove status from ZK.As this class is only an accessor but not a repository so it will not cache anything in local memory. In other words it's stateless and Thread-Safe.
The data structure on ZK would be:
- /OfflinePushes/$topic -> push status for $topic
- /OfflinePushes/$topic/$partitionId -> partition status including all of replicas statuses for $topic and $partitionId.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
OFFLINE_PUSH_SUB_PATH
-
Constructor Summary
Constructors Constructor Description VeniceOfflinePushMonitorAccessor(java.lang.String clusterName, org.apache.helix.manager.zk.ZkBaseDataAccessor<OfflinePushStatus> offlinePushStatusAccessor, org.apache.helix.manager.zk.ZkBaseDataAccessor<PartitionStatus> partitionStatusAccessor)
For testing purpose only.VeniceOfflinePushMonitorAccessor(java.lang.String clusterName, org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer adapter)
VeniceOfflinePushMonitorAccessor(java.lang.String clusterName, org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer adapter, int refreshAttemptsForZkReconnect, long refreshIntervalForZkReconnectInMs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
batchUpdateReplicaIncPushStatus(java.lang.String kafkaTopic, int partitionId, java.lang.String instanceId, long progress, java.util.List<java.lang.String> pendingReportIncPushVersionList)
void
createOfflinePushStatusAndItsPartitionStatuses(OfflinePushStatus pushStatus)
Create offline push and its partition statues on persistent storage.void
deleteOfflinePushStatusAndItsPartitionStatuses(java.lang.String kafkaTopic)
Delete offline push and its partition statuses from persistent storage.java.lang.String
getOfflinePushStatuesParentPath()
org.apache.helix.manager.zk.ZkBaseDataAccessor<OfflinePushStatus>
getOfflinePushStatusAccessor()
For testing only.OfflinePushStatus
getOfflinePushStatusAndItsPartitionStatuses(java.lang.String kafkaTopic)
Read one offline push and its partitions status from persistent storage.java.util.Optional<java.lang.Long>
getOfflinePushStatusCreationTime(java.lang.String kafkaTopic)
Get the creation time of the given offline push ZK path; the creation time is set bySystem.currentTimeMillis()
.protected PartitionStatus
getPartitionStatus(java.lang.String topic, int partitionId)
Get one partition status ZNode from ZK by given topic and partition.protected java.util.List<PartitionStatus>
getPartitionStatuses(java.lang.String topic, int partitionCount)
Get all partition status ZNodes under offline push of given topic from ZK.java.util.List<OfflinePushStatus>
loadOfflinePushStatusesAndPartitionStatuses()
Load entire database of offline pushes including offline pushes statues and their partitions statuses from persistent storage.java.util.List<java.lang.String>
loadOfflinePushStatusPaths()
Load store versions of all existing push statuses on Zookeeper, without actually deserializing the contentsvoid
subscribePartitionStatusChange(OfflinePushStatus pushStatus, PartitionStatusListener listener)
Subscribe the data change of partition status.void
subscribePushStatusCreationChange(org.apache.helix.zookeeper.zkclient.IZkChildListener childListener)
Subscribe a child listener that listens to OfflinePushStatus creation/deleted.void
unsubscribePartitionsStatusChange(OfflinePushStatus pushStatus, PartitionStatusListener listener)
Unsubscribe the data change of partition status.void
unsubscribePartitionsStatusChange(java.lang.String topicName, int partitionCount, PartitionStatusListener listener)
Unsubscribe the data change of partition status.void
unsubscribePushStatusCreationChange(org.apache.helix.zookeeper.zkclient.IZkChildListener childListener)
Unsubscribe a child listenervoid
updateOfflinePushStatus(OfflinePushStatus pushStatus)
Update status of the given offline push to persistent storage.void
updateReplicaStatus(java.lang.String topic, int partitionId, java.lang.String instanceId, ExecutionStatus status, long progress, java.lang.String incrementalPushVersion)
Update one particular replica status and progress by given topic, partition and instanceId to the persistent storage.void
updateReplicaStatus(java.lang.String topic, int partitionId, java.lang.String instanceId, ExecutionStatus status, java.lang.String incrementalPushVersion)
Update one particular replica status only by given topic, partition and instanceId to the persistent storage.
-
-
-
Field Detail
-
OFFLINE_PUSH_SUB_PATH
public static final java.lang.String OFFLINE_PUSH_SUB_PATH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VeniceOfflinePushMonitorAccessor
public VeniceOfflinePushMonitorAccessor(java.lang.String clusterName, org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer adapter)
-
VeniceOfflinePushMonitorAccessor
public VeniceOfflinePushMonitorAccessor(java.lang.String clusterName, org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer adapter, int refreshAttemptsForZkReconnect, long refreshIntervalForZkReconnectInMs)
-
VeniceOfflinePushMonitorAccessor
public VeniceOfflinePushMonitorAccessor(java.lang.String clusterName, org.apache.helix.manager.zk.ZkBaseDataAccessor<OfflinePushStatus> offlinePushStatusAccessor, org.apache.helix.manager.zk.ZkBaseDataAccessor<PartitionStatus> partitionStatusAccessor)
For testing purpose only.
-
-
Method Detail
-
loadOfflinePushStatusesAndPartitionStatuses
public java.util.List<OfflinePushStatus> loadOfflinePushStatusesAndPartitionStatuses()
Description copied from interface:OfflinePushAccessor
Load entire database of offline pushes including offline pushes statues and their partitions statuses from persistent storage.- Specified by:
loadOfflinePushStatusesAndPartitionStatuses
in interfaceOfflinePushAccessor
-
loadOfflinePushStatusPaths
public java.util.List<java.lang.String> loadOfflinePushStatusPaths()
Description copied from interface:OfflinePushAccessor
Load store versions of all existing push statuses on Zookeeper, without actually deserializing the contents- Specified by:
loadOfflinePushStatusPaths
in interfaceOfflinePushAccessor
-
getOfflinePushStatusAndItsPartitionStatuses
public OfflinePushStatus getOfflinePushStatusAndItsPartitionStatuses(java.lang.String kafkaTopic)
Description copied from interface:OfflinePushAccessor
Read one offline push and its partitions status from persistent storage.- Specified by:
getOfflinePushStatusAndItsPartitionStatuses
in interfaceOfflinePushAccessor
-
getOfflinePushStatusCreationTime
public java.util.Optional<java.lang.Long> getOfflinePushStatusCreationTime(java.lang.String kafkaTopic)
Description copied from interface:OfflinePushAccessor
Get the creation time of the given offline push ZK path; the creation time is set bySystem.currentTimeMillis()
. If the path does not exist or error when trying to get creation time, return an empty Optional.- Specified by:
getOfflinePushStatusCreationTime
in interfaceOfflinePushAccessor
-
updateOfflinePushStatus
public void updateOfflinePushStatus(OfflinePushStatus pushStatus)
Description copied from interface:OfflinePushAccessor
Update status of the given offline push to persistent storage.- Specified by:
updateOfflinePushStatus
in interfaceOfflinePushAccessor
-
createOfflinePushStatusAndItsPartitionStatuses
public void createOfflinePushStatusAndItsPartitionStatuses(OfflinePushStatus pushStatus)
Description copied from interface:OfflinePushAccessor
Create offline push and its partition statues on persistent storage.- Specified by:
createOfflinePushStatusAndItsPartitionStatuses
in interfaceOfflinePushAccessor
-
deleteOfflinePushStatusAndItsPartitionStatuses
public void deleteOfflinePushStatusAndItsPartitionStatuses(java.lang.String kafkaTopic)
Description copied from interface:OfflinePushAccessor
Delete offline push and its partition statuses from persistent storage.- Specified by:
deleteOfflinePushStatusAndItsPartitionStatuses
in interfaceOfflinePushAccessor
- Parameters:
kafkaTopic
- version topic
-
updateReplicaStatus
public void updateReplicaStatus(java.lang.String topic, int partitionId, java.lang.String instanceId, ExecutionStatus status, long progress, java.lang.String incrementalPushVersion)
Description copied from interface:OfflinePushAccessor
Update one particular replica status and progress by given topic, partition and instanceId to the persistent storage.- Specified by:
updateReplicaStatus
in interfaceOfflinePushAccessor
-
updateReplicaStatus
public void updateReplicaStatus(java.lang.String topic, int partitionId, java.lang.String instanceId, ExecutionStatus status, java.lang.String incrementalPushVersion)
Description copied from interface:OfflinePushAccessor
Update one particular replica status only by given topic, partition and instanceId to the persistent storage.- Specified by:
updateReplicaStatus
in interfaceOfflinePushAccessor
-
batchUpdateReplicaIncPushStatus
public void batchUpdateReplicaIncPushStatus(java.lang.String kafkaTopic, int partitionId, java.lang.String instanceId, long progress, java.util.List<java.lang.String> pendingReportIncPushVersionList)
- Specified by:
batchUpdateReplicaIncPushStatus
in interfaceOfflinePushAccessor
-
subscribePartitionStatusChange
public void subscribePartitionStatusChange(OfflinePushStatus pushStatus, PartitionStatusListener listener)
Description copied from interface:OfflinePushAccessor
Subscribe the data change of partition status.- Specified by:
subscribePartitionStatusChange
in interfaceOfflinePushAccessor
-
unsubscribePartitionsStatusChange
public void unsubscribePartitionsStatusChange(OfflinePushStatus pushStatus, PartitionStatusListener listener)
Description copied from interface:OfflinePushAccessor
Unsubscribe the data change of partition status.- Specified by:
unsubscribePartitionsStatusChange
in interfaceOfflinePushAccessor
-
unsubscribePartitionsStatusChange
public void unsubscribePartitionsStatusChange(java.lang.String topicName, int partitionCount, PartitionStatusListener listener)
Description copied from interface:OfflinePushAccessor
Unsubscribe the data change of partition status.- Specified by:
unsubscribePartitionsStatusChange
in interfaceOfflinePushAccessor
-
subscribePushStatusCreationChange
public void subscribePushStatusCreationChange(org.apache.helix.zookeeper.zkclient.IZkChildListener childListener)
Description copied from interface:OfflinePushAccessor
Subscribe a child listener that listens to OfflinePushStatus creation/deleted.- Specified by:
subscribePushStatusCreationChange
in interfaceOfflinePushAccessor
-
unsubscribePushStatusCreationChange
public void unsubscribePushStatusCreationChange(org.apache.helix.zookeeper.zkclient.IZkChildListener childListener)
Description copied from interface:OfflinePushAccessor
Unsubscribe a child listener- Specified by:
unsubscribePushStatusCreationChange
in interfaceOfflinePushAccessor
-
getPartitionStatus
protected PartitionStatus getPartitionStatus(java.lang.String topic, int partitionId)
Get one partition status ZNode from ZK by given topic and partition.
-
getPartitionStatuses
protected java.util.List<PartitionStatus> getPartitionStatuses(java.lang.String topic, int partitionCount)
Get all partition status ZNodes under offline push of given topic from ZK. The partition statuses paths for a topic are created in ZK one by one; Helix doesn't guarantee that all the paths are created atomically; therefore, it's possible that a partial list is returned. This function would take cover of all edges cases -- empty response as well as partial response by filling the missing partitions. The returned partition status list is ordered by partition Id.
-
getOfflinePushStatuesParentPath
public final java.lang.String getOfflinePushStatuesParentPath()
-
getOfflinePushStatusAccessor
public org.apache.helix.manager.zk.ZkBaseDataAccessor<OfflinePushStatus> getOfflinePushStatusAccessor()
For testing only.
-
-