[1.11.x] Spark: Test streaming recovery across replacement metadata - #17599
Draft
timothyw553 wants to merge 1 commit into
Draft
[1.11.x] Spark: Test streaming recovery across replacement metadata#17599timothyw553 wants to merge 1 commit into
timothyw553 wants to merge 1 commit into
Conversation
Signed-off-by: Timothy Wang <timothy.art@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
An Iceberg Spark streaming checkpoint stores a snapshot ID and a position inside that snapshot. If table metadata is replaced with an independent snapshot history, the old snapshot ID is no longer on the current lineage and the stream cannot restart.
For example:
Restarting against the replacement history fails because
O2cannot be resolved.What this draft proves
This is a test-only proof of concept, not a production recovery command or service.
The tests construct a separate, read-only recovery table:
The recovery table keeps the old snapshots and manifest lists unchanged.
K*keeps the final replacement snapshot ID and v3 manifests, but points toO4and uses theREPLACEoperation. Spark therefore finishes the partially consumed old snapshot, reads later old appends, skipsK*, and reaches the real post-replacement snapshotA1.After Spark commits
A1, the same checkpoint restarts against the original live table. BecauseA1exists in both histories, streaming continues from the live descendants without replaying earlier rows.The tests cover both an in-process catalog and an HTTP REST catalog with catalog caching enabled. They also verify that:
The REST fixture serves metadata that is already registered in the test catalog. It does not test production REST registration, authentication, or credential vending.
Current assumptions
The fixture is intentionally limited to an append-only, unpartitioned table without delete files. A production implementation must fail safely unless the old terminal snapshot and final replacement snapshot describe the same physical table state. It must also handle metadata retention, schema and partition evolution, delete files, encryption, authentication, and temporary recovery-table lifecycle.
The test demonstrates a handoff between two table identifiers with the same source provider, schema, and source position. It does not establish a general Spark compatibility contract for arbitrary source changes.
Tests
Result: 2 tests passed and formatting passed.
AI assistance
AI assistance was used to scaffold and pressure-test this prototype. I reviewed the complete diff, corrected the snapshot-summary and row-ID validation, and ran the focused tests and formatting check. The production limitations and source-handoff compatibility noted above remain open design questions.