Skip to content

Core: close MetricsReporter when RESTSessionCatalog is closed#16310

Merged
huaxingao merged 1 commit into
apache:mainfrom
talatuyarer:restcatalog-close-reporter
May 14, 2026
Merged

Core: close MetricsReporter when RESTSessionCatalog is closed#16310
huaxingao merged 1 commit into
apache:mainfrom
talatuyarer:restcatalog-close-reporter

Conversation

@talatuyarer
Copy link
Copy Markdown
Contributor

RESTSessionCatalog loaded a custom MetricsReporter via CatalogUtil.loadMetricsReporter but failed to register it with the closeables group. Consequently, RESTCatalog.close() did not propagate to the reporter, leading to resource leaks for the JVM's lifetime.

This change registers the reporter with the catalog's CloseableGroup, ensuring close() cascades and mirrors BaseMetastoreCatalog behavior.

@github-actions github-actions Bot added the core label May 13, 2026
Comment thread core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java Outdated
@nastra nastra self-requested a review May 13, 2026 07:40
Comment thread core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java Outdated
Comment thread core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java Outdated
Comment thread core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java Outdated
@nastra
Copy link
Copy Markdown
Contributor

nastra commented May 13, 2026

thanks for catching this @talatuyarer. I think we missed updating this because closing the MetricsReporter was added later as part of #9353

Comment thread core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java Outdated
* counter (the reporter is loaded reflectively, so per-instance state is not directly reachable
* from the test).
*/
public static class CloseTrackingMetricsReporter
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just enhance the CatalogTests.CustomMetricsReporter to record the close rather than using new one ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @singhpk234. Your comment reminded me of the test in CatalogTests. I've moved my standalone test there. Now, we're testing all catalogs, not just the REST catalog.

@talatuyarer talatuyarer force-pushed the restcatalog-close-reporter branch from f7bb073 to 154b4af Compare May 13, 2026 23:27
Copy link
Copy Markdown
Contributor

@huaxingao huaxingao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@huaxingao
Copy link
Copy Markdown
Contributor

@singhpk234 @nastra

Do you have any further comments? I believe @talatuyarer would like this fix included in the 1.11 release. If there are no objections, I will merge this PR before RC2 cut tonight.

Also cc @aihuaxu

Copy link
Copy Markdown
Contributor

@singhpk234 singhpk234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @talatuyarer !

@aihuaxu
Copy link
Copy Markdown
Contributor

aihuaxu commented May 14, 2026

@singhpk234 @nastra

Do you have any further comments? I believe @talatuyarer would like this fix included in the 1.11 release. If there are no objections, I will merge this PR before RC2 cut tonight.

Also cc @aihuaxu

LGTM. Seems straightforward to me.

@huaxingao huaxingao merged commit 8b45abc into apache:main May 14, 2026
36 checks passed
@huaxingao
Copy link
Copy Markdown
Contributor

Thanks @talatuyarer for the PR! Thanks @nastra @singhpk234 @aihuaxu for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants