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

   ### What changes were proposed in this pull request?
   
   - **New `JcasbinAuthorizationCacheKeys.nestedInvalidationPrefixes`.** It 
returns the object's own key
     and, for a schema, a second prefix ending with the hierarchical schema 
separator (`...SCHEMA␟A:`),
     so `A:B`, `A:B:C` and the objects under them are evicted with `A`.
   - `JcasbinAuthorizer.handleEntityNameIdMappingChange` uses it in one 
invalidation batch, and
     `JcasbinChangeListener.onEntityChange` adds both prefixes to its coalesced 
prefix set.
   
   ### Why are the changes needed?
   
   **Dropping schema `A` left stale name-to-id entries for its nested 
schemas.** The key stores `A:B` as
   one part, so prefix eviction on `A|` missed it. A recreated `A:B` could be 
checked against the old ids
   until the entry expired.
   
   Fix: #14248
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   New `TestJcasbinHierarchicalSchemaInvalidation`: 
`testLocalSchemaDropEvictsHierarchicalDescendants`
   and `testChangeLogSchemaDropEvictsHierarchicalDescendants`. Both check that 
`A:B`, `A:B:C`, `A:B.t` and
   `A:B.v` are evicted and that sibling `AB` and `AB.t` stay cached.
   
   - **On `main`:** both new tests fail ("stale name-to-id entry survived the 
drop of schema A: cat1.A:B").
   - **With the fix:** both pass, as do the other JCasbin tests in 
`server-common`, `TestJcasbinAuthorizer` (95) included.
   
   `./gradlew -PskipITs :server-common:test --tests 
'org.apache.gravitino.server.authorization.jcasbin.*'`
   


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