Repository navigation
fix(warehouse): retry a failed clickhouse v2 block - #7354
Merged
Merged
Conversation
1 task
achettyiitr
force-pushed
the
fix.ch-v2-block-retry
branch
from
September 8, 2026 08:50
0fa3589 to
c552636
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/1.86.x #7354 +/- ##
==================================================
+ Coverage 79.89% 79.97% +0.07%
==================================================
Files 615 615
Lines 69136 69166 +30
==================================================
+ Hits 55239 55318 +79
+ Misses 10650 10620 -30
+ Partials 3247 3228 -19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ItsSudip
approved these changes
Sep 8, 2026
saikumarrs
approved these changes
Sep 9, 2026
achettyiitr
force-pushed
the
fix.ch-v2-block-retry
branch
2 times, most recently
from
September 9, 2026 09:15
c8828f8 to
225b559
Compare
A single block failure fails the whole table load, and the retry above it restarts the table from scratch — one upload retried several times today, each attempt re-inserting ~11M rows over one transient failure. insertBlock now reads the block before sending it. That is the part that makes a retry correct: the rows come off a csv.Reader shared with the caller, so retrying the previous shape would have pulled the *next* rows rather than resending the failed ones, skipping a block's worth of data and reporting success. Only connection-level failures retry — driver.ErrBadConn, EOF, EPIPE, ECONNRESET, net.OpError. Anything the server rejected is deterministic and returns through backoff.Permanent. Bounded by maxRetriesPerBlock, default 3, zero disables. The name says how many attempts one block gets rather than reading as a switch that blocks retrying. The policy lives in withBlockRetries rather than inline, so it can be exercised without a server: the tests cover how many attempts each class of failure buys, that a rejected block is sent exactly once, that the budget is finite and surfaces the last failure, and that the driver's wrapped errors are still recognised — a miss there would turn every transient failure back into a failed load. The held block makes commitEvery a memory knob as well as a batching one, so raw records are kept and binding happens per attempt rather than holding bound values for the lifetime of the block. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014pXCMMrSLnt63xCWqvXhQ4
achettyiitr
force-pushed
the
fix.ch-v2-block-retry
branch
from
September 9, 2026 09:35
225b559 to
81788fa
Compare
Merged
achettyiitr
added a commit
that referenced
this pull request
Sep 9, 2026
# Description > Stacked on #7354 — review that one first; this PR's diff is only the instrumentation. The v2 loader carried a `stats` handle and never used it, so the whole path was unobserved where v1 emitted seven measurements. A destination moving to v2 lost every load metric it had. This restores them rather than adding anything new. ### Metrics | metric | v1 counterpart | | --- | --- | | `warehouse.clickhouse.numRowsLoadFile` | same name | | `warehouse.clickhouse.downloadLoadFilesTime` | same name | | `warehouse.clickhouse.loadTableTime` | same name | | `warehouse.clickhouse.commitTime` | same name, same meaning | | `warehouse.clickhouse.blockReadTime` | none | | `warehouse.clickhouse.blockPrepareTime` | none | | `warehouse.clickhouse.blockBindTime` | none | | `warehouse.clickhouse.blockSize` | none | | `warehouse.clickhouse.blocks` | none | | `warehouse.clickhouse.blockRetries` | none | The whole set reuses v1's tag set, so a destination stays comparable across the migration on one dashboard. The block-level metrics have no v1 counterpart because v1 commits a table once and v2 commits every `commitEvery` rows. ### Why a block is timed in four parts Each part is bounded by something different: - `blockReadTime` — CSV parse, client CPU - `blockPrepareTime` — a round trip - `blockBindTime` — `bindValue` per cell plus the driver's append, client CPU only, because `ExecContext` appends to a client-side batch and sends nothing - `commitTime` — the single wire write, since the driver's `Commit` is `batch.Send` Timed together they cannot tell a saturated server from a saturated loader. That ratio is the thing worth knowing before spending concurrency or moving `commitEvery`, both of which are open questions on this path. ## Linear Ticket https://linear.app/rudderstack/issue/INT-7100/crew-workspace-loading-is-taking-lot-of-time ## Security - [ ] The code changed/added as part of this pull request won't create any security issues with how the software is being used. Co-authored-by: Claude Opus 5 <[email protected]>
achettyiitr
pushed a commit
that referenced
this pull request
Sep 9, 2026
🤖 I have created a release *beep* *boop* --- ## [1.86.1](v1.86.0...v1.86.1) (2026-09-09) ### Bug Fixes * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([6456c64](6456c64)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([c835fc0](c835fc0)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([3a1407c](3a1407c)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([72390f6](72390f6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum
pushed a commit
that referenced
this pull request
Sep 9, 2026
# Description Syncing patch release v1.86.1 to main branch **↓↓ Please review and edit commit overrides before merging ↓↓** BEGIN_COMMIT_OVERRIDE fix(warehouse): retire idle clickhouse v2 connections (#7352) fix(warehouse): retry a failed clickhouse v2 block (#7354) fix(warehouse): pass temporary credentials to the clickhouse v2 s3 copy engine (#7353) fix(warehouse): instrument the clickhouse v2 load path (#7355) END_COMMIT_OVERRIDE --------- Co-authored-by: Akash Chetty <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
This was referenced Sep 14, 2026
Closed
Closed
atzoum
pushed a commit
that referenced
this pull request
Sep 14, 2026
🤖 I have created a release *beep* *boop* --- ## [1.87.0-rc.1](v1.86.0...v1.87.0-rc.1) (2026-09-14) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
This was referenced Sep 14, 2026
Closed
atzoum
pushed a commit
that referenced
this pull request
Sep 14, 2026
🤖 I have created a release *beep* *boop* --- ## [1.87.0-rc.2](v1.86.0...v1.87.0-rc.2) (2026-09-14) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * log the candidate error when a backend config shadow sample fails to fetch ([#7383](#7383)) ([eaa9b61](eaa9b61)) * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
This was referenced Sep 14, 2026
Closed
atzoum
pushed a commit
that referenced
this pull request
Sep 14, 2026
🤖 I have created a release *beep* *boop* --- ## [1.87.0-rc.3](v1.86.0...v1.87.0-rc.3) (2026-09-14) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **router:** request fails with unexpected use of stub RoundTripper error ([#7386](#7386)) ([2ff491f](2ff491f)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * log the candidate error when a backend config shadow sample fails to fetch ([#7383](#7383)) ([eaa9b61](eaa9b61)) * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
Merged
atzoum
pushed a commit
that referenced
this pull request
Sep 15, 2026
🤖 I have created a release *beep* *boop* --- ## [1.87.0-rc.4](v1.86.0...v1.87.0-rc.4) (2026-09-15) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **batchrouter:** retry failed async manager initialization ([#7374](#7374)) ([974d383](974d383)) * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **router:** request fails with unexpected use of stub RoundTripper error ([#7386](#7386)) ([2ff491f](2ff491f)) * singer-protocol sources filtered destination config for source type cloud instead of cloudSource ([#7389](#7389)) ([f48c997](f48c997)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * log the candidate error when a backend config shadow sample fails to fetch ([#7383](#7383)) ([eaa9b61](eaa9b61)) * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum
pushed a commit
that referenced
this pull request
Sep 15, 2026
🤖 I have created a release *beep* *boop* --- ## [1.87.0](v1.86.0...v1.87.0) (2026-09-15) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **batchrouter:** retry failed async manager initialization ([#7374](#7374)) ([974d383](974d383)) * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **router:** request fails with unexpected use of stub RoundTripper error ([#7386](#7386)) ([2ff491f](2ff491f)) * singer-protocol sources filtered destination config for source type cloud instead of cloudSource ([#7389](#7389)) ([f48c997](f48c997)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * log the candidate error when a backend config shadow sample fails to fetch ([#7383](#7383)) ([eaa9b61](eaa9b61)) * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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.
Description
A single block failure fails the whole table load, and the retry above it restarts the table from scratch. One upload was retried several times in a day, each attempt re-inserting ~11M rows over one transient connection failure.
Why the split into
readBlock/sendBlockis required, not cosmeticThe rows come off a
csv.Readershared with the caller. Retrying the previous shape would have pulled the next rows rather than resending the failed ones — skipping a block's worth of data and reporting success. Reading the block before sending it is what makes a retry mean the same thing twice.Binding still happens per attempt rather than up front, so what is held is the block's raw text and not bound values.
What retries
Only connection-level failures, since the pool can hand over a socket the server closed while it sat idle:
Anything the server actually rejected is deterministic and returns through
backoff.Permanent. Bounded byWarehouse.clickhouse.v2.blockRetries, default3,0disables.Duplicate rows on a retry
The nastiest case is a send that reached the server but whose ack was lost. We resend a byte-identical block, so ClickHouse's insert deduplication covers it — but only on replicated tables:
replicated_deduplication_window10000replicated_deduplication_window_seconds3600non_replicated_deduplication_window0Values read from a ClickHouse Cloud 26.4 service. Self-hosted non-replicated deployments do not get this safety net.
Memory
Holding the block makes
commitEverya memory knob as well as a batching one — roughlycommitEvery × row sizeresident per concurrent load. At the current default of1000000that is substantial on a wide table, and worth lowering to the 100k–250k range on rollout.Linear Ticket
https://linear.app/rudderstack/issue/INT-7100/crew-workspace-loading-is-taking-lot-of-time
Security