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
ConstructorsConstructorDescriptionZkHelixAdminClient(VeniceControllerMultiClusterConfig multiClusterConfigs, io.tehuti.metrics.MetricsRepository metricsRepository) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClusterToGrandCluster(String clusterName) Add the specified cluster as a resource to the grand cluster to be managed by HaaS controllers.voidaddVeniceStorageClusterToControllerCluster(String clusterName) Add the given Venice storage cluster's cluster resource to the controller cluster.voidclose()Release resources.booleancontainsResource(String clusterName, String resourceName) Check if a resource exists in a cluster by checking its ideal state.voidCreate and configure the Venice controller cluster.voidcreateVeniceStorageCluster(String clusterName, org.apache.helix.model.ClusterConfig helixClusterConfig, org.apache.helix.model.RESTConfig restConfig) Create and configure the Venice storage cluster.voidcreateVeniceStorageClusterResources(String clusterName, String kafkaTopic, int numberOfPartition, int replicationFactor) Create resources for a given storage node cluster.voiddropResource(String clusterName, String resourceName) Drop a resource from a cluster.voiddropStorageInstance(String clusterName, String instanceName) Drop a storage node instance from the given cluster.voidenablePartition(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.org.apache.helix.model.IdealStategetResourceIdealState(String clusterName, String resourceName) booleanisClusterInGrandCluster(String clusterName) Check if the grand cluster managed by HaaS controllers is aware of the given cluster.booleanCheck if the Venice controller cluster is created and configured.booleanisVeniceStorageClusterCreated(String clusterName) Check if the given Venice storage cluster is created and configured.booleanisVeniceStorageClusterInControllerCluster(String clusterName) Check if the given Venice storage cluster's cluster resource is in the Venice controller cluster.voidmanuallyEnableMaintenanceMode(String clusterName, boolean enabled, String reason, Map<String, String> customFields) Manually enable maintenance mode.voidresetPartition(String clusterName, String instanceName, String resourceName, List<String> partitionNames) Reset a list of partitions in error state for an instance.voidsetInstanceOperation(String clusterName, String instanceName, org.apache.helix.constants.InstanceConstants.InstanceOperation instanceOperation, String reason) Set the instanceOperation of and instance withInstanceConstants.InstanceOperation.voidupdateClusterConfigs(String clusterName, org.apache.helix.model.ClusterConfig clusterConfig) Update some Helix cluster properties for the given cluster.voidupdateIdealState(String clusterName, String resourceName, org.apache.helix.model.IdealState idealState) voidupdateRESTConfigs(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:HelixAdminClientCheck if the Venice controller cluster is created and configured.- Specified by:
isVeniceControllerClusterCreatedin interfaceHelixAdminClient- Returns:
- true or false.
- See Also:
-
isVeniceStorageClusterCreated
Description copied from interface:HelixAdminClientCheck if the given Venice storage cluster is created and configured.- Specified by:
isVeniceStorageClusterCreatedin interfaceHelixAdminClient- Parameters:
clusterName- of the Venice cluster.- Returns:
- true or false.
- See Also:
-
createVeniceControllerCluster
public void createVeniceControllerCluster()Description copied from interface:HelixAdminClientCreate and configure the Venice controller cluster.- Specified by:
createVeniceControllerClusterin 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:HelixAdminClientCreate and configure the Venice storage cluster.- Specified by:
createVeniceStorageClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the Venice storage cluster.helixClusterConfig-ClusterConfigfor the new cluster.restConfig-RESTConfigfor the new cluster.- See Also:
-
isVeniceStorageClusterInControllerCluster
Description copied from interface:HelixAdminClientCheck if the given Venice storage cluster's cluster resource is in the Venice controller cluster.- Specified by:
isVeniceStorageClusterInControllerClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the Venice storage cluster.- Returns:
- true or false.
- See Also:
-
addVeniceStorageClusterToControllerCluster
Description copied from interface:HelixAdminClientAdd the given Venice storage cluster's cluster resource to the controller cluster.- Specified by:
addVeniceStorageClusterToControllerClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the Venice storage cluster.- See Also:
-
isClusterInGrandCluster
Description copied from interface:HelixAdminClientCheck if the grand cluster managed by HaaS controllers is aware of the given cluster.- Specified by:
isClusterInGrandClusterin interfaceHelixAdminClient- Parameters:
clusterName- of the cluster.- Returns:
- true or false.
- See Also:
-
addClusterToGrandCluster
Description copied from interface:HelixAdminClientAdd the specified cluster as a resource to the grand cluster to be managed by HaaS controllers.- Specified by:
addClusterToGrandClusterin 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:HelixAdminClientUpdate some Helix cluster properties for the given cluster.- Specified by:
updateClusterConfigsin interfaceHelixAdminClient- Parameters:
clusterName- of the cluster to be updated.clusterConfig-ClusterConfigfor the new cluster.- See Also:
-
updateRESTConfigs
Description copied from interface:HelixAdminClientUpdate some Helix cluster properties for the given cluster.- Specified by:
updateRESTConfigsin interfaceHelixAdminClient- Parameters:
clusterName- of the cluster to be updated.restConfig-RESTConfigfor the new cluster.- See Also:
-
enablePartition
public void enablePartition(boolean enabled, String clusterName, String instanceName, String resourceName, List<String> partitionNames) Description copied from interface:HelixAdminClientDisable or enable a list of partitions on an instance.- Specified by:
enablePartitionin interfaceHelixAdminClient- See Also:
-
getInstancesInCluster
Description copied from interface:HelixAdminClientGet a list of instances under a cluster.- Specified by:
getInstancesInClusterin 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:HelixAdminClientCreate resources for a given storage node cluster.- Specified by:
createVeniceStorageClusterResourcesin interfaceHelixAdminClient- See Also:
-
containsResource
Description copied from interface:HelixAdminClientCheck if a resource exists in a cluster by checking its ideal state.- Specified by:
containsResourcein interfaceHelixAdminClient
-
dropResource
Description copied from interface:HelixAdminClientDrop a resource from a cluster.- Specified by:
dropResourcein interfaceHelixAdminClient- See Also:
-
dropStorageInstance
Description copied from interface:HelixAdminClientDrop a storage node instance from the given cluster.- Specified by:
dropStorageInstancein interfaceHelixAdminClient- See Also:
-
getDisabledPartitionsMap
Description copied from interface:HelixAdminClientReturns a list of disabled partitions in an instance.- Specified by:
getDisabledPartitionsMapin interfaceHelixAdminClient
-
resetPartition
public void resetPartition(String clusterName, String instanceName, String resourceName, List<String> partitionNames) Description copied from interface:HelixAdminClientReset 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:
resetPartitionin interfaceHelixAdminClient- See Also:
-
close
public void close()Description copied from interface:HelixAdminClientRelease resources.- Specified by:
closein interfaceHelixAdminClient- See Also:
-
manuallyEnableMaintenanceMode
public void manuallyEnableMaintenanceMode(String clusterName, boolean enabled, String reason, Map<String, String> customFields) Description copied from interface:HelixAdminClientManually enable maintenance mode. To be called by the REST client that accepts KV mappings as the payload.- Specified by:
manuallyEnableMaintenanceModein interfaceHelixAdminClient- See Also:
-
setInstanceOperation
public void setInstanceOperation(String clusterName, String instanceName, org.apache.helix.constants.InstanceConstants.InstanceOperation instanceOperation, String reason) Description copied from interface:HelixAdminClientSet the instanceOperation of and instance withInstanceConstants.InstanceOperation.- Specified by:
setInstanceOperationin interfaceHelixAdminClient- Parameters:
clusterName- The cluster nameinstanceName- The instance nameinstanceOperation- The instance operation typereason- The reason for the operation- See Also:
-
getResourceIdealState
public org.apache.helix.model.IdealState getResourceIdealState(String clusterName, String resourceName) - Specified by:
getResourceIdealStatein interfaceHelixAdminClient
-
updateIdealState
public void updateIdealState(String clusterName, String resourceName, org.apache.helix.model.IdealState idealState) - Specified by:
updateIdealStatein interfaceHelixAdminClient
-