Adds unified retry handling for all Thrift operations using wrapTCLICall() method, bringing Thrift under the same retry framework as HTTP operations.#3
Open
nishkarsh-db wants to merge 1 commit intoUnified_Retry_3from
Conversation
- Add wrapTCLICall() method and ThriftCall functional interface to DatabricksThriftAccessor - Implement retry orchestration for all Thrift operations (OpenSession, ExecuteStatement, etc.) - Add checkHHTTPResponseForRetry() in DatabricksHttpTTransport with proper error formatting - Update ArrowResultChunkStatusTest mock to include executeWithRetry methods - Ensure error messages and exception chains match master branch behavior Thrift retry handling now uses explicit application-layer control via wrapTCLICall. Error messages include status code, status line, and Thrift headers when present. HttpClientType is preserved throughout all PRs (not removed). Co-authored-by: Cursor <cursoragent@cursor.com>
| } | ||
|
|
||
| @SuppressWarnings("rawtypes") | ||
| TBase getThriftResponse(TBase request) throws DatabricksSQLException { |
There was a problem hiding this comment.
can we not wrap this function simply?
|
|
||
| TFetchResultsResp response; | ||
| try { | ||
| response = getThriftClient().FetchResults(request); |
There was a problem hiding this comment.
this needs to be wrapped as well
| try (CloseableHttpResponse response = httpClient.execute(request)) { | ||
|
|
||
| ValidationUtil.checkHTTPError(response); | ||
| checkHHTTPResponseForRetry(response); |
| response.getFirstHeader(THRIFT_ERROR_MESSAGE_HEADER).getValue()); | ||
| } | ||
|
|
||
| throw new DatabricksRetryHandlerException(errorMessage, statusCode, headers); |
There was a problem hiding this comment.
Consume the response entity in checkHHTTPResponseForRetry before throwing.
| // Non-retriable exception or exhausted retries for exception | ||
| String errorMsg = | ||
| String.format( | ||
| "Failed to flush data to server: %s", retryException.getCause().getMessage()); |
There was a problem hiding this comment.
error message should be something like: Thrift request failed after retry exhaustion
| @SuppressWarnings("rawtypes") | ||
| public interface ThriftCall { | ||
| TBase call(TBase request) throws TException; | ||
| } |
| return thriftCall.call(request); | ||
| } catch (TException e) { | ||
| DatabricksRetryHandlerException retryException = RetryUtils.extractRetryException(e); | ||
| if (retryException != null) { |
There was a problem hiding this comment.
retryException will be null for non-status code exceptions, which means DatabricksHttpException/IOException is actually never retried?
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
DatabricksThriftAccessor
ThriftCallfunctional interface andwrapTCLICall()methodDatabricksHttpTTransport
checkHHTTPResponseForRetry()to inspect HTTP responses for retryable status codesIntegration
Builds on:
Design Notes
Files Changed
DatabricksThriftAccessor.java- Added wrapTCLICall() and updated all Thrift operationsDatabricksHttpTTransport.java- Added checkHHTTPResponseForRetry() for error inspectionTest Plan