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

   ### What changes were proposed in this pull request?
   
   Tighten Iceberg maintenance policy write-time validation:
   
   1. **#14422** — share orphan `location` syntax checks via 
`IcebergOrphanFileRemovalContent.parseAndValidateLocation` (includes 
`URI.create` / absolute path). `OrphanFileLocationUtils.normalizeLocation` 
reuses the same helper so create/update and job submission reject the same 
illegal values (spaces, control chars, etc.).
   2. **#14418** — introduce shared `StrictLongDeserializer` / 
`StrictBooleanDeserializer` on `PolicyContentDTO` and apply them to compaction 
numerics, orphan `olderThanDays`/`dryRun`, rewrite-manifest 
thresholds/`use_caching`, snapshot fields, and peer 
`minIntervalMs`/`commitTrigger` on all four Iceberg maintenance DTOs. Removes 
the duplicated snapshot/manifest strict readers.
   
   ### Why are the changes needed?
   
   Fix: #14422
   Fix: #14418
   
   Invalid orphan locations were stored and only failed at job run; wrong JSON 
types were silently truncated/coerced for most maintenance fields while 
snapshot `olderThanDays` was already strict.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Policy create/update now returns 400 for:
   - orphan `location` values that are not valid absolute URIs (e.g. embedded 
spaces)
   - fractional numbers, numeric strings, and non-boolean tokens on the 
maintenance fields listed above
   
   ### How was this patch tested?
   
   ```
   ./gradlew :api:test :common:test :maintenance:optimizer-api:test -PskipITs \
     --tests org.apache.gravitino.policy.TestIcebergOrphanFileRemovalContent \
     --tests org.apache.gravitino.dto.policy.TestOrphanFileRemovalPolicyDTO \
     --tests org.apache.gravitino.dto.policy.TestCompactionPolicyStrictTypes \
     --tests org.apache.gravitino.dto.policy.TestSnapshotExpirationPolicyDTO \
     --tests org.apache.gravitino.dto.policy.TestManifestRewritePolicyDTO
   ./gradlew :maintenance:optimizer-api:test -PskipITs
   ```
   
   Made with [Cursor](https://cursor.com)


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