marsii1017 opened a new pull request, #10595:
URL: https://github.com/apache/gravitino/pull/10595
### What changes were proposed in this pull request?
This PR fixes `PolicyMetaService.deletePolicyVersionsByRetentionCount(...)`
to enforce `limit` as a global budget per invocation.
- Track a remaining budget across policies.
- Pass remaining budget to `softDeletePolicyVersionsByRetentionLine(...)`.
- Stop deleting when the budget is exhausted.
- Add regression test
`testDeletePolicyVersionsByRetentionCountRespectGlobalLimit`.
### Why are the changes needed?
Previously, `limit` was applied per policy in the loop, which could delete
up to `limit * numberOfPolicies` in one GC run, exceeding the intended
single-batch cap and causing unexpectedly large cleanup operations.
This change ensures one run respects a bounded deletion cap while still
making progress across runs.
Fix: #10275
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
- Added unit test:
-
`TestPolicyMetaService.testDeletePolicyVersionsByRetentionCountRespectGlobalLimit`
- Ran:
- `./gradlew :core:compileJava`
- `./gradlew :core:test --tests
org.apache.gravitino.storage.relational.service.TestPolicyMetaService.testDeletePolicyVersionsByRetentionCountRespectGlobalLimit
-PskipITs -PskipDockerTests=false`
--
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]