Repository navigation
Retry fs command reads on transient errors - #7556
Merged
Merged
Conversation
databricks fs cp/ls/cat/rm now retry Stat, Read and ReadDir against DBFS and the Files API on transient errors, including the SDK's inactivity timeout, using the same retry policy as bundle file operations (libs/retry). Writes and deletes are not retried. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Collaborator
✅ Integration test reportCommit: f153cb2
Top 14 slowest tests (at least 2 minutes):
|
andrewnester
approved these changes
Nov 12, 2026
Rename retry.ReadFiler to retry.FilerExceptWrites: it keeps Filer's retry-safe Delete and skips only Write. Add acceptance/cmd/fs/retry-504, which injects a 504 on dbfs list, get-status and delete. Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
|
Commit: Regression test reportSelected 1 changed tests (limit=20, 0 not selected) 1 tests: regression=1 unreleased=0 coverage=0 failing=0
TestAccept/cmd/fs/retry-504: branch ✅ | main (2848f68) ❌ | latest (v1.26.0) ❌main (2848f68): latest (v1.26.0): same output as main (2848f68) |
andrewnester
approved these changes
Nov 12, 2026
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
databricks fs cp/ls/cat/rmnow retryStat,Read,ReadDirandDeleteagainst DBFS and the Files API on transient errors, using the policy fromlibs/retry(5xx/408 the SDK did not retry, the SDK's "request timed out after ... of inactivity",unexpected EOF,REFUSED_STREAM; 2 retries, 15s apart).#7521 added the inactivity-timeout retry, but only bundle code wraps its filers with
retry.Filer;cmd/fsused the raw DBFS/Files clients, so a single stalledGET /api/2.0/dbfs/get-statusfailed the whole copy.Added
retry.FilerExceptWrites, a variant ofretry.Filerthat passesWritethrough, becausefs cpwrites are not safe to retry the same way:--overwrite, a retried create may hit the file its own first attempt created, andfs cpwould then report it as "skipped; already exists";--overwrite,retry.Filerbuffers a non-seekable source (e.g. a DBFS/Volumes read stream) in memory to replay it, andfs cpcan copy multi-GB files.Question for reviewers: error/1213 below fails in
DbfsClient.WriteatPOST /api/2.0/dbfs/create, before any data is read. Retrying just that call in overwrite mode would be safe and cheap; in non-overwrite mode a retry that gets RESOURCE_ALREADY_EXISTS could return the original timeout instead of "already exists". Worth doing in a follow-up?Why
Flaky
integration/cmd/fstests on cloud.Dashboard
Get "[DATABRICKS_URL]/api/2.0/dbfs/get-status": request timed out after 1m0s of inactivityTests: integration/cmd/fs.TestFsCpDirToDirFileNotOverwritten/dbfs_to_uc-volumes, integration/cmd/fs.TestFsCpFileToDir/dbfs_to_local
Not covered here (same family, different paths):
dbfs open: Post "[DATABRICKS_URL]/api/2.0/dbfs/create": request timed out after 1m0s of inactivity: a non-overwrite write, see the question above.Put "[DATABRICKS_URL]/api/2.0/fs/files/[PATH]": read tcp ...: a test-setup write without overwrite, not a CLI call.Get "[DATABRICKS_URL]/api/2.0/workspace/get-status": unexpected EOF: the generatedworkspace get-statuscommand, which only goes through the SDK.Tests
Unit tests for
retry.FilerExceptWrites; newacceptance/cmd/fs/retry-504injects a 504 on dbfs list, get-status and delete and shows each retried;cmd/fsunit tests and localTestAccept/cmd/fspass.This pull request and its description were written by Isaac.