TOO_MANY_PARTS
和DB::Exception: Suspiciously many (12 parts, 0.00 B in total) broken parts to remove while maximum allowed broken parts count is 10.
,大概意思是太多数据碎片,要移除的损坏碎片为12,但允许的最大数量为10You can change the maximum value with merge tree setting 'max_suspicious_broken_parts' in configuration section or in table settings in .sql file (don't forget to return setting back to default value)
。大致意思是,修改表参数max_suspicious_broken_parts
,但是别忘了恢复后改回来Cannot attach table radar.signal_status from metadata file /var/lib/clickhouse/store/422/4222e684-3a04-4de6-bacc-879c855ef94c/signal_status.sql from query ATTACH TABLE radar.signal_status
0. DB::Exception::Exception(std::__1::basic_string, std::__1::allocator > const&, int, bool) @ 0xaebed1a in /usr/bin/clickhouse
1. DB::Exception::Exception(int, std::__1::basic_string, std::__1::allocator > const&, unsigned long&) @ 0xaf096b2 in /usr/bin/clickhouse
2. DB::MergeTreeData::delayInsertOrThrowIfNeeded(Poco::Event*) const @ 0x15488280 in /usr/bin/clickhouse
3. ? @ 0x15c0a4e9 in /usr/bin/clickhouse
4. DB::ExceptionKeepingTransform::work() @ 0x15c09c94 in /usr/bin/clickhouse
5. DB::ExecutionThreadContext::executeTask() @ 0x15a60ca3 in /usr/bin/clickhouse
6. DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic*) @ 0x15a54b7e in /usr/bin/clickhouse
7. DB::PipelineExecutor::executeStep(std::__1::atomic*) @ 0x15a54280 in /usr/bin/clickhouse
8. DB::PushingPipelineExecutor::start() @ 0x15a68d14 in /usr/bin/clickhouse
9. DB::SystemLog::flushImpl(std::__1::vector > const&, unsigned long) @ 0x14d9b618 in /usr/bin/clickhouse
10. DB::SystemLog::savingThreadFunction() @ 0x14d99ab5 in /usr/bin/clickhouse
11. ? @ 0xaf80cb1 in /usr/bin/clickhouse
12. ThreadPoolImpl::worker(std::__1::__list_iterator) @ 0xaf62837 in /usr/bin/clickhouse
13. ? @ 0xaf662fd in /usr/bin/clickhouse
14. start_thread @ 0x7ea5 in /usr/lib64/libpthread-2.17.so
15. __clone @ 0xfe96d in /usr/lib64/libc-2.17.so
(version 22.2.2.1)
2022.12.08 15:07:08.647866 [ 18188 ] {} void DB::SystemLog::flushImpl(const std::vector &, uint64_t) [LogElement = DB::MetricLogElement]: Code: 252. DB::Exception: Too many parts (300). Merges are processing significantly slower than inserts. (TOO_MANY_PARTS), Stack trace (when copying this message, always include the lines below):
0. DB::Exception::Exception(std::__1::basic_string, std::__1::allocator > const&, int, bool) @ 0xaebed1a in /usr/bin/clickhouse
1. DB::Exception::Exception(int, std::__1::basic_string, std::__1::allocator > const&, unsigned long&) @ 0xaf096b2 in /usr/bin/clickhouse
2. DB::MergeTreeData::delayInsertOrThrowIfNeeded(Poco::Event*) const @ 0x15488280 in /usr/bin/clickhouse
3. ? @ 0x15c0a4e9 in /usr/bin/clickhouse
4. DB::ExceptionKeepingTransform::work() @ 0x15c09c94 in /usr/bin/clickhouse
5. DB::ExecutionThreadContext::executeTask() @ 0x15a60ca3 in /usr/bin/clickhouse
6. DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic*) @ 0x15a54b7e in /usr/bin/clickhouse
7. DB::PipelineExecutor::executeStep(std::__1::atomic*) @ 0x15a54280 in /usr/bin/clickhouse
8. DB::PushingPipelineExecutor::start() @ 0x15a68d14 in /usr/bin/clickhouse
9. DB::SystemLog::flushImpl(std::__1::vector > const&, unsigned long) @ 0x14d9b618 in /usr/bin/clickhouse
10. DB::SystemLog::savingThreadFunction() @ 0x14d99ab5 in /usr/bin/clickhouse
11. ? @ 0xaf80cb1 in /usr/bin/clickhouse
12. ThreadPoolImpl::worker(std::__1::__list_iterator) @ 0xaf62837 in /usr/bin/clickhouse
13. ? @ 0xaf662fd in /usr/bin/clickhouse
14. start_thread @ 0x7ea5 in /usr/lib64/libpthread-2.17.so
15. __clone @ 0xfe96d in /usr/lib64/libc-2.17.so
(version 22.2.2.1)
2022.12.08 15:07:09.448149 [ 18117 ] {} Application: DB::Exception: Suspiciously many (12 parts, 0.00 B in total) broken parts to remove while maximum allowed broken parts count is 10. You can change the maximum value with merge tree setting 'max_suspicious_broken_parts' in configuration section or in table settings in .sql file (don't forget to return setting back to default value): Cannot attach table `radar`.`signal_status` from metadata file /var/lib/clickhouse/store/422/4222e684-3a04-4de6-bacc-879c855ef94c/signal_status.sql from query ATTACH TABLE radar.signal_status UUID '85937e46-5e81-4d48-bcfc-dbd2a738c086' (`time_stamp` DateTime COMMENT '信控上报时间(当前灯色开始时间)', `intersection_number` Int32 COMMENT '交叉口编号', `pattern_number` Int16 COMMENT '方案编号', `working_mode` String COMMENT '信号机工作模式', `stage_index` Int8 COMMENT '当前阶段序号', `phase_number` Int8 COMMENT '当前执行相位', `stage_status` String COMMENT '当前阶段灯色', `len_lamp_light` Int16 COMMENT '当前灯色的持续时间', `cycle` Int16 COMMENT '方案周期(秒)', `green_movement` Array(String) COMMENT '当前相位绿灯可通行进口流向', `green_lane` Array(String) COMMENT '当前相位绿灯可通行进口车道编号', `stage_end_time` DateTime COMMENT '当前灯色结束时间', `cycle_start_time` DateTime COMMENT '本周期开始时间') ENGINE = MergeTree PARTITION BY toYYYYMM(time_stamp) PRIMARY KEY time_stamp ORDER BY (time_stamp, intersection_number) TTL time_stamp + toIntervalMonth(6) SETTINGS index_granularity = 8192, old_parts_lifetime = 300
/var/lib/clickhouse/store/422/4222e684-3a04-4de6-bacc-879c855ef94c/signal_status.sql
在创建MergeTree表的时候特别配置一下max_suspicious_broken_parts参数
CREATE TABLE foo
(
`A` Int64
)
ENGINE = MergeTree
ORDER BY tuple()
SETTINGS max_suspicious_broken_parts = 1000;
使用ALTER TABLE … MODIFY SETTING命令修改
ALTER TABLE foo
MODIFY SETTING max_suspicious_broken_parts = 1000;
-- 恢复默认值
-- reset to default (use value from system.merge_tree_settings)
ALTER TABLE foo
RESET SETTING max_suspicious_broken_parts;
如果服务起不来了,就只能使用这个方式解决
<yandex>
<merge_tree>
<max_suspicious_broken_parts>1000max_suspicious_broken_parts>
merge_tree>
yandex>
services:
clickhouse:
image: clickhouse/clickhouse-server
ulimits:
nofile:
soft: 262144
hard: 262144
restart: always
container_name: demo-clickhouse
environment:
- CLICKHOUSE_USER=demo
- CLICKHOUSE_PASSWORD=demo-pass
- CLICKHOUSE_DB=demo
ports:
- "8123:8123"
- "9000:9000"
volumes:
- ./max_suspicious_broken_parts.xml:/etc/clickhouse-server/config.d/max_suspicious_broken_parts.xml
- demo-clickhouse:/var/lib/clickhouse
healthcheck:
test: 'wget -O - http://127.0.0.1:8123 || exit 1'
volumes:
demo-clickhouse: {}
SELECT *
FROM system.merge_tree_settings
WHERE name LIKE '%max_suspicious_broken_parts%'