You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2018/03/13 22:53:26 UTC

helix git commit: [HELIX-677] Change error log to info/warning when replica count cannot be read in ResourceMonitor.

Repository: helix
Updated Branches:
  refs/heads/master 0147f9466 -> 5383e7318


[HELIX-677] Change error log to info/warning when replica count cannot be read in ResourceMonitor.

Some string such as ALL_LIVEINSTANCES in the replica field cannot be processed by the monitor. And those resources are not expected to be monitoring.
Currently error log on this case drags too much attention. Lower the log level to info/warning according to the Exception type.


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/5383e731
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/5383e731
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/5383e731

Branch: refs/heads/master
Commit: 5383e7318e874d94bb0f01072be56bb57c392275
Parents: 0147f94
Author: Jiajun Wang <jj...@linkedin.com>
Authored: Wed Feb 21 14:16:30 2018 -0800
Committer: jiajunwang <er...@gmail.com>
Committed: Tue Mar 13 15:52:42 2018 -0700

----------------------------------------------------------------------
 .../org/apache/helix/monitoring/mbeans/ResourceMonitor.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/5383e731/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
index 42d2bf2..3d5c579 100644
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
+++ b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
@@ -215,11 +215,14 @@ public class ResourceMonitor extends DynamicMBeanProvider {
 
     _numOfPartitions.updateValue(partitions.size());
 
-    int replica = -1;
+    int replica;
     try {
       replica = Integer.valueOf(idealState.getReplicas());
     } catch (NumberFormatException e) {
-      _logger.error("Invalid replica count for " + _resourceName + ", failed to update its ResourceMonitor Mbean!");
+      _logger.info("Unspecified replica count for " + _resourceName + ", skip updating the ResourceMonitor Mbean: " + idealState.getReplicas());
+      return;
+    } catch (Exception ex) {
+      _logger.warn("Failed to get replica count for " + _resourceName + ", cannot update the ResourceMonitor Mbean.");
       return;
     }