2022-10-25 13:56:46 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Storages/MergeTree/BackgroundProcessList.h>
|
|
|
|
#include <Interpreters/StorageID.h>
|
|
|
|
#include <Common/Stopwatch.h>
|
|
|
|
#include <Common/CurrentMetrics.h>
|
|
|
|
#include <Poco/URI.h>
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
|
|
|
namespace CurrentMetrics
|
|
|
|
{
|
|
|
|
extern const Metric Move;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
struct MoveInfo
|
|
|
|
{
|
|
|
|
std::string database;
|
|
|
|
std::string table;
|
2022-11-21 16:16:53 +00:00
|
|
|
std::string part_name;
|
2022-11-18 20:04:11 +00:00
|
|
|
std::string target_disk_name;
|
2022-11-07 20:33:25 +00:00
|
|
|
std::string target_disk_path;
|
2022-10-25 13:56:46 +00:00
|
|
|
UInt64 part_size;
|
|
|
|
|
|
|
|
Float64 elapsed;
|
|
|
|
UInt64 thread_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MovesListElement : private boost::noncopyable
|
|
|
|
{
|
|
|
|
const StorageID table_id;
|
2022-11-21 16:16:53 +00:00
|
|
|
const std::string part_name;
|
2022-11-18 20:04:11 +00:00
|
|
|
const std::string target_disk_name;
|
2022-11-07 20:33:25 +00:00
|
|
|
const std::string target_disk_path;
|
|
|
|
const UInt64 part_size;
|
2022-10-25 13:56:46 +00:00
|
|
|
|
|
|
|
Stopwatch watch;
|
|
|
|
const UInt64 thread_id;
|
|
|
|
|
|
|
|
MovesListElement(
|
|
|
|
const StorageID & table_id_,
|
2022-11-21 16:16:53 +00:00
|
|
|
const std::string & part_name_,
|
2022-11-18 20:04:11 +00:00
|
|
|
const std::string & target_disk_name_,
|
2022-11-07 20:33:25 +00:00
|
|
|
const std::string & target_disk_path_,
|
|
|
|
UInt64 part_size_);
|
2022-10-25 13:56:46 +00:00
|
|
|
|
|
|
|
MoveInfo getInfo() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// List of currently processing moves
|
|
|
|
class MovesList final : public BackgroundProcessList<MovesListElement, MoveInfo>
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
using Parent = BackgroundProcessList<MovesListElement, MoveInfo>;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MovesList()
|
|
|
|
: Parent(CurrentMetrics::Move)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|