ClickHouse/src/Interpreters/AsynchronousInsertLog.h
Anton Popov 5819bcd07a
Support asynchronous inserts for native protocol (#54730)
* support async insert for native protocol

* use separate queue for async inserts via native protocol

* fix test

* better logging for async inserts and more tests

* disable mixed internal and external data in async inserts

* fix tests

* fix quota in async inserts

* disable async insert for secondary query of distributed
2023-10-20 18:39:48 +02:00

58 lines
1.4 KiB
C++

#pragma once
#include <Interpreters/AsynchronousInsertQueue.h>
#include <Interpreters/SystemLog.h>
#include <Core/NamesAndTypes.h>
#include <Core/NamesAndAliases.h>
#include <Parsers/IAST_fwd.h>
namespace DB
{
struct AsynchronousInsertLogElement
{
enum Status : Int8
{
Ok = 0,
ParsingError = 1,
FlushError = 2,
};
time_t event_time{};
Decimal64 event_time_microseconds{};
String query_id;
String query_for_logging;
String database;
String table;
String format;
UInt64 bytes{};
UInt64 rows{};
String exception;
Status status{};
using DataKind = AsynchronousInsertQueue::DataKind;
DataKind data_kind{};
time_t flush_time{};
Decimal64 flush_time_microseconds{};
String flush_query_id;
static std::string name() { return "AsynchronousInsertLog"; }
static NamesAndTypesList getNamesAndTypes();
static NamesAndAliases getNamesAndAliases() { return {}; }
void appendToBlock(MutableColumns & columns) const;
static const char * getCustomColumnList() { return nullptr; }
};
class AsynchronousInsertLog : public SystemLog<AsynchronousInsertLogElement>
{
public:
using SystemLog<AsynchronousInsertLogElement>::SystemLog;
/// This table is usually queried for fixed table name.
static const char * getDefaultOrderBy() { return "database, table, event_date, event_time"; }
};
}