Altinity / clickhouse-backup

Tool for easy backup and restore for ClickHouse® using object storage for backup files.
https://altinity.com
Other
1.25k stars 225 forks source link

Error while creating backups of tables with DISTRIBUTED engine #44

Closed oleksandr-neshcheret closed 5 years ago

oleksandr-neshcheret commented 5 years ago

I have observed an issue during creating a backup for table with use DISTRIBUTED engine:

$ sudo docker run --rm -it --network host -v "/mnt/clickhouse:/var/lib/clickhouse" -e S3_BUCKET=test   alexakulov/clickhouse-backup create db_layer_0.sikandar_replicated
2019/09/09 16:35:04 Create backup 'db_layer_0.sikandar_replicated'
2019/09/09 16:35:04 Freeze 'db_layer_0.sikandar_replicated'
2019/09/09 16:35:04 Freeze 'db_layer_1.sikandar_replicated'
2019/09/09 16:35:04 Freeze 'default.sikandar'
2019/09/09 16:35:04 can't freeze 'default.sikandar' with: code: 48, message: Partition operations are not supported by storage Distributed

Looks like that issue is related to a fact that distributed table does not hold data itself, thus it doesn't have any partition.

CREATE TABLE sikandar
(
    sikandarDay Date, 
    sikandarId String, 
    sikandarAge UInt32
)
ENGINE = Distributed(level0, db_layer_0, sikandar_replicated, sipHash64(sikandarId));

The way current freeze works in the code(https://github.com/AlexAkulov/clickhouse-backup/blob/5d3a0d0196d58eb00cad915738795a120554f1ed/clickhouse.go#L178) fails

d40c477505fb :) ALTER TABLE default.sikandar FREEZE

ALTER TABLE default.sikandar
    FREEZE

Received exception from server (version 19.4.1):
Code: 48. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Partition operations are not supported by storage Distributed. 

Does distributed table backup is supported now, maybe I have missed something?

BR, Aleksandr

AlexAkulov commented 5 years ago

Hi, Aleksandr!

Thank you! It fixed in https://github.com/AlexAkulov/clickhouse-backup/commit/8646a73c08e92cd126c397e3b381a68d355b7b16

oleksandr-neshcheret commented 5 years ago

Thank for fixing.

gowth commented 3 years ago

Does the clickhouse-backup tool work for distributed engines, because i see there is a limitation that this tool wont work for distributed engines

gowth commented 3 years ago

https://github.com/AlexAkulov/clickhouse-backup

Slach commented 3 years ago

@gowth clickhouse-backup works with DISTIRBUTED engine could you describe what exactly wrong with your installation?