2023-08-10 12:46:04 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/SystemLog.h>
|
|
|
|
#include <Core/NamesAndTypes.h>
|
|
|
|
#include <Core/NamesAndAliases.h>
|
|
|
|
#include <Backups/BackupOperationInfo.h>
|
2024-01-12 15:39:22 +00:00
|
|
|
#include <Storages/ColumnsDescription.h>
|
2023-08-10 12:46:04 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/** A struct which will be inserted as row into backup_log table.
|
|
|
|
* Contains a record about backup or restore operation.
|
|
|
|
*/
|
|
|
|
struct BackupLogElement
|
|
|
|
{
|
|
|
|
BackupLogElement() = default;
|
|
|
|
BackupLogElement(BackupOperationInfo info_);
|
|
|
|
BackupLogElement(const BackupLogElement &) = default;
|
|
|
|
BackupLogElement & operator=(const BackupLogElement &) = default;
|
|
|
|
BackupLogElement(BackupLogElement &&) = default;
|
|
|
|
BackupLogElement & operator=(BackupLogElement &&) = default;
|
|
|
|
|
2023-08-17 13:42:22 +00:00
|
|
|
std::chrono::system_clock::time_point event_time{};
|
|
|
|
Decimal64 event_time_usec{};
|
|
|
|
BackupOperationInfo info{};
|
2023-08-10 12:46:04 +00:00
|
|
|
|
|
|
|
static std::string name() { return "BackupLog"; }
|
2024-01-12 15:39:22 +00:00
|
|
|
static ColumnsDescription getColumnsDescription();
|
2023-08-10 12:46:04 +00:00
|
|
|
static NamesAndAliases getNamesAndAliases() { return {}; }
|
|
|
|
void appendToBlock(MutableColumns & columns) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BackupLog : public SystemLog<BackupLogElement>
|
|
|
|
{
|
|
|
|
using SystemLog<BackupLogElement>::SystemLog;
|
2023-08-17 13:42:22 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
static const char * getDefaultOrderBy() { return "event_date, event_time_microseconds"; }
|
2023-08-10 12:46:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|