Merge pull request #62152 from JackyWoo/add_query_progress_to_table_zookeeper

Add query progress to table zookeeper
This commit is contained in:
Alexey Milovidov 2024-04-20 00:48:31 +00:00 committed by GitHub
commit 968d8b7ee5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -622,6 +622,20 @@ Chunk SystemZooKeeperSource::generate()
ZooKeeperRetriesControl("", nullptr, retries_seetings, query_status).retryLoop(
[&]() { get_responses = get_zookeeper()->tryGet(paths_to_get); });
/// Add children count to query total rows. We can not get total rows in advance,
/// because it is too heavy to get row count for non exact paths.
/// Please be aware that there might be minor setbacks in the query progress,
/// but overall it should reflect the advancement of the query.
size_t children_count = 0;
for (size_t i = 0, size = get_tasks.size(); i < size; ++i)
{
auto & res = get_responses[i];
if (res.error == Coordination::Error::ZNONODE)
continue; /// Node was deleted meanwhile.
children_count += res.stat.numChildren;
}
addTotalRowsApprox(children_count);
for (size_t i = 0, size = get_tasks.size(); i < size; ++i)
{
auto & res = get_responses[i];