Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory for table data [...] already exists on replicated table in case of disk failure #11551

Open
YiuRULE opened this issue Jun 9, 2020 · 3 comments

Comments

@YiuRULE
Copy link
Contributor

YiuRULE commented Jun 9, 2020

Not sure if it's a bug or not, but I prefer to be sure.

Describe the bug
If we had a disk failure, we cannot recreate the table without removing the node on zookeeper.

How to reproduce
clickhouse-server 20.4

The error can be reproduced easily using docker containers. Two containers are present, clickhouse1a and clickhouse1b, both are them are part of the same shard, both of them have a volume, and both of them have an hostname (clickhouse1a and clickhouse1b).

We create a table using the ON CLUSTER clause.

CREATE TABLE test ON CLUSTER 'cluster' (foo UInt32) Engine = ReplicatedMergeTree('/clickhouse/test', '{replica-name}') PRIMARY KEY foo ORDER BY foo

We insert datas on the table.

INSERT INTO test VALUES (1)

then, we stop and remove the container clickhouse1b, and after this we remove the volume affiliated to clickhouse1b.

After running the container clickhouse1b again, and try to recreate the table again, we got this error.

Received exception from server (version 20.4.3):
Code: 57. DB::Exception: Received from 127.0.0.1:10001. DB::Exception: Directory for table data data/default/test/ already exists.

Expected behavior
Different way to fix it. ClickHouse could possibly get his metadatas back from zookeeper, or during creation of the table, with a setting or by default, to be less strict in a case that's the same instance with the same schemas create the table again.

Error message and/or stacktrace
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@YiuRULE YiuRULE added the bug Confirmed user-visible misbehaviour in official release label Jun 9, 2020
@qoega
Copy link
Member

qoega commented Jun 9, 2020

Duplicate #11432?

@YiuRULE
Copy link
Contributor Author

YiuRULE commented Jun 9, 2020

Hum slighty different but maybe related. Ensure as I don't know too much the workflow of ClickHouse with zookeeper during a table creation. the difference between both are on this one, we were able to create the table successfully but lost the metadatas in a way or an another, while on the first issue, we wasn't able to create the table at all.

@alexey-milovidov
Copy link
Member

@YiuRULE To attach existing data, you can simply use ATTACH TABLE query instead of CREATE TABLE.

@alexey-milovidov alexey-milovidov removed the bug Confirmed user-visible misbehaviour in official release label Jun 11, 2020
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

No branches or pull requests

3 participants