2020-10-27 12:47:42 +00:00
|
|
|
#include <Storages/MergeTree/ReplicatedFetchList.h>
|
2020-10-26 16:38:35 +00:00
|
|
|
#include <Common/CurrentMetrics.h>
|
2021-10-02 07:13:14 +00:00
|
|
|
#include <base/getThreadId.h>
|
2020-10-26 16:38:35 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2020-10-27 12:57:55 +00:00
|
|
|
|
2020-10-26 16:38:35 +00:00
|
|
|
ReplicatedFetchListElement::ReplicatedFetchListElement(
|
|
|
|
const std::string & database_, const std::string & table_,
|
|
|
|
const std::string & partition_id_, const std::string & result_part_name_,
|
|
|
|
const std::string & result_part_path_, const std::string & source_replica_path_,
|
2020-10-27 12:24:10 +00:00
|
|
|
const Poco::URI & uri_, UInt8 to_detached_, UInt64 total_size_bytes_compressed_)
|
2020-10-26 16:38:35 +00:00
|
|
|
: database(database_)
|
|
|
|
, table(table_)
|
|
|
|
, partition_id(partition_id_)
|
|
|
|
, result_part_name(result_part_name_)
|
|
|
|
, result_part_path(result_part_path_)
|
|
|
|
, source_replica_path(source_replica_path_)
|
2020-10-27 12:24:10 +00:00
|
|
|
, source_replica_hostname(uri_.getHost())
|
|
|
|
, source_replica_port(uri_.getPort())
|
|
|
|
, interserver_scheme(uri_.getScheme())
|
|
|
|
, uri(uri_.toString())
|
2020-10-26 16:38:35 +00:00
|
|
|
, to_detached(to_detached_)
|
|
|
|
, total_size_bytes_compressed(total_size_bytes_compressed_)
|
2020-10-27 12:24:10 +00:00
|
|
|
, thread_id(getThreadId())
|
2020-10-26 16:38:35 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ReplicatedFetchInfo ReplicatedFetchListElement::getInfo() const
|
|
|
|
{
|
|
|
|
ReplicatedFetchInfo res;
|
|
|
|
res.database = database;
|
|
|
|
res.table = table;
|
|
|
|
res.partition_id = partition_id;
|
|
|
|
res.result_part_name = result_part_name;
|
|
|
|
res.result_part_path = result_part_path;
|
|
|
|
res.source_replica_path = source_replica_path;
|
2020-10-27 12:24:10 +00:00
|
|
|
res.source_replica_hostname = source_replica_hostname;
|
|
|
|
res.source_replica_port = source_replica_port;
|
|
|
|
res.interserver_scheme = interserver_scheme;
|
|
|
|
res.uri = uri;
|
2020-10-26 16:38:35 +00:00
|
|
|
res.to_detached = to_detached;
|
|
|
|
res.elapsed = watch.elapsedSeconds();
|
|
|
|
res.progress = progress.load(std::memory_order_relaxed);
|
|
|
|
res.bytes_read_compressed = bytes_read_compressed.load(std::memory_order_relaxed);
|
|
|
|
res.total_size_bytes_compressed = total_size_bytes_compressed;
|
|
|
|
res.thread_id = thread_id;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|