ClickHouse/src/Interpreters/TransactionsInfoLog.h

60 lines
1.3 KiB
C++
Raw Normal View History

2022-01-14 14:03:00 +00:00
#pragma once
#include <Core/NamesAndAliases.h>
#include <Interpreters/SystemLog.h>
#include <Common/TransactionID.h>
#include <Storages/ColumnsDescription.h>
2022-01-14 14:03:00 +00:00
namespace DB
{
struct TransactionInfoContext;
struct TransactionsInfoLogElement
{
enum Type
{
UNKNOWN = 0,
BEGIN = 1,
COMMIT = 2,
ROLLBACK = 3,
ADD_PART = 10,
LOCK_PART = 11,
UNLOCK_PART = 12,
};
Type type = UNKNOWN;
Decimal64 event_time = 0;
UInt64 thread_id;
String query_id;
TransactionID tid = Tx::EmptyTID;
/// For COMMIT events
CSN csn = Tx::UnknownCSN;
/// For *_PART events
StorageID table = StorageID::createEmpty();
String part_name;
static std::string name() { return "TransactionsInfoLog"; }
static ColumnsDescription getColumnsDescription();
2022-01-14 14:03:00 +00:00
static NamesAndAliases getNamesAndAliases() { return {}; }
void appendToBlock(MutableColumns & columns) const;
void fillCommonFields(const TransactionInfoContext * context = nullptr);
};
class TransactionsInfoLog : public SystemLog<TransactionsInfoLogElement>
{
using SystemLog<TransactionsInfoLogElement>::SystemLog;
};
2022-02-14 19:50:08 +00:00
2024-01-23 17:04:50 +00:00
void tryWriteEventToSystemLog(LoggerPtr log, TransactionsInfoLogElement::Type type,
2022-02-14 19:50:08 +00:00
const TransactionID & tid, const TransactionInfoContext & context);
2022-01-14 14:03:00 +00:00
}