jerryshao opened a new pull request, #15115: URL: https://github.com/apache/gravitino/pull/15115
### What changes were proposed in this pull request? Only a draft domain can be deleted. - `DomainManager.deleteDomain` checks the status of the locked domain row (`checkDelete`) and rejects a published domain with `IllegalArgumentException`: "Domain X cannot be deleted while it is published, unpublish it first". The check runs in the same transaction and row lock as the existing sub-domain check, before it, so a published domain with sub-domains fails with the status error. - The REST layer maps it to HTTP 400, like the publish/unpublish/attach status rules. No new exception type. - Javadoc of `DomainOperations.deleteDomain` (API) and `DomainDispatcher.deleteDomain`, the Python client docstrings, the OpenAPI spec (`domains.yaml`) and `manage-domains-in-gravitino.md` describe the rule; the complete Java/Python examples unpublish before deleting. - Java and Python ITs that deleted published domains now unpublish them first, and check the rejection. ### Why are the changes needed? A published domain could be deleted in one step, while the other status rules already protect published domains (a domain with published sub-domains cannot be unpublished, a sub-domain is published only under a published parent). Enforcing it on the server keeps the REST API, clients and UI consistent. Fixes #15114 ### Does this PR introduce _any_ user-facing change? Yes, for the unreleased 2.0.0 domain API: deleting a published domain now fails with HTTP 400 / `IllegalArgumentException`; unpublish it first. Deleting a draft domain is unchanged; a draft with sub-domains still fails with HTTP 409 / `NonEmptyDomainException`. ### How was this patch tested? - `TestDomainManager.testDeleteChecksStatus`: published delete rejected and the domain kept, status checked before sub-domains, delete succeeds after unpublish. - `TestDomainOperations.testDeletePublishedDomain` (server): HTTP 400 with `IllegalArgumentException`. - Updated `DomainIT`, `DomainAuthorizationIT` and the Python domain ITs. - `./gradlew :core:test --tests '*Domain*' :server:test --tests '*Domain*' :clients:client-java:test --tests 'org.apache.gravitino.client.TestDomain*' :docs:build -PskipITs` 🤖 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]
