异常关机clickhouse无法启动

发布时间 2023-12-12 13:20:33作者: 秋来叶黄
[ 169492 ] {} <Error> Application: DB::Exception: Suspiciously many (1416 parts, 0.00 B in total) broken parts to remove while maximum allowed broken parts count is 100. You can change the maximum value with merge tree setting 'max_suspicious_broken_parts' in <merge_tree> configuration section or in table settings in .sql file (don't forget to return setting back to default value): Cannot attach table `xxx` from metadata file /xxx/clickhouse/store/471/4714bfe1-4aae-41c5-90dd-fc116041c0f1/xxx.sql from query ATTACH TABLE xxx UUID '52ee5ee1-3bf6-4a16-b89e-81b78e91de90' (`client` UInt32, ...) ENGINE = MergeTree PRIMARY KEY client ORDER BY client SETTINGS index_granularity = 8192

报错日志也说的很清楚了,因为文件损坏,默认可以修复的是100个,但是现在有1416个,超过了限制。可以在配置文件中增加也可以在损坏的数据库sql中增加。数据库sql的位置也给定了/xxx/clickhouse/store/471/4714bfe1-4aae-41c5-90dd-fc116041c0f1/xxx.sql

在sql最后SETTINGS后面增加一个设置SETTINGS index_granularity = 8192,max_suspicious_broken_parts=2000 把限制设置的大于损坏的part个数即可