You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "danny0405 (via GitHub)" <gi...@apache.org> on 2026/10/15 02:37:57 UTC
[PR] fix(common): avoid archive lookups for active clean and rollback instants [hudi]
danny0405 opened a new pull request, #20340:
URL: https://github.com/apache/hudi/pull/20340
### Describe the issue this Pull Request addresses
Following #20273, `CompletionTimeQueryViewV2.isArchived()` excludes savepointed instants but still classifies active clean/rollback instants before the first non-savepointed write as archived. If their completion times fall in an incremental query's range, `IncrementalQueryAnalyzer` unnecessarily loads the archived timeline. This can occur even when archival beyond savepoints is disabled.
### Summary and Changelog
Use membership in the meta client's cached active timeline to exclude all active instants from archive classification.
- Replace the separate savepoint timestamp set with `getActiveTimeline().containsInstant()` while preserving the existing write boundary and lazy-loading cursor.
- Clarify that tables upgraded from pre-v8 can have interleaved archived and active instants.
- Extend existing tests with clean/rollback cases, with and without savepoints, verifying that incremental queries avoid archive lookups and that archived writes remain readable around older active instants.
No code was copied from external projects.
### Impact
Avoids unnecessary archived-timeline initialization and manifest lookup for incremental queries containing active clean/rollback completion times. When those instants are newer than all archived files, existing filename-range filtering already skips the Parquet files, so the benefit is limited to setup and metadata overhead. Older interleaved active instants can overlap archive file ranges. The membership check reuses the cached active timeline and adds no storage I/O. No public API, configuration, or storage-format changes.
### Risk Level
low
The change is limited to archive classification in the V2 completion-time query view. The existing cursor and archive-loading behavior are preserved. All 21 targeted tests passed across `TestIncrementalQueryAnalyzer`, `TestCompletionTimeQueryView`, and `TestCompletionTimeQueryViewV1`, including savepoint and interleaving coverage.
Validation used Java 17 with the Byte Buddy agent preloaded:
```sh
mvn -o -pl hudi-client/hudi-client-common -am test \
-Dtest=TestCompletionTimeQueryView,TestCompletionTimeQueryViewV1,TestIncrementalQueryAnalyzer \
-Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false \
-DskipITs -DskipFTs -Drat.skip=true
```
Integration/functional test suites and RAT were not run. `git diff --check` passed.
### Documentation Update
none — internal query optimization with no new feature or configuration. The constructor comment explains the pre-v8 upgrade case.
### Contributor's checklist
- [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [x] Enough context is provided in the sections above
- [x] Adequate tests were added if applicable
--
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
Re: [PR] fix(common): avoid archive lookups for active clean and rollback instants [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 merged PR #20340:
URL: https://github.com/apache/hudi/pull/20340
--
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
Re: [PR] fix(common): avoid archive lookups for active clean and rollback instants [hudi]
Posted by "hudi-agent (via GitHub)" <gi...@apache.org>.
hudi-agent commented on code in PR #20340:
URL: https://github.com/apache/hudi/pull/20340#discussion_r4278486022
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/versioning/v2/CompletionTimeQueryViewV2.java:
##########
@@ -131,10 +121,9 @@ public boolean isCompleted(String instantTime) {
* Returns whether the instant is archived.
*/
public boolean isArchived(String instantTime) {
- // with archival beyond savepoint, the write instants between a savepointed commit and the first active write
- // instant are archived as well, while the savepointed commit itself stays active.
+ // A savepointed write or an older clean/rollback can still be active before the write boundary.
return InstantComparison.compareTimestamps(instantTime, LESSER_THAN, this.firstActiveWriteInstant)
- && !this.activeSavepointedInstants.contains(instantTime);
+ && !this.metaClient.getActiveTimeline().containsInstant(instantTime);
Review Comment:
🤖 nit: would it make sense to keep the active timeline in a field? The constructor snapshots it, but `isArchived` now re-fetches `metaClient.getActiveTimeline()` on every call.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.</i></sub>
##########
hudi-common/src/test/java/org/apache/hudi/common/table/read/TestIncrementalQueryAnalyzer.java:
##########
@@ -77,6 +91,51 @@ void testQueryContextRangeEdges() {
assertThrows(IllegalStateException.class, IncrementalQueryAnalyzer.QueryContext.EMPTY::getLastInstant);
}
+ @ParameterizedTest
+ @CsvSource({"clean,false", "clean,true", "rollback,false", "rollback,true"})
+ void testActiveNonWriteDoesNotTriggerArchivedTimelineLookup(String action, boolean savepoint) {
Review Comment:
🤖 nit: could you pull the timeline and metaClient mock setup into small helpers? This test is about 40 lines and mixes setup, view assertions and analyzer assertions.
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.</i></sub>
--
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
Re: [PR] fix(common): avoid archive lookups for active clean and rollback instants [hudi]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #20340:
URL: https://github.com/apache/hudi/pull/20340#issuecomment-6183388932
## [Codecov](https://app.codecov.io/gh/apache/hudi/pull/20340?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `1 line` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 80.71%. Comparing base ([`276d120`](https://app.codecov.io/gh/apache/hudi/commit/276d120b839a3d7b6ec64bf32b9132fab9f88a6d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`daf10aa`](https://app.codecov.io/gh/apache/hudi/commit/daf10aa93592c21639e791a1d46fc9acdc308ed7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/hudi/pull/20340?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...eline/versioning/v2/CompletionTimeQueryViewV2.java](https://app.codecov.io/gh/apache/hudi/pull/20340?src=pr&el=tree&filepath=hudi-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fhudi%2Fcommon%2Ftable%2Ftimeline%2Fversioning%2Fv2%2FCompletionTimeQueryViewV2.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3RhYmxlL3RpbWVsaW5lL3ZlcnNpb25pbmcvdjIvQ29tcGxldGlvblRpbWVRdWVyeVZpZXdWMi5qYXZh) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/hudi/pull/20340?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #20340 +/- ##
============================================
- Coverage 80.71% 80.71% -0.01%
Complexity 35143 35143
============================================
Files 2553 2553
Lines 143547 143545 -2
Branches 17478 17478
============================================
- Hits 115867 115864 -3
- Misses 19734 19735 +1
Partials 7946 7946
```
| [Components](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hudi-common](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `84.17% <0.00%> (-0.01%)` | :arrow_down: |
| [hudi-client](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.93% <ø> (ø)` | |
| [hudi-flink](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `86.07% <ø> (ø)` | |
| [hudi-spark-datasource](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `74.19% <ø> (ø)` | |
| [hudi-utilities](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.19% <ø> (ø)` | |
| [hudi-cli](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.80% <ø> (ø)` | |
| [hudi-hadoop](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `71.17% <ø> (ø)` | |
| [hudi-sync](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.62% <ø> (ø)` | |
| [hudi-io](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.52% <ø> (ø)` | |
| [hudi-timeline-service](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.65% <ø> (ø)` | |
| [hudi-cloud](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.00% <ø> (ø)` | |
| [hudi-kafka-connect](https://app.codecov.io/gh/apache/hudi/pull/20340/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `54.48% <ø> (ø)` | |
| [Flag](https://app.codecov.io/gh/apache/hudi/pull/20340/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hadoop-mr-java-client](https://app.codecov.io/gh/apache/hudi/pull/20340/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `43.95% <0.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files with missing lines](https://app.codecov.io/gh/apache/hudi/pull/20340?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...eline/versioning/v2/CompletionTimeQueryViewV2.java](https://app.codecov.io/gh/apache/hudi/pull/20340?src=pr&el=tree&filepath=hudi-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fhudi%2Fcommon%2Ftable%2Ftimeline%2Fversioning%2Fv2%2FCompletionTimeQueryViewV2.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3RhYmxlL3RpbWVsaW5lL3ZlcnNpb25pbmcvdjIvQ29tcGxldGlvblRpbWVRdWVyeVZpZXdWMi5qYXZh) | `91.20% <0.00%> (-1.27%)` | :arrow_down: |
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</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