Repository navigation
fix(cloudfetch): refresh a link that storage rejects with 401/403/404 - #452
vuanhphung wants to merge 11 commits into
Conversation
A CloudFetch download refused with 401, 403 or 404 was retried with the same presigned URL: the provider refreshes a link only on time-based expiry, so a URL whose signature storage rejected (or GCS's 404 for an expired one) could never succeed on retry. Mark the refused URL and refresh the chunk's link before the next attempt; the batched refresh no longer treats the refused URL as fresh. The failure still counts against the download attempt budget. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good, with one low concern. The rejected URL is tracked correctly through both the local stale check and the coordinator dedupe (is_usable), the retry still counts against max_retries, and the wiremock test exercises the dedupe-skip path that caused the bug, including the 400 negative case. The concern: rejected URLs are now retried without any backoff.
…gain Review follow-up. The first refusal still refreshes at once; when a refreshed URL is refused too, the attempt waits the usual retry delay before the next refresh, so a persistently refused chunk does not issue back-to-back refresh RPCs. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good, with one low test-coverage gap. The rejected-URL refresh stays bounded: every attempt counts against max_retries, the claim retries in refresh_links_batch_replacing are capped by MAX_CLAIM_RETRIES, and a refresh that returns the same URL is retried without looping forever. The 4xx statuses outside 401/403/404 keep the old same-URL retry.
Review follow-up: assert exactly one retry_delay, so the test fails if the first refusal also sleeps. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
|
The red "Unit + doc tests" check is an unrelated flake in |
Review follow-up. A refresh for a refused URL is skipped when the cached link already carries a different, fresh URL; the new test fails if any refusal is treated as stale. The waiter test parks the waiter with a yield instead of a 50ms sleep, and the download_chunk_with_retry doc names the refusal path. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good, with one low concern: the 401/403/404 → refresh logic, the dedupe change, and the first-refusal-only backoff are correct, and the wiremock tests cover them well. The concern is that a failed refresh right after a rejection fails the whole download without using the remaining retry budget.
Review follow-up. A refused download whose refresh RPC fails surfaces the refresh error after one download; the RPC retries transient errors itself, so the outer loop does not stack a second budget on it. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good, with one low-severity logging gap. The refusal → refresh flow, the dedupe change in refresh_links_batch_replacing (is_usable combined with url_changed), the attempt-budget accounting and the constant backoff all hold up. The new tests can fail if the fix regresses.
Review follow-up. The first 401/403/404 refusal now logs at warn with the attempt count and error, like every other failed attempt; before, it skipped the shared retry warning and only showed at debug. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Medium
The 401/403/404 refresh logic is correct, with one medium scope concern. Each refusal counts against max_retries, only the first refusal skips the backoff, and the is_usable predicate handles dedupe correctly in both the waiter path and the post-claim path. The new wiremock tests cover the refresh, backoff, failed-refresh and dedupe behaviour well. The concern is that the PR also commits unrelated, fully regenerated napi bindings (napi/index.js and napi/index.d.ts).
cb4b6ac accidentally committed napi/index.js and napi/index.d.ts regenerated by a local napi-rs build. Restore them to main's content; this PR does not change the bindings. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Review follow-up. When a refresh returns the refused URL unchanged and the next failure is not a refusal, the retry reuses the URL without a second refresh; the test fails if the post-refresh reset of the refused URL is removed. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Scope trim. A 401/403/404 download now marks the cached link expired, so the existing expiry path refreshes it on the next attempt, after the usual retry delay. This replaces the rejected-URL state, the refresh variant and its dedupe predicate, the first-refusal fast path and its log, and the tests that covered only those. Production change vs main: +12 lines. Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
|
Closing: not needed. CLOUDFETCH-001/002/007 is being relaxed to "a one-shot 401/403/404 must not fail the query; a link refresh or a same-URL retry both count", which the kernel's existing same-URL retry already satisfies. Only C# refreshes, and only on 401/403; JDBC also retries the same URL. The driver-test spec change follows separately. |
When cloud storage refuses a CloudFetch download with 401, 403 or 404, the provider retried the same presigned URL.
download_chunk_with_retryrefreshes a link only on time-based expiry (is_expired()), so a URL whose signature storage rejected, or GCS's 404 for an expired one, can never succeed on retry. That happens when the client clock lags storage or storage revokes a URL early. The cross-driver CloudFetch spec (CLOUDFETCH-001/002/007) expects these statuses to fetch a fresh link, and C# refreshes on 401/403. Every kernel-backed driver (Node.js SEA, Python, Go, ODBC) inherits the gap.The change marks the refused link as expired in the chunk cache. The next attempt, after the usual retry delay, then refreshes it through the existing expiry path, including the refresh coordinator's dedupe. Each refusal still counts against
max_retries. Other 4xx, 5xx and transport errors keep the same-URL retry. Size: +12 lines of production code instreaming_provider.rs, plus two unit tests and a changelog line.Testing:
rejected_presigned_url_is_refreshed_before_retry(wiremock): 401/403/404 cause one refresh, then a download of the fresh URL; 400 keeps the same-URL retry.refused_url_with_failing_refresh_surfaces_the_refresh_error: a refresh that fails after a refusal ends the chunk withLink refresh RPC failed.cargo test,cargo clippy --all-targets -- -D warningsandcargo fmt --checkpass.tests/kernelagainst this branch (pecotesting warehouse): CLOUDFETCH-001/002/007 and EXTRA-001 pass every spec assertion in 3 of 3 runs each: aFetchResultChunkfor chunk 0 between the failed download and its retry, and distinct URLs. The tripwires that databricks/databricks-driver-test#2129 put on driver-test main trip against this branch, as they should. Kernel replay of the follow-up's re-recorded tests passes.Merge order: databricks/databricks-driver-test#2129 has already merged, so the merge queue's replay of
tests/kernelpasses with this change. A driver-test follow-up removes the tripwires and re-records those four tests once this lands.Possible follow-ups, deliberately left out:
MaxUrlRefreshAttempts.This pull request and its description were written by Isaac.