You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@helix.apache.org by GitBox <gi...@apache.org> on 2019/07/20 08:56:57 UTC

[GitHub] [helix] pkuwm commented on a change in pull request #346: Unwanted logs have been removed.

pkuwm commented on a change in pull request #346: Unwanted logs have been removed.
URL: https://github.com/apache/helix/pull/346#discussion_r305573518
 
 

 ##########
 File path: helix-core/src/main/java/org/apache/helix/controller/rebalancer/strategy/CrushRebalanceStrategy.java
 ##########
 @@ -89,7 +89,16 @@ public ZNRecord computePartitionAssignment(final List<String> allNodes,
       long data = partitionName.hashCode();
 
       // apply the placement rules
-      List<Node> selected = select(topNode, data, _replicas, eventId);
+      List<Node> selected;
+      try {
+        selected = select(topNode, data, _replicas, eventId);
+      } catch (IllegalStateException e) {
+        String errorMessage = String
+            .format("Could not select enough number of nodes. %s partition %s, required %d",
+                _resourceName, partitionName, _replicas);
+        LogUtil.logError(Log, eventId, errorMessage);
 
 Review comment:
   Since you are throwing the exception, would it be better not to log the error message twice? If you log the exception and then throw it, there’s a chance that the exception will be logged again further up the call stack, resulting in two log events for the same error. I would add eventId into the errerMessage would be a good idea.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services