Skip to content

Cluster mode for clickhouse connector#25447

Closed
vixns wants to merge 1 commit into
trinodb:masterfrom
vixns:clickhouse_cluster
Closed

Cluster mode for clickhouse connector#25447
vixns wants to merge 1 commit into
trinodb:masterfrom
vixns:clickhouse_cluster

Conversation

@vixns
Copy link
Copy Markdown

@vixns vixns commented Mar 28, 2025

PR based on #17433 by @nelsonspark

Fixes #17307

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@github-actions github-actions Bot added docs clickhouse ClickHouse connector labels Mar 28, 2025
@vixns vixns force-pushed the clickhouse_cluster branch from 4a2c9ce to 1066dd6 Compare March 28, 2025 11:26
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@vixns vixns force-pushed the clickhouse_cluster branch from 1066dd6 to 1518fa7 Compare March 28, 2025 11:43
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@vixns vixns force-pushed the clickhouse_cluster branch from 1518fa7 to 5f9ccf3 Compare March 28, 2025 11:46
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@vixns vixns force-pushed the clickhouse_cluster branch from 5f9ccf3 to 09902ea Compare March 28, 2025 12:01
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@vixns vixns force-pushed the clickhouse_cluster branch from 09902ea to 9eabbce Compare March 28, 2025 12:04
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@vixns vixns force-pushed the clickhouse_cluster branch from 9eabbce to 226d472 Compare March 28, 2025 13:33
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@vixns vixns force-pushed the clickhouse_cluster branch from 226d472 to 93567b9 Compare March 28, 2025 14:03
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@vixns vixns force-pushed the clickhouse_cluster branch from 93567b9 to 864dc3b Compare March 28, 2025 17:06
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Mar 28, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

.build());
}

private String getClusterInfo()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adding ON CLUSTER to all queries is error-prone. ClickHouse doesn't support configuring the cluster at connection level with JDBC property or something?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

https://clickhouse.com/docs/sql-reference/distributed-ddl

But yes, it's not that simple, as you can read on https://clickhouse.com/docs/engines/table-engines/special/distributed

In short, you have to create/alter tables on each node using the ON CLUSTER ... , and then create a "virtual" distributed table using the "real" tables as data source.

It may be required to add this distributed table when creating the real ones, I'm not (yet) used to clickhouse cluster mode.

return this;
}

private Optional<String> clusterName = Optional.empty();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Move under mapStringAsVarchar.

return clusterName;
}

@Config("clickhouse.cluster-name")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should test all statements with this property. TestClickHouseConfig is insufficient.

@ebyhr
Copy link
Copy Markdown
Member

ebyhr commented Mar 31, 2025

Did you submit CLA?

@vixns
Copy link
Copy Markdown
Author

vixns commented Mar 31, 2025

Did you submit CLA?

yes

@github-actions
Copy link
Copy Markdown

This pull request has gone a while without any activity. Ask for help on #core-dev on Trino slack.

@github-actions github-actions Bot added the stale label Apr 22, 2025
@github-actions
Copy link
Copy Markdown

Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time.

@github-actions github-actions Bot closed this May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clickhouse ClickHouse connector docs stale

Development

Successfully merging this pull request may close these issues.

Support specifying cluster name in ClickHouse connector

2 participants