Repository navigation
filer: retry small non-seekable uploads to UC Volumes - #7607
Merged
Merged
Conversation
fs cp from a Volume or DBFS to a Volume streams the source download into the Files API upload. #7559 retries uploads only for seekable readers, so a single 503 (e.g. "Azure is temporarily unavailable; try again later.") on that upload still failed the copy. Buffer non-seekable bodies of up to 8 MiB so they can be replayed; larger streams keep one attempt. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Collaborator
✅ Integration test reportCommit: ea52c08
Top 3 slowest tests (at least 2 minutes):
|
denik
marked this pull request as ready for review
November 13, 2026 16:51
denik
requested review from
Divyansh-db,
Sankalp-Mittal,
andrewnester and
rclarey
November 13, 2026 16:51
Sankalp-Mittal
left a comment
Contributor
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Fable 5.2, cross-verified). Only points the reviewers agreed on are posted.
A DBFS read handle makes one /dbfs/read call per Read, and io.ReadAll asks for small growing chunks, so buffering a 1 MiB DBFS file took ~20 calls. Read through a 1 MiB bufio.Reader instead. Also update the cmd/fs comment that said Volume writes are not retried. Co-authored-by: Isaac <no-reply@databricks.com>
andrewnester
left a comment
Contributor
There was a problem hiding this comment.
No blocking findings from a full pass; I'll take a manual look at the filer changes before approving.
rclarey
removed their request for review
November 17, 2026 21:41
Co-authored-by: Isaac <no-reply@databricks.com>
andrewnester
left a comment
Contributor
There was a problem hiding this comment.
No blocking findings from a full pass; I'll take a manual look at the filer changes before approving.
andrewnester
approved these changes
Nov 19, 2026
Collaborator
❌ Integration test reportCommit: 44a9c42
1274 interesting tests: 1242 MISS, 9 KNOWN, 9 RECOVERED, 9 FAIL, 5 PANIC
Top 50 slowest tests (at least 2 minutes):
|
idelafuente-oc
pushed a commit
to idelafuente-oc/cli
that referenced
this pull request
Nov 20, 2026
…databricks#7763) ## Changes `DbfsClient.Write` restarts the whole DBFS upload (create, add-block, close) once when add-block or close fails with 404 `RESOURCE_DOES_NOT_EXIST` "No such stream with handle". To restart, it has to read the source again: - seekable sources (local files) seek back to where they started; - non-seekable sources (a download from DBFS or a Volume during `fs cp`, a pipe) are copied into a memory buffer as they are read, up to 8 MiB. Past that limit there is no restart, the same limit databricks#7607 uses for Volumes. The restart always passes overwrite. The first create succeeded, so the file at the path now is this upload's own partial file. Without overwrite, a retried `fs cp` without `--overwrite` would fail on that file with "already exists". Decision: accept the small window where another writer creates the same path between the two attempts and gets overwritten. The testserver's DBFS fake now returns the same message as the real API for an unknown handle. I checked the message on AWS: closing a handle and then calling add-block or close on it returns `404 RESOURCE_DOES_NOT_EXIST "No such stream with handle: [ID]."`. This is separate from databricks#7607, which changes UC Volumes uploads in `files_client.go`. The two buffers look alike, but I kept them apart so the PRs don't depend on each other. ## Why The backend drops stream handles now and then, a few seconds into uploads of files that are only a few bytes. It happens on every cloud, and it failed 38 integration tests (`integration/cmd/fs` and `integration/libs/filer` DBFS variants) in 21 runs on 2026-11-17, including main on Azure. Before this change, `DbfsClient.Write` made a single attempt and the SDK does not retry a 404, so every lost handle failed the command. ## Dashboard | error | snippet | |---|---| | [error/1218](http://go/cli/dashboard/error/1218?main=1&pr=1&end=2026-11-18T12:00:00Z&last=7d) | `dbfs write: No such stream with handle: [ID].` | Example tests: [integration/cmd/fs.TestFsCpFileToDirFileNotOverwritten/uc-volumes_to_dbfs](http://go/cli/dashboard/test/integration/cmd/fs.TestFsCpFileToDirFileNotOverwritten/uc-volumes_to_dbfs?main=1&pr=1&end=2026-11-18T12:00:00Z&last=7d), [integration/cmd/fs.TestFsCpDirToDirWithOverwriteFlag/dbfs_to_dbfs](http://go/cli/dashboard/test/integration/cmd/fs.TestFsCpDirToDirWithOverwriteFlag/dbfs_to_dbfs?main=1&pr=1&end=2026-11-18T12:00:00Z&last=7d) ``` cp_test.go:237: Error: Received unexpected error: dbfs write: No such stream with handle: [ID]. Test: TestFsCpFileToDirFileNotOverwritten/uc-volumes_to_dbfs ``` ## Tests - New unit tests in `libs/filer/dbfs_client_test.go` use a fake that drops the handle on add-block or close. They cover non-seekable and seekable sources, a large source that fails early, the single-restart limit, the buffer limit, and the case where the error is not a lost handle. All but the last fail without the fix. - `TestFsCpFileToDirFileNotOverwritten`, `TestFsCpDirToDirWithOverwriteFlag` and `TestFsCpFileToFileWithOverwriteFlag` pass on AWS (30 subtests). A lost handle could not be triggered against the real backend. This pull request and its description were written by Isaac. --------- Co-authored-by: Isaac <no-reply@databricks.com>
idelafuente-oc
pushed a commit
to idelafuente-oc/cli
that referenced
this pull request
Nov 22, 2026
databricks#7839) ## Changes `FilesClient` (UC Volumes): - When a Files API error carries no message, the error now names the operation, the path and the HTTP status, plus the body's `error_code` if it has one, e.g. `stat /Volumes/c/s/v/dir: Files API returned HTTP 500 Internal Server Error`. Before, it printed as `databricks-api error: ` with nothing after it. This covers every FilesClient call, the experimental multipart upload included. - Read-only calls (file and directory metadata, download, list) are also retried on HTTP 500, at most 3 times per call. Writes, deletes and mkdir keep the current retry set (408/429/502/503/504). ## Why The files/v2 SDK prints an `APIError` as `"databricks-api error: " + message`, and the message comes only from a JSON error body. A failed HEAD (`GetFileMetadata`, `GetDirectoryMetadata`, used by `Stat` and by `Write`'s parent-directory check) has no body, and a proxy error page is not JSON. Either way, users and CI see `Error: databricks-api error: ` with no status, call or path. The old databricks-sdk-go used `http.StatusText` in that case. The filer moved to files/v2 in [databricks#6760](databricks#6760) (2026-09-21), and the first empty-message failures on the dashboard date from that day. Since then the dashboard has 47 errors (one per test) with exactly this text: 179 failing runs in 60 days across UC Volumes tests in `integration/cmd/fs` and `integration/libs/filer`, on AWS, Azure and GCP. Some happened after [databricks#7559](databricks#7559) and [databricks#7607](databricks#7607), which already retry 408/429/502/503/504. In the run linked below the test failed in under 12 seconds, so the 10 retries were not exhausted. The status was outside the retry set, most likely 500. Decisions: - Retry 500 only on read-only calls, where a repeated attempt cannot apply anything twice. A retried PUT or DELETE after a 500 that the backend did apply would turn into "already exists" or "not found". Those keep the current retry set, and the new message shows their status if they still fail. - At most 3 retries on 500 (the other statuses keep the cap of 10), so a 500 that does not clear, e.g. on one broken path, still fails within seconds instead of about 75s. - The response body of a non-JSON error (a proxy HTML page) is not included; the status and path are enough to tell which call failed. - I could not confirm the status code: the CI output has only the empty text. If the next failure shows a status other than 500, the retry part should be revisited; the message part is needed either way. - Errors are described in the filer, not in the SDK. `sdk-go/core` v0.1.0 (the latest) still has a TODO in `APIError.Error()`. - Only a bare `APIError` is replaced. A wrapped one already has its wrapper's context, and the replacement keeps `Unwrap`, so status-based mapping (`httpStatus`) still works. ## Tests - `TestFilesClientRetriesReadOnlyCallsOn500`: HEAD (directory and file) and GET return 500 with an empty body twice and then succeed. Fails without the fix. - `TestFilesClientDoesNotRetryDeleteOn500` and `TestFilesClientDescribesErrorWithoutMessage` check the new text, a single DELETE attempt, and that `httpStatus` still sees the status. Without the fix both show `databricks-api error: `, the text from CI. - `TestFilesClientStopsRetrying500`: a 500 that does not clear gets 3 retries. - `TestFilesAPIErrorText`: an `error_code`-only body and a non-standard status (520). - `TestDescribeFilesErrorLeavesOtherErrors`: errors with a message, wrapped errors and nil are unchanged. - `go test ./libs/filer/ ./cmd/fs/` and local `TestAccept/cmd/fs` pass. - On AWS, `integration/cmd/fs` `TestFsCpDir`, `TestFsStat*`, `TestFsLs`, `TestFsRmDirRecursively` and `TestFsCpFileToFileFileNotOverwritten` pass, all variants (26 subtests). A 500 cannot be forced on cloud. ## Dashboard | error | verbatim | |---|---| | [error/1148](http://go/cli/dashboard/error/1148?main=1&pr=1&end=2026-11-20T08:30:00Z&last=60d) | `Error: databricks-api error: ` in `TestFsCpDir/dbfs_to_uc-volumes` (GCP, main, 2026-11-18 and 2026-11-19) | | [error/1204](http://go/cli/dashboard/error/1204?main=1&pr=1&end=2026-11-20T08:30:00Z&last=60d) | same text in `TestFsRmDirRecursively/uc-volumes` | | [error/1175](http://go/cli/dashboard/error/1175?main=1&pr=1&end=2026-11-20T08:30:00Z&last=60d) | same text in `TestFsCpFileToDirWithOverwriteFlag/uc-volumes_to_dbfs` | | [error/1157](http://go/cli/dashboard/error/1157?main=1&pr=1&end=2026-11-20T08:30:00Z&last=60d) | same text in `TestFsCpDirToDirFileNotOverwritten/uc-volumes_to_uc-volumes` | Test: [TestFsCpDir/dbfs_to_uc-volumes](http://go/cli/dashboard/test/integration/cmd/fs.TestFsCpDir/dbfs_to_uc-volumes?main=1&pr=1&end=2026-11-20T08:30:00Z&last=30d) ``` cp_test.go:139: stderr: Error: databricks-api error: Error: Received unexpected error: databricks-api error: Test: TestFsCpDir/dbfs_to_uc-volumes ``` _AI agent (opus5.5, isaac_claude)._ This pull request and its description were written by Isaac. --------- Co-authored-by: Isaac <no-reply@databricks.com>
deco-sdk-tagging Bot
added a commit
that referenced
this pull request
Nov 24, 2026
## Release v1.28.0 ### CLI * Retry transient errors in `fs` commands: `fs cp` to a UC Volume from another Volume or DBFS (files up to 8 MiB) on HTTP 503, DBFS uploads when the upload stream is lost, and stat, read and list on UC Volumes on HTTP 500. ([#7607](#7607), [#7763](#7763), [#7839](#7839)) * `databricks auth profiles --skip-validate` now omits the `Valid` column instead of reporting `NO` for every profile. ([#7638](#7638)) * Fix Ctrl-C taking about 10 seconds to stop `databricks aitools install`, `update` or `uninstall` while it runs a coding agent's CLI, and retry reading an agent's config on Windows while the agent rewrites it. ([#7832](#7832), [#7870](#7870)) * Automatic installation of Databricks AI tools no longer asks in containers or installs for the first time without a terminal, no longer runs as root in another user's home, keeps newer skills you installed, no longer hints to install what it is about to install, and on Linux and macOS stops the calling script on Ctrl-C. ([#7828](#7828), [#7834](#7834), [#7874](#7874), [#7888](#7888), [#7890](#7890), [#7901](#7901)) * Wait before retrying a failed automatic install of Databricks AI tools, starting at 5 minutes and doubling after each failure, so a skills source or coding agent CLI that stays broken no longer slows down each of the next commands. ([#7900](#7900)) * `databricks aitools install` now cancels the agent picker on Esc. ([#7721](#7721)) * `databricks aitools uninstall --skills` now fails when its value names no skill instead of removing every skill, and `aitools update` and `uninstall` no longer prompt when a coding agent runs them; with skills in both scopes they fail and ask for `--scope`. ([#7873](#7873)) * `databricks aitools install --skills-only` and `databricks aitools update` no longer mix skill files with the Databricks plugin: install skips agents that already have the plugin, and update no longer replaces skill files from a `--skills-only` install made with this release or later while the agent's CLI was on PATH. To keep skill files from an earlier `--skills-only` install, run `databricks aitools install --skills-only` again with the agent's CLI on PATH. ([#7831](#7831), [#7903](#7903)) * `apps init` no longer suggests installing skills to Codex and Copilot users who installed the Databricks plugin with `databricks aitools install`. ([#7830](#7830)) * Fix `databricks auth login` failing with `data passed to Set was too big` on macOS and Windows for OAuth tokens too large for one keyring item. ([#7845](#7845)) * Fix the token storage mode (`auth_storage`) being read from the file named by `DATABRICKS_CONFIG_FILE` instead of the config file the profile was loaded from. ([#7733](#7733)) * `databricks auth login` no longer waits for the browser that the default opener starts to close before it continues. ([#7551](#7551)) * Allow `databricks auth docker configure` when several profiles match one workspace; the chosen profile is recorded for the registry and shown by `databricks auth docker host`. ([#7383](#7383)) * Show the HTTP status, error code and endpoint when an API error has no message, instead of a bare `Error: `, and the HTTP status and path for Files API errors that used to show an empty `databricks-api error:`. ([#7800](#7800), [#7839](#7839)) * AI agents can now submit feedback without confirmation; `--yes`/`-y` is deprecated, and agents passing `--yes=false` now get an error. ([#7795](#7795)) * Log `/.well-known/databricks-config` fetch failures with a transient HTTP status (408, 429, or 5xx other than 501) at debug level instead of as a warning, like timeouts. ([#7912](#7912)) * Fix interactive list output sometimes dropping or reordering a page of rows. ([#7804](#7804), [#7914](#7914)) * Allow `databricks sandbox forward` to forward remote ports below 10000. The sandbox refuses a few reserved platform ports with an error that names the port. ([#7861](#7861)) * Breaking: `databricks sandbox ssh` now uses local SSH keys and works with sandboxes created through the SDK or API; it no longer accepts `--port` and needs Python 3 and `openssh-server` in the sandbox. Add `databricks sandbox ssh-setup` to configure native SSH and SCP. ([#7588](#7588), [#7589](#7589), [#7590](#7590)) * `databricks ssh connect` to serverless CPU compute now defaults to environment version 5, so the first connection after upgrading starts a new server; pass `--environment-version 4` to keep the old one. ([#7847](#7847)) * `databricks ssh connect` now downloads the SSH server binaries from PyPI when GitHub is unreachable, using `PIP_INDEX_URL` or `index-url` from the per-user pip config over HTTPS only, and checks SHA-256 digests. ([#7852](#7852)) ### AI Runtime * Breaking: `compute.pool_id` is no longer accepted in AIR workload YAML; use `compute.accelerator_pool_id`. ([#7698](#7698)) * `databricks air convert-to-dabs` handles an existing output directory better: it gives the right guidance when the directory already holds the workload's bundle, `--force` no longer replaces a different bundle or an alternate root file, re-converting removes stale sidecars, and git-pinned code outside the bundle gets an `--output-dir` suggestion. ([#7835](#7835), [#7853](#7853), [#7857](#7857), [#7866](#7866)) * `air list` and `air get` now find the AI Runtime task anywhere in a multi-task job; a job with several such tasks lists one row per task (so `run_id` is no longer unique in `air list -o json`), and both report `task_key` (`air get --task-key` selects one). `air list --all-status` now orders runs by submission time instead of by their latest attempt's start. ([#7632](#7632)) * Update fallback messages for pending AI Runtime runs when AIR does not report a status reason. ([#7899](#7899)) * `air run -o json` now reports config-validation errors as a JSON error envelope, with `UNAUTHENTICATED`, `INVALID_ARGS` or the new `PERMISSION_DENIED` code. ([#7864](#7864)) ### Bundles * Bundle commands no longer hang after a request timeout on a dead HTTP/2 connection. ([#7723](#7723)) * Fix a panic when the local Terraform state is removed after it is pulled and before it is migrated to the direct engine, for example by a concurrent `bundle deploy`. ([#7778](#7778)) * The direct deployment engine now uses a Lakebase or postgres catalog that a failed create request still created, instead of failing the deploy. ([#7801](#7801)) * `bundle deploy` and `bundle run` for apps now succeed when the app's compute is already active or starting, and deploy the app when the deployment triggered by start failed. ([#7709](#7709), [#7780](#7780)) * Add `thumbnail_path` to the `apps` resource, so `bundle deploy` sets, updates and deletes the thumbnail shown for the app in the Apps UI. ([#7728](#7728)) * Fix bundle commands failing on a notebook or file path with a colon in its first segment, such as the default workspace notebook name `New Notebook 2026-10-28 12:17:43.ipynb`. ([#7851](#7851)) * `bundle run` and `pipelines run` now retry transient errors from the pipeline events and update status reads while waiting for an update. ([#7800](#7800)) ### Dependency Updates * Bump dependencies with known vulnerabilities. ([#7904](#7904)) * Update the Go SDK to [v0.203.0](https://github.com/databricks/databricks-sdk-go/releases/tag/v0.203.0). ([#7869](#7869), [#7906](#7906)) * Update `github.com/databricks/sdk-go/files` to [v0.9.0](https://github.com/databricks/sdk-go/blob/files/v0.9.0/files/CHANGELOG.md). ([#7889](#7889))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
FilesClient.Write(UC Volumes) now buffers a non-seekable upload body of up to 8 MiB in memory, so the upload is retried on 408/429/502/503/504 like a seekable one. Bodies over 8 MiB are streamed with one attempt, as before.Why
#7559 retries Files API uploads by rewinding a seekable reader.
fs cpfrom a Volume or from DBFS to a Volume passes the source's download stream toWrite, which is not seekable, so a single 503 on the upload still failed the copy. A local source (*os.File) is seekable and already covered.The errors below are HTTP 503 from the Files API. All failures in the window predate #7556 and #7559 (merged 2026-11-12 ~18:10 UTC). One later PR failure ran on a stacked branch that does not include them. Those PRs cover reads, stats, deletes, mkdir and seekable writes, including the test-setup writes behind most of these failures. This PR closes the remaining gap: remote-to-Volume copies.
Decisions:
cmd/fs, so every caller (fs cp, bundle uploads of generated content) gets it, and the size does not have to be known up front.Open points for the reviewer:
cpFileToFilewould re-open the source withsourceFiler.Readand retry theWrite. That covers files of any size with no buffering, but only forfs cp, andcmd/fswould need its own status-code policy. I went with the smaller, filer-local change. Happy to switch.Tests
TestFilesClientDoesNotRetryNonSeekableUploadwith three tests.TestFilesClientRetriesSmallNonSeekableUploadcovers a body of exactly the buffer size and fails without the fix.TestFilesClientRetriesSmallPipeUploadcovers an*os.Filewhose Seek fails.TestFilesClientDoesNotRetryLargeNonSeekableUploadchecks a larger body gets one attempt and is sent in full. The tests lower the limit to a few bytes.TestFilesClientBuffersUploadInLargeReads: the source is read in 1 MiB chunks, so buffering a DBFS file takes about one/dbfs/readper MiB rather than ~20. It fails without thebufio.Reader.go test -race ./libs/filer/ ./cmd/fs/and localTestAccept/cmd/fspass.fs cpdbfs_to_uc-volumes and uc-volumes_to_uc-volumes variants re-run after the 1 MiB read change: pass.integration/cmd/fsTestFsCpDir,TestFsCpDirToDirFileNotOverwritten,TestFsCpFileToFileFileNotOverwrittenandTestFsRmEmptyDirpass, all variants. A 503 cannot be forced on cloud.Dashboard
databricks-api error: Azure is temporarily unavailable; try again later.(17 failures, 13 tests, Azure)databricks-api error: GCP is temporarily unavailable; try again later.(6 failures, GCP)databricks-api error: The service at /api/2.0/fs/files/[PATH] is temporarily unavailable. Please try again later.Remote-to-Volume tests this PR covers:
AI agent (harness_auto).
This pull request and its description were written by Isaac.