smengcl opened a new pull request, #11894: URL: https://github.com/apache/ozone/pull/11894
Generated-by: Claude Code (Opus 5.5) ## What changes were proposed in this pull request? Each `TypedTable` with a cache owns a single thread executor in its `FullTableCache` or `PartialTableCache`. The FULL cache executor runs a cleanup task every second from creation, and the PARTIAL one starts its thread on the first cleanup. Nothing ever shuts these executors down, so a stopped `OmMetadataManagerImpl`, or one whose tables are replaced, leaves its cleanup threads running, and the scheduled FULL task keeps the old cache (a full in memory copy of the volume, bucket and revoked STS token tables) reachable. This happens on every checkpoint install on an OM follower (`OzoneManager.reloadOMState` stops the old metadata manager and creates a new one) and on every full OM DB snapshot sync in Recon (`ReconOmMetadataManagerImpl.updateOmDB` initializes new FULL cache tables over the old ones). The threads are daemon threads, so shutdown and data are not affected, but threads and old caches accumulate until the process restarts. This PR: - adds `TableCache.close` (no op by default), which shuts down the executor in `FullTableCache` and `PartialTableCache`; - adds `Table.closeCache` (no op by default), which `TypedTable` forwards to its cache; - calls `closeCache` on all tables in `OmMetadataManagerImpl.stop`, and on a table that `OmMetadataManagerImpl`'s table initializer replaces (the Recon sync case). On install the double buffer is flushed and stopped before the old metadata manager is stopped, and on OM stop the Ratis server stops first, so no cache cleanup reaches a closed cache. Recon never calls `cleanupCache`. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17460 ## How was this patch tested? - New `TestOmMetadataManager#testStopShutsDownTableCacheThreads`: starts both a FULL and a PARTIAL cleanup thread, stops the metadata manager and waits for those threads to end. - New check in `TestReconOmMetadataManagerImpl#testUpdateOmDB`: after the second `updateOmDB`, the FULL cleanup threads of the replaced tables must end. Both waits time out without the fix. Locally with the fix, `TestTableCache`, `TestTypedTable`, `TestRDBTableStore`, `TestTypedRDBTableStore`, `TestOmMetadataManager`, `TestReconOmMetadataManagerImpl`, `TestOMDBUpdatesHandler` and `TestOzoneManagerServiceProviderImpl` pass, and checkstyle is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
