Repository navigation
Conversation
The Go SDK only retried HTTP 429/408/5xx. Doris reports almost every load failure as HTTP 200 + Status "Fail" -- including transient ones such as "[E-235] too many versions", "[E-238] too many segments", "current running txns on db ... larger than limit", memory limit exceeded and txn/publish timeouts -- so none of those were ever retried, while the Flink connector (DorisBatchStreamLoad.load) retries every failed load. Bring the Go SDK on par with the Flink connector: - classifyResponseError: every non-success outcome (non-2xx HTTP, or 2xx with a Status other than Success/Publish Timeout) is retriable. The only exception is "Label Already Exists" + ExistingJobStatus RUNNING, which stays ambiguous and is resolved by polling get_load_state. - New Config.MaxRetries / LoaderConfig.max_retries, default 3 (same as sink.max-retries); a batch is sent at most MaxRetries+1 times, still bounded by DorisUploadTimeout. Negative disables retries. - Every retry uses a fresh label <label>_<attempt>, mirroring the Flink connector's label + "_" + retry. - streamLoadError.Error() includes ErrorURL and keeps both the wrapper message and the last Doris response message. Ambiguous outcomes (response lost after the request was sent, label RUNNING) are still resolved through get_load_state before any retry, so data is never loaded twice -- Flink batch mode re-sends blindly there. Tests: updated classification table; new fakeSender tests for MaxRetries, fresh labels and -1; new mock_backend_test.go drives the real HTTP path against a scripted mock Doris (stream load + get_load_state, dropped connections, FE 307 redirect) for each scenario: Fail retried, txn limit exhausts MaxRetries, non-2xx retried, connection refused retried without polling, dropped response VISIBLE not re-sent, ABORTED/UNKNOWN retried, PREPARE polled, poll timeout fails without re-send, Label Already Exists FINISHED/RUNNING/other, redirect keeps auth, concurrent batches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UzpE493uFnJ1UQWx5N55sh
wushilin
force-pushed
the
go-sdk-retry-parity-with-flink
branch
from
August 28, 2026 08:26
a1d64bf to
73a2334
Compare
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.
Problem
The Go stream load SDK only retried HTTP 429/408/5xx. Doris reports almost every load failure as HTTP 200 +
Status: Fail— including transient ones such as[E-235] too many versions,[E-238] too many segments,current running txns on db ... larger than limit, memory limit exceeded and txn/publish timeouts — so none of those were ever retried. The Flink connector (DorisBatchStreamLoad.load()) retries every failed load up tosink.max-retrieswith a freshlabel_N.Changes
classifyResponseError: every non-success outcome (non-2xx HTTP, or 2xx whoseStatusis notSuccess/Publish Timeout) is now retriable, matching the Flink connector. The HTTP status code is no longer used to guess retriability. The only exception isLabel Already Exists+ExistingJobStatus: RUNNING, which stays ambiguous and is resolved by pollingget_load_state.Config.MaxRetries/LoaderConfig.max_retries: default 3 (same assink.max-retries). A batch is sent at mostMaxRetries+1times, still bounded byDorisUploadTimeout.-1disables retries.<label>_<attempt>, mirroring Flink'slabel + "_" + retry.streamLoadError.Error()includesErrorURL(like the Flink error message) and keeps both the wrapper message and the last Doris response message.Deliberately kept from the Go SDK: ambiguous outcomes (response lost after the request was sent, or label
RUNNING) are resolved viaget_load_statebefore any retry —VISIBLE/COMMITTEDis success,ABORTED/UNKNOWNretries — so data is never loaded twice. Flink batch mode re-sends blindly in that situation.Tests
TestClassifyResponseErrortable; new fakeSender tests forMaxRetries, fresh labels,-1, and that ABORTED-poll retries count against the cap.mock_backend_test.go: a scripted mock Doris (_stream_load+get_load_state, dropped TCP connections, FE 307 → BE redirect) driving the realhttpSenderfor each scenario:Fail(too many versions) retried with fresh label, same body, auth keptFailexhaustsMaxRetries, last Doris message + ErrorURL surfacedMaxRetries=-1fails fast;DorisUploadTimeoutbounds retriesVISIBLE→ success without re-send;ABORTED/UNKNOWN→ retried;PREPARE/PRECOMMITTEDpolled until terminal; poll timeout → failure without re-sendLabel Already Exists:FINISHED→ success,RUNNING→ polled (then success or retry), other → retriedgo vet,go test ./...andgo test -race ./...pass; the mock tests were run with-count=5to check for flakiness.🤖 Generated with Claude Code
https://claude.ai/code/session_01UzpE493uFnJ1UQWx5N55sh