smengcl opened a new pull request, #11706:
URL: https://github.com/apache/ozone/pull/11706

   Generated-by: Claude Code (Opus 5.5)
   
   ## What changes were proposed in this pull request?
   
   `ContainerCache#shutdownCache` runs 
`Preconditions.checkArgument(cleanupDb(db), ...)` for every cached schema V1/V2 
container DB, so it throws `IllegalArgumentException` when one of them is still 
referenced, for example by a running `BlockDeletingTask` (handlers are stopped 
before `blockDeletingService` in `OzoneContainer#stop`). Nothing on the stop 
path catches it, so the remaining V1/V2 DBs, the schema V3 DBs, the volume sets 
and the rest of the datanode shutdown are skipped. When the datanode stops 
itself through `HddsDatanodeService#terminateDatanode`, the exception escapes 
`stop()` and `terminate(1)` is never reached, so the datanode stays up with its 
services stopped instead of exiting and being restarted.
   
   This PR makes `shutdownCache` close and remove every DB it can and leave a 
DB that is still referenced open in the cache, with one WARN line naming it. 
Force closing it would make its user's next DB call fail and break the 
reference count contract. A skipped DB is closed by a later eviction, 
`removeDB` or `shutdownCache` once released, or by process exit on a real stop. 
Nothing changes when no DB is referenced.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17355
   
   ## How was this patch tested?
   
   - `TestContainerCache` including the new `testShutdownCacheKeepsDBInUseOpen` 
(fails without the fix with `IllegalArgumentException: refCount: 1`): 4 tests 
passed
   - `TestOzoneContainer`: 36 tests passed
   - `TestBlockDeletingService`: 81 tests, 0 failures (8 skipped)
   - Checkstyle on `hadoop-hdds/container-service`: no violations
   
   🤖 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]

Reply via email to