Skip to content

[Protocol] Clarifying Metadata Cleanup to Preserve JSON Commits at Checkpoint Versions - #5355

Merged
zachschuermann merged 3 commits into
delta-io:masterfrom
DrakeLin:drake-lin_data/protocol-keep-commits
Oct 22, 2025
Merged

zachschuermann merged 3 commits into
delta-io:masterfrom
DrakeLin:drake-lin_data/protocol-keep-commits

Conversation

@DrakeLin

Copy link
Copy Markdown
Collaborator

Description

This PR updates the Delta Protocol specification to clarify that JSON commit files at checkpoint versions must be preserved during metadata cleanup. This ensures that commitInfo actions remain accessible for table features such as In-Commit Timestamps (ICT).

The current Delta Protocol's metadata cleanup section could be interpreted to allow deletion of JSON commit files when a checkpoint exists at the same version. However, this creates a critical problem for ICT-enabled tables:

  1. Checkpoints don't preserve commitInfo actions - The protocol explicitly states that checkpoints must not preserve commit provenance information
  2. ICT writers need previous commit timestamps - ICT-enabled tables need to read the previous commit's inCommitTimestamp to ensure monotonicity

Thus, if a checkpoint exists without its corresponding JSON commit file, the commitInfo is lost, causing writes to the table to fail.

How was this patch tested?

Does this PR introduce any user-facing changes?

Comment thread PROTOCOL.md Outdated
`cutOffCheckpoint` checkpoint. Also delete all the [log compaction files](#log-compaction-files) having
`cutOffCheckpoint` checkpoint. The JSON commit file at the `cutOffCheckpoint` version must be preserved because checkpoints do not preserve [commit provenance information](#commit-provenance-information) (e.g., `commitInfo` actions), which may be required by table features such as [In-Commit Timestamps](#in-commit-timestamps).
Also delete all the [log compaction files](#log-compaction-files) having
startVersion <= `cutOffCheckpoint`'s version.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: move this line up to the one above it

@felipepessoto

Copy link
Copy Markdown
Contributor

@DrakeLin do you know if current Spark implementation follows the new spec?

@DrakeLin

Copy link
Copy Markdown
Collaborator Author

@DrakeLin do you know if current Spark implementation follows the new spec?

Both Delta Spark and Kernel Java implicitly require this:

@scovich

scovich commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

... and AFAIK, both have always required it

@DrakeLin

Copy link
Copy Markdown
Collaborator Author

@scovich Anything missing before we can merge?

@scovich scovich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Both delta-spark and delta-kernel have always required this, so it's really just clarifying a constraint that always existed.

@zachschuermann
zachschuermann merged commit c0f0aa8 into delta-io:master Oct 22, 2025
27 checks passed
@felipepessoto

Copy link
Copy Markdown
Contributor

@DrakeLin, @scottsand-db @scovich

Although Spark Delta preserve the JSON commit at checkpoint version, it doesn't validate it exists, like Kernel does:

#4090

String.format("Missing delta file for version %s", latestCompleteCheckpointVersion));

The Spark PR was never merged: #3080

01001101CK pushed a commit to 01001101CK/delta that referenced this pull request Nov 17, 2025
…eckpoint Versions (delta-io#5355)

## Description

<!--
- Describe what this PR changes.
- Describe why we need the change.
 
If this PR resolves an issue be sure to include "Resolves #XXX" to
correctly link and close the issue upon merge.
-->

This PR updates the Delta Protocol specification to clarify that JSON
commit files at checkpoint versions must be preserved during metadata
cleanup. This ensures that commitInfo actions remain accessible for
table features such as In-Commit Timestamps (ICT).

The current Delta Protocol's metadata cleanup section could be
interpreted to allow deletion of JSON commit files when a checkpoint
exists at the same version. However, this creates a critical problem for
ICT-enabled tables:

1. Checkpoints don't preserve commitInfo actions - The protocol
explicitly states that checkpoints must not preserve commit provenance
information
2. ICT writers need previous commit timestamps - ICT-enabled tables need
to read the previous commit's inCommitTimestamp to ensure monotonicity

Thus, if a checkpoint exists without its corresponding JSON commit file,
the commitInfo is lost, causing writes to the table to fail.

## How was this patch tested?

<!--
If tests were added, say they were added here. Please make sure to test
the changes thoroughly including negative and positive cases if
possible.
If the changes were tested in any way other than unit tests, please
clarify how you tested step by step (ideally copy and paste-able, so
that other reviewers can test and check, and descendants can verify in
the future).
If the changes were not tested, please explain why.
-->

## Does this PR introduce _any_ user-facing changes?

<!--
If yes, please clarify the previous behavior and the change this PR
proposes - provide the console output, description and/or an example to
show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change
compared to the released Delta Lake versions or within the unreleased
branches such as master.
If no, write 'No'.
-->
huashi-st pushed a commit to huashi-st/delta that referenced this pull request Apr 24, 2026
…eckpoint Versions (delta-io#5355)

## Description

<!--
- Describe what this PR changes.
- Describe why we need the change.
 
If this PR resolves an issue be sure to include "Resolves #XXX" to
correctly link and close the issue upon merge.
-->

This PR updates the Delta Protocol specification to clarify that JSON
commit files at checkpoint versions must be preserved during metadata
cleanup. This ensures that commitInfo actions remain accessible for
table features such as In-Commit Timestamps (ICT).

The current Delta Protocol's metadata cleanup section could be
interpreted to allow deletion of JSON commit files when a checkpoint
exists at the same version. However, this creates a critical problem for
ICT-enabled tables:

1. Checkpoints don't preserve commitInfo actions - The protocol
explicitly states that checkpoints must not preserve commit provenance
information
2. ICT writers need previous commit timestamps - ICT-enabled tables need
to read the previous commit's inCommitTimestamp to ensure monotonicity

Thus, if a checkpoint exists without its corresponding JSON commit file,
the commitInfo is lost, causing writes to the table to fail.

## How was this patch tested?

<!--
If tests were added, say they were added here. Please make sure to test
the changes thoroughly including negative and positive cases if
possible.
If the changes were tested in any way other than unit tests, please
clarify how you tested step by step (ideally copy and paste-able, so
that other reviewers can test and check, and descendants can verify in
the future).
If the changes were not tested, please explain why.
-->

## Does this PR introduce _any_ user-facing changes?

<!--
If yes, please clarify the previous behavior and the change this PR
proposes - provide the console output, description and/or an example to
show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change
compared to the released Delta Lake versions or within the unreleased
branches such as master.
If no, write 'No'.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants