diff --git a/src/Common/ZooKeeper/TestKeeper.cpp b/src/Common/ZooKeeper/TestKeeper.cpp index ae8d95b806a..3982971163c 100644 --- a/src/Common/ZooKeeper/TestKeeper.cpp +++ b/src/Common/ZooKeeper/TestKeeper.cpp @@ -362,9 +362,13 @@ std::pair TestKeeperRemoveRecursiveRequest::process(TestKeepe std::vector> children; - for (const auto & [child_path, child_node] : container) + for (auto it = std::next(root_it); it != container.end(); ++it) + { + const auto & [child_path, child_node] = *it; + if (child_path.starts_with(path)) children.emplace_back(child_path, child_node); + } if (children.size() > remove_nodes_limit) { diff --git a/src/Coordination/KeeperStorage.cpp b/src/Coordination/KeeperStorage.cpp index 24d95a89a4d..1bd6c27fe63 100644 --- a/src/Coordination/KeeperStorage.cpp +++ b/src/Coordination/KeeperStorage.cpp @@ -1766,7 +1766,7 @@ private: return false; - auto children = node_it->value.getChildren(); + const auto & children = node_it->value.getChildren(); for (auto && child_name : children) { auto child_path = (root_fs_path / child_name.toView()).generic_string();