Clickhouse: CH complains when create a table : DB::Exception: Existing table metadata in ZooKeeper differs in primary key. Stored in ZooKeeper: name, tags, ts, local: name, ts.

Created on 28 Jun 2018  路  5Comments  路  Source: ClickHouse/ClickHouse

I drop the table before and I rebuild it with another primary key .
CH says the different primary key exists in the ZK.
Should I clean the meta data as the time when drop a table ?
If have to , what is the right way to do this ?

question

Most helpful comment

And that is the reason. If you will drop table on all the replicas then table metadata will be removed from zookeeper. Till that moment any attempts to create table on the same zookeeper path will be considered as attempts to make another replica of that table (and all table replicas should have the same structure).

All 5 comments

Did you drop it on all the replicas?

no . I have two shards and each shard has two replicas.
Only one shard's replica's table is dropped.

And that is the reason. If you will drop table on all the replicas then table metadata will be removed from zookeeper. Till that moment any attempts to create table on the same zookeeper path will be considered as attempts to make another replica of that table (and all table replicas should have the same structure).

thanks I'll have a try .

@filimonov :+1:

Was this page helpful?
0 / 5 - 0 ratings