Skip to content

feat: allow configuring clusterMode#1273

Open
KadekM wants to merge 3 commits into
jitsucom:newjitsufrom
KadekM:newjitsu-ch
Open

feat: allow configuring clusterMode#1273
KadekM wants to merge 3 commits into
jitsucom:newjitsufrom
KadekM:newjitsu-ch

Conversation

@KadekM
Copy link
Copy Markdown

@KadekM KadekM commented Apr 20, 2026

Destination currently always emits ENGINE = Replicated*MergeTree('/clickhouse/tables/{shard}/<db>/<table>', '{replica}') when cluster is set.

That works for classic multi-node ClickHouse, but it's rejected by the server when the target database itself uses ENGINE=Replicated(...) and in that mode ClickHouse manages the ZooKeeper path and replica macros automatically and refuses explicit arguments.

@KadekM
Copy link
Copy Markdown
Author

KadekM commented Apr 23, 2026

@absorbb this would help our setup, or do you have some alternative ideas?

ClickHouseProtocolHTTPS ClickHouseProtocol = "https"
)

type ClickHouseClusterMode string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more universal to change this parameter to ClickHouseDatabaseEngine
with possible values:
default - Atomic or Shared (for Clickhouse Cloud)
replicated - Replicated


// InitDatabase create database instance if doesn't exist
func (ch *ClickHouse) InitDatabase(ctx context.Context) error {
err := ch.createDatabaseIfNotExists(ctx, ch.config.Database)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If replicated engine is selected in config - we need to respect this setting when creating a new DB if one doesn't exist

@absorbb
Copy link
Copy Markdown
Contributor

absorbb commented Apr 23, 2026

@KadekM
That option makes significant changes on how bulker works with ClickHouse
Full test suit must be run for this configuration.
Please check bulker/bulkerlib/implementations/sql/bulker_test.go:31
ClickHouseBulkerTypeId + "_cluster" config and how it is configured bellow.
Similar docker compose test container must be setup for an additional test configuration with Replicated db engine

@KadekM
Copy link
Copy Markdown
Author

KadekM commented Apr 23, 2026

Thanks, I'll look into it!

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