2022-10-03 18:52:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Common/Exception.h"
|
|
|
|
#include <Interpreters/SystemLog.h>
|
|
|
|
#include <Core/NamesAndTypes.h>
|
|
|
|
#include <Core/NamesAndAliases.h>
|
|
|
|
#include <Parsers/IAST_fwd.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
struct AsynchronousInsertLogElement
|
|
|
|
{
|
2022-10-04 14:19:05 +00:00
|
|
|
enum Status : Int8
|
2022-10-03 18:52:14 +00:00
|
|
|
{
|
2022-10-04 14:19:05 +00:00
|
|
|
Ok = 0,
|
|
|
|
ParsingError = 1,
|
|
|
|
FlushError = 2,
|
2022-10-03 18:52:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
time_t event_time{};
|
|
|
|
Decimal64 event_time_microseconds{};
|
|
|
|
|
|
|
|
ASTPtr query;
|
|
|
|
String query_id;
|
2022-10-04 14:19:05 +00:00
|
|
|
UInt64 bytes{};
|
2022-10-03 18:52:14 +00:00
|
|
|
String exception;
|
2022-10-04 14:19:05 +00:00
|
|
|
Status status{};
|
2022-10-03 18:52:14 +00:00
|
|
|
|
|
|
|
time_t flush_time{};
|
|
|
|
Decimal64 flush_time_microseconds{};
|
|
|
|
String flush_query_id;
|
|
|
|
|
2022-10-04 14:19:05 +00:00
|
|
|
static std::string name() { return "AsynchronousInsertLog"; }
|
2022-10-03 18:52:14 +00:00
|
|
|
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)"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|