Package com.linkedin.venice.helix
Class VeniceOfflinePushMonitorAccessor
java.lang.Object
com.linkedin.venice.helix.VeniceOfflinePushMonitorAccessor
- All Implemented Interfaces:
OfflinePushAccessor
Venice implementation of
OfflinePushAccessor. 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 -
Constructor Summary
ConstructorsConstructorDescriptionVeniceOfflinePushMonitorAccessor(String clusterName, org.apache.helix.manager.zk.ZkBaseDataAccessor<OfflinePushStatus> offlinePushStatusAccessor, org.apache.helix.manager.zk.ZkBaseDataAccessor<PartitionStatus> partitionStatusAccessor, LogContext logContext) For testing purpose only.VeniceOfflinePushMonitorAccessor(String clusterName, org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer adapter, LogContext logContext, int refreshAttemptsForZkReconnect) -
Method Summary
Modifier and TypeMethodDescriptionvoidbatchUpdateReplicaIncPushStatus(String kafkaTopic, int partitionId, String instanceId, List<String> pendingReportIncPushVersionList) voidCreate offline push and its partition statues on persistent storage.voiddeleteOfflinePushStatusAndItsPartitionStatuses(String kafkaTopic) Delete offline push and its partition statuses from persistent storage.final Stringorg.apache.helix.manager.zk.ZkBaseDataAccessor<OfflinePushStatus>For testing only.getOfflinePushStatusAndItsPartitionStatuses(String kafkaTopic) Read one offline push and its partitions status from persistent storage.getOfflinePushStatusCreationTime(String kafkaTopic) Get the creation time of the given offline push ZK path; the creation time is set bySystem.currentTimeMillis().protected PartitionStatusgetPartitionStatus(String topic, int partitionId) Get one partition status ZNode from ZK by given topic and partition.protected List<PartitionStatus>getPartitionStatuses(String topic, int partitionCount) Get all partition status ZNodes under offline push of given topic from ZK.Load entire database of offline pushes including offline pushes statues and their partitions statuses from persistent storage.Load store versions of all existing push statuses on Zookeeper, without actually deserializing the contentsvoidsubscribePartitionStatusChange(OfflinePushStatus pushStatus, PartitionStatusListener listener) Subscribe the data change of partition status.voidsubscribePushStatusCreationChange(org.apache.helix.zookeeper.zkclient.IZkChildListener childListener) Subscribe a child listener that listens to OfflinePushStatus creation/deleted.voidunsubscribePartitionsStatusChange(OfflinePushStatus pushStatus, PartitionStatusListener listener) Unsubscribe the data change of partition status.voidunsubscribePartitionsStatusChange(String topicName, int partitionCount, PartitionStatusListener listener) Unsubscribe the data change of partition status.voidunsubscribePushStatusCreationChange(org.apache.helix.zookeeper.zkclient.IZkChildListener childListener) Unsubscribe a child listenervoidupdateOfflinePushStatus(OfflinePushStatus pushStatus) Update status of the given offline push to persistent storage.voidupdateReplicaStatus(String topic, int partitionId, String instanceId, ExecutionStatus status, String incrementalPushVersion) Update one particular replica status by given topic, partition and instanceId to the persistent storage.
-
Field Details
-
OFFLINE_PUSH_SUB_PATH
- See Also:
-
-
Constructor Details
-
VeniceOfflinePushMonitorAccessor
public VeniceOfflinePushMonitorAccessor(String clusterName, org.apache.helix.zookeeper.impl.client.ZkClient zkClient, HelixAdapterSerializer adapter, LogContext logContext, int refreshAttemptsForZkReconnect) -
VeniceOfflinePushMonitorAccessor
public VeniceOfflinePushMonitorAccessor(String clusterName, org.apache.helix.manager.zk.ZkBaseDataAccessor<OfflinePushStatus> offlinePushStatusAccessor, org.apache.helix.manager.zk.ZkBaseDataAccessor<PartitionStatus> partitionStatusAccessor, LogContext logContext) For testing purpose only.
-
-
Method Details
-
loadOfflinePushStatusesAndPartitionStatuses
Description copied from interface:OfflinePushAccessorLoad entire database of offline pushes including offline pushes statues and their partitions statuses from persistent storage.- Specified by:
loadOfflinePushStatusesAndPartitionStatusesin interfaceOfflinePushAccessor
-
loadOfflinePushStatusPaths
Description copied from interface:OfflinePushAccessorLoad store versions of all existing push statuses on Zookeeper, without actually deserializing the contents- Specified by:
loadOfflinePushStatusPathsin interfaceOfflinePushAccessor
-
getOfflinePushStatusAndItsPartitionStatuses
Description copied from interface:OfflinePushAccessorRead one offline push and its partitions status from persistent storage.- Specified by:
getOfflinePushStatusAndItsPartitionStatusesin interfaceOfflinePushAccessor
-
getOfflinePushStatusCreationTime
Description copied from interface:OfflinePushAccessorGet 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:
getOfflinePushStatusCreationTimein interfaceOfflinePushAccessor
-
updateOfflinePushStatus
Description copied from interface:OfflinePushAccessorUpdate status of the given offline push to persistent storage.- Specified by:
updateOfflinePushStatusin interfaceOfflinePushAccessor
-
createOfflinePushStatusAndItsPartitionStatuses
Description copied from interface:OfflinePushAccessorCreate offline push and its partition statues on persistent storage.- Specified by:
createOfflinePushStatusAndItsPartitionStatusesin interfaceOfflinePushAccessor
-
deleteOfflinePushStatusAndItsPartitionStatuses
Description copied from interface:OfflinePushAccessorDelete offline push and its partition statuses from persistent storage.- Specified by:
deleteOfflinePushStatusAndItsPartitionStatusesin interfaceOfflinePushAccessor- Parameters:
kafkaTopic- version topic
-
updateReplicaStatus
public void updateReplicaStatus(String topic, int partitionId, String instanceId, ExecutionStatus status, String incrementalPushVersion) Description copied from interface:OfflinePushAccessorUpdate one particular replica status by given topic, partition and instanceId to the persistent storage.- Specified by:
updateReplicaStatusin interfaceOfflinePushAccessor
-
batchUpdateReplicaIncPushStatus
public void batchUpdateReplicaIncPushStatus(String kafkaTopic, int partitionId, String instanceId, List<String> pendingReportIncPushVersionList) - Specified by:
batchUpdateReplicaIncPushStatusin interfaceOfflinePushAccessor
-
subscribePartitionStatusChange
public void subscribePartitionStatusChange(OfflinePushStatus pushStatus, PartitionStatusListener listener) Description copied from interface:OfflinePushAccessorSubscribe the data change of partition status.- Specified by:
subscribePartitionStatusChangein interfaceOfflinePushAccessor
-
unsubscribePartitionsStatusChange
public void unsubscribePartitionsStatusChange(OfflinePushStatus pushStatus, PartitionStatusListener listener) Description copied from interface:OfflinePushAccessorUnsubscribe the data change of partition status.- Specified by:
unsubscribePartitionsStatusChangein interfaceOfflinePushAccessor
-
unsubscribePartitionsStatusChange
public void unsubscribePartitionsStatusChange(String topicName, int partitionCount, PartitionStatusListener listener) Description copied from interface:OfflinePushAccessorUnsubscribe the data change of partition status.- Specified by:
unsubscribePartitionsStatusChangein interfaceOfflinePushAccessor
-
subscribePushStatusCreationChange
public void subscribePushStatusCreationChange(org.apache.helix.zookeeper.zkclient.IZkChildListener childListener) Description copied from interface:OfflinePushAccessorSubscribe a child listener that listens to OfflinePushStatus creation/deleted.- Specified by:
subscribePushStatusCreationChangein interfaceOfflinePushAccessor
-
unsubscribePushStatusCreationChange
public void unsubscribePushStatusCreationChange(org.apache.helix.zookeeper.zkclient.IZkChildListener childListener) Description copied from interface:OfflinePushAccessorUnsubscribe a child listener- Specified by:
unsubscribePushStatusCreationChangein interfaceOfflinePushAccessor
-
getPartitionStatus
Get one partition status ZNode from ZK by given topic and partition. -
getPartitionStatuses
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
-
getOfflinePushStatusAccessor
public org.apache.helix.manager.zk.ZkBaseDataAccessor<OfflinePushStatus> getOfflinePushStatusAccessor()For testing only.
-