jerryshao opened a new pull request, #14350:
URL: https://github.com/apache/gravitino/pull/14350

   ### What changes were proposed in this pull request?
   
   > Depends on #14281 (#13882). This PR is stacked on it and stays draft until 
#14281 merges. Only the new commit: 
https://github.com/jerryshao/gravitino/compare/13882-domain-storage...13883-domain-rel
   
   Store the parent of each domain in a new `domain_rel` table and resolve it 
on domain reads.
   
   - Add the `domain_rel` table (one live parent per domain, indexed by parent) 
to the H2, MySQL and PostgreSQL 2.0.0 schema and upgrade scripts.
   - Add `DomainRelPO`, `DomainRelMapper` and its SQL providers.
   - Add `DomainRelService` to insert, re-point and remove a parent edge, to 
list sub-domains, and to resolve parents singly or in batch. Hierarchy changes 
lock the metalake row first, then the domain rows in ID order, so they keep the 
lock order of a metalake drop.
   - Keep the hierarchy acyclic: attaching or re-pointing a domain under one of 
its own sub-domains is refused. These changes hold the metalake row 
exclusively, so concurrent changes cannot close a cycle together.
   - Fill `DomainEntity.parent` on domain get, list and batch get, and reject a 
domain update that changes the parent.
   - Remove a domain's own edge when it is deleted, and refuse the delete while 
it has live sub-domains.
   - Soft-delete edges on metalake delete and hard-delete them in GC.
   
   ### Why are the changes needed?
   
   Domains form a hierarchy (epic #13864). The domain manager (#13884) needs 
storage for the parent edge with consistent locking before it can implement 
attach, move and detach.
   
   Fixes #13883
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. It adds the `domain_rel` table to the 2.0.0 schema and upgrade scripts; 
no API change.
   
   ### How was this patch tested?
   
   - New `TestDomainRelPO` and `TestDomainRelService`, covering edge insert / 
re-point / remove, cycle rejection, delete refusal while sub-domains exist, 
metalake delete (cascade and non-cascade), GC, and concurrency (concurrent 
attaches cannot form a cycle; parent delete and attach serialize).
   - Updated `TestDomainPO` and `TestDomainMetaService`.
   - Passed locally on H2; MySQL and PostgreSQL are covered by CI.
   
   🤖 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]

Reply via email to