Skip to content

Conversation

@zachschuermann
Copy link
Member

What changes are proposed in this pull request?

Adds two new APIs for our FFI to support catalog-managed tables:

  1. snapshot_with_log_tail to get the latest snapshot of a catalog-managed table
  2. snapshot_at_version_with_log_tail to get the snapshot of a catalog-managed table at a specific version

And in order to implement the above, a new LogPathArray type is introduced to communicate Vec<LogPath> across FFI (basically just uses ptr + len for the array type and the FfiLogPath does KernelStringSlice + size + mod time)

The above APIs are behind a new catalog-managed (FFI) feature flag similar to kernel's own catalog-managed flag.

How was this change tested?

new UT

@codecov
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

❌ Patch coverage is 81.30081% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.88%. Comparing base (a27f366) to head (f9e24c6).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
ffi/src/log_path.rs 57.14% 16 Missing and 2 partials ⚠️
ffi/src/lib.rs 93.82% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1379      +/-   ##
==========================================
+ Coverage   84.73%   84.88%   +0.14%     
==========================================
  Files         113      114       +1     
  Lines       28396    29040     +644     
  Branches    28396    29040     +644     
==========================================
+ Hits        24062    24651     +589     
- Misses       3198     3215      +17     
- Partials     1136     1174      +38     

☔ 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.

@github-actions github-actions bot added the breaking-change Change that require a major version bump label Oct 7, 2025
// Convert LogPathArray to Vec<LogPath>
let log_tail = match unsafe { log_tail.log_paths() } {
Ok(paths) => paths,
Err(e) => return DeltaResult::Err(e).into_extern_result(&engine_ref),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Err(e) => return DeltaResult::Err(e).into_extern_result(&engine_ref),
err => return err.into_extern_result(&engine_ref),

Comment on lines +1023 to +1029
let log_path =
log_path::FfiLogPath::new(kernel_string_slice!(commit1_path), 123456789, 100);
let log_tail = vec![log_path];
let log_tail = log_path::LogPathArray {
ptr: log_tail.as_ptr(),
len: log_tail.len(),
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be worth just making a LogPathArray::fromVec.

Also, while it's handled right here, I think we need to be very careful with Vec since drop could still be called and we'd have a use-after-free.

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.

2 participants