jerryshao commented on code in PR #15115:
URL: https://github.com/apache/gravitino/pull/15115#discussion_r4630446982


##########
core/src/test/java/org/apache/gravitino/domain/TestDomainManager.java:
##########
@@ -662,6 +669,31 @@ public void testDeleteDomain() {
     Assertions.assertEquals(0, domainManager.listDomains(METALAKE).length);
   }
 
+  @Test
+  public void testDeleteChecksStatus() {

Review Comment:
   Added `TestDomainMetaService.testDeleteChecksStatusOfLockedRow` in 
1ca24df623: a publish holds the row in an open transaction, the delete reads 
DRAFT and waits for the lock, then the publish commits; the delete fails with 
`IllegalArgumentException` and a fresh read returns PUBLISHED. Verified it 
fails with your mutation (pre-lock `domainPO` in the callback). The latch 
helper is generalized to `alterInOpenTransaction`.
   
   _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_



##########
api/src/main/java/org/apache/gravitino/domain/DomainOperations.java:
##########
@@ -117,11 +117,14 @@ Domain alterDomain(String name, DomainChange... changes)
       throws NoSuchDomainException, DomainAlreadyExistsException, 
IllegalArgumentException;
 
   /**
-   * Deletes a domain. The backing tag and the tags on the member objects are 
kept.
+   * Deletes a draft domain. The backing tag and the tags on the member 
objects are kept. A
+   * published domain must be unpublished first. The status is checked before 
the sub-domains, so
+   * deleting a published domain with sub-domains throws {@link 
IllegalArgumentException}.
    *
    * @param name The name of the domain.
    * @return True if the domain is deleted, false if it does not exist.

Review Comment:
   In 1ca24df623 the return contract now says `false` also covers a draft 
hidden from the caller, which is not deleted, in 
`DomainOperations.deleteDomain` (inherited by the Java client) and the Python 
`delete_domain` docstrings. The user guide's 200 and 404 rows now say DELETE 
returns `dropped: false` for a hidden draft and 404 only for a missing metalake.
   
   _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_



##########
docs/manage-domains-in-gravitino.md:
##########
@@ -283,8 +283,12 @@ draft = domain.unpublish()
 
 ### Delete a Domain
 
-Delete or detach children before deleting their parent. Members alone do not 
prevent deletion.
-The operation keeps backing tags and object assignments and returns false if 
the domain is absent.
+Only a draft domain can be deleted. Unpublish a published domain first; 
deleting it fails with
+HTTP 400 and `IllegalArgumentException`. Delete or detach children before 
deleting their parent;
+deleting a draft parent with children fails with HTTP 409 and 
`NonEmptyDomainException`. The status

Review Comment:
   In 1ca24df623 the Delete bullet in `design-docs/domain-design.md` now says 
deletion requires DRAFT and the status is checked before children, and the HTTP 
status table source columns are aligned.
   
   _🤖 Addressed by [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]

Reply via email to