Skip to content

Complete server-marked Volume transfers in the native kernel - #465

Open
aakash-saravanan-db wants to merge 63 commits into
mainfrom
aakash-saravanan_data/feat/volume-restart-20261113
Open

aakash-saravanan-db wants to merge 63 commits into
mainfrom
aakash-saravanan_data/feat/volume-restart-20261113

Conversation

@aakash-saravanan-db

@aakash-saravanan-db aakash-saravanan-db commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Feature or gap

SQL PUT, GET and REMOVE results require a client-side storage transfer before the operation is complete.

What this PR addresses

Add explicit completion shared by the Rust API, ADBC, NAPI, PyO3 and C ABI. Enforce lexical and resolved local roots, download GET data before copying it into place, reject missing destination directories before downloading, and cache success or failure. Session and detached cancellers interrupt running transfers.

Storage follows reqwest redirects with Referer disabled and refuses HTTPS-to-HTTP redirects. A file PUT redirected with 307/308 is replayed from the opened file, without reopening its path. On such a redirect, the replay buffer uses one full file's worth of memory. Python Thrift reads every PUT file into memory; Node and Go Thrift fail on these redirects. Caller-supplied stream bytes can also be replayed. GET decodes gzip Content-Encoding before writing, matching Python Thrift.

tempfile moves from a dev dependency to a regular dependency: a GET downloads into a temporary file before it is copied into place.

Storage HTTP errors include the S3 request id and host id when those headers are present.

Dependencies

Consumers require coordinated native releases containing these APIs and compatible package metadata before merge. GET copies into an existing destination in place; a copy failure can leave partial bytes, and a copy already started runs to completion. Storage idle limits cover connection setup, GET reads, initial PUT progress and response waits, but redirected resends have no idle limit.

Tests and validation

Formatting, strict all-target Clippy and the root Rust tests pass: 1,360 passed, 64 ignored. Volume tests cover shared-position and short-file reads, file and stream redirect replay, missing-parent preflight, and async-canceller completion and repeat calls. Compatible installed packages and scheduled execution remain separate delivery gates.

@aakash-saravanan-db
aakash-saravanan-db marked this pull request as ready for review November 14, 2026 02:18
@aakash-saravanan-db
aakash-saravanan-db requested a review from a team as a code owner November 14, 2026 02:18

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 High · 1 Medium · 1 Low · 1 Nit

The per-execution state machine, safe GET replacement and cancellation wiring look solid. I found one high-severity problem: storage transfers inherit the workspace client's total 60s request timeout. There are also a few medium/low concerns in the Python binding and the async filesystem handling.

Other findings

  • ⚪ Nit — transfer runs blocking filesystem calls directly on the async runtime: std::fs::File::open and metadata here, and the canonicalize/read_link/symlink_metadata calls inside allowed_path/resolve_existing_parent. On slow or network filesystems (SMB/NFS roots are common for ODBC users), these block a Tokio worker thread. That worker is shared with other sessions' polling and CloudFetch work. Consider wrapping the path resolution and file opening in spawn_blocking, or using tokio::fs equivalents.

Comment thread src/session.rs Resolved
Comment thread pyo3/src/result_stream.rs Resolved
Comment thread pyo3/src/errors.rs Resolved
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
…nostics

Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔀 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 · 3 Low

Mostly solid: 1 medium and 2 low concerns, all about the bindings behaving differently. The core completion and caching, the cancellation wiring and the path checks look sound; parts of src/volume.rs were only partly readable because of size caps.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.

Review incomplete

This review did not cover the whole change, so it is posted as a comment and does not approve the PR. Review the items below by hand, or split the PR so the bot can cover all of it:

  • The PR diff exceeded the 200,000-byte review cap, so 1 production hunk(s) and 7 docs hunk(s) and 1 test hunk(s) and 15 generated/data hunk(s) were not shown to the reviewer (production: src/volume.rs; docs: CONNECTION_PARAMETERS.md, NEXT_CHANGELOG.md, README.md, adbc/README.md, napi/NEXT_CHANGELOG.md, napi/README.md, pyo3/NEXT_CHANGELOG.md; tests: tests/v0_volume_wiremock.rs; generated: Cargo.lock, adbc/Cargo.lock, napi/Cargo.lock, pyo3/Cargo.lock).

Comment thread napi/src/statement.rs Resolved
Comment thread pyo3/src/errors.rs Resolved
Comment thread src/kernel_error.rs Resolved
Comment thread adbc/src/statement.rs Resolved

@vuanhphung vuanhphung left a comment

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.

This PR is getting a little too big. Can your factory break it down further?


async fn cancel(&self) -> Result<()> {
async {
self.valid.check()?;

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.

Since 9ed6b72, dropping the Statement invalidates valid without cancelling completion, so valid.check()? here returns InvalidStatementHandle before cancel_volume() runs and the transfer keeps going. Same at :1252 for AsyncStatementCanceller. Can these do the same, with a test for submit → await_result → drop stmt → complete → cancel?

Comment thread adbc/src/statement.rs
.map_err(map_kernel_error)?;
return Ok(count);
}
let executed = self.execute_inner()?;

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.

With staging_allowed_local_paths unset, complete_volume returns Ok and execute_update returns only the row count, so ExecuteUpdate("REMOVE '/Volumes/...'") reports success and deletes nothing. Python raises when no staging path is configured. Can execute_update fail with InvalidState naming the option when the result is a Volume op?

Comment thread src/statement/executed.rs
@@ -348,6 +349,7 @@ impl ExecutedStatementHandle for ExecutedStatement {
}

async fn cancel(&self) -> Result<()> {

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.

Sync Volume results come back inline CLOSED (closed=true at mutable.rs:413), but cancel() still sends CancelStatement, which napi's comment at statement.rs:136-140 says fails with a server error. So cancelling a slow PUT stops it and then reports failure (ADBC Connection::cancel → Status::Unknown). Can we skip the RPC when closed is set?

Comment thread src/volume.rs
.unwrap_or_else(|| std::io::ErrorKind::IsADirectory.into());
return Err(local_error(error, &local_file));
}
source = Some((file, metadata.len()));

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.

Only directories are rejected, so a FIFO or procfs source sends Content-Length: 0 (or a stale size) and the PUT reports Completed with an empty or truncated object. Can we reject !metadata.is_file() with VOLUME_LOCAL_FILE_ERROR, ideally before open so FIFOs don't block either?

This branch was successfully deployed

1 active deployment
azure-prod — 088cb40f Deployed Nov 29, 2026 by vuanhphung via followup #4387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants