[Spark] Add protocol validation in Metadata cleanup based on CRCs #4211
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which Delta project/connector is this regarding?
Description
CheckpointProtectionTableFeature
requires clients to only cleanup metadata if they can clean up torequireCheckpointProtectionBeforeVersion
. When this this not possible the metadata cleanup operation aborts.requireCheckpointProtectionBeforeVersion
is updated with the version of the latest protocol downgrade every time a feature is dropped. Because of that, in certain scenarios, metadata cleanup could halt for extended periods of time.This PR improves this behavior by allowing the client to proceed with metadata cleanup when the invariant above does not hold, as long as, a checkpoint already exists at the cleanup cut off version. If none of the invariants hold, it verifies it supports the protocols of all commits planning to remove (including any new checkpoint creation version).
How was this patch tested?
Added tests in
DeltaRetentionSuite
.Does this PR introduce any user-facing changes?
No.