From 399f031a4c8bd14dea44000ff7e56283f7905374 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 14:42:31 +0800 Subject: [PATCH] [BugFix] Fix thrift RuntimeProfile child node number not consistent (backport #54837) (#54864) Co-authored-by: PengFei Li --- be/src/util/runtime_profile.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/be/src/util/runtime_profile.cpp b/be/src/util/runtime_profile.cpp index 13962b5433176..2d3a2b50ead33 100644 --- a/be/src/util/runtime_profile.cpp +++ b/be/src/util/runtime_profile.cpp @@ -746,13 +746,10 @@ void RuntimeProfile::to_thrift(TRuntimeProfileTree* tree) { } void RuntimeProfile::to_thrift(std::vector* nodes) { - nodes->reserve(nodes->size() + _children.size()); - int index = nodes->size(); nodes->emplace_back(); TRuntimeProfileNode& node = (*nodes)[index]; node.name = _name; - node.num_children = _children.size(); node.metadata = _metadata; node.indent = true; @@ -810,6 +807,8 @@ void RuntimeProfile::to_thrift(std::vector* nodes) { std::lock_guard l(_children_lock); children = _children; } + node.num_children = children.size(); + nodes->reserve(nodes->size() + children.size()); for (auto& i : children) { int child_idx = nodes->size();