Skip to content

chore(warehouse): remove the ClickHouse v1 driver - #7417

Merged
achettyiitr merged 1 commit into
masterfrom
chore/clickhouse-remove-v1-master
Sep 23, 2026
Merged

achettyiitr merged 1 commit into
masterfrom
chore/clickhouse-remove-v1-master

Conversation

@achettyiitr

Copy link
Copy Markdown
Member

Description

v2 now carries every ClickHouse destination that has been migrated, so keeping a second implementation costs two files to hold in step, a selector that runs per destination, and an integration suite executed twice. This removes v1 and promotes v2 to be the ClickHouse integration rather than a variant of it.

Net: −1,562 lines (179 added, 1,741 removed), across 10 files.

The v2 files keep their *_v2 names here. Renaming them in this PR makes git pair the new clickhouse.go with the deleted one, so the removal renders as a 1,258-line rewrite rather than a delete. The renames are stacked in #7416, where clickhouse.go no longer exists in the base and they show as renames.

What changed

Deleted

  • clickhouse.go — the v1 implementation (1,311 lines)
  • clickhouseSelector and useV2Driver in warehouse/integrations/manager — the factory now returns clickhouse.New directly
  • manager_test.go — all three of its tests covered driver selection
  • The v1 test helper (connectClickhouseDB) and its compose file

Extracted rather than deleted — v2 has always depended on symbols that lived in v1's file, so these move to a new schema.go instead of disappearing: rudderDataTypesMapToClickHouse, clickhouseDataTypesMapToRudder, datatypeDefaultValuesMap, clickhouseSpecificColumnNameMappings, clickhouseDefaultDateTime, errorsMappings, the credentials type, generateArgumentString, getClickhouseColumnTypeForSpecificColumn, getSortKeyTuple, and partitionField.

Tests — the CLICKHOUSE_USE_V2 parameterisation is collapsed: one implementation, one pass. Subtests that skipped on v1 (JSON paths, native JSON columns, temporary credentials, s3Copy settings) now always run. CI drops the clickhouse-v2 matrix entry, so the suite runs once instead of twice.

⚠️ This switches namespaces that are still on v1

useV2Driver defaults to false, so deleting the selector moves every remaining destination onto v2 at once. From rudder-devops, 9 namespaces have a ClickHouse block and only 3 reference useV2Driver:

Namespace Today
multi-tenant-us/hostedmtedmt v2, namespace-wide
enterprise-us/entusmtprod v2, one workspace
enterprise-in/rudderstacwqla v2, one workspace
enterprise-eu/ivendi v1
enterprise-eu/onefootball v1
enterprise-eu/ticketswapjll v1
enterprise-eu/rudderstacst v1
enterprise-us/padlet v1
dev-rudder/hostedmt-dev v1

blockSize is the specific hazard. It is a v1-only setting, and four of those namespaces set it — onefootball 250000, ticketswapjll 250000, padlet 250000, rudderstacst 25000. v2 has no blockSize; it drives commit cadence with commitEvery, which defaults to 1,000,000. Those destinations would jump to batches 4-40x larger than they are tuned for, on a code path whose memory scales with batch size.

Suggested sequencing rather than merging straight in:

  1. Set commitEvery for the four blockSize namespaces to match their current tuning
  2. Enable useV2Driver namespace-wide on the remaining six and let them run
  3. Merge this once they are all genuinely on v2

The alternative is to merge and treat the per-destination useV2Driver: false escape hatch as the rollback — but that escape hatch is exactly what this PR deletes, so it would not exist.

Test plan

  • go build ./... clean
  • go vet ./warehouse/... clean, gofmt clean
  • Package unit tests pass (TestS3CopySettings, TestCredentials, TestJSONPaths, TestPartition, TestRetry, TestBinder)
  • Integration suite (SLOW=1, docker) — previously skipped subtests now run on every pass
  • Confirm the four blockSize namespaces have a commitEvery equivalent before this ships
  • Confirm the six v1 namespaces are on v2 and healthy before this ships

Linear Ticket

https://linear.app/rudderstack/issue/INT-7053/cleanup

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Deletions and renames only; no change to credential handling. The s3 credential masking path is untouched and still covered by TestS3CredentialsRegex.

🤖 Generated with Claude Code

v2 carries every destination that has been migrated, so the second
implementation is now dead weight: two files to keep in step, a selector
per destination, and a test suite run twice.

Deletes the v1 implementation and the selector. The shared schema maps
and helpers v1 owned move to schema.go, since v2 has always depended on
them. The v2 files keep their names here; renaming them in the same
change would make git read the removal as a rewrite of clickhouse.go
rather than a delete.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.29.1
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.30%. Comparing base (130bdd3) to head (35e09a5).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7417      +/-   ##
==========================================
- Coverage   83.86%   83.30%   -0.56%     
==========================================
  Files         621      621              
  Lines       62690    61967     -723     
==========================================
- Hits        52575    51622     -953     
- Misses      10112    10342     +230     
  Partials        3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@achettyiitr
achettyiitr merged commit bd14179 into master Sep 23, 2026
73 checks passed
@achettyiitr
achettyiitr deleted the chore/clickhouse-remove-v1-master branch September 23, 2026 10:38
achettyiitr added a commit that referenced this pull request Sep 23, 2026
#7417 landed on master as a squash, so this branch's own copy of the
v1 removal conflicted with it. Resolved by taking master's tree and
re-applying the rename diff on top, leaving this PR as purely the
v2-suffix drop plus the unprefixed config-key fallbacks.

🔒 Scanned for secrets using gitleaks 8.29.1
achettyiitr added a commit that referenced this pull request Sep 23, 2026
# Description

Follow-up to #7417, which removes the v1 ClickHouse driver. With v1
gone, the files, the exported type and the config namespace no longer
need to say "v2".

Kept separate on purpose: doing the renames in #7417 makes git pair the
new `clickhouse.go` with the deleted one, so the removal reads as a
1,258-line rewrite instead of a delete. Stacked on top, `clickhouse.go`
no longer exists in the base, so every move below shows as a rename.

## Renames

| From | To |
|---|---|
| `clickhousev2.go` | `clickhouse.go` |
| `load_v2.go` | `load.go` |
| `driver_v2.go` | `driver.go` |
| `binder_v2.go` | `binder.go` |
| `stats_v2.go` | `stats.go` |
| `*_v2_test.go` | `*_test.go` |
| `testdata/docker-compose.clickhouse-v2.yml` |
`testdata/docker-compose.clickhouse.yml` |

Type `ClickhouseV2` → `Clickhouse`, `NewV2` → `New`, and the logger
drops its `v2` child so lines read `integrations.clickhouse` again.

## Config

Settings are read from `Warehouse.clickhouse.v2.*` first and
`Warehouse.clickhouse.*` second. Config deployed against the v2
namespace keeps winning, while the unprefixed name becomes canonical —
nothing has to move in lockstep. Once deployments migrate, the `v2.`
keys can be dropped.

## Test plan

- [x] `go build ./...`, `go vet ./warehouse/...`, `gofmt` clean
- [x] Package unit tests pass
- [ ] Integration suite (`SLOW=1`, docker) in CI
- [ ] Merge after #7417

## Linear Ticket

https://linear.app/rudderstack/issue/INT-7053/cleanup

## Security

- [x] The code changed/added as part of this pull request won't create
any security issues with how the software is being used.

Renames and a config-key fallback only. Credential masking is untouched
and still covered by `TestS3CredentialsRegexV2`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
achettyiitr added a commit that referenced this pull request Sep 23, 2026
# Description

Moves the ClickHouse driver import from the RudderStack fork back to
upstream `github.com/ClickHouse/clickhouse-go/v2`, and drops the v1
dependency.

## Why the fork existed

From the fork's own README:

> `rudder-server` still depends on v1
(`github.com/ClickHouse/clickhouse-go`) while the ClickHouse warehouse
integration migrates to v2. Both upstream versions register the driver
name `clickhouse` in `init()`, so linking them into one binary panics
with `sql: Register called twice for driver clickhouse` before `main`
[...] **It is temporary.** Once every destination is on v2 and the v1
dependency is dropped, `rudder-server` moves its import back to upstream
and this fork is retired.

That condition is now met. #7417 removes the v1 implementation, so
nothing links v1 any more and the driver-name collision cannot happen.

The fork was 4 commits ahead of upstream `v2.48.0` and 0 behind: the
module path rename, the `clickhouse-v2` driver registration, a README
note, and a CI runner change. Only the registration was functional, and
it is precisely what is no longer needed.

## What changed

- `driver.go`: import swapped to
`github.com/ClickHouse/clickhouse-go/v2`
- `clickhouse_test.go`: same swap; `clickhouseExceptionCode` dropped its
v1 branch, which was the last thing importing
`github.com/ClickHouse/clickhouse-go`
- `go.mod` / `go.sum`: the fork and the v1 driver are gone; upstream
`v2.48.0` is now a direct dependency (it was already present indirectly
at v2.36.0)

**The registered driver name is not a concern.** Both call sites use
`clickhouse.OpenDB(opts)`, which constructs a `*sql.DB` directly and
never looks up a name in `database/sql`'s registry, so upstream
registering `clickhouse` rather than `clickhouse-v2` changes nothing
here.

Once this merges, `rudderlabs/clickhouse-go` can be archived.

## Test plan

- [x] `go build ./...`, `go vet ./warehouse/...`, `gofmt` clean
- [x] `golangci-lint` (CI-pinned v2.13.2) — 0 issues
- [x] Package unit tests pass
- [x] No `rudderlabs/clickhouse-go` references remain in Go sources,
`go.mod` or `go.sum`
- [ ] Integration suite (`SLOW=1`, docker) in CI
- [ ] Merge after #7417 and #7418

## Linear Ticket

https://linear.app/rudderstack/issue/INT-7053/cleanup

## Security

- [x] The code changed/added as part of this pull request won't create
any security issues with how the software is being used.

Swapping a fork for its upstream at the same version reduces what we
carry; the fork's only functional patch was a driver-registration name.
TLS and credential handling are upstream's and unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
achettyiitr added a commit that referenced this pull request Sep 25, 2026
…7427)

## What

Replaces the dead `blockSize: 1000` with `commitEvery: 1000` in the
ClickHouse block of `config/config.yaml`.

```diff
   clickhouse:
     maxParallelLoads: 3
     queryDebugLogs: false
-    blockSize: 1000
+    commitEvery: 1000
     poolSize: 10
```

## Why

`Warehouse.clickhouse.blockSize` is no longer read. The v1 driver was
removed in #7417 and the v2 equivalent is
`Warehouse.clickhouse.commitEvery`, so the shipped value has had no
effect since that merged. The only `blockSize` left in the tree is the
`warehouse.clickhouse.blockSize` stats histogram, which is unrelated and
untouched.

This matters because `config/config.yaml` is live config, not
documentation — it deliberately overrides code defaults for self-hosted
deployments:

| Key | Code default | Shipped |
|---|---|---|
| `poolSize` | 100 | **10** |
| `maxParallelLoads` | 8 | **3** |
| `commitEvery` | 1,000,000 | **1,000** (this PR) |

Carrying the value across keeps that conservative posture rather than
silently handing self-hosted deployments the 1,000,000-row driver
default.

## Behaviour change — worth a reviewer's attention

This is **not** a no-op. `blockSize` was only ever read by v1, so anyone
running v2 has been getting the 1,000,000 default regardless of what
this file said. Setting `commitEvery: 1000` brings self-hosted commit
size down by three orders of magnitude from what it is today.

That means smaller, more frequent inserts: lower peak memory per commit,
more round trips. For reference, tuned production values sit between
25,000 and 250,000.

If 1,000 is considered too low for a default, the alternatives are a
mid-range value or dropping the key entirely and letting the driver
default apply.

## Not changed

`enableArraySupport` stays — still read at
`processor/internal/transformer/destination_transformer/destination_transformer.go:366`
and passed to the destination transformer as `chEnableArraySupport`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
This was referenced Sep 28, 2026
itsmihir pushed a commit that referenced this pull request Sep 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.89.0-rc.1](v1.88.0...v1.89.0-rc.1)
(2026-09-28)


### Features

* **warehouse:** add shared SQL identifier and string literal quoting
helpers
([#7406](#7406))
([814f6db](814f6db))


### Bug Fixes

* **warehouse:** quote azure synapse identifiers
([#7363](#7363))
([d399fd1](d399fd1))
* **warehouse:** quote bigquery identifiers
([#7366](#7366))
([89de526](89de526))
* **warehouse:** quote clickhouse identifiers
([#7420](#7420))
([490c097](490c097))
* **warehouse:** quote deltalake identifiers
([#7368](#7368))
([08f2f1e](08f2f1e))
* **warehouse:** quote mssql identifiers
([#7364](#7364))
([695b881](695b881))
* **warehouse:** quote postgres load column list and bind schema
existence check
([#7405](#7405))
([2ff81c1](2ff81c1))
* **warehouse:** quote redshift identifiers
([#7365](#7365))
([a3e2a3c](a3e2a3c))
* **warehouse:** quote snowflake identifiers
([#7367](#7367))
([53d4891](53d4891))


### Miscellaneous

* sync release v1.88.0 to main branch
([#7415](#7415))
([130bdd3](130bdd3))
* **warehouse:** drop the per dialect identifier quoting wrappers
([#7421](#7421))
([ec0cf52](ec0cf52))
* **warehouse:** drop the v2 suffix now v1 is gone
([#7418](#7418))
([b759c33](b759c33))
* **warehouse:** move back to upstream clickhouse-go
([#7419](#7419))
([1a7e776](1a7e776))
* **warehouse:** remove the ClickHouse v1 driver
([#7417](#7417))
([bd14179](bd14179))
* **warehouse:** replace dead clickhouse blockSize with commitEvery
([#7427](#7427))
([0806478](0806478))

---
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>
itsmihir pushed a commit that referenced this pull request Sep 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.89.0](v1.88.0...v1.89.0)
(2026-09-28)


### Features

* **warehouse:** add shared SQL identifier and string literal quoting
helpers
([#7406](#7406))
([814f6db](814f6db))


### Bug Fixes

* **warehouse:** quote azure synapse identifiers
([#7363](#7363))
([d399fd1](d399fd1))
* **warehouse:** quote bigquery identifiers
([#7366](#7366))
([89de526](89de526))
* **warehouse:** quote clickhouse identifiers
([#7420](#7420))
([490c097](490c097))
* **warehouse:** quote deltalake identifiers
([#7368](#7368))
([08f2f1e](08f2f1e))
* **warehouse:** quote mssql identifiers
([#7364](#7364))
([695b881](695b881))
* **warehouse:** quote postgres load column list and bind schema
existence check
([#7405](#7405))
([2ff81c1](2ff81c1))
* **warehouse:** quote redshift identifiers
([#7365](#7365))
([a3e2a3c](a3e2a3c))
* **warehouse:** quote snowflake identifiers
([#7367](#7367))
([53d4891](53d4891))


### Miscellaneous

* sync release v1.88.0 to main branch
([#7415](#7415))
([130bdd3](130bdd3))
* **warehouse:** drop the per dialect identifier quoting wrappers
([#7421](#7421))
([ec0cf52](ec0cf52))
* **warehouse:** drop the v2 suffix now v1 is gone
([#7418](#7418))
([b759c33](b759c33))
* **warehouse:** move back to upstream clickhouse-go
([#7419](#7419))
([1a7e776](1a7e776))
* **warehouse:** remove the ClickHouse v1 driver
([#7417](#7417))
([bd14179](bd14179))
* **warehouse:** replace dead clickhouse blockSize with commitEvery
([#7427](#7427))
([0806478](0806478))

---
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants