databricks-sdk-java icon indicating copy to clipboard operation
databricks-sdk-java copied to clipboard

Capture DatabricksError when retrying API calls

Open tom-s-powell opened this issue 8 months ago • 2 comments

What changes are proposed in this pull request?

When requests are retried, there is currently no information available to the caller to understand why. On retries no exception is logged and on final retry, the cause is only available if an IOException were the original source of failure rather. DatabricksError feels like a more useful error to surface as this will capture the error from the server which would have evaluated into a retriable error.

Currently the stacktrace appears as follows, which doesn't provide much information:

com.databricks.sdk.core.DatabricksException: Request GET /api/2.1/unity-catalog/tables?catalog_name=<REDACTED>&schema_name=<REDACTED> failed after 4 retries
\tat com.databricks.sdk.core.ApiClient.executeInner(ApiClient.java:282)
\tat com.databricks.sdk.core.ApiClient.getResponse(ApiClient.java:235)
\tat com.databricks.sdk.core.ApiClient.execute(ApiClient.java:227)
\tat com.databricks.sdk.core.ApiClient.GET(ApiClient.java:148)
\tat com.databricks.sdk.service.catalog.TablesImpl.list(TablesImpl.java:47)
\tat com.databricks.sdk.support.Paginator.flipNextPage(Paginator.java:58)
\tat com.databricks.sdk.support.Paginator.<init>(Paginator.java:51)
\tat com.databricks.sdk.service.catalog.TablesAPI.list(TablesAPI.java:102)
\tat com.databricks.sdk.service.catalog.TablesAPI.list(TablesAPI.java:89)

How is this tested?

Unit tests added.

tom-s-powell avatar Apr 04 '25 10:04 tom-s-powell

Hi @tom-s-powell, thanks for the PR! Before we proceed, could you make sure that all your commits are verified? Unverified commits are not allowed in this repository.

renaudhartert-db avatar Apr 14 '25 07:04 renaudhartert-db

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger: go/deco-tests-run/sdk-java

Inputs:

  • PR number: 427
  • Commit SHA: f3c5b31996686cbbd8ca93cde84c1366d1df355d

Checks will be approved automatically on success.

github-actions[bot] avatar May 09 '25 09:05 github-actions[bot]