You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ji...@apache.org on 2020/04/23 19:27:49 UTC

[helix] 03/23: Add java API to add or remove CustomizedStateAggregationConfig (#792)

This is an automated email from the ASF dual-hosted git repository.

jiajunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git

commit f0eb926de81ac5b6357744588d9b0d0b16de0c9c
Author: Ali Reza Zamani Zadeh Najari <an...@linkedin.com>
AuthorDate: Fri Feb 21 11:40:28 2020 -0800

    Add java API to add or remove CustomizedStateAggregationConfig (#792)
    
    In this commit the below APIs have been added.
    1- addCustomizedStateAggregationConfig
    2- removeCustomizedStateAggregationConfig.
    3- addTypeToCustomizedStateAggregationConfig
    4- removeTypeFromCustomizedStateAggregationConfig
    Tests have been added to check the functionality of these APIs.
---
 .../main/java/org/apache/helix/ConfigAccessor.java |  2 +-
 .../src/main/java/org/apache/helix/HelixAdmin.java | 26 ++++++
 .../org/apache/helix/manager/zk/ZKHelixAdmin.java  | 82 +++++++++++++++++++
 .../model/CustomizedStateAggregationConfig.java    | 82 ++++++++++---------
 .../apache/helix/manager/zk/TestZkHelixAdmin.java  | 95 +++++++++++++++++++++-
 .../java/org/apache/helix/mock/MockHelixAdmin.java | 22 +++++
 .../TestCustomizedStateAggregationConfig.java      | 15 ++--
 7 files changed, 274 insertions(+), 50 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/ConfigAccessor.java b/helix-core/src/main/java/org/apache/helix/ConfigAccessor.java
index 5a41241..63f232e 100644
--- a/helix-core/src/main/java/org/apache/helix/ConfigAccessor.java
+++ b/helix-core/src/main/java/org/apache/helix/ConfigAccessor.java
@@ -606,7 +606,7 @@ public class ConfigAccessor {
       return null;
     }
 
-    return new CustomizedStateAggregationConfig(record);
+    return new CustomizedStateAggregationConfig.Builder(record).build();
   }
 
   /**
diff --git a/helix-core/src/main/java/org/apache/helix/HelixAdmin.java b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
index 511a763..985d00f 100644
--- a/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
+++ b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
@@ -26,6 +26,7 @@ import org.apache.helix.model.CloudConfig;
 import org.apache.helix.model.ClusterConstraints;
 import org.apache.helix.model.ClusterConstraints.ConstraintType;
 import org.apache.helix.model.ConstraintItem;
+import org.apache.helix.model.CustomizedStateAggregationConfig;
 import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.HelixConfigScope;
 import org.apache.helix.model.IdealState;
@@ -105,6 +106,31 @@ public interface HelixAdmin {
    */
   void addClusterToGrandCluster(String clusterName, String grandCluster);
 
+  /** Add a CustomizedStateAggregationConfig to a cluster
+   * @param clusterName
+   * @param customizedStateAggregationConfig
+   */
+  void addCustomizedStateAggregationConfig(String clusterName,
+      CustomizedStateAggregationConfig customizedStateAggregationConfig);
+
+  /**
+   * Remove CustomizedStateAggregationConfig from specific cluster
+   * @param clusterName
+   */
+  void removeCustomizedStateAggregationConfig(String clusterName);
+
+  /**
+   * Add a type to CustomizedStateAggregationConfig of specific cluster
+   * @param clusterName
+   */
+  void addTypeToCustomizedStateAggregationConfig(String clusterName, String type);
+
+  /**
+   * Remove a type from CustomizedStateAggregationConfig of specific cluster
+   * @param clusterName
+   */
+  void removeTypeFromCustomizedStateAggregationConfig(String clusterName, String type);
+
   /**
    * Add a resource to a cluster, using the default ideal state mode AUTO
    * @param clusterName
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
index 14f73f9..24e0a60 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
@@ -63,6 +63,7 @@ import org.apache.helix.model.ClusterConstraints.ConstraintType;
 import org.apache.helix.model.ConstraintItem;
 import org.apache.helix.model.ControllerHistory;
 import org.apache.helix.model.CurrentState;
+import org.apache.helix.model.CustomizedStateAggregationConfig;
 import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.HelixConfigScope;
 import org.apache.helix.model.IdealState;
@@ -1215,6 +1216,87 @@ public class ZKHelixAdmin implements HelixAdmin {
   }
 
   @Override
+  public void addCustomizedStateAggregationConfig(String clusterName,
+      CustomizedStateAggregationConfig customizedStateAggregationConfig) {
+    logger.info(
+        "Add CustomizedStateAggregationConfig to cluster {}, CustomizedStateAggregationConfig is {}",
+        clusterName, customizedStateAggregationConfig.toString());
+
+    if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
+      throw new HelixException("cluster " + clusterName + " is not setup yet");
+    }
+
+    CustomizedStateAggregationConfig.Builder builder =
+        new CustomizedStateAggregationConfig.Builder(customizedStateAggregationConfig);
+    CustomizedStateAggregationConfig customizedStateAggregationConfigFromBuilder = builder.build();
+
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
+    Builder keyBuilder = accessor.keyBuilder();
+    accessor.setProperty(keyBuilder.customizedStateAggregationConfig(),
+        customizedStateAggregationConfigFromBuilder);
+  }
+
+  @Override
+  public void removeCustomizedStateAggregationConfig(String clusterName) {
+    logger.info(
+        "Remove CustomizedStateAggregationConfig from cluster {}.", clusterName);
+
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
+    Builder keyBuilder = accessor.keyBuilder();
+    accessor.removeProperty(keyBuilder.customizedStateAggregationConfig());
+
+  }
+
+  @Override
+  public void addTypeToCustomizedStateAggregationConfig(String clusterName, String type) {
+    logger.info("Add type {} to CustomizedStateAggregationConfig of cluster {}", type, clusterName);
+
+    if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
+      throw new HelixException("cluster " + clusterName + " is not setup yet");
+    }
+    CustomizedStateAggregationConfig.Builder builder =
+        new CustomizedStateAggregationConfig.Builder();
+
+    builder.addAggregationEnabledType(type);
+    CustomizedStateAggregationConfig customizedStateAggregationConfigFromBuilder = builder.build();
+
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
+    Builder keyBuilder = accessor.keyBuilder();
+    accessor.updateProperty(keyBuilder.customizedStateAggregationConfig(),
+        customizedStateAggregationConfigFromBuilder);
+  }
+
+
+  @Override
+  public void removeTypeFromCustomizedStateAggregationConfig(String clusterName, String type) {
+    logger.info("Remove type {} to CustomizedStateAggregationConfig of cluster {}", type,
+        clusterName);
+
+    if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
+      throw new HelixException("cluster " + clusterName + " is not setup yet");
+    }
+
+    CustomizedStateAggregationConfig.Builder builder = new CustomizedStateAggregationConfig.Builder(
+        _configAccessor.getCustomizedStateAggregationConfig(clusterName));
+
+    if (!builder.getAggregationEnabledTypes().contains(type)) {
+      throw new HelixException("Type " + type
+          + " is missing from the CustomizedStateAggregationConfig of cluster " + clusterName);
+    }
+
+    builder.removeAggregationEnabledType(type);
+    CustomizedStateAggregationConfig customizedStateAggregationConfigFromBuilder = builder.build();
+    ZKHelixDataAccessor accessor =
+        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
+    Builder keyBuilder = accessor.keyBuilder();
+    accessor.setProperty(keyBuilder.customizedStateAggregationConfig(),
+        customizedStateAggregationConfigFromBuilder);
+  }
+
+  @Override
   public List<String> getConfigKeys(HelixConfigScope scope) {
     return _configAccessor.getKeys(scope);
   }
diff --git a/helix-core/src/main/java/org/apache/helix/model/CustomizedStateAggregationConfig.java b/helix-core/src/main/java/org/apache/helix/model/CustomizedStateAggregationConfig.java
index 0e4a065..8d13fda 100644
--- a/helix-core/src/main/java/org/apache/helix/model/CustomizedStateAggregationConfig.java
+++ b/helix-core/src/main/java/org/apache/helix/model/CustomizedStateAggregationConfig.java
@@ -21,13 +21,20 @@ package org.apache.helix.model;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import org.apache.helix.HelixException;
 import org.apache.helix.HelixProperty;
-import org.apache.helix.ZNRecord;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+
 
 /**
  * CustomizedStateAggregation configurations
  */
 public class CustomizedStateAggregationConfig extends HelixProperty {
+
+  public static final String CUSTOMIZED_STATE_AGGREGATION_CONFIG_KW =
+      "CustomizedStateAggregationConfig";
+
   /**
    * Indicate which customized states will be aggregated.
    * NOTE: Do NOT use this field name directly, use its corresponding getter/setter in the
@@ -39,10 +46,9 @@ public class CustomizedStateAggregationConfig extends HelixProperty {
 
   /**
    * Instantiate the CustomizedStateAggregationConfig
-   * @param cluster
    */
-  public CustomizedStateAggregationConfig(String cluster) {
-    super(cluster);
+  public CustomizedStateAggregationConfig() {
+    super(CUSTOMIZED_STATE_AGGREGATION_CONFIG_KW);
   }
 
   /**
@@ -50,21 +56,10 @@ public class CustomizedStateAggregationConfig extends HelixProperty {
    * @param record a ZNRecord corresponding to a CustomizedStateAggregationConfig
    */
   public CustomizedStateAggregationConfig(ZNRecord record) {
-    super(record);
-  }
-
-  /**
-   * Instantiate the config using each field individually.
-   * Users should use CustomizedStateAggregationConfig.Builder to create
-   * CustomizedStateAggregationConfig.
-   * @param cluster
-   * @param aggregationEnabledTypes
-   */
-  public CustomizedStateAggregationConfig(String cluster, List<String> aggregationEnabledTypes) {
-    super(cluster);
-    _record.setListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name(),
-        aggregationEnabledTypes);
-
+    super(CUSTOMIZED_STATE_AGGREGATION_CONFIG_KW);
+    _record.setSimpleFields(record.getSimpleFields());
+    _record.setListFields(record.getListFields());
+    _record.setMapFields(record.getMapFields());
   }
 
   /**
@@ -86,25 +81,26 @@ public class CustomizedStateAggregationConfig extends HelixProperty {
   }
 
   public static class Builder {
-    private String _clusterName = null;
-    private List<String> _aggregationEnabledTypes;
+    private ZNRecord _record;
+
 
     public CustomizedStateAggregationConfig build() {
-      return new CustomizedStateAggregationConfig(_clusterName, _aggregationEnabledTypes);
+      return new CustomizedStateAggregationConfig(_record);
     }
 
     /**
      * Default constructor
      */
     public Builder() {
+      _record = new ZNRecord(CUSTOMIZED_STATE_AGGREGATION_CONFIG_KW);
     }
 
     /**
-     * Constructor with Cluster Name as input
-     * @param clusterName
+     * Instantiate with a pre-populated record
+     * @param record a ZNRecord corresponding to a Customized State Aggregation configuration
      */
-    public Builder(String clusterName) {
-      _clusterName = clusterName;
+    public Builder(ZNRecord record) {
+      _record = record;
     }
 
     /**
@@ -112,33 +108,39 @@ public class CustomizedStateAggregationConfig extends HelixProperty {
      * @param customizedStateAggregationConfig
      */
     public Builder(CustomizedStateAggregationConfig customizedStateAggregationConfig) {
-      _aggregationEnabledTypes = customizedStateAggregationConfig.getAggregationEnabledTypes();
+      _record = customizedStateAggregationConfig.getRecord();
     }
 
-    public Builder setClusterName(String v) {
-      _clusterName = v;
+    public Builder setAggregationEnabledTypes(List<String> aggregationEnabledTypes) {
+      _record.setListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name(), aggregationEnabledTypes);
       return this;
     }
 
-    public Builder setAggregationEnabledTypes(List<String> v) {
-      _aggregationEnabledTypes = v;
+    public Builder addAggregationEnabledType(String type) {
+      if (_record.getListField(
+          CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name()) == null) {
+        _record.setListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name(), new ArrayList<String>());
+      }
+      List<String> aggregationEnabledTypes = _record.getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name());
+      aggregationEnabledTypes.add(type);
+      _record.setListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name(), aggregationEnabledTypes);
       return this;
     }
 
-    public Builder addAggregationEnabledType(String v) {
-      if (_aggregationEnabledTypes == null) {
-        _aggregationEnabledTypes = new ArrayList<String>();
+    public Builder removeAggregationEnabledType(String type) {
+      if (!_record.getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name())
+          .contains(type)) {
+        throw new HelixException(
+            "Type " + type + " is missing from the CustomizedStateAggregationConfig");
       }
-      _aggregationEnabledTypes.add(v);
+      _record.getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name())
+          .remove(type);
       return this;
     }
 
-    public String getClusterName() {
-      return _clusterName;
-    }
-
     public List<String> getAggregationEnabledTypes() {
-      return _aggregationEnabledTypes;
+      return _record
+          .getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name());
     }
   }
 }
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
index 639a4b1..61eb9e2 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
@@ -54,6 +54,7 @@ import org.apache.helix.model.ClusterConstraints;
 import org.apache.helix.model.ClusterConstraints.ConstraintAttribute;
 import org.apache.helix.model.ClusterConstraints.ConstraintType;
 import org.apache.helix.model.ConstraintItem;
