Repository navigation
Complete Volume file operations through the kernel backend - #1057
aakash-saravanan-db wants to merge 55 commits into
Conversation
There was a problem hiding this comment.
Verdict: 1 High · 1 Medium · 1 Low
Needs changes. The main blocker is that the code relies on new kernel APIs while the dependency floor still allows older wheels, which would break every kernel query, not only Volume operations. There is also a KeyError crash when the best-effort canceller is missing.
Other findings
- 🔵 Low — This PR deletes the kernel e2e tests for staging and adds no replacements. All new coverage uses mocks that invent
is_volume_operation,complete_volume_operationreturn strings ("needs_input_stream","completed","not_volume") and exception attributes (local_os_error,http_status,local_path). Nothing in CI checks that the real kernel binding actually has these names and values. Please add kernel e2e cases, such as PUT→GET→REMOVE round trips (file andinput_stream) and a rejected symlink outside the allowed root, so a mismatch with the kernel contract fails the build.
There was a problem hiding this comment.
Verdict: 1 High · 1 Medium · 2 Nit
Needs changes: 1 high, 1 medium and 2 low findings. The high one: the new is_volume_operation attribute is read unconditionally on every execute, but the kernel floor is still ^1.4.0, so released wheels would break all kernel queries. The medium one: any kernel error with an HTTP status is turned into a generic staging OperationalError. Follow-up already noted in the PR: Windows and installed released-package validation are still open.
Other findings
- ⚪ Nit — The new ordering (backend
close_commandfirst, then_kernel_handle.close()) now applies to every kernel result set, not only Volume ones. For async results,close_commandcloses the retained owning handle and the parentStatement(client.py ~800-820) while the result stream taken from them is still open. Before this change the stream was closed first. Any error from closing the stream afterwards is logged and swallowed, but this changes the teardown order for all async results to work around a lock that only Volume transfers hold. Consider cancelling only the Volume canceller first and keeping the old order for everything else. - ⚪ Nit — Several new cancellation paths have no unit tests:
close_sessionnow cancels all in-flight sync cancellers and retained Volume cancellers, andclose_commandcancels a pending Volume canceller (client.py:784-790). The only Volume backend test coverscancel_commandandfinish_volume_operation.test_volume_close_signals_backend_before_native_lockuses a mocked backend, so it doesn't exercise the realclose_commandlogic. Add tests that (a)close_commandon a registered Volume id callscancel()and removes the entry, and (b)close_sessioncancels and clears both maps, even whencancel()raises.
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>
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>
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 High
One high concern: the kernel floor isn't bumped. With a supported 1.5.x wheel, every kernel statement breaks, not only Volume ones. The rest of the cancellation, completion and error-mapping wiring looks consistent and has tests.
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 High
Needs changes: 1 high concern. The Volume completion and cancel wiring looks sound. However, the unconditional reads of the new kernel attribute break every kernel query on wheels the current ^1.5.0 floor still allows.
Feature or gap
Kernel-backed cursors need to complete server-marked Volume transfers through the Python staging API.
What this PR addresses
Complete file PUT, GET, REMOVE and BinaryIO PUT through the native core. Keep the mutable statement owner and detached canceller available during synchronous transfer, consume instruction rows on completion, and preserve Python filesystem and HTTP exception mapping. Async execution completes through its retained result stream. Cancelling or closing the cursor stops a running transfer; the Thrift backend lets it finish. Resolved symlink targets must stay within
staging_allowed_local_path.Dependencies
Requires the kernel Volume APIs in databricks/databricks-sql-kernel#465 and a compatible coordinated native release. The package floor and lock must select that release, with clean installed-driver validation before merge.
Kernel version
The compatible kernel release has not been selected. When it is available, update the dependency floor and lockfile in this PR and validate a clean installation before merge.
KERNEL_REVselects source for local and CI builds only.Tests and validation
The focused client and result-set suites pass. Local validation uses source-built native inputs; package installation and scheduled activation remain separate gates.