roryqi commented on PR #14326:
URL: https://github.com/apache/gravitino/pull/14326#issuecomment-6684321383

   Thanks for the review. The deletion refactor is in 
081a5e032e6602ff39d164f29273bc01059bd0d6.
   
   1. **Existing policies:** initialization belongs with the migration 
follow-up (#14375). This PR creates the hidden tag for new policies; the 
internal `addPolicyToObject` helper expects it to exist already. It only 
assigns that tag to the object. Existing-policy overwrite intentionally does 
not backfill it, as documented.
   
   2. **Reserved prefix:** we are keeping the case-insensitive 
`gravitino_hidden_` namespace. We consider a pre-existing user tag with this 
distinct prefix unlikely enough to accept the collision risk, and prefer to 
keep one namespace rule for creation and visibility.
   
   3. **Transactions:** confirmed: nested calls reuse the thread-local 
`SqlSession`, and commit only when its reference count reaches zero. 
[`testLifecycleHookFailureRollsBackInsert`](https://github.com/apache/gravitino/blob/081a5e032e6602ff39d164f29273bc01059bd0d6/core/src/test/java/org/apache/gravitino/storage/relational/service/TestPolicyMetaService.java#L385)
 reads the newly inserted hidden tag and policy-tag relation inside 
`afterPersist`, then throws; it verifies that the policy, tag and relation are 
all rolled back. `IOException` is unwrapped by `insertPolicy`. We are retaining 
the existing duplicate-key handling under the reserved-namespace assumption in 
point 2.
   
   4. **Deletion reuse:** changed `deleteHiddenTagWithoutCommit` to call the 
existing `TagMetaService.deleteTag(identifier, lockedTag)` overload. Tag-row 
deletion and all dependent relation cleanup now share the ordinary tag 
implementation, including policy-tag relations. The policy operation retains 
the row lock, failure check and tag change-log entry within its outer 
transaction.
   
   5. **REST filtering:** this boundary is intentional. Internal policy 
resolution needs the hidden-tag edges, so managers retain them. The Java client 
uses the REST endpoints and receives filtered results.
   
   Validation: 65 policy/tag service tests passed on H2, including 
insert/delete rollback and dependent-relation cleanup. `spotlessApply` and `git 
diff --check` passed.
   


-- 
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