nicoloboschi opened a new pull request, #19666:
URL: https://github.com/apache/pulsar/pull/19666

   ### Motivation
   
   The `LedgerOffloaderStatsImpl` singleton close method can't be called twice 
due to wrong condition in the close method.
   Also not every metric is unregistered from the prometheus collector.
   Also there might be concurrency issues while closing.
   
   I've noticed that the test `LedgerOffloaderMetricsTest` often fails if the 
topic test method is executed after the namespace one.
   This is because the assertions in the namespace test are not strict enough 
to catch the error. 
   
   ### Modifications
   
   * Set the singleton instance to null after closing
   * Unregister all the metrics
   * Add `synchronized` to the close method which makes sense since the 
creation method is synchronized too
   * Fix assertion in LedgerOffloaderMetricsTest to be more precise
   
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   


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

Reply via email to