smengcl opened a new pull request, #10987: URL: https://github.com/apache/ozone/pull/10987
## What changes were proposed in this pull request? `KeyDeletingService` opens the current snapshot database and may open previous snapshot databases while determining which deleted keys and rename entries are reclaimable. Each open snapshot DB handle retains a striped `SNAPSHOT_DB_LOCK` read lock. Previously, these handles remained open while `KeyDeletingService` submitted synchronous OM requests. This could form the following circular wait: 1. `KeyDeletingService` retains a snapshot DB read lock. 2. `OMDoubleBufferFlushThread` processes a snapshot purge that needs the colliding write lock. 3. The double-buffer flush blocks on the read lock. 4. The number of unflushed transactions reaches `ozone.om.unflushed.transaction.max.count`. 5. Transaction application blocks, preventing the synchronous KDS request from completing. 6. KDS cannot return and close the snapshot DB handle. This change releases all snapshot DB handles after the metadata scan and before synchronous OM requests are submitted: - The current snapshot DB handle is closed early. - Previous-snapshot handles opened by the reclaimable filters are closed early. - Snapshot GC locks remain held until the corresponding OM requests complete, preserving snapshot-chain and block-reclamation correctness. - The existing try-with-resources cleanup remains as an exception-safety fallback. No snapshot database is accessed after the handles are released; subsequent processing uses metadata already materialized in memory. A regression test verifies that the current snapshot DB handle has been closed before `KeyDeletingService` submits an OM request. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-16118 ## How was this patch tested? The following validation passed: - `TestKeyDeletingService`: 18 tests - `TestReclaimableKeyFilter` and `TestReclaimableRenameEntryFilter`: 137 tests - Full 58-module Checkstyle - `git diff --check` Generated-by: Codex (GPT-5) -- 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]