+import org.apache.helix.model.CustomizedStateAggregationConfig;
 import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.HelixConfigScope;
 import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
@@ -684,7 +685,6 @@ public class TestZkHelixAdmin extends ZkUnitTestBase {
     Assert.assertEquals(cloudConfigFromZk.getCloudInfoProcessorName(), "TestProcessor");
   }
 
-
   @Test
   public void testRemoveCloudConfig() throws Exception {
     String className = TestHelper.getTestClassName();
@@ -719,4 +719,95 @@ public class TestZkHelixAdmin extends ZkUnitTestBase {
     cloudConfigFromZk = _configAccessor.getCloudConfig(clusterName);
     Assert.assertNull(cloudConfigFromZk);
   }
-}
+
+  @Test
+  public void testAddCustomizedStateConfig() {
+    String className = TestHelper.getTestClassName();
+    String methodName = TestHelper.getTestMethodName();
+    String clusterName = className + "_" + methodName;
+
+    HelixAdmin admin = new ZKHelixAdmin(ZK_ADDR);
+    admin.addCluster(clusterName, true);
+    CustomizedStateConfig.Builder builder =
+        new CustomizedStateConfig.Builder();
+    builder.addAggregationEnabledType("mockType1");
+    CustomizedStateConfig customizedStateConfig = builder.build();
+
+    admin.addCustomizedStateConfig(clusterName, customizedStateConfig);
+
+    // Read CustomizedStateConfig from Zookeeper and check the content
+    ConfigAccessor _configAccessor = new ConfigAccessor(ZK_ADDR);
+    CustomizedStateConfig configFromZk =
+        _configAccessor.getCustomizedStateConfig(clusterName);
+    List<String> listTypesFromZk = configFromZk.getAggregationEnabledTypes();
+    Assert.assertEquals(listTypesFromZk.get(0), "mockType1");
+  }
+
+  @Test
+  public void testRemoveCustomizedStateConfig() throws Exception {
+    String className = TestHelper.getTestClassName();
+    String methodName = TestHelper.getTestMethodName();
+    String clusterName = className + "_" + methodName;
+
+    HelixAdmin admin = new ZKHelixAdmin(ZK_ADDR);
+    admin.addCluster(clusterName, true);
+    CustomizedStateConfig.Builder builder =
+        new CustomizedStateConfig.Builder();
+    builder.addAggregationEnabledType("mockType1");
+    CustomizedStateConfig customizedStateConfig = builder.build();
+
+    admin.addCustomizedStateConfig(clusterName, customizedStateConfig);
+
+    // Read CustomizedStateConfig from Zookeeper and check the content
+    ConfigAccessor _configAccessor = new ConfigAccessor(ZK_ADDR);
+    CustomizedStateConfig configFromZk =
+        _configAccessor.getCustomizedStateConfig(clusterName);
+    List<String> listTypesFromZk = configFromZk.getAggregationEnabledTypes();
+    Assert.assertEquals(listTypesFromZk.get(0), "mockType1");
+
+    // Remove CustomizedStateConfig Config and make sure it has been removed from
+    // Zookeeper
+    admin.removeCustomizedStateConfig(clusterName);
+    configFromZk = _configAccessor.getCustomizedStateConfig(clusterName);
+    Assert.assertNull(configFromZk);
+  }
+
+  @Test
+  public void testUpdateCustomizedStateConfig() throws Exception {
+    String className = TestHelper.getTestClassName();
+    String methodName = TestHelper.getTestMethodName();
+    String clusterName = className + "_" + methodName;
+
+    HelixAdmin admin = new ZKHelixAdmin(ZK_ADDR);
+    admin.addCluster(clusterName, true);
+    CustomizedStateConfig.Builder builder =
+        new CustomizedStateConfig.Builder();
+    builder.addAggregationEnabledType("mockType1");
+    CustomizedStateConfig customizedStateConfig = builder.build();
+
+    admin.addCustomizedStateConfig(clusterName, customizedStateConfig);
+
+    // Read CustomizedStateConfig from Zookeeper and check the content
+    ConfigAccessor _configAccessor = new ConfigAccessor(ZK_ADDR);
+    CustomizedStateConfig configFromZk =
+        _configAccessor.getCustomizedStateConfig(clusterName);
+    List<String> listTypesFromZk = configFromZk.getAggregationEnabledTypes();
+    Assert.assertEquals(listTypesFromZk.get(0), "mockType1");
+
+    admin.addTypeToCustomizedStateConfig(clusterName, "mockType2");
+    admin.addTypeToCustomizedStateConfig(clusterName, "mockType3");
+    configFromZk =
+        _configAccessor.getCustomizedStateConfig(clusterName);
+    listTypesFromZk = configFromZk.getAggregationEnabledTypes();
+    Assert.assertEquals(listTypesFromZk.get(0), "mockType1");
+    Assert.assertEquals(listTypesFromZk.get(1), "mockType2");
+    Assert.assertEquals(listTypesFromZk.get(2), "mockType3");
+
+    admin.removeTypeFromCustomizedStateConfig(clusterName, "mockType1");
+    configFromZk =
+        _configAccessor.getCustomizedStateConfig(clusterName);
+    listTypesFromZk = configFromZk.getAggregationEnabledTypes();
+    Assert.assertEquals(listTypesFromZk.get(0), "mockType2");
+    Assert.assertEquals(listTypesFromZk.get(1), "mockType3");
+  }
+}
\ No newline at end of file
diff --git a/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java b/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java
index 69fdb7b..595e435 100644
--- a/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java
+++ b/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java
@@ -35,6 +35,7 @@ import org.apache.helix.model.CloudConfig;
 import org.apache.helix.model.ClusterConfig;
 import org.apache.helix.model.ClusterConstraints;
 import org.apache.helix.model.ConstraintItem;
+import org.apache.helix.model.CustomizedStateAggregationConfig;
 import org.apache.helix.model.ExternalView;
 import org.apache.helix.model.HelixConfigScope;
 import org.apache.helix.model.IdealState;
@@ -143,6 +144,27 @@ public class MockHelixAdmin implements HelixAdmin {
 
   }
 
+  @Override
+  public void addCustomizedStateAggregationConfig(String clusterName,
+      CustomizedStateAggregationConfig customizedStateAggregationConfig) {
+
+  }
+
+  @Override
+  public void removeCustomizedStateAggregationConfig(String clusterName) {
+
+  }
+
+  @Override
+  public void addTypeToCustomizedStateAggregationConfig(String clusterName, String type) {
+
+  }
+
+  @Override
+  public void removeTypeFromCustomizedStateAggregationConfig(String clusterName, String type) {
+
+  }
+
   @Override public void addResource(String clusterName, String resourceName, int numPartitions,
       String stateModelRef) {
 
diff --git a/helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateAggregationConfig.java b/helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateAggregationConfig.java
index 5cdc333..2b9752a 100644
--- a/helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateAggregationConfig.java
+++ b/helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateAggregationConfig.java
@@ -62,12 +62,14 @@ public class TestCustomizedStateAggregationConfig extends ZkUnitTestBase {
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
 
     // Create dummy CustomizedStateAggregationConfig object
-    CustomizedStateAggregationConfig customizedStateAggregationConfig =
-        new CustomizedStateAggregationConfig(clusterName);
+    CustomizedStateAggregationConfig.Builder customizedStateAggregationConfigBuilder =
+        new CustomizedStateAggregationConfig.Builder();
     List<String> aggregationEnabledTypes = new ArrayList<String>();
-    aggregationEnabledTypes.add("mockState1");
-    aggregationEnabledTypes.add("mockState2");
-    customizedStateAggregationConfig.setAggregationEnabledTypes(aggregationEnabledTypes);
+    aggregationEnabledTypes.add("mockType1");
+    aggregationEnabledTypes.add("mockType2");
+    customizedStateAggregationConfigBuilder.setAggregationEnabledTypes(aggregationEnabledTypes);
+    CustomizedStateAggregationConfig customizedStateAggregationConfig =
+        customizedStateAggregationConfigBuilder.build();
 
     // Write the CustomizedStateAggregationConfig to Zookeeper
     ZKHelixDataAccessor accessor =
@@ -92,12 +94,11 @@ public class TestCustomizedStateAggregationConfig extends ZkUnitTestBase {
     String clusterName = "CLUSTER_" + className;
     TestHelper.setupEmptyCluster(_gZkClient, clusterName);
     CustomizedStateAggregationConfig.Builder builder =
-        new CustomizedStateAggregationConfig.Builder(clusterName);
+        new CustomizedStateAggregationConfig.Builder();
     builder.addAggregationEnabledType("mockType1");
     builder.addAggregationEnabledType("mockType2");
 
     // Check builder getter methods
-    Assert.assertEquals(builder.getClusterName(), clusterName);
     List<String> aggregationEnabledTypes = builder.getAggregationEnabledTypes();
     Assert.assertEquals(aggregationEnabledTypes.size(), 2);
     Assert.assertEquals(aggregationEnabledTypes.get(0), "mockType1");