Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Interpreters/AsynchronousMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
#endif


namespace CurrentMetrics
{
extern const Metric MemoryTracking;
}


namespace DB
{

Expand Down Expand Up @@ -146,6 +152,7 @@ void AsynchronousMetrics::update()
/// Otherwise it might be calculated incorrectly - it can include a "drift" of memory amount.
/// See https://github.com/ClickHouse/ClickHouse/issues/10293
total_memory_tracker.set(data.resident);
CurrentMetrics::set(CurrentMetrics::MemoryTracking, data.resident);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still some issues with memory tracking, but now with per-user tracking:

2020.07.06 08:59:07.817896 [ 47193 ] {902cf22b-87e0-4dae-a687-ecd89ba5360c} executeQuery: Code: 241, e.displayText() = DB::Exception: Memory limit (for user) exceeded: would use 437.72 GiB (attempt to allocate chunk of 4200926 bytes), maximum: 437.72 GiB (version 20.6.1.1) (from 10.7.140.7:31318)

Although the server is mostly idle:

SELECT formatReadableSize(memory_usage)
FROM system.processes
SETTINGS max_memory_usage_for_user = 1

┌─formatReadableSize(memory_usage)─┐
│ 289.28 MiB                       │
│ 155.75 MiB                       │
│ 0.00 B                           │
└──────────────────────────────────┘

3 rows in set. Elapsed: 0.002 sec.

@alexey-milovidov how about reseting per-user accounting here too as a temporary solution?

P.S. this version is compiled from sources 811d124 + some of PRs applied (mostly mine), although this should not affect memory tracking.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexey-milovidov FWIW it will be nice to print not only per-user limit on error, but per-query too, and looks like it is not that complex (just adding childs into the MemoryTracker), thoughts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about reseting per-user accounting here too as a temporary solution?

Ok.

FWIW it will be nice to print not only per-user limit on error, but per-query too, and looks like it is not that complex (just adding childs into the MemoryTracker), thoughts?

Ok, that will be better.

}
#endif

Expand Down