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

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

commit 2c8960488c9403358422d22f07e2d8af02b1d1cc
Author: Tengfei Mu <[email protected]>
AuthorDate: Mon Sep 9 14:46:37 2024 -0700

    Add null check for getClusterConfig()
---
 .../helix/controller/dataproviders/ResourceControllerDataProvider.java | 3 ++-
 .../apache/helix/controller/stages/CurrentStateComputationStage.java   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/helix-core/src/main/java/org/apache/helix/controller/dataproviders/ResourceControllerDataProvider.java
 
b/helix-core/src/main/java/org/apache/helix/controller/dataproviders/ResourceControllerDataProvider.java
index 8d08e1b91..eae6af8ce 100644
--- 
a/helix-core/src/main/java/org/apache/helix/controller/dataproviders/ResourceControllerDataProvider.java
+++ 
b/helix-core/src/main/java/org/apache/helix/controller/dataproviders/ResourceControllerDataProvider.java
@@ -188,7 +188,8 @@ public class ResourceControllerDataProvider extends 
BaseControllerDataProvider {
     refreshStablePartitionList(getIdealStates());
     refreshDisabledInstancesForAllPartitionsSet();
 
-    if (getClusterConfig().getGlobalMaxPartitionAllowedPerInstance() != -1) {
+    if (getClusterConfig() != null
+        && getClusterConfig().getGlobalMaxPartitionAllowedPerInstance() != -1) 
{
       
buildSimpleCapacityMap(getClusterConfig().getGlobalMaxPartitionAllowedPerInstance());
       // Remove all cached IdealState because it is a global computation 
cannot partially be
       // performed for some resources. The computation is simple as well not 
taking too much resource
diff --git 
a/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateComputationStage.java
 
b/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateComputationStage.java
index b755f6b74..79325bea2 100644
--- 
a/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateComputationStage.java
+++ 
b/helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateComputationStage.java
@@ -136,7 +136,8 @@ public class CurrentStateComputationStage extends 
AbstractBaseStage {
     }
 
     // Populate the capacity for simple CapacityNode
-    if (cache.getClusterConfig().getGlobalMaxPartitionAllowedPerInstance() != 
-1
+    if (cache.getClusterConfig() != null
+        && cache.getClusterConfig().getGlobalMaxPartitionAllowedPerInstance() 
!= -1
         && cache instanceof ResourceControllerDataProvider) {
       final ResourceControllerDataProvider dataProvider = 
(ResourceControllerDataProvider) cache;
       dataProvider.populateSimpleCapacitySetUsage(resourceToRebalance.keySet(),

Reply via email to