Skip to content

Commit 9402029

Browse files
author
peco-engineer-bot[bot]
committed
ERROR:databricks.sql.common.unified_http_client:HTTP request error: Retry request would exceed Retry policy max retry duration of 300 seconds (#709)
Signed-off-by: peco-engineer-bot[bot] <3815206+peco-engineer-bot[bot]@users.noreply.github.com>
1 parent 9775996 commit 9402029

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

src/databricks/sql/auth/common.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,16 @@ def __init__(
7373
# HTTP client configuration
7474
self.ssl_options = ssl_options
7575
self.socket_timeout = socket_timeout
76-
self.retry_stop_after_attempts_count = retry_stop_after_attempts_count or 5
76+
# Defaults align with the connector-wide retry defaults used by the
77+
# Thrift and SEA backends (30 attempts / 900.0s), which are anchored to
78+
# the ODBC/JDBC drivers. UnifiedHttpClient (used by CloudFetch downloads)
79+
# builds its retry policy from this context, so diverging here cut
80+
# cloudfetch retries off far too early (see issue #709).
81+
self.retry_stop_after_attempts_count = retry_stop_after_attempts_count or 30
7782
self.retry_delay_min = retry_delay_min or 1.0
7883
self.retry_delay_max = retry_delay_max or 10.0
7984
self.retry_stop_after_attempts_duration = (
80-
retry_stop_after_attempts_duration or 300.0
85+
retry_stop_after_attempts_duration or 900.0
8186
)
8287
self.retry_delay_default = retry_delay_default or 5.0
8388
self.retry_dangerous_codes = retry_dangerous_codes or []
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
Unit tests for ClientContext / build_client_context retry-policy defaults.
3+
4+
Regression tests for issue #709: CloudFetch downloads go through
5+
UnifiedHttpClient, which builds its DatabricksRetryPolicy from ClientContext.
6+
When the user does not override the retry settings, those defaults must match
7+
the connector-wide defaults used by the Thrift and SEA backends (30 attempts /
8+
900.0s), which are anchored to the ODBC/JDBC drivers (see
9+
thrift_backend.py: "900s attempts-duration lines up w ODBC/JDBC drivers").
10+
Previously ClientContext fell back to 5 attempts / 300.0s, cutting cloudfetch
11+
retries off far earlier than the rest of the connector.
12+
"""
13+
14+
from databricks.sql.auth.common import ClientContext
15+
from databricks.sql.utils import build_client_context
16+
17+
18+
class TestClientContextRetryDefaults:
19+
def test_default_max_retry_duration_is_900(self):
20+
"""With no override, retry duration defaults to 900.0s (not 300.0)."""
21+
context = build_client_context("test.databricks.com", "test-version")
22+
assert context.retry_stop_after_attempts_duration == 900.0
23+
24+
def test_default_max_retry_count_is_30(self):
25+
"""With no override, retry attempt count defaults to 30 (not 5)."""
26+
context = build_client_context("test.databricks.com", "test-version")
27+
assert context.retry_stop_after_attempts_count == 30
28+
29+
def test_user_override_still_honored(self):
30+
"""Explicit user overrides are propagated unchanged."""
31+
context = build_client_context(
32+
"test.databricks.com",
33+
"test-version",
34+
_retry_stop_after_attempts_duration=120.0,
35+
_retry_stop_after_attempts_count=7,
36+
)
37+
assert context.retry_stop_after_attempts_duration == 120.0
38+
assert context.retry_stop_after_attempts_count == 7

0 commit comments

Comments
 (0)