Repository navigation
Complete Volume file transfers in the Rust kernel core - #512
aakash-saravanan-db wants to merge 1 commit into
Conversation
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Medium · 2 Low
Solid, well-tested change with one medium concern. Storage redirects using 301/302/303 can silently turn a PUT or REMOVE into a GET, so the operation reports success without transferring or deleting anything. Also, no live-warehouse test confirms the instruction format.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
| Operation::Get(path) => { | ||
| let local_file = path.to_string_lossy().into_owned(); | ||
| let path = allowed_path(&local_file, &roots)?; | ||
| let existing = match std::fs::OpenOptions::new().write(true).open(&path) { |
There was a problem hiding this comment.
🔵 Low — GET opens an existing destination for writing inside spawn_blocking. If the destination is a FIFO with no reader, the worker thread blocks forever even after cancellation, and it can stall runtime shutdown. Check that an existing destination is a regular file before opening it, or open it with O_NONBLOCK.
🔀 Found by GPT-6.1 Sol · confirmed by the judge
| #[derive(Debug, Clone, Deserialize)] | ||
| pub struct ResultManifest { | ||
| #[serde(default)] | ||
| pub is_volume_operation: bool, |
There was a problem hiding this comment.
🔵 Low — Volume detection depends on the SEA manifest field is_volume_operation and on the instruction column names (operation, presignedUrl, headers, localFile) and their types. Only wiremock fixtures cover these, so nothing confirms they match what a real warehouse sends. Fix: add an ignored tests/v0_volume_e2e.rs that runs PUT, GET and REMOVE against a real Volume.
🔀 Found by Claude Opus 5.5 · the judge couldn't confirm it
| { | ||
| attempt.error("Volume storage redirect cannot downgrade HTTPS to HTTP") | ||
| } else { | ||
| reqwest::redirect::Policy::default().redirect(attempt) |
There was a problem hiding this comment.
🟡 Medium — The storage client uses reqwest's default redirect policy. A 303 response turns a PUT or DELETE into a bodiless GET, so a 200 from that GET is reported as Completed without the upload or delete having happened. (reqwest keeps the method on 301/302 for PUT and DELETE.) Reject or handle 303 for mutating requests, and add redirect tests for PUT and DELETE.
🔀 Found by both reviewers · confirmed by the judge
Description
SQL
PUT,GETandREMOVEcurrently return an instruction row without moving the file. AddResultStream::complete_volume_operationto run the storage transfer before reading rows, cache success or failure, and support cancellation through the session or statement.Local paths and their resolved symlink targets must stay within the caller's allowed directories. File PUT sources must be regular files that report their size. GET downloads into a temporary file before copying into the destination, and rejects a missing destination directory before downloading. Storage errors retain their status and include S3 request and host IDs when available.
Split from #465. Binding adapters follow in the bindings PR #513.
Testing
Standalone core: 1,137 unit tests and 11 Volume wiremock tests pass. Strict all-target Clippy and formatting pass. All four Cargo manifests resolve with
--locked, including the intermediate ADBC and NAPI lockfiles.The tests cover file and stream transfers, redirect replay, allowed roots, missing destinations, cancellation after parent drop, cached outcomes and unsupported file sources.
Additional notes
This core change has no upstream PR dependency. The bindings follow-up supplies the C ABI, ADBC, NAPI and PyO3 APIs.
tempfilemoves from a dev dependency to a regular dependency for GET downloads. A failure during the final copy can leave the destination partly written; a copy that has started finishes despite cancellation. The allowed directories must not have files or links swapped during a transfer.A file PUT redirected with 307 or 308 is resent from memory, using a buffer equal to the file size. This resend has no idle limit. Python Thrift reads every PUT file into memory; Node and Go Thrift fail on these redirects.