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
The following commit(s) were added to refs/heads/master by this push:
new b429d48 Remove TODO NPE log for computeResourceBestPossibleState
b429d48 is described below
commit b429d4815f5314bdb0c67ca7ed31d17270a4b878
Author: Ali Reza Zamani Zadeh Najari <[email protected]>
AuthorDate: Tue Jul 23 15:15:47 2019 -0700
Remove TODO NPE log for computeResourceBestPossibleState
The logs related to NPE in computeResourceBestPossibleState is not needed
anymore.
This commit fixes issue #351.
---
.../stages/BestPossibleStateCalcStage.java | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git
a/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
b/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
index 539d7d9..85a4add 100644
---
a/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
+++
b/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java
@@ -250,6 +250,13 @@ public class BestPossibleStateCalcStage extends
AbstractBaseStage {
// The next release will support rebalancers that compute the mapping
from start to finish
partitionStateAssignment = mappingCalculator
.computeBestPossiblePartitionState(cache, idealState, resource,
currentStateOutput);
+
+ if (partitionStateAssignment == null) {
+ LogUtil.logWarn(logger, _eventId,
+ "PartitionStateAssignment is null, resource: " + resourceName);
+ return false;
+ }
+
for (Partition partition : resource.getPartitions()) {
Map<String, String> newStateMap =
partitionStateAssignment.getReplicaMap(partition);
output.setState(resourceName, partition, newStateMap);
@@ -263,19 +270,6 @@ public class BestPossibleStateCalcStage extends
AbstractBaseStage {
} catch (Exception e) {
LogUtil.logError(logger, _eventId,
"Error computing assignment for resource " + resourceName + ".
Skipping.");
- // TODO : remove this part after debugging NPE
- StringBuilder sb = new StringBuilder();
-
- sb.append(String
- .format("HelixManager is null : %s\n",
event.getAttribute("helixmanager") == null));
- sb.append(String.format("Rebalancer is null : %s\n", rebalancer ==
null));
- sb.append(String.format("Calculated idealState is null : %s\n",
idealState == null));
- sb.append(String.format("MappingCaculator is null : %s\n",
mappingCalculator == null));
- sb.append(
- String.format("PartitionAssignment is null : %s\n",
partitionStateAssignment == null));
- sb.append(String.format("Output is null : %s\n", output == null));
-
- LogUtil.logError(logger, _eventId, sb.toString());
}
}
// Exception or rebalancer is not found