Skip to content

Conversation

@Rupreht
Copy link

@Rupreht Rupreht commented Sep 18, 2024

Fix for x-migrations-table-engine=ReplicatedReplacingMergeTree

2024/09/18 22:32:32 error: failed to open database, "clickhouse://localhost:9440/?username=xxx&password=xxx&secure=1&skip_verify=1&debug=1&x-migrations-table=MIGRATE_SCHEMA_MIGRATIONS&x-migrations-table-engine=ReplicatedReplacingMergeTree('/clickhouse/tables/xxx/MIGRATE_SCHEMA_MIGRATIONS','{replica}')&x-cluster-name=xxxx":
 code: 42, message: There was an error on [chi-replicated-xxxx-0-0:9440]:
Code: 42. DB::Exception: ORDER BY or PRIMARY KEY clause is missing.
Consider using extended storage definition syntax with ORDER BY or PRIMARY KEY clause.

this patch makes so:

CREATE TABLE MIGRATE_SCHEMA_MIGRATIONS ON CLUSTER otel (
   version    Int64,
   dirty      UInt8,
   sequence   UInt64
) Engine=ReplicatedReplacingMergeTree('/clickhouse/tables/otel/MIGRATE_SCHEMA_MIGRATIONS','{replica}')
PRIMARY KEY sequence
ORDER BY sequence

@Rupreht
Copy link
Author

Rupreht commented Sep 18, 2024

you can connect to any nodes in cluster and deploy everything at once
p/s
the broken test in 1.22.x is not because of database/clickhouse/clickhouse.go (my patch)

@Rupreht Rupreht force-pushed the fix_clickhouse_migrationstableengine_tree branch from 8efead9 to 16cb313 Compare September 19, 2024 08:57
@nielsreijers
Copy link

Any idea if/when this will be merged? The failing test does indeed seem unrelated.
I was about to open a PR for exactly the same change since I need to set a Zookeeper path on my ReplicatedMergeTree, which doesn't work without this change.

Good to see I'm not alone in this. :-)

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