You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "hdygxsj (via GitHub)" <gi...@apache.org> on 2026/01/26 14:29:08 UTC

[PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

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

   ### What changes were proposed in this pull request?
   
   support preload table metadata in batch metadata authorization
   
   ### Why are the changes needed?
   
   Fix: #9802
   
   ### Does this PR introduce _any_ user-facing change?
   
   None
   
   ### How was this patch tested?
   
   Existing IT test in org.apache.gravitino.client.integration.test.authorization.TableAuthorizationIT
   


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

Posted by "hdygxsj (via GitHub)" <gi...@apache.org>.
hdygxsj commented on PR #9803:
URL: https://github.com/apache/gravitino/pull/9803#issuecomment-3799891904

   @jerqi PHAL


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi merged PR #9803:
URL: https://github.com/apache/gravitino/pull/9803


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

Posted by "hdygxsj (via GitHub)" <gi...@apache.org>.
hdygxsj commented on PR #9803:
URL: https://github.com/apache/gravitino/pull/9803#issuecomment-3799963801

   after batch get we only need 2.8 s for 5000 tables
   <img width="1056" height="772" alt="image" src="https://github.com/user-attachments/assets/8d374bc3-7cef-4312-86bf-c7c864ee3af5" />
   
   before batch get we need 4-5s for 5000 tables
   <img width="1608" height="990" alt="image" src="https://github.com/user-attachments/assets/78896f8a-f99b-4995-a5f0-83e533ea9c57" />
   
   After this PR, the main bottleneck lies in fetching the owner ID; we need to further optimize batch operations for IDs.
   <img width="1236" height="864" alt="image" src="https://github.com/user-attachments/assets/fd61bc9c-f4de-4056-83d7-cfb11e40bae0" />
   
   


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #9803:
URL: https://github.com/apache/gravitino/pull/9803#discussion_r2735231952


##########
server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataAuthzHelper.java:
##########
@@ -136,6 +137,7 @@ public static NameIdentifier[] filterByExpression(
       String expression,
       Entity.EntityType entityType,
       NameIdentifier[] nameIdentifiers) {
+    preloadToCache(entityType, nameIdentifiers);

Review Comment:
   Prefetching the tables is a nice optimization for Jcasbin. I have the following points that need to be cleared up. 
   - It seems that we need to load all tables in a schema whenever calling `filterByExpression`, Is there a way to cache them?
   - Based on the code,  although you just put tables in the entity cache, you did not use any of them when executing `batchGet`, am I right?
   ```
   @Override
     public <E extends Entity & HasIdentifier> List<E> batchGet(
         List<NameIdentifier> ident, Entity.EntityType entityType, Class<E> clazz) {
       List<E> entities = backend.batchGet(ident, entityType);
       for (E entity : entities) {
         cache.put(entity);
       }
       return entities;
     }
   ```
   



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #9803:
URL: https://github.com/apache/gravitino/pull/9803#discussion_r2740654881


##########
server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataAuthzHelper.java:
##########
@@ -318,4 +325,15 @@ private static void checkExecutor() {
       }
     }
   }
+
+  private static void preloadToCache(
+      Entity.EntityType entityType, NameIdentifier[] nameIdentifiers) {
+    if (GravitinoEnv.getInstance().config().get(Configs.CACHE_ENABLED)) {

Review Comment:
   GravitinoEnv.getInstance()#cacheEnabled



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

Posted by "hdygxsj (via GitHub)" <gi...@apache.org>.
hdygxsj commented on code in PR #9803:
URL: https://github.com/apache/gravitino/pull/9803#discussion_r2736624823


##########
server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataAuthzHelper.java:
##########
@@ -136,6 +137,7 @@ public static NameIdentifier[] filterByExpression(
       String expression,
       Entity.EntityType entityType,
       NameIdentifier[] nameIdentifiers) {
+    preloadToCache(entityType, nameIdentifiers);

Review Comment:
   Regarding the first point, I've optimized the code so that batchGet is now only performed for entities not present in the cache.
   Regarding the second point: Yes.



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on PR #9803:
URL: https://github.com/apache/gravitino/pull/9803#issuecomment-3809393149

   cc @yuqi1129 U are the owner of storage module. Could u give some suggestion?


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#9802] feat(authz): support preload table metadata in batch metadata authorization [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on code in PR #9803:
URL: https://github.com/apache/gravitino/pull/9803#discussion_r2740648968


##########
server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataAuthzHelper.java:
##########
@@ -136,6 +137,7 @@ public static NameIdentifier[] filterByExpression(
       String expression,
       Entity.EntityType entityType,
       NameIdentifier[] nameIdentifiers) {
+    preloadToCache(entityType, nameIdentifiers);

Review Comment:
   Okay. The code LGTM overall. Can you spare some time to solve the CI problem?



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org