Anoous opened a new pull request, #18671: URL: https://github.com/apache/iceberg/pull/18671
When connector options are used without a caller-owned catalog, `FlinkDynamicTableFactory` creates a temporary `FlinkCatalog` but leaves its underlying catalog open after extracting a loader, including when database or table operations fail. This can leak catalog-owned FileIO and client resources. Make `FlinkCatalog` implement `AutoCloseable` using its existing `close()` method and scope both temporary-catalog paths with try-with-resources. Caller-owned catalogs remain open, loaders can create independent catalog instances, and cleanup failures are suppressed behind an existing operation failure. Applies to Flink 1.20, 2.2, and 2.3. Test plan and validation (JDK 17): - Verify source/sink creation, existing tables, and dynamic sinks release temporary catalogs while returned loaders remain usable; verify caller-owned catalogs stay open. - Verify cleanup after namespace/table failures, standalone close failures, and suppressed close failures. - On unmodified main, the Flink 1.20 regression run failed 8 lifecycle cases and passed 2 caller-ownership cases. With the fix, all 60 selected tests passed across the three versions (`TestFlinkDynamicTableFactory`, `TestFlinkCatalogFactory`, `TestCatalogLoader`, `TestCatalogTableLoader`). - All three module `build`, `checkstyleMain`, and `checkstyleTest` tasks passed with those test filters. `spotlessApply`, `spotlessCheck`, and `git diff --check` passed. The complete Flink test suites and a live REST service were not run. --- **AI Disclosure** - Model: GPT-6 - Platform/Tool: OpenAI Codex - Human Oversight: unreviewed - Prompt Summary: Diagnose factory-owned temporary catalog leakage, generate the lifecycle changes and regression tests, verify them locally, and submit an upstream PR. The implementation and tests were AI-generated; the validation scope and remaining limits are listed above. -- 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]
