You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "nsivabalan (via GitHub)" <gi...@apache.org> on 2023/04/11 00:50:37 UTC
[GitHub] [hudi] nsivabalan opened a new pull request, #8422: [HUDI-6056] Calidate archival configs alignment with cleaner configs with policy based on hours
nsivabalan opened a new pull request, #8422:
URL: https://github.com/apache/hudi/pull/8422
### Change Logs
If both archival and cleaner is based on num_commits, we do have some validations in place that archival should not be aggressive compared to cleaner. But if cleaner is based on hours, we don't have any such conditions. we need to add them to ensure archival does not clean up any commits which cleaner has not cleaned up yet.
### Impact
Adding guard rails to archival when cleaner is based on num hours policy.
### Risk level (write none, low medium or high below)
low.
### Documentation Update
N/A
### Contributor's checklist
- [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] codope commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1163858777
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
+ String latestCommitToArchive = instantsToArchive.get(instantsToArchive.size() - 1).getTimestamp();
+ try {
+ Instant latestCommitInstant = HoodieActiveTimeline.parseDateFromInstantTime(commitTimeline.lastInstant().get().getTimestamp()).toInstant();
+ ZonedDateTime currentDateTime = ZonedDateTime.ofInstant(latestCommitInstant, ZoneId.systemDefault());
+ String earliestTimeToRetain = HoodieActiveTimeline.formatDate(Date.from(currentDateTime.minusHours(config.getCleanerHoursRetained()).toInstant()));
Review Comment:
Isn't there some util to do this thing? If not, can we extract this to a separate method?
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] danny0405 commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1172021405
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
+ String latestCommitToArchive = instantsToArchive.get(instantsToArchive.size() - 1).getTimestamp();
+ try {
+ Instant latestCommitInstant = HoodieActiveTimeline.parseDateFromInstantTime(commitTimeline.lastInstant().get().getTimestamp()).toInstant();
+ ZonedDateTime currentDateTime = ZonedDateTime.ofInstant(latestCommitInstant, ZoneId.systemDefault());
+ String earliestTimeToRetain = HoodieActiveTimeline.formatDate(Date.from(currentDateTime.minusHours(config.getCleanerHoursRetained()).toInstant()));
+ if (HoodieTimeline.compareTimestamps(latestCommitToArchive, GREATER_THAN_OR_EQUALS, earliestTimeToRetain)) {
+ throw new HoodieIOException("Please align your archival configs based on cleaner configs. 'hoodie.keep.min.commits' : "
+ + config.getMinCommitsToKeep() + " + should be greater than "
Review Comment:
Can we not hardcode these config options ?
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8422:
URL: https://github.com/apache/hudi/pull/8422#issuecomment-1502551235
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "292d0351f9385b7186d21e861ddb8bb85c216548",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "292d0351f9385b7186d21e861ddb8bb85c216548",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 292d0351f9385b7186d21e861ddb8bb85c216548 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1162197182
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java:
##########
@@ -3030,24 +3030,26 @@ private void validate() {
.equals(HoodieFailedWritesCleaningPolicy.EAGER.name()), "To enable optimistic concurrency control, set hoodie.cleaner.policy.failed.writes=LAZY");
}
- HoodieCleaningPolicy.valueOf(writeConfig.getString(CLEANER_POLICY));
- // Ensure minInstantsToKeep > cleanerCommitsRetained, otherwise we will archive some
- // commit instant on timeline, that still has not been cleaned. Could miss some data via incr pull
- int minInstantsToKeep = Integer.parseInt(writeConfig.getStringOrDefault(HoodieArchivalConfig.MIN_COMMITS_TO_KEEP));
- int maxInstantsToKeep = Integer.parseInt(writeConfig.getStringOrDefault(HoodieArchivalConfig.MAX_COMMITS_TO_KEEP));
- int cleanerCommitsRetained =
- Integer.parseInt(writeConfig.getStringOrDefault(HoodieCleanConfig.CLEANER_COMMITS_RETAINED));
- checkArgument(maxInstantsToKeep > minInstantsToKeep,
- String.format(
- "Increase %s=%d to be greater than %s=%d.",
- HoodieArchivalConfig.MAX_COMMITS_TO_KEEP.key(), maxInstantsToKeep,
- HoodieArchivalConfig.MIN_COMMITS_TO_KEEP.key(), minInstantsToKeep));
- checkArgument(minInstantsToKeep > cleanerCommitsRetained,
- String.format(
- "Increase %s=%d to be greater than %s=%d. Otherwise, there is risk of incremental pull "
- + "missing data from few instants.",
- HoodieArchivalConfig.MIN_COMMITS_TO_KEEP.key(), minInstantsToKeep,
- HoodieCleanConfig.CLEANER_COMMITS_RETAINED.key(), cleanerCommitsRetained));
+ HoodieCleaningPolicy cleaningPolicy = HoodieCleaningPolicy.valueOf(writeConfig.getString(CLEANER_POLICY));
+ if (cleaningPolicy == HoodieCleaningPolicy.KEEP_LATEST_COMMITS) {
Review Comment:
NTR(note to reviewer) : no changes except that this validation is done only incase of KEEP LATEST COMMITS cleaner 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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan merged pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan merged PR #8422:
URL: https://github.com/apache/hudi/pull/8422
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] xushiyan commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "xushiyan (via GitHub)" <gi...@apache.org>.
xushiyan commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1164172550
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
Review Comment:
this is another special rule added to the codebase and increased logic complexity. how can we design it better so that cleaner policy can fit nicely with archiver. for e.g., cleaner policy can have an API say `canArchive()` and archiver just use it. (illustration only, not as an formal suggestion). we need to design better APIs rather than adding conditions to just make things work.
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] xushiyan commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "xushiyan (via GitHub)" <gi...@apache.org>.
xushiyan commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1173326046
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
Review Comment:
do you have a follow up work/ticket for solving cleaner/archiver entanglement? let's link the jiras?
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1170365435
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
+ String latestCommitToArchive = instantsToArchive.get(instantsToArchive.size() - 1).getTimestamp();
+ try {
+ Instant latestCommitInstant = HoodieActiveTimeline.parseDateFromInstantTime(commitTimeline.lastInstant().get().getTimestamp()).toInstant();
+ ZonedDateTime currentDateTime = ZonedDateTime.ofInstant(latestCommitInstant, ZoneId.systemDefault());
Review Comment:
I checked the impl of HoodieActiveTimeline.parseDateFromInstantTime and did not see any timezone specific handling. So, might have to chase few other places as well. for now, will go ahead w/ the fix. will create a follow up ticket. https://issues.apache.org/jira/browse/HUDI-6097
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8422:
URL: https://github.com/apache/hudi/pull/8422#issuecomment-1502558029
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "292d0351f9385b7186d21e861ddb8bb85c216548",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16238",
"triggerID" : "292d0351f9385b7186d21e861ddb8bb85c216548",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 292d0351f9385b7186d21e861ddb8bb85c216548 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16238)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] hudi-bot commented on pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8422:
URL: https://github.com/apache/hudi/pull/8422#issuecomment-1502630545
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "292d0351f9385b7186d21e861ddb8bb85c216548",
"status" : "CANCELED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16238",
"triggerID" : "292d0351f9385b7186d21e861ddb8bb85c216548",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 292d0351f9385b7186d21e861ddb8bb85c216548 Azure: [CANCELED](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16238)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] xushiyan commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "xushiyan (via GitHub)" <gi...@apache.org>.
xushiyan commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1164167633
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
+ String latestCommitToArchive = instantsToArchive.get(instantsToArchive.size() - 1).getTimestamp();
+ try {
+ Instant latestCommitInstant = HoodieActiveTimeline.parseDateFromInstantTime(commitTimeline.lastInstant().get().getTimestamp()).toInstant();
+ ZonedDateTime currentDateTime = ZonedDateTime.ofInstant(latestCommitInstant, ZoneId.systemDefault());
Review Comment:
we need to consider timezone setting for timeline `org.apache.hudi.common.table.HoodieTableConfig#TIMELINE_TIMEZONE`
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
Review Comment:
this is another special rule added to the codebase and increased logic complexity. how can we design it better so that cleaner policy can fit nicely with archiver. for e.g., cleaner policy can have an API say `canArchive()` and archiver just use it. we need to design better APIs rather than adding conditions to just make things work.
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1170367249
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
+ String latestCommitToArchive = instantsToArchive.get(instantsToArchive.size() - 1).getTimestamp();
+ try {
+ Instant latestCommitInstant = HoodieActiveTimeline.parseDateFromInstantTime(commitTimeline.lastInstant().get().getTimestamp()).toInstant();
+ ZonedDateTime currentDateTime = ZonedDateTime.ofInstant(latestCommitInstant, ZoneId.systemDefault());
+ String earliestTimeToRetain = HoodieActiveTimeline.formatDate(Date.from(currentDateTime.minusHours(config.getCleanerHoursRetained()).toInstant()));
Review Comment:
parse Date from instant is already a util method.
L495 is based on clean hours. So, that leaves just L494. probably we can leave it as is. in future we can move it to utils method.
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a diff in pull request #8422: [HUDI-6056] Validate archival configs alignment with cleaner configs with policy based on hours
Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8422:
URL: https://github.com/apache/hudi/pull/8422#discussion_r1170103899
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/HoodieTimelineArchiver.java:
##########
@@ -475,7 +485,24 @@ private Stream<HoodieInstant> getCommitInstantsToArchive() throws IOException {
HoodieTimeline.compareTimestamps(s.getTimestamp(), LESSER_THAN, instantToRetain.getTimestamp()))
.orElse(true)
);
- return instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep);
+ List<HoodieInstant> instantsToArchive = instantToArchiveStream.limit(commitTimeline.countInstants() - minInstantsToKeep).collect(Collectors.toList());
+ // If cleaner is based on hours, lets ensure hudi does not archive commits yet to cleaned by the cleaner.
+ if (config.getCleanerPolicy() == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS && !instantsToArchive.isEmpty()) {
Review Comment:
yeah. I agree. but the guard conditions differ slightly from one policy to another. for eg, incase of num_commits, we can validate just w/ right configs. but if its based on hours, since archival is based on num of commits, we had to defer this check to when we actually do the archival. I do have a follow up patch where we will do some policy agnostic check in archival. but for this, do you think we need to think about adding a new api in cleaner code.
--
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@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org