Skip to content

feat: expose snapshot load metrics in order to detect if log truncati…#11

Merged
VLCDaniel merged 2 commits intomainfrom
log-size-limiter-stats
Mar 30, 2026
Merged

feat: expose snapshot load metrics in order to detect if log truncati…#11
VLCDaniel merged 2 commits intomainfrom
log-size-limiter-stats

Conversation

@VLCDaniel
Copy link
Copy Markdown
Collaborator

Fixed file size calculation, and added snapshot truncation metrics

Comment thread crates/core/src/kernel/snapshot/mod.rs Outdated

let (snapshot, load_metrics) = if let Some(limiter) = &config.log_size_limiter {
let original_segment = snapshot.log_segment().clone();
let original_size: u64 = original_segment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@VLCDaniel can we do something like have a function in the newly added struct like from_segment_and_snapshot ?
I would try to move this code in the new struct. The reason is that is a new file, our code, so there will be less chance of merge conflicts if / when we upgrade to a new version

Comment thread crates/core/src/kernel/snapshot/mod.rs Outdated
(Arc::new(KernelSnapshot::new(truncated_segment, table_configuration)), metrics)
} else {
snapshot
let metrics = SnapshotLoadMetrics::from_snapshot(&snapshot);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@VLCDaniel this is great, see previous, we should have something like

let metric = SnapshotLoadMetrics::from_snapshot_and_segment...

Comment thread crates/core/src/kernel/snapshot/mod.rs Outdated
.try_into_arrow()?,
);

// For updates, we don't track truncation metrics since we're building from existing snapshot
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@VLCDaniel same comment here - could we have a line here and stuff this complexity inside SnapshotLoadMetrics ?

Copy link
Copy Markdown
Collaborator

@cdobre cdobre left a comment

Choose a reason for hiding this comment

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

LGTM

// At upgrade, RECHECK usage sites for DeltaTableConfig, we'll need to re-evaluate if
// stuff begins writing to it
let delta_table_config = DeltaTableConfig::default();
let load_metrics = SnapshotLoadMetrics::from_snapshot(&exec_scan_plan_scan_snapshot);
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.

nit: This is a little strange as the SnapshotLoadMetrics::from_snapshot could be hidden within snapshot (as it acts on the inner object ) - I think I don't like the fact that a SnapshotLoadMetrics comes from size_limits which really seems like an implementation detail

@VLCDaniel VLCDaniel force-pushed the log-size-limiter-stats branch from 0562010 to 6b24db5 Compare March 26, 2026 10:33
Copy link
Copy Markdown
Collaborator

@aditanase aditanase left a comment

Choose a reason for hiding this comment

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

much better integration into upstream codebase

@VLCDaniel VLCDaniel merged commit b7e9ac0 into main Mar 30, 2026
4 of 23 checks passed
@VLCDaniel VLCDaniel deleted the log-size-limiter-stats branch March 30, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants