Package com.linkedin.venice.controller
Class ZkHelixAdminClient
java.lang.Object
com.linkedin.venice.controller.ZkHelixAdminClient
- All Implemented Interfaces:
HelixAdminClient
The purpose of this class is to abstract Helix operations out of the
VeniceHelixAdmin
and eventually rename
it to VeniceAdmin. This is one implementation of the HelixAdminClient
interface which uses Zk based Helix
API. In the future we might move to the Helix REST API.-
Constructor Summary
ConstructorDescriptionZkHelixAdminClient
(VeniceControllerMultiClusterConfig multiClusterConfigs, io.tehuti.metrics.MetricsRepository metricsRepository) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addClusterToGrandCluster
(String clusterName) Add the specified cluster as a resource to the grand cluster to be managed by HaaS controllers.void
addVeniceStorageClusterToControllerCluster
(String clusterName) Add the given Venice storage cluster's cluster resource to the controller cluster.void
close()
Release resources.boolean
containsResource
(String clusterName, String resourceName) Check if a resource exists in a cluster by checking its ideal state.void
Create and configure the Venice controller cluster.void
createVeniceStorageCluster
(String clusterName, org.apache.helix.model.ClusterConfig helixClusterConfig, org.apache.helix.model.RESTConfig restConfig) Create and configure the Venice storage cluster.void
createVeniceStorageClusterResources
(String clusterName, String kafkaTopic, int numberOfPartition, int replicationFactor) Create resources for a given storage node cluster.void
dropResource
(String clusterName, String resourceName) Drop a resource from a cluster.void
dropStorageInstance
(String clusterName, String instanceName) Drop a storage node instance from the given cluster.void
enablePartition
(boolean enabled, String clusterName, String instanceName, String resourceName, List<String> partitionNames) Disable or enable a list of partitions on an instance.getDisabledPartitionsMap
(String clusterName, String instanceName) Returns a list of disabled partitions in an instance.getInstancesInCluster
(String clusterName) Get a list of instances under a cluster.boolean
isClusterInGrandCluster
(String clusterName) Check if the grand cluster managed by HaaS controllers is aware of the given cluster.boolean
Check if the Venice controller cluster is created and configured.boolean
isVeniceStorageClusterCreated
(String clusterName) Check if the given Venice storage cluster is created and configured.boolean
isVeniceStorageClusterInControllerCluster
(String clusterName) Check if the given Venice storage cluster's cluster resource is in the Venice controller cluster.void
manuallyEnableMaintenanceMode
(String clusterName, boolean enabled, String reason, Map<String, String> customFields) Manually enable maintenance mode.void
resetPartition
(String clusterName, String instanceName, String resourceName, List<String> partitionNames) Reset a list of partitions in error state for an instance.void
setInstanceOperation
(String clusterName, String instanceName, org.apache.helix.constants.InstanceConstants.InstanceOperation instanceOperation, String reason) Set the instanceOperation of and instance withInstanceConstants.InstanceOperation
.void
updateClusterConfigs
(String clusterName, org.apache.helix.model.ClusterConfig clusterConfig) Update some Helix cluster properties for the given cluster.void
updateRESTConfigs
(String clusterName, org.apache.helix.model.RESTConfig restConfig) Update some Helix cluster properties for the given cluster.
-
Constructor Details
-
ZkHelixAdminClient
public ZkHelixAdminClient(VeniceControllerMultiClusterConfig multiClusterConfigs, io.tehuti.metrics.MetricsRepository metricsRepository)
-
-
Method Details
-
isVeniceControllerClusterCreated
public boolean isVeniceControllerClusterCreated()Description copied from interface:HelixAdminClient
Check if the Venice controller cluster is created and configured.- Specified by:
isVeniceControllerClusterCreated
in interfaceHelixAdminClient
- Returns:
- true or false.
- See Also:
-
isVeniceStorageClusterCreated
Description copied from interface:HelixAdminClient
Check if the given Venice storage cluster is created and configured.- Specified by:
isVeniceStorageClusterCreated
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the Venice cluster.- Returns:
- true or false.
- See Also:
-
createVeniceControllerCluster
public void createVeniceControllerCluster()Description copied from interface:HelixAdminClient
Create and configure the Venice controller cluster.- Specified by:
createVeniceControllerCluster
in interfaceHelixAdminClient
- See Also:
-
createVeniceStorageCluster
public void createVeniceStorageCluster(String clusterName, org.apache.helix.model.ClusterConfig helixClusterConfig, org.apache.helix.model.RESTConfig restConfig) Description copied from interface:HelixAdminClient
Create and configure the Venice storage cluster.- Specified by:
createVeniceStorageCluster
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the Venice storage cluster.helixClusterConfig
-ClusterConfig
for the new cluster.restConfig
-RESTConfig
for the new cluster.- See Also:
-
isVeniceStorageClusterInControllerCluster
Description copied from interface:HelixAdminClient
Check if the given Venice storage cluster's cluster resource is in the Venice controller cluster.- Specified by:
isVeniceStorageClusterInControllerCluster
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the Venice storage cluster.- Returns:
- true or false.
- See Also:
-
addVeniceStorageClusterToControllerCluster
Description copied from interface:HelixAdminClient
Add the given Venice storage cluster's cluster resource to the controller cluster.- Specified by:
addVeniceStorageClusterToControllerCluster
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the Venice storage cluster.- See Also:
-
isClusterInGrandCluster
Description copied from interface:HelixAdminClient
Check if the grand cluster managed by HaaS controllers is aware of the given cluster.- Specified by:
isClusterInGrandCluster
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the cluster.- Returns:
- true or false.
- See Also:
-
addClusterToGrandCluster
Description copied from interface:HelixAdminClient
Add the specified cluster as a resource to the grand cluster to be managed by HaaS controllers.- Specified by:
addClusterToGrandCluster
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the cluster to be added as a resource to the grand cluster.- See Also:
-
updateClusterConfigs
public void updateClusterConfigs(String clusterName, org.apache.helix.model.ClusterConfig clusterConfig) Description copied from interface:HelixAdminClient
Update some Helix cluster properties for the given cluster.- Specified by:
updateClusterConfigs
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the cluster to be updated.clusterConfig
-ClusterConfig
for the new cluster.- See Also:
-
updateRESTConfigs
Description copied from interface:HelixAdminClient
Update some Helix cluster properties for the given cluster.- Specified by:
updateRESTConfigs
in interfaceHelixAdminClient
- Parameters:
clusterName
- of the cluster to be updated.restConfig
-RESTConfig
for the new cluster.- See Also:
-
enablePartition
public void enablePartition(boolean enabled, String clusterName, String instanceName, String resourceName, List<String> partitionNames) Description copied from interface:HelixAdminClient
Disable or enable a list of partitions on an instance.- Specified by:
enablePartition
in interfaceHelixAdminClient
- See Also:
-
getInstancesInCluster
Description copied from interface:HelixAdminClient
Get a list of instances under a cluster.- Specified by:
getInstancesInCluster
in interfaceHelixAdminClient
- Returns:
- a list of instance names.
- See Also:
-
createVeniceStorageClusterResources
public void createVeniceStorageClusterResources(String clusterName, String kafkaTopic, int numberOfPartition, int replicationFactor) Description copied from interface:HelixAdminClient
Create resources for a given storage node cluster.- Specified by:
createVeniceStorageClusterResources
in interfaceHelixAdminClient
- See Also:
-
containsResource
Description copied from interface:HelixAdminClient
Check if a resource exists in a cluster by checking its ideal state.- Specified by:
containsResource
in interfaceHelixAdminClient
-
dropResource
Description copied from interface:HelixAdminClient
Drop a resource from a cluster.- Specified by:
dropResource
in interfaceHelixAdminClient
- See Also:
-
dropStorageInstance
Description copied from interface:HelixAdminClient
Drop a storage node instance from the given cluster.- Specified by:
dropStorageInstance
in interfaceHelixAdminClient
- See Also:
-
getDisabledPartitionsMap
Description copied from interface:HelixAdminClient
Returns a list of disabled partitions in an instance.- Specified by:
getDisabledPartitionsMap
in interfaceHelixAdminClient
-
resetPartition
public void resetPartition(String clusterName, String instanceName, String resourceName, List<String> partitionNames) Description copied from interface:HelixAdminClient
Reset a list of partitions in error state for an instance.The partitions are assumed to be in error state and reset will bring them from error to initial state. An error to initial state transition is required for reset.
- Specified by:
resetPartition
in interfaceHelixAdminClient
- See Also:
-
close
public void close()Description copied from interface:HelixAdminClient
Release resources.- Specified by:
close
in interfaceHelixAdminClient
- See Also:
-
manuallyEnableMaintenanceMode
public void manuallyEnableMaintenanceMode(String clusterName, boolean enabled, String reason, Map<String, String> customFields) Description copied from interface:HelixAdminClient
Manually enable maintenance mode. To be called by the REST client that accepts KV mappings as the payload.- Specified by:
manuallyEnableMaintenanceMode
in interfaceHelixAdminClient
- See Also:
-
setInstanceOperation
public void setInstanceOperation(String clusterName, String instanceName, org.apache.helix.constants.InstanceConstants.InstanceOperation instanceOperation, String reason) Description copied from interface:HelixAdminClient
Set the instanceOperation of and instance withInstanceConstants.InstanceOperation
.- Specified by:
setInstanceOperation
in interfaceHelixAdminClient
- Parameters:
clusterName
- The cluster nameinstanceName
- The instance nameinstanceOperation
- The instance operation typereason
- The reason for the operation- See Also:
-