You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "mchades (via GitHub)" <gi...@apache.org> on 2025/08/13 10:04:09 UTC

[PR] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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

   ### What changes were proposed in this pull request?
   
   - remove remove `inheritable`, `exclusive` from policy
   - move `supported_object_types` from policy to content
   - only validate the `supported_object_types` for built-in policy
   
   ### Why are the changes needed?
   
   Fix: #8064
   
   ### Does this PR introduce _any_ user-facing change?
   
   no
   
   ### How was this patch tested?
   
   tests updated
   


-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
core/src/main/java/org/apache/gravitino/storage/relational/service/PolicyMetaService.java:
##########
@@ -305,19 +305,6 @@ public List<PolicyEntity> associatePoliciesWithMetadataObject(
               ? Collections.emptyList()
               : getPolicyPOsByMetalakeAndNames(metalake, policyNamesToAdd);

Review Comment:
   The relevant check logic has been removed, and other check logic is in another [PR](https://github.com/apache/gravitino/pull/7842/files#diff-1d6a9bb4111963dfdd2e5dcb2690acdad1d7e1ccecc2f48428f2af3f90dc54f5) that has not been merged yet.
   
   



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
core/src/test/java/org/apache/gravitino/meta/TestPolicyEntity.java:
##########
@@ -50,7 +50,7 @@ public void testPolicyEntityFields() {
             .withName("test")
             .withNamespace(namespace)
             .withComment("test comment")
-            .withPolicyType("my_compaction")
+            .withPolicyType("custom")

Review Comment:
   Why don't we make this field enum?



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
core/src/main/java/org/apache/gravitino/storage/relational/service/PolicyMetaService.java:
##########
@@ -305,19 +305,6 @@ public List<PolicyEntity> associatePoliciesWithMetadataObject(
               ? Collections.emptyList()
               : getPolicyPOsByMetalakeAndNames(metalake, policyNamesToAdd);

Review Comment:
   I remembered that you have several checking logic in the storage layer, do you need to remove that logic?



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
core/src/main/java/org/apache/gravitino/meta/PolicyEntity.java:
##########
@@ -73,9 +64,6 @@ public static Builder builder() {
   private String policyType;

Review Comment:
   I think we'd use enum internally, to avoid unexpected type and force the type check on serde.



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
core/src/main/java/org/apache/gravitino/meta/PolicyEntity.java:
##########
@@ -73,9 +64,6 @@ public static Builder builder() {
   private String policyType;

Review Comment:
   ok, fixed. Please help to review again, thanks!



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
api/src/main/java/org/apache/gravitino/policy/Policy.java:
##########
@@ -103,8 +76,10 @@ public static BuiltInType fromPolicyType(String policyType) {
             String.format("Unknown built-in policy type: %s", policyType));
       }

Review Comment:
   For "custom", this logic is correct?



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
api/src/main/java/org/apache/gravitino/policy/PolicyOperations.java:
##########
@@ -74,38 +71,6 @@ Policy createPolicy(
       String name, String type, String comment, boolean enabled, PolicyContent content)

Review Comment:
   Shall we use enum type? I think for custom policy, the type should always be "CUSTOM", what do you think? cc @yuqi1129 



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
api/src/main/java/org/apache/gravitino/policy/PolicyOperations.java:
##########
@@ -74,38 +71,6 @@ Policy createPolicy(
       String name, String type, String comment, boolean enabled, PolicyContent content)

Review Comment:
   OK.



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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

   > For built-in policy, we should also validate other rules?
   > 
   > > only validate the supported_object_types for built-in policy
   
   Yes, when we add the built-in policy implementation, we should also implement the `validate()` method in the corresponding built-in content interface.


-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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

   For built-in policy, we should also validate other rules?
   
   > only validate the supported_object_types for built-in policy


-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
api/src/main/java/org/apache/gravitino/policy/Policy.java:
##########
@@ -103,8 +76,10 @@ public static BuiltInType fromPolicyType(String policyType) {
             String.format("Unknown built-in policy type: %s", policyType));
       }

Review Comment:
   It's correct. if the policy is custom, the method will be return in above L70:
   ```
    for (BuiltInType type : BuiltInType.values()) {
           if (type.policyType.equalsIgnoreCase(policyType)) {
             return type;
           }
         }
   ``` 



-- 
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] [#8064] improvement(policy): simplify the definition of policy [gravitino]

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


##########
api/src/main/java/org/apache/gravitino/policy/PolicyOperations.java:
##########
@@ -74,38 +71,6 @@ Policy createPolicy(
       String name, String type, String comment, boolean enabled, PolicyContent content)

Review Comment:
   I have fixed the type value of the custom policy to "custom", but still use string as the field type for `policyType`, this is to minimize the impact on clients for future changes. You can review again.



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