You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by "csudharsanan (via GitHub)" <gi...@apache.org> on 2024/06/03 18:42:22 UTC
Re: [PR] [apache/helix] --> Update logic for metric calculation when replica is set to ANY_LIVEINSTANCE [helix]
csudharsanan commented on code in PR #2804:
URL: https://github.com/apache/helix/pull/2804#discussion_r1624896112
##########
helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java:
##########
@@ -274,13 +275,22 @@ public void updateResourceState(ExternalView externalView, IdealState idealState
Set<String> partitions = idealState.getPartitionSet();
int replica;
try {
- replica = Integer.valueOf(idealState.getReplicas());
- } catch (NumberFormatException e) {
- _logger.info("Unspecified replica count for {}, skip updating the ResourceMonitor Mbean: {}", _resourceName,
- idealState.getReplicas());
- return;
+ String replicaCount = idealState.getReplicas();
+ if (!replicaCount.equals(ResourceConfig.ResourceConfigConstants.ANY_LIVEINSTANCE.name())) {
+ try {
+ replica = Integer.parseInt(replicaCount);
+ } catch (NumberFormatException ex) {
+ _logger.info(
+ "Unspecified replica count for {}, skip updating the ResourceMonitor Mbean: {}",
+ _resourceName, idealState.getReplicas());
+ return;
+ }
+ } else {
+ replica = -1;
+ }
Review Comment:
@junkaixue I've updated the code to use an existing IdealState method (getReplicaCount mentioned above by komal) that sets it to -1 when replica is ANY_LIVEINSTANCE. are you referring to the same ?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org