adutra commented on code in PR #4545:
URL: https://github.com/apache/polaris/pull/4545#discussion_r3303234876
##########
persistence/nosql/persistence/metastore/src/main/java/org/apache/polaris/persistence/nosql/metastore/mutation/PolicyMutation.java:
##########
@@ -131,11 +134,22 @@ public PolicyAttachmentResult apply() {
}
}
+ var policyMapping =
PolicyMapping.builder().parameters(parameters).build();
+ var serializedPolicyMappingSize =
+ POLICY_MAPPING_SERIALIZER.serializedSize(policyMapping);
+ if (serializedPolicyMappingSize >
MAX_POLICY_MAPPING_INDEX_VALUE_SIZE) {
+ return state.noCommit(
+ new PolicyAttachmentResult(
+ UNEXPECTED_ERROR_SIGNALED,
Review Comment:
Shouldn't we use a better error code for this client input validation
failure?
##########
persistence/nosql/persistence/metastore/src/main/java/org/apache/polaris/persistence/nosql/metastore/mutation/PolicyMutation.java:
##########
@@ -47,6 +48,8 @@ public record PolicyMutation(
long targetId,
boolean doAttach,
@NonNull Map<String, String> parameters) {
+ private static final int MAX_POLICY_MAPPING_INDEX_VALUE_SIZE = 384;
Review Comment:
Also should this be public? (and reused in tests)
##########
persistence/nosql/persistence/metastore/src/main/java/org/apache/polaris/persistence/nosql/metastore/mutation/PolicyMutation.java:
##########
@@ -47,6 +48,8 @@ public record PolicyMutation(
long targetId,
boolean doAttach,
@NonNull Map<String, String> parameters) {
+ private static final int MAX_POLICY_MAPPING_INDEX_VALUE_SIZE = 384;
Review Comment:
Why 384?
--
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]