Add _retry_server_directed_only mode for Retry-After header compliance#756
Open
sd-db wants to merge 4 commits intodatabricks:mainfrom
Open
Add _retry_server_directed_only mode for Retry-After header compliance#756sd-db wants to merge 4 commits intodatabricks:mainfrom
_retry_server_directed_only mode for Retry-After header compliance#756sd-db wants to merge 4 commits intodatabricks:mainfrom
Conversation
When enabled, the connector only retries on 429/503 if the server includes a Retry-After header in the response. This prevents duplicate side effects for non-idempotent ExecuteStatement operations where the server has not explicitly signaled that retry is safe. The new opt-in parameter `_retry_server_directed_only` threads through ClientContext, all three DatabricksRetryPolicy construction sites (Thrift, SEA, UnifiedHttpClient), and the retry policy's should_retry/is_retry methods. Default behavior (retry without requiring the header) is unchanged. Signed-off-by: Shubham Dhal <shubham.dhal@databricks.com>
_retry_server_directed_only mode for Retry-After header compliance
jprakash-db
reviewed
Mar 18, 2026
Inline kwargs.get() at the single point of use in ThriftDatabricksClient and SeaHttpClient instead of storing as dead instance state. Signed-off-by: Shubham Dhal <shubham.dhal@databricks.com>
- Rename server_directed_only to respect_server_retry_after_header throughout for clarity - Store _respect_server_retry_after_header as instance variable in Thrift/SEA backends to match existing kwargs extraction pattern - Replace duplicate test fixture with _make_retry_policy(**overrides) helper for flexible policy construction in tests Signed-off-by: Shubham Dhal <shubham.dhal@databricks.com>
jprakash-db
approved these changes
Mar 18, 2026
Contributor
jprakash-db
left a comment
There was a problem hiding this comment.
LGTM. Thanks for making the changes
Signed-off-by: Shubham Dhal <shubham.dhal@databricks.com>
2 tasks
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.
Summary
_retry_server_directed_onlyconnection parameter that restricts retries to only occur when the server includes aRetry-Afterheader in the responseExecuteStatementoperations where the server has not explicitly signaled that retry is safeClientContext, all threeDatabricksRetryPolicyconstruction sites (Thrift, SEA, UnifiedHttpClient), and the retry policy'sshould_retry/is_retrymethodsTest plan
tests/unit/test_retry.pytests/unit/test_unified_http_client.pyfor the new attributepoetry run python -m pytest tests/unit)