Skip to content

[Kernel] Remove SnapshotHint; Fix CRCInfo caching bug in LogReplay; Simplify LogReplay - #5276

Merged
scottsand-db merged 2 commits into
delta-io:masterfrom
scottsand-db:stack/kernel_remove_snapshot_hint
Sep 30, 2025
Merged

scottsand-db merged 2 commits into
delta-io:masterfrom
scottsand-db:stack/kernel_remove_snapshot_hint

Conversation

@scottsand-db

@scottsand-db scottsand-db commented Sep 30, 2025 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

This PR removes SnapshotHint. This was a legacy optimization -- in the future, we don't plan to have a persisted Table that holds on to cached information like previous snapshots. That should be done by the connector.

While cleaning up SnapshotHint, I realized that we could significatintly simplify our CRCInfo logic and caching in LogReplay. I also noticed a bug where we were treating Optional<CRCInfo> as both (a) we have never checked to load the crcInfo at this version, and (b) there is no CRC info at this version. I've fixed that here by just using a Lazy<Optional<CRCInfo>>

How was this patch tested?

Just a refactor. Existing UTs.

Does this PR introduce any user-facing changes?

No.

@scottsand-db scottsand-db changed the title done first pass [Kernel] Remove SnapshotHint; Fix CRCInfo caching bug in LogReplay; Simplify LogReplay Sep 30, 2025

/** Returns the CRC info persisted in the logSegment's lastSeenChecksum File */
public Optional<CRCInfo> getLastSeenCrcInfo() {
if (!cachedLastSeenCrcInfo.isPresent()) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Bug! What if there is no CRC at version N? Then we will check the cache -- see that this is EMPTY -- and then try and load it! And then what happens if someone invokes this method again? Well, we will repeat the same load attempt!

This really just needed to be an Optional<Optional<CRCInfo>> or a Lazy<Optional<CRC<Info>>

@vkorukanti vkorukanti 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.

pending test fixes

@scottsand-db
scottsand-db merged commit a2851a9 into delta-io:master Sep 30, 2025
27 checks passed
huashi-st pushed a commit to huashi-st/delta that referenced this pull request Apr 24, 2026
…implify LogReplay (delta-io#5276)

## 🥞 Stacked PR
Use this [link](https://github.com/delta-io/delta/pull/5276/files) to
review incremental changes.
-
[**stack/kernel_remove_snapshot_hint**](delta-io#5276)
[[Files changed](https://github.com/delta-io/delta/pull/5276/files)]

---------
#### Which Delta project/connector is this regarding?

- [ ] Spark
- [ ] Standalone
- [ ] Flink
- [X] Kernel
- [ ] Other (fill in here)

## Description

This PR removes SnapshotHint. This was a legacy optimization -- in the
future, we don't plan to have a persisted `Table` that holds on to
cached information like previous snapshots. That should be done by the
connector.

While cleaning up SnapshotHint, I realized that we could significatintly
simplify our CRCInfo logic and caching in LogReplay. I also noticed a
bug where we were treating `Optional<CRCInfo>` as both (a) we have never
checked to load the crcInfo at this version, and (b) there is no CRC
info at this version. I've fixed that here by just using a
`Lazy<Optional<CRCInfo>>`

## How was this patch tested?

Just a refactor. Existing UTs.

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

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.

3 participants