Merge pull request #3099 from VadimPE/CLICKHOUSE-3839

CLICKHOUSE-3839 add partition_id in system.merges
This commit is contained in:
alexey-milovidov 2018-09-12 07:38:43 +03:00 committed by GitHub
commit 0751290dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,9 @@ MergeListElement::MergeListElement(const std::string & database, const std::stri
for (const auto & source_part : source_parts)
source_part_names.emplace_back(source_part->name);
if (!source_parts.empty())
partition_id = source_parts[0]->info.partition_id;
/// Each merge is executed into separate background processing pool thread
background_thread_memory_tracker = &CurrentThread::getMemoryTracker();
if (background_thread_memory_tracker)
@ -37,6 +40,7 @@ MergeInfo MergeListElement::getInfo() const
res.database = database;
res.table = table;
res.result_part_name = result_part_name;
res.partition_id = partition_id;
res.elapsed = watch.elapsedSeconds();
res.progress = progress.load(std::memory_order_relaxed);
res.num_parts = num_parts;

View File

@ -29,6 +29,7 @@ struct MergeInfo
std::string table;
std::string result_part_name;
Array source_part_names;
std::string partition_id;
Float64 elapsed;
Float64 progress;
UInt64 num_parts;
@ -49,6 +50,7 @@ struct MergeListElement : boost::noncopyable
const std::string database;
const std::string table;
const std::string result_part_name;
std::string partition_id;
Stopwatch watch;
std::atomic<Float64> progress{};
UInt64 num_parts{};

View File

@ -16,6 +16,7 @@ NamesAndTypesList StorageSystemMerges::getNamesAndTypes()
{"num_parts", std::make_shared<DataTypeUInt64>()},
{"source_part_names", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>())},
{"result_part_name", std::make_shared<DataTypeString>()},
{"partition_id", std::make_shared<DataTypeString>()},
{"total_size_bytes_compressed", std::make_shared<DataTypeUInt64>()},
{"total_size_marks", std::make_shared<DataTypeUInt64>()},
{"bytes_read_uncompressed", std::make_shared<DataTypeUInt64>()},
@ -43,6 +44,7 @@ void StorageSystemMerges::fillData(MutableColumns & res_columns, const Context &
res_columns[i++]->insert(merge.num_parts);
res_columns[i++]->insert(merge.source_part_names);
res_columns[i++]->insert(merge.result_part_name);
res_columns[i++]->insert(merge.partition_id);
res_columns[i++]->insert(merge.total_size_bytes_compressed);
res_columns[i++]->insert(merge.total_size_marks);
res_columns[i++]->insert(merge.bytes_read_uncompressed);