Commit e4d92f7
refactor: deduplicate ListedLogFiles / LogSegment and clean up validation (delta-io#1983)
## What changes are proposed in this pull request?
This PR cleans up the relationship between `ListedLogFiles` (now
`LogSegmentFiles`) and `LogSegment`, removing several sources of
duplication:
- **Remove `ListedLogFilesBuilder`**: it was an exact structural
duplicate of `ListedLogFiles`. Replaced with `#[derive(Default)]`
and direct struct-literal construction + `..Default::default()`.
- **Rename `ListedLogFiles` → `LogSegmentFiles`**: the struct combines
filesystem-listed files _and_ catalog-provided log tail commits, so
"listed" was a misnomer. Also renames the module.
- **Embed `LogSegmentFiles` in `LogSegment`**: `LogSegment` previously
declared the same 6 fields (`ascending_commit_files`,
`ascending_compaction_files`, `checkpoint_parts`, `latest_crc_file`,
`latest_commit_file`, `max_published_version`) that `LogSegmentFiles`
already had. These are now accessed via `log_segment.listed.*`.
Also removes `into_parts()` since `try_new()` now mutates the struct
in place.
- **Consolidate validation into `LogSegment::try_new`**: every
`LogSegmentFiles` construction flows into `try_new`, so `validate()`
on `LogSegmentFiles` was a redundant pre-check. The structural
invariant checks (compaction sort order, checkpoint integrity) are
now a `#[cfg(debug_assertions)]` block at the top of `try_new`,
alongside the existing always-on checks (contiguity, checkpoint gap,
end version).
Follow up PR that consolidates all the validations to a single loop and
enables them for prod.
delta-io#1995
<!--
**Uncomment** this section if there are any changes affecting public
APIs. Else, **delete** this section.
### This PR affects the following public APIs
If there are breaking changes, please ensure the `breaking-changes`
label gets added by CI, and describe why the changes are needed.
Note that _new_ public APIs are not considered breaking.
-->
## How was this change tested?
unit test added
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent 38a420e commit e4d92f7
15 files changed
Lines changed: 605 additions & 507 deletions
File tree
- kernel
- src
- log_reader
- log_segment
- parallel
- scan
- table_changes
- log_replay
- transaction
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
| 139 | + | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| |||
Large diffs are not rendered by default.
0 commit comments