Skip to content

Spec: require monotonically increasing snapshot timestamp-ms in v4#16294

Open
stevenzwu wants to merge 1 commit into
apache:mainfrom
stevenzwu:spec-snapshot-timestamp-monotonic
Open

Spec: require monotonically increasing snapshot timestamp-ms in v4#16294
stevenzwu wants to merge 1 commit into
apache:mainfrom
stevenzwu:spec-snapshot-timestamp-monotonic

Conversation

@stevenzwu
Copy link
Copy Markdown
Contributor

@stevenzwu stevenzwu commented May 12, 2026

Summary

Adds a v4 spec requirement that a snapshot's timestamp-ms must be strictly greater than the parent snapshot's timestamp-ms on the same branch. Root snapshots (with no parent) are not constrained.

  • format/spec.md Snapshots section: notes the v4-only requirement directly under the snapshot field table.
  • format/spec.md Appendix E: adds a new Version 4 subsection (above Version 3) listing the snapshot-timestamp rule. This is the first v4 entry in Appendix E and is intentionally minimal\u2014other v4 changes can be appended as they land.

The spec only states the requirement; it does not prescribe how writers should achieve it or enumerate downstream features that benefit from it.

No table or schema fields are added. v1\u2013v3 semantics are unchanged.

Companion PR

A reference implementation in SnapshotProducer is proposed in #16293.

Test plan

  • format/spec.md renders correctly (note added to the v1\u2013v3 Snapshots tab; new Version 4 subsection in Appendix E above Version 3)
  • Spec review

@github-actions github-actions Bot added the Specification Issues that may introduce spec changes. label May 12, 2026
@stevenzwu stevenzwu force-pushed the spec-snapshot-timestamp-monotonic branch 2 times, most recently from bf46974 to 8ec0c31 Compare May 12, 2026 00:24
Comment thread format/spec.md Outdated
| | | _required_ | **`added-rows`** | The upper bound of the number of rows with assigned row IDs, see [Row Lineage](#row-lineage) |
| | | _optional_ | **`key-id`** | ID of the encryption key that encrypts the manifest list key metadata |

In format version 4 and above, a snapshot's `timestamp-ms` must be strictly greater than the `timestamp-ms` of its parent snapshot on the same branch. Root snapshots (those without a parent) are not constrained by this requirement.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about tables migrated from v3 to v4 ... with broken timestamps ? do we need to say something about them ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Pushed an update that explicitly carves out pre-upgrade snapshots:

In format version 4 and above, a snapshot's timestamp-ms must be strictly greater than the timestamp-ms of its parent snapshot on the same branch. The requirement applies only to snapshots committed while the table is at format version 4 or higher; root snapshots, and snapshots that existed before a table was upgraded to v4, are not constrained.

So a table migrated from v3 with non-monotonic timestamps is conformant: the existing snapshots are grandfathered in, and only new snapshots committed at v4+ must satisfy the rule. A new v4 snapshot whose parent happens to be a pre-upgrade snapshot must still beat that parent's timestamp-ms, which will naturally fast-forward past any anomaly inherited from v3.

In format version 4 and above, a snapshot's `timestamp-ms` must be
strictly greater than the `timestamp-ms` of its parent snapshot on
the same branch. The requirement applies only to snapshots committed
while the table is at format version 4 or higher; root snapshots,
and snapshots that existed before a table was upgraded to v4, are
not constrained.

Adds the requirement to the Snapshots section and a new Version 4
subsection in Appendix E. No table or schema fields are added.

Made-with: Cursor
Model: claude-4.7-opus
Co-authored-by: Cursor <cursoragent@cursor.com>
@stevenzwu stevenzwu force-pushed the spec-snapshot-timestamp-monotonic branch from 8ec0c31 to 7c2f7fe Compare May 12, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Specification Issues that may introduce spec changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants