mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-30 13:40:50 +00:00
75920565c9
It started having problems under heavy workloads such as saving all memory allocations to trace_log table. To improve that, stop popping entries one by one from the log queue, and actually stop using the queue completely, because we don't use most of its methods or its backpressure feature. Just keep a vector of messages and flush it to disk periodically.
43 lines
774 B
C++
43 lines
774 B
C++
#pragma once
|
|
#include <Interpreters/SystemLog.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
using Poco::Message;
|
|
|
|
struct TextLogElement
|
|
{
|
|
time_t event_time{};
|
|
UInt32 microseconds;
|
|
|
|
String thread_name;
|
|
UInt64 thread_id;
|
|
|
|
Message::Priority level = Message::PRIO_TRACE;
|
|
|
|
String query_id;
|
|
String logger_name;
|
|
String message;
|
|
|
|
String source_file;
|
|
UInt64 source_line;
|
|
|
|
static std::string name() { return "TextLog"; }
|
|
static Block createBlock();
|
|
void appendToBlock(Block & block) const;
|
|
};
|
|
|
|
class TextLog : public SystemLog<TextLogElement>
|
|
{
|
|
public:
|
|
TextLog(
|
|
Context & context_,
|
|
const String & database_name_,
|
|
const String & table_name_,
|
|
const String & storage_def_,
|
|
size_t flush_interval_milliseconds_);
|
|
};
|
|
|
|
}
|