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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]