Skip to content

clickhouse background merge cause memory_limit_exceeded error #59411

@ly123-liu

Description

@ly123-liu

clickhouse version: 22.3.15.33
ram memory 40G

we have 2 old partition has too many parts , and cannot be merges, since merge those parts cause
MergeFromLogEntryTask MEMORY_LIMIT_EXCEEDED, i change merge settings like max_bytes_to_merge_at_max_space_in_pool seems not help

how can i manully merge this parts or limit one partition merge can slowerly not to merge all this parts in on merge , just do it in an allowable batch? can someone help?

  1. clickhouse error.log
    2024.01.31 07:39:16.491564 [ 74 ] {} <Error> MergeFromLogEntryTask: virtual bool DB::ReplicatedMergeMutateTaskBase::executeStep(): Code: 241. DB::Exception: Memory limit (total) exceeded: would use 37.46 GiB (attempt to allocate chunk of 4830532 bytes), maximum: 37.46 GiB. (MEMORY_LIMIT_EXCEEDED), Stack trace (when copying this message, always include the lines below)

  2. table system.merges table can see merge options
    ┌─database─┬─table────────┬──────elapsed─┬─progress─┬─num_parts─┬─rows_written─┬─columns_written─┬─memory_usage─┐ │ log │ default_log │ 34.150429372 │ 1 │ 4216 │ 0 │ 0 │ 27731064652 │ │ log │ default_log │ 33.536565067 │ 1 │ 16414 │ 0 │ 0 │ 27363748489 │

  3. clickhouse config.xml
    <merge_tree> <merge_max_block_size>1024</merge_max_block_size> <max_bytes_to_merge_at_min_space_in_pool>10485760</max_bytes_to_merge_at_min_space_in_pool> <max_bytes_to_merge_at_max_space_in_pool>10737418240</max_bytes_to_merge_at_max_space_in_pool> <number_of_free_entries_in_pool_to_lower_max_size_of_merge>0</number_of_free_entries_in_pool_to_lower_max_size_of_merge> <max_replicated_merges_in_queue>32</max_replicated_merges_in_queue> </merge_tree>

Metadata

Metadata

Assignees

No one assigned

    Labels

    memoryWhen memory usage is higher than expectedquestionQuestion?

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions