diff --git a/internal/venice-client-common/src/main/java/com/linkedin/venice/utils/VeniceProperties.java b/internal/venice-client-common/src/main/java/com/linkedin/venice/utils/VeniceProperties.java index dfafe3ef15..e9855ece93 100644 --- a/internal/venice-client-common/src/main/java/com/linkedin/venice/utils/VeniceProperties.java +++ b/internal/venice-client-common/src/main/java/com/linkedin/venice/utils/VeniceProperties.java @@ -389,6 +389,7 @@ public List getList(String key, List defaultValue) { } String value = get(key); + String[] pieces = value.split("\\s*,\\s*"); return Arrays.asList(pieces); } diff --git a/internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/controller/TestHAASController.java b/internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/controller/TestHAASController.java index 796edb2aa2..905a853693 100644 --- a/internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/controller/TestHAASController.java +++ b/internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/controller/TestHAASController.java @@ -78,6 +78,27 @@ public void testClusterResourceInstanceTag() { } } + @Test(timeOut = 60 * Time.MS_PER_SECOND) + public void testClusterResourceEmptyInstanceTag() { + try (VeniceClusterWrapper venice = ServiceFactory.getVeniceCluster(0, 0, 0, 1); + HelixAsAServiceWrapper helixAsAServiceWrapper = startAndWaitForHAASToBeAvailable(venice.getZk().getAddress())) { + String instanceTag = ""; + String controllerClusterName = "venice-controllers"; + + Properties clusterProperties = (Properties) enableControllerAndStorageClusterHAASProperties.clone(); + clusterProperties.put(ConfigKeys.CONTROLLER_RESOURCE_INSTANCE_GROUP_TAG, instanceTag); + clusterProperties.put(ConfigKeys.CONTROLLER_INSTANCE_TAG_LIST, instanceTag); + + VeniceControllerWrapper controllerWrapper = venice.addVeniceController(clusterProperties); + + HelixAdmin helixAdmin = controllerWrapper.getVeniceHelixAdmin().getHelixAdmin(); + List resources = helixAdmin.getResourcesInClusterWithTag(controllerClusterName, instanceTag); + assertEquals(resources.size(), 0); + List instances = helixAdmin.getInstancesInClusterWithTag(controllerClusterName, instanceTag); + assertEquals(instances.size(), 0); + } + } + @Test(timeOut = 60 * Time.MS_PER_SECOND) public void testStartHAASHelixControllerAsControllerClusterLeader() { try (VeniceClusterWrapper venice = ServiceFactory.getVeniceCluster(0, 0, 0, 1); diff --git a/services/venice-controller/src/main/java/com/linkedin/venice/controller/VeniceControllerClusterConfig.java b/services/venice-controller/src/main/java/com/linkedin/venice/controller/VeniceControllerClusterConfig.java index e0c1881e05..7d390d3b99 100644 --- a/services/venice-controller/src/main/java/com/linkedin/venice/controller/VeniceControllerClusterConfig.java +++ b/services/venice-controller/src/main/java/com/linkedin/venice/controller/VeniceControllerClusterConfig.java @@ -654,7 +654,13 @@ public VeniceControllerClusterConfig(VeniceProperties props) { this.adminCheckReadMethodForKafka = props.getBoolean(ADMIN_CHECK_READ_METHOD_FOR_KAFKA, true); this.controllerClusterName = props.getString(CONTROLLER_CLUSTER, "venice-controllers"); this.controllerResourceInstanceGroupTag = props.getString(CONTROLLER_RESOURCE_INSTANCE_GROUP_TAG, ""); - this.controllerInstanceTagList = props.getList(CONTROLLER_INSTANCE_TAG_LIST, Collections.emptyList()); + + if (props.getString(CONTROLLER_INSTANCE_TAG_LIST, "").isEmpty()) { + this.controllerInstanceTagList = Collections.emptyList(); + } else { + this.controllerInstanceTagList = props.getList(CONTROLLER_INSTANCE_TAG_LIST, Collections.emptyList()); + } + this.controllerClusterReplica = props.getInt(CONTROLLER_CLUSTER_REPLICA, 3); this.controllerClusterZkAddress = props.getString(CONTROLLER_CLUSTER_ZK_ADDRESSS, getZkAddress()); this.parent = props.getBoolean(CONTROLLER_PARENT_MODE, false);