pan3793 commented on code in PR #8534:
URL: https://github.com/apache/hadoop/pull/8534#discussion_r3370637762
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancerLongRunningTasks.java:
##########
@@ -823,17 +824,20 @@ public void testBalancerMetricsDuplicate() throws
Exception {
// Throw an error when we double-initialize BalancerMetrics
DefaultMetricsSystem.setMiniClusterMode(false);
- MetricsSystem instance = DefaultMetricsSystem.instance();
- // Avoid the impact of cluster metric, remove cluster JvmMetrics
- instance.unregisterSource("JvmMetrics");
-
- final BalancerParameters balancerParameters = Balancer.Cli.parse(new
String[] {
- "-policy", BalancingPolicy.Node.INSTANCE.getName(),
- "-threshold", "10",
- });
- int r = Balancer.run(namenodes, nsIds, balancerParameters, conf);
- assertEquals(ExitStatus.SUCCESS.getExitCode(), r);
- DefaultMetricsSystem.setMiniClusterMode(true);
+ try {
+ MetricsSystem instance = DefaultMetricsSystem.instance();
+ // Avoid the impact of cluster metric, remove cluster JvmMetrics
Review Comment:
changed to memorize the prior state and restore it in the `finally` block
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]