Closed
Description
When I execute this command to add a new column, it will continue to run normally after adding. If you restart the server or execute "deache table", it will not be able to continue running. The error "table columns structure in zookeeper is different from local table structure" is returned
version: 20.3.5.21
table engine:ReplicatedMergeTree
execute command : alter table test.test1 on cluster testcluster add column if not exists test_add_column Int64 default 0 comment 'test add column';
error :DB::Exception: There was an error on [ck1.:9000]: Code: 122, e.displayText() = DB::Exception: Table columns structure in ZooKeeper is different from local table structure (version 20.3.5.21 (official build)).
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
IVitamin-C commentedon Aug 18, 2020
If the server restarts, if the table of new fields is not deleted, the server will not be able to start. If you execute "deache table", "DB:: exception: table columns structure in zookeeper is different from local table structure (version 20.3.5.21)" will be returned after "attach table on cluster testcluster"
Fanduzi commentedon Aug 18, 2020
I also face a similar situation in our RC environment.
we add one column to a table
A
yesterday,it all runs ok, data were inserted, nothing wrong happened. But today our clickhouse killed by oom-killer, then we restart the clickhouse, but get these error
this is not the first time we see this error.
I don’t know if it should be handled like this, but when I perform the following operations clickhouse starts successfully and the table is restored
rename metadata sql file
then, start clickhouse-server.
check metadata in zookeeper
remove
V_IP String DEFAULT 1
, reset columns valuerestore table
attach table
the table was stored, and is able to select/insert
I realy don't know why... It's really uncomfortable, I don't know if the production environment will encounter this problem.
filimonov commentedon Aug 18, 2020
Similar: #13673
IVitamin-C commentedon Aug 18, 2020
After testing, it is found that if the newly added column is of string type, this problem will not occur. If it is of int type, it will appear, with 100% recurrence
Fanduzi commentedon Aug 18, 2020
hi.
alter table inno_topping_user.active_duration_local on cluster ck_cluster add column V_IP String DEFAULT 1 after V_VERSION;
maybe string default int will appear too?
I did not test, if you are interested, you can help test it, my case is this situation
IVitamin-C commentedon Aug 18, 2020
String is not allowed to default to 1. It can be '1' and converted once during upper processing
IVitamin-C commentedon Aug 26, 2020
At present, the upgrade version can solve this problem. We will upgrade the production environment cluster
filimonov commentedon Aug 27, 2020
I've got one more error report about the same:
alesapin commentedon Aug 27, 2020
Yes we had several bugs in early 20.3 versions with different metadata structure. Just try to update and check that issue reproduces.
I'll try to investigate, it reproduces only when the added column has a comment?
IVitamin-C commentedon Sep 3, 2020
At present, it is found that distributed DDL for updating or deleting columns cannot be executed in some tables,progress 0%
Version has been updated to 20.6.
IVitamin-C commentedon Sep 3, 2020
DB::Exception: Metadata on replica is not up to date with common metadata in Zookeeper. Cannot alter, Stack trace (when copying this message, always include the lines below):
IVitamin-C commentedon Sep 3, 2020
The current situation is that new fields can be added. If the new fields are deleted immediately, some problems may occur. After these problems, all DDL statements will execute exceptions. progress 0%
Restarting the cluster did not solve the problem, so for stability, we migrated the data in the table to a new table and deleted the table