Repository navigation
fix: ensure manifest timestamp is monotonically increasing - #5899
jackye1995 wants to merge 2 commits into
Conversation
Code ReviewP1: Potential overflow in timestamp computation In match prev_timestamp_nanos {
Some(prev) => std::cmp::max(current_nanos, prev.saturating_add(MILLIS_TO_NANOS)),
None => current_nanos,
}Minor observations (non-blocking):
Overall, the change is well-structured with good test coverage and clear documentation. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
A little concern on this: If a commit writes a manifest timestamp far in the future (e.g., due to a clock error setting it one year ahead), monotonic logic treats this value as the new baseline. Consequently, all subsequent manifests are forced to use timestamps at or beyond that future point, never reverting to real wall-clock time, effectively shifting the entire dataset's timeline into the future. |
|
Thank you for your contribution. This PR has been inactive for a while, so we're closing it to free up bandwidth. Feel free to reopen it if you still find it useful. |
b479564 to
11c0318
Compare
|
@wjones127 Could you review this follow-up to your suggestion in #9764 (comment)? I've reopened and rebased the original implementation onto current main. It uses |
|
Important Format specification voteThis PR modifies the Lance format specification, so it requires 3 binding +1 votes from PMC members (excluding the proposer), at least one of them on the latest commit, and a minimum 72-hour voting period, weekends excluded, before it can merge. Vote by approving this PR (+1) or requesting changes (−1, a veto). See the voting process. Approvals carry over across pushes, so a rebase or a typo fix does not send everyone back to re-vote. Whoever approves the latest commit is vouching that nothing substantive has changed since the earlier approvals; if something has, ask for fresh votes. Status: ❌ Blocked — 0 of 3 required approvals
Updated automatically by the format-spec vote gate, which re-checks every 15 minutes — just voted? Re-check now (press Run workflow; leave the input blank to re-check every open format PR). A PMC member may apply the |
There was a problem hiding this comment.
🟡 Gate recommendation: maintainer decision required.
The author’s follow-up leaves the future-clock concern open. One writer a year ahead makes later commits remain future-dated after its clock is corrected, including through restores. Those commits stay outside normal asof cutoffs and time-based cleanup until wall time catches up.
Please choose whether continued writes justify that unbounded timestamp skew, or whether excessive skew should reject commits with an explicit recovery policy. Keeping wall-clock timestamps and representing ordering separately is a larger alternative.
#9764 has merged with timestamp policies still reading manifests. This change alone does not establish ordering across existing history or older writers for a cleanup shortcut.
wjones127
left a comment
There was a problem hiding this comment.
@majin1102 is right that we can't mess with the timestamp without potentially distorting the timestamps via the write skew.
If we really want this optimization, I think we need a separate field that's a monotonic_timestamp high water mark, and say it's explicitly used for the "can I stop scanning here?" search. That's a format change, but not a super expensive one. Unclear if it's worth it yet, but if we see more cases where it would be beneficial worth considering.
Manifest commit timestamps currently follow the writer's wall clock, so a clock moving backward can make later versions appear older. Set each new timestamp to
max(wall_clock, previous_timestamp + 1ms), using the latest predecessor after a commit conflict. First versions use wall-clock time; restore commits use the current predecessor rather than the restored version. Reject timestamp arithmetic overflow.This supplies the commit-side behavior discussed in #9764. It does not change cleanup or retroactively establish ordering for existing history or older writers. A future-dated commit also moves the timestamp floor into the future; that trade-off remains a review question. The file-format specification is unchanged.
Rebased onto current main with regression coverage for equal/backward/forward clocks, restores, and concurrent commit retries. Local builds, tests, and clippy were omitted as requested; CI provides validation. Formatting passed.