[Spark] Stop metadata cleanup listing after retention checkpoint - #7557
Open
sivakumar-mahalingam wants to merge 1 commit into
Open
[Spark] Stop metadata cleanup listing after retention checkpoint#7557sivakumar-mahalingam wants to merge 1 commit into
sivakumar-mahalingam wants to merge 1 commit into
Conversation
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.
Which Delta project/connector is this regarding?
Description
Related to #6531.
Metadata cleanup continued consuming the
_delta_loglisting afterBufferingLogDeletionIteratorprocessed the complete checkpoint beyond the maximum deletable version. At that point, all subsequent files are version-ineligible for deletion.This change records that boundary and stops consuming the underlying iterator.
The stopping condition is based on ordered log versions. It does not assume that file modification timestamps are monotonic.
Correctness
The existing timestamp-adjustment and checkpoint-buffering behavior remains unchanged. In particular:
An incomplete multipart checkpoint does not establish an early-exit boundary.
Performance
A deterministic regression test supplies more than 10,000 newer entries after the retention checkpoint.
For the nothing-expired and few-files-expired cases, the iterator consumes only the entries required to reach the complete checkpoint instead of consuming the entire synthetic listing.
Hadoop and Azure follow-up
This change reduces work when
LogStore.listFromprovides a genuinely lazy or paginated iterator.The Hadoop and Azure implementations currently call
listStatusand materialize/sort the directory contents before returning their iterator. Therefore, this patch does not eliminate the provider-level listing cost for those implementations.Making Hadoop/Azure listing lazy requires preserving the public
LogStore.listFromcontract that results are lexicographically sorted. Generic HadoopRemoteIteratorAPIs do not provide that ordering guarantee. This broader provider/API design is left.For this reason, this PR is related to #6531 but does not close it.
Tests
The following focused tests passed:
DeltaTimeTravelSuitefiltered toBufferingLogDeletionIteratorA broader
DeltaRetentionSuiterun completed with 10 passing and 5 failing tests. The failures occurred during Windowstable_changes_by_pathvalidation after the relevant cleanup assertions:Does this PR introduce any user-facing changes?
No. Metadata retention and deletion semantics are unchanged. The change only avoids consuming log-listing entries that cannot affect the cleanup result.