vamshipasunuru1 commented on issue #20650:
URL: https://github.com/apache/hudi/issues/20650#issuecomment-7047283379

   Thanks @nsivabalan and @danny0405 for the proposals. I checked both designs 
against the timeline from the incident. As written, neither one accepts it.
   
   **The incident timeline**
   
   Table version 6, archived by `TimelineArchiverV1`. Reconstructed from the 
server timeline in the driver log and the archive file written in the window.
   
   | Requested time | Instants | After the archival |
   |---|---|---|
   | 2021-11-19 → 2026-11-02 10:16 | 98 rollbacks | kept |
   | 2026-11-01 22:53 → 2026-11-04 01:15 | 33 commits | **archived** |
   | 2026-11-02 19:03 → 2026-11-04 01:03 | 16 cleans | kept |
   | 2026-11-04 02:53 → 2026-11-12 11:04 | 96 commits, 91 cleans | kept |
   | 2026-11-12 13:04 | 1 clean | **new** |
   
   Both designs assume archival removes a **prefix** of the timeline. Here it 
did not: the first instant is the same 2021 rollback on both sides, and the 33 
archived commits came from the middle. This is normal for V1, which trims 
commits, cleans and rollbacks independently.
   
   **Where each design falls short**
   
   - **Archived-prefix reconstruction.** The range `[clientFirst, serverFirst)` 
is empty, because both sides start at the same rollback. No archived instant is 
loaded, the hashes still differ, and the server syncs on every request as it 
does today. Widening the range to "everything archived since the client's first 
instant" would read the archive back to 2021 on this table.
   - **Previous snapshot.** `newFirst` is the 2021 rollback, so 
`prev.instantsFrom(newFirst)` is all of `prev`, including the 33 archived 
commits. The hash does not match and `archivalOnly` is false. Also, the 
server's first load was after the archival, so this case rests entirely on the 
registration step, and registration has to hand over the instant list, not only 
the hash.
   
   **Why this keeps getting tricky**
   
   The timeline changes in four ways, and a comparison of two instant lists 
cannot always tell them apart:
   
   1. New instants are added at the tail.
   2. Late completions are inserted in the middle, because the order is by 
requested time.
   3. Archival removes from the head or the middle, per action type.
   4. Restore removes from the tail.
   
   A missing instant can be archival (harmless) or restore (must sync). A 
matching tail can hide a middle insert, which is the gap you both pointed out 
in #20651. An instant can go pending → completed → archived and appear in 
neither list, which is the case @danny0405 raised above.
   
   **Probable fix: three extra guards on the previous-snapshot design**
   
   1. **Compare per archival group, not as a prefix.** Every instant the client 
has and the server lacks must be completed, and older than the oldest instant 
of the same group (commit actions, cleans, rollbacks) that the server still 
has. The server may have at most one extra instant, a trailing clean. 
Everything else must match one for one on (requestedTime, action, state).
   2. **Check pending instants.** The driver registers its full timeline, 
including pending instants. The server refuses the shortcut if an instant that 
was pending there is no longer pending in the server's active timeline. This 
covers the complete-then-archive case.
   3. **Check that the server is not behind.** The server refuses the shortcut 
if an instant that only the client has is still pending in the server's active 
timeline. That instant was not archived: it completed after the server loaded 
its timeline. For example, a replace commit that is older than every commit the 
server has passes guard 1, but the server would still serve the file group it 
replaced.
   
   All three guards are in-memory comparisons with no archive I/O. On the 
incident, guard 1 holds: the newest archived commit (2026-11-04 01:15) is older 
than the oldest surviving commit (2026-11-04 02:53).
   
   Does this make sense to you both? If so, I can reproduce the incident in 
tests first, and then check whether the three guards handle all the cases 
listed above.
   


-- 
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