hudi-agent commented on code in PR #19946:
URL: https://github.com/apache/hudi/pull/19946#discussion_r4007099843


##########
hudi-timeline-service/src/main/java/org/apache/hudi/timeline/service/RequestHandler.java:
##########
@@ -750,9 +750,15 @@ private boolean isLocalViewBehind(Context ctx) {
       }
 
       String localTimelineHash = localTimeline.getTimelineHash();
-      // refresh if timeline hash mismatches
       if (!localTimelineHash.equals(timelineHashFromClient)) {
-        return true;
+        if 
(HoodieTimeline.INVALID_INSTANT_TS.equals(lastKnownInstantFromClient)
+            || !localTimeline.containsInstant(lastKnownInstantFromClient)) {
+          return true;
+        }
+        // A newer last instant alone is insufficient: all actions and states 
through the
+        // client boundary must match before the server can be treated as an 
exact extension.
+        return 
!localTimeline.findInstantsBeforeOrEquals(lastKnownInstantFromClient)

Review Comment:
   🤖 One behavioural shift worth calling out explicitly: before this change, a 
server that was strictly ahead of the client (beyond a trailing clean) failed 
the final check with `BadRequestResponse`, which `PriorityBasedFileSystemView` 
turns into a sticky fallback to the local secondary view — i.e. the caller got 
results computed from its *own* timeline. Now the server answers from its newer 
timeline instead. For bounded calls (`...BeforeOrOn`) that's equivalent, but 
unbounded write-path callers (`HoodieAppendHandle.getLatestFileSlice`, 
`HoodieAbstractMergeHandle.getLatestBaseFile`, 
`SparkInsertOverwrite*.getLatestFileSlices`, 
`ConsistentBucketIndexUtils.getLatestBaseFiles`) can now observe file slices 
from instants the client hasn't seen. I believe that's the intended semantics 
from the issue discussion, but could you confirm it was considered, and maybe 
note it in the `isLocalViewBehind` javadoc? The trailing-clean special case in 
`shouldThrowExceptionIfLocalViewBehind` is als
 o now subsumed by this branch, so a short comment there tying the two together 
might help future readers.
   
   <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]

Reply via email to