Repository navigation
Cherry pick #119238 to 26.3: Don't use backoffs on concurrent inserts conflicts - #119416
Merged
robot-clickhouse-ci-2 merged 4 commits intoSep 17, 2026
Merged
Conversation
`409 Conflict` reports that a request conflicts with the current state of the target resource, so resending the same bytes cannot succeed - only the caller, after re-reading that state, can build a request that does. It was classified as retriable, so `ReadWriteBufferFromHTTP::doWithRetries` resent the byte-identical request `http_max_tries` (10) times with a growing backoff before handing the error back. An Iceberg REST catalog commit is the worst case: it carries an `assert-ref-snapshot-id` requirement naming a parent snapshot that a concurrent writer has already replaced, so all 10 attempts are refused by construction, and every logical commit conflict cost ~32 seconds of `sleepForMilliseconds`. `IcebergStorageSink` already handles the refusal properly - `RestCatalog::updateMetadata` returns `false`, the sink re-reads the branch tip and rebuilds the commit - so the retries only delayed the answer it was waiting for. Measured against a mock server counting requests: one `409` cost 10 requests and 32.9 seconds before, and 1 request and 0.19 seconds after. Forcing `http_max_tries = 1` for catalog commits instead would also drop the retries of genuinely transient failures, which the sink's own loop does not recover from: it treats only `409` as retriable and throws on anything else. Tests: `05055_http_conflict_is_not_retried` pins the transport behaviour, and `test_catalog_commit_conflict_reaches_caller_at_once` pins it for a catalog commit, where a single `INSERT` with `max_insert_threads = 4` makes the conflict a property of the plan rather than a race - every sink reads the branch tip in its constructor, and all of them are constructed before the pipeline starts. The latter fails with `assert 10 == 1` without this change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Don't use backoffs on concurrent inserts conflicts
Contributor
|
Dear @diegomestre2, @scanhex12, this cherry-pick PR has not been updated for 3d0h7m24s. Please resolve the conflicts to backport #119238, or close this PR if the backport is no longer needed. This PR will be automatically closed after 7 days of inactivity. |
Contributor
|
@oranjeai check the changes and merge are correct |
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.
Original pull-request #119238
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job