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

empty disk path during CopyToDetachedFolder, makes hardlink to relative folder, and later error Detached part "all_10009_10012_1" not found #453

Closed metaIhead closed 2 years ago

metaIhead commented 2 years ago

I try sudo ./clickhouse-backup -c config.yml restore last_backup_09_06 and after error was occured.

error can't attach partitions for table database.table1': code: 233, message: Detached part "all_10009_10012_1" not found

what i am doing wrong?

clickhouse-backup --version
Version:     1.4.0
Git Commit:  e549da93400f9101ea3d88861d94fea63000acf8
Build Date:  2022-05-17

ClickHouse server version 22.2.2.1.
LOG_LEVEL=debug  sudo ./clickhouse-backup -c config.yml restore last_backup_09_06
2022/06/09 19:20:21.033423  info SELECT value FROM `system`.`build_options` where name='VERSION_INTEGER'
2022/06/09 19:20:21.038369  info SELECT * FROM system.disks;
2022/06/09 19:20:21.040397  info CREATE DATABASE IF NOT EXISTS my_database
ENGINE = Atomic
2022/06/09 19:20:21.042290  info SELECT engine FROM system.databases WHERE name = 'my_database'
2022/06/09 19:20:21.043965  info DROP TABLE IF EXISTS `my_database`.`my_table1` NO DELAY
2022/06/09 19:20:21.147078  info SELECT engine FROM system.databases WHERE name = 'configservice'
2022/06/09 19:20:21.150646  info DROP TABLE IF EXISTS `my_database`.`my_table2` NO DELAY
2022/06/09 19:20:21.153606  info CREATE DATABASE IF NOT EXISTS `configservice`
2022/06/09 19:20:21.155484  info CREATE TABLE my_database.my_table1
(
    `instance_object_id` UInt32,
    `config` String,
    `config_checksum` String,
    `config_size` UInt32,
    `added_lines_number` UInt16,
    `deleted_lines_number` UInt16,
    `updated_lines_number` UInt16,
    `total_lines_number` UInt16,
    `statistic_time` DateTime
)
ENGINE = ReplacingMergeTree(statistic_time)
ORDER BY (instance_object_id, statistic_time)
TTL statistic_time + toIntervalYear(5)
SETTINGS index_granularity = 8192
2022/06/09 19:20:21.161205  info CREATE DATABASE IF NOT EXISTS `my_database'
2022/06/09 19:20:21.162321  info CREATE TABLE my_database.my_table2
(
    `instance_object_id` UInt32,
    `config` String,
    `config_checksum` String,
    `config_size` UInt32,
    `added_lines_number` UInt16,
    `deleted_lines_number` UInt16,
    `updated_lines_number` UInt16,
    `total_lines_number` UInt16,
    `statistic_time` DateTime
)
ENGINE = ReplacingMergeTree(statistic_time)
ORDER BY instance_object_id
SETTINGS index_granularity = 8192
2022/06/09 19:20:21.169482  info SELECT count() FROM system.settings WHERE name = 'show_table_uuid_in_table_create_query_if_not_nil'
2022/06/09 19:20:21.173357  info SELECT name FROM system.databases WHERE engine IN ('MySQL','PostgreSQL')
2022/06/09 19:20:21.176126  info 
        SELECT 
            countIf(name='data_path') is_data_path_present, 
            countIf(name='data_paths') is_data_paths_present, 
            countIf(name='uuid') is_uuid_present, 
            countIf(name='create_table_query') is_create_table_query_present, 
            countIf(name='total_bytes') is_total_bytes_present 
        FROM system.columns WHERE database='system' AND table='tables'

2022/06/09 19:20:21.179964  info SELECT database, name, engine   FROM system.tables WHERE is_temporary = 0 SETTINGS show_table_uuid_in_table_create_query_if_not_nil=1
2022/06/09 19:20:21.188208  info SELECT sum(bytes_on_disk) as size FROM system.parts WHERE active AND database='my_database' AND table='my_table1' GROUP BY database, table
2022/06/09 19:20:21.191827  info SELECT sum(bytes_on_disk) as size FROM system.parts WHERE active AND database='my_database' AND table='my_table2' GROUP BY database, table
2022/06/09 19:20:21.194829  info ALTER TABLE `my_database`.`my_table1` ATTACH PART 'all_10009_10012_1'
2022/06/09 19:20:21.197860 error can't attach partitions for table 'my_database.my_table1': code: 233, message: Detached part "all_10009_10012_1" not found
config.yml

clickhouse:
  username: username              
  password: "somepass"   
  host: localhost                      
  port: 9123                           
  skip_tables:                        
    - system.*
    - INFORMATION_SCHEMA.*
    - information_schema.*
metaIhead commented 2 years ago

yes! it works! 10q, it means i can restore only with default user?

Slach commented 2 years ago

you can restore with any user which not restricted access to system database