smengcl commented on code in PR #10763:
URL: https://github.com/apache/ozone/pull/10763#discussion_r4227429131


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerManagerFacade.java:
##########
@@ -377,7 +378,8 @@ public 
ReconStorageContainerManagerFacade(OzoneConfiguration conf,
 
     // Use a version manager with no upgrade actions. The version will only be 
used to track Datanode versions,
     // not run SCM specific reformatting on upgrade.
-    this.scmVersionManager = new ScmVersionManager(scmStorageConfig, this, 
HashMap::new);
+    this.scmVersionManager = new ScmVersionManager(scmStorageConfig, this, 
HashMap::new,
+        MetricUtil.metricsSourceComponent(conf, "ReconSCM"));

Review Comment:
   This gives Recon its own version-metrics source, but 
`ReconStorageContainerManagerFacade.stop()` never calls 
`scmVersionManager.close()`. I reproduced two local-cluster starts in the same 
JVM: after the first `close()`, `ComponentVersionManagerMetrics.ReconSCM` 
remained registered; the second start reused the exact same metrics source, and 
its `versionManager` still pointed to the first, stopped manager rather than 
the new Recon manager.
   
   Please close the version manager during shutdown so the next start registers 
metrics for its own instance:
   
   ```diff
   --- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerManagerFacade.java
   +++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerManagerFacade.java
   @@ -682,5 +682,6 @@
        containerManager.flushReplicaHistoryMapToDB(true);
        containerSyncMetrics.unRegister();
   +    scmVersionManager.close();
        scmSnapshotExecutor.shutdownNow();
        IOUtils.close(LOG, dbStore);
      }
   ```
   
   Please extend `TestLocalOzoneRecon` to assert that this source is absent 
after cluster close and that a second start gets a new source.



-- 
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]

Reply via email to