Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLICKHOUSE-3839 add partition_id in system.merges #3099

Merged
merged 2 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dbms/src/Storages/MergeTree/MergeList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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();
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions dbms/src/Storages/MergeTree/MergeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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{};
Expand Down
2 changes: 2 additions & 0 deletions dbms/src/Storages/System/StorageSystemMerges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>()},
Expand Down Expand Up @@ -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);
Expand Down