seoyoniee opened a new pull request, #4317:
URL: https://github.com/apache/amoro/pull/4317
## Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you add a feature, you can talk about its use case.
2. If you fix a bug, you can clarify why it is a bug.
3. Use Fix/Resolve/Close #{ISSUE_NUMBER} to link this PR to its related
issue
-->
Close #4316
Auto-created tags are useful as long-lived checkpoints for archival and
audit. For that, a calendar month is often the right granularity — `daily`
creates ~365 refs per table per year, and each one pins a snapshot from
expiration.
`tag.auto-create.trigger.period` currently accepts only `hourly` and
`daily`, so there is no way to express this without giving up auto-create and
driving `createTag()` from an external scheduler.
## Brief change log
- `TagConfiguration.Period`: add `MONTHLY("monthly")`.
- `TagConfiguration.Period#periodDuration()`: widen `Duration` →
`TemporalAmount`.
A calendar month is not a fixed-length duration, so `java.time.Period` is
needed here. With `Duration.ofDays(30)` the February tag would be named
`tag-202601`, collide with January's, and never be created.
`DAILY`/`HOURLY` keep returning `Duration` (covariant override).
- `TableProperties`: add `AUTO_CREATE_TAG_FORMAT_MONTHLY_DEFAULT =
"'tag-'yyyyMM"`.
- `TableConfigurations#parseTagConfiguration`: add the `MONTHLY` case to the
default-format switch (it throws on unknown periods). The same switch is
duplicated in `TestAutoCreateIcebergTagAction`'s helper and updated too.
- Docs updated.
## How was this patch tested?
- [x] Add some test cases that check the changes thoroughly including
negative and positive cases if possible
`TestAutoCreateIcebergTagAction`: `testCreateMonthlyTag`,
`testMonthlyTagNameAcrossMonthBoundary` (Feb/Mar, leap year, year
boundary), and `monthly` cases in `testTriggerTimePeriod`.
- [x] Run test locally before making a pull request
## Documentation
- Does this pull request introduce a new feature? (yes)
- If yes, how is the feature documented? (docs)
--
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]