ClickHouse/src/Interpreters/ZooKeeperLog.h

83 lines
1.6 KiB
C++
Raw Normal View History

2021-07-09 14:05:35 +00:00
#pragma once
#include <Core/NamesAndTypes.h>
2021-07-09 14:05:35 +00:00
#include <Core/NamesAndAliases.h>
#include <Interpreters/SystemLog.h>
#include <Interpreters/ClientInfo.h>
#include <Common/ZooKeeper/IKeeper.h>
namespace DB
{
struct ZooKeeperLogElement
{
enum Type
{
UNKNOWN = 0,
2021-07-27 16:57:28 +00:00
REQUEST = 1,
RESPONSE = 2,
2021-07-09 14:05:35 +00:00
FINALIZE = 3
};
Type type = UNKNOWN;
Decimal64 event_time = 0;
UInt64 thread_id = 0;
String query_id;
2021-07-09 14:05:35 +00:00
Poco::Net::SocketAddress address;
Int64 session_id = 0;
/// Common request info
Int32 xid = 0;
bool has_watch = false;
Int32 op_num = 0;
String path;
/// create, set
String data;
/// create
bool is_ephemeral = false;
bool is_sequential = false;
/// remove, check, set
2021-07-27 16:57:28 +00:00
std::optional<Int32> version;
2021-07-09 14:05:35 +00:00
/// multi
UInt32 requests_size = 0;
UInt32 request_idx = 0;
/// Common response info
Int64 zxid = 0;
std::optional<Int32> error;
/// watch
2021-07-27 16:57:28 +00:00
std::optional<Int32> watch_type;
std::optional<Int32> watch_state;
2021-07-09 14:05:35 +00:00
/// create
String path_created;
/// exists, get, set, list
Coordination::Stat stat = {};
/// list
Strings children;
static std::string name() { return "ZooKeeperLog"; }
static NamesAndTypesList getNamesAndTypes();
static NamesAndAliases getNamesAndAliases() { return {}; }
void appendToBlock(MutableColumns & columns) const;
static const char * getCustomColumnList() { return nullptr; }
2021-07-09 14:05:35 +00:00
};
class ZooKeeperLog : public SystemLog<ZooKeeperLogElement>
{
using SystemLog<ZooKeeperLogElement>::SystemLog;
};
2021-09-15 18:06:20 +00:00
DataTypePtr getCoordinationErrorCodesEnumType();
2021-07-09 14:05:35 +00:00
}