mlbiscoc commented on code in PR #4902: URL: https://github.com/apache/solr/pull/4902#discussion_r4031044029
########## solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java: ########## Review Comment: Based on [this PR](https://github.com/apache/solr/pull/4917) is what caused the leak. Do we need the rest of this stuff then? ########## solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java: ########## @@ -405,16 +367,19 @@ private LongCounterBuilder longCounterBuilder( private DoubleCounterBuilder doubleCounterBuilder( String registry, String counterName, String description, OtelUnit unit) { DoubleCounterBuilder builder = - meterProvider(registry) - .get(OTEL_SCOPE_NAME) - .counterBuilder(counterName) - .setDescription(description) - .ofDoubles(); + meter(registry).counterBuilder(counterName).setDescription(description).ofDoubles(); if (unit != null) builder.setUnit(unit.getSymbol()); return builder; } + private Meter meter(String registry) { + if (!enabled) { + return OpenTelemetry.noop().getMeterProvider().get(OTEL_SCOPE_NAME); + } + return meterProvider(registry).get(OTEL_SCOPE_NAME); + } Review Comment: I think this PR should be rescoped and titled to fixing this disabling of metrics. ########## solr/core/src/test/org/apache/solr/search/SolrIndexSearcherTest.java: ########## @@ -198,6 +206,15 @@ public void testHighMinExactCountWithQueryResultCache() throws IOException { }); } + public void testReplacedSearcherCanBeGarbageCollected() throws Exception { + WeakReference<SolrIndexSearcher> replacedSearcher = registerCurrentSearcherForGcCheck(); + + assertU(adoc("id", "1000000", "field1_s", "foo")); + openNewSearcherAndWait(); + + assertEventuallyReleased(replacedSearcher); Review Comment: If a test take a while depending on the person environment, probably nightly makes sense if that is the case in this test. -- 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]
