Apache Software Foundation logo

Skill

doris-debug-compaction

resolve Apache Doris compaction lag

Covers Performance Database Debugging

Description

Use for Doris -235 / too many versions and compaction lag. Error raised in RowsetBuilder::check_tablet_version_count when version_count > max_tablet_version_num (default 2000) or meta serialize size limit.

SKILL.md

Compaction / Versions

Code

be/src/storage/rowset_builder.cpp:

  • version_count > max_version_configStatus::Error<TOO_MANY_VERSION>(...)
  • Suggests reduce load frequency or raise max_tablet_version_num / time_series_max_tablet_version_num in be.conf
  • Near limit triggers cumulative compaction submit

Defaults (config.cpp): max_tablet_version_num=2000, time_series_max_tablet_version_num=20000.

Causes

IDCauseEvidenceFix direction
AIngest rate > compaction throughputversion_count rising; compaction score growingReduce ingest frequency or increase compaction threads
BDisk IO bottleneckiostat shows disk util > 90%Move WAL to separate disk; add compaction disks
Cmax_tablet_version_num too low for workload-235 on normal ingest ratesRaise limit (temporary), then fix root cause
DSingle-tablet hotspotOne tablet has 10× versions of peersPartition / bucket key skew

Actions

  1. Confirm with ./scripts/doris-debug log-grep be/log --pack versions
  2. Check compaction throughput: ./scripts/doris-debug be-metrics --be http://$BE:8040 --grep compaction
  3. Check disk IO: iostat -x 1
  4. Slow ingest / enlarge group commit batches
  5. Raising max_tablet_version_num is a temporary valve — fix ingest vs compaction balance
./scripts/doris-debug be-metrics --be http://$BE:8040 --grep compaction

Compaction knobs

# be.conf
max_tablet_version_num = 2000               # hard cap, raise only as stopgap
time_series_max_tablet_version_num = 20000   # separate cap for time-series tables
max_cumulative_compaction_threads = -1       # -1 = auto based on CPU cores
compaction_task_num_per_disk = 4             # per-disk concurrent compaction tasks
compaction_tablet_size_threshold = 107374182400  # 100GB — above this, skip base compaction

Source

  • be/src/storage/rowset_builder.cpp-235 error
  • be/src/common/config.cpp — all compaction config defaults
  • be/src/olap/cumulative_compaction_policy.cpp — score calculation

© 2026 YourAI.tools. Every skill from an identity-verified publisher.

Independent catalog. Not affiliated with, endorsed by, or sponsored by Anthropic or any listed publisher. All trademarks belong to their respective owners.