Skip to content

Conversation

zachschuermann
Copy link
Member

@zachschuermann zachschuermann commented Sep 10, 2025

Note

I'll split up this PR into more reviewable commits if we have alignment on this direction! also note the vast majority of this PR is either code movement or callsite updates.

What changes are proposed in this pull request?

Seeking some early feedback on integrating Snapshot::try_new_from into SnapshotBuilder. This PR has two major changes:

  1. Moves Snapshot::try_new_from into SnapshotBuilder with two pieces:
    a. SnapshotBuilder::from_snapshot to specify an existing snapshot for the builder
    b. Migrates all of the try_new_from implementation into SnapshotBuilder::build
  2. Modifies SnapshotBuilder:
    a. to now optionally take a table_root - since the snapshot hint passed to the builder includes its own table_root
    b. since Snapshot::try_new_from relies on Arcs to easily return snapshots that are unchanged from the existing snapshot, SnapshotBuilder::build() now returns an Arc<Snapshot> instead of a Snapshot

This PR affects the following public APIs

  1. Replaces Snapshot::try_new_from(existing) with SnapshotBuilder::new().from_snapshot(existing)
  2. SnapshotBuilder::build() now returns an Arc<Snapshot> instead of a Snapshot
  3. Snapshot::builder() signature changed: now it accepts no parameters, and instead has a .with_table_root() method

How was this change tested?

existing

@zachschuermann zachschuermann changed the title [wip] refactor!: replace Snapshot::try_new_from with SnapshotBuilder::from_snapshot refactor!: replace Snapshot::try_new_from with SnapshotBuilder::from_snapshot Sep 10, 2025
@github-actions github-actions bot added the breaking-change Change that require a major version bump label Sep 10, 2025
Copy link

codecov bot commented Sep 10, 2025

Codecov Report

❌ Patch coverage is 82.63889% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.63%. Comparing base (5552d21) to head (018e45e).

Files with missing lines Patch % Lines
kernel/src/snapshot/builder.rs 84.32% 12 Missing and 9 partials ⚠️
kernel/src/checkpoint/tests.rs 54.54% 0 Missing and 10 partials ⚠️
kernel/src/snapshot.rs 88.31% 0 Missing and 9 partials ⚠️
acceptance/src/meta.rs 40.00% 0 Missing and 3 partials ⚠️
ffi/src/transaction/mod.rs 33.33% 0 Missing and 2 partials ⚠️
kernel/src/table_changes/mod.rs 81.81% 0 Missing and 2 partials ⚠️
acceptance/src/data.rs 66.66% 0 Missing and 1 partial ⚠️
ffi/src/lib.rs 50.00% 0 Missing and 1 partial ⚠️
test-utils/src/lib.rs 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1277      +/-   ##
==========================================
+ Coverage   83.60%   83.63%   +0.02%     
==========================================
  Files         107      107              
  Lines       25651    25773     +122     
  Branches    25651    25773     +122     
==========================================
+ Hits        21446    21554     +108     
- Misses       3135     3142       +7     
- Partials     1070     1077       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zachschuermann
Copy link
Member Author

closing in favor of #1289

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Change that require a major version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant