hello-stephen commented on code in PR #71336:
URL: https://github.com/apache/doris/pull/71336#discussion_r4781453851
##########
be/src/runtime/fragment_mgr.cpp:
##########
@@ -598,41 +606,61 @@ std::string FragmentMgr::dump_pipeline_tasks(int64_t
duration) {
timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
- _pipeline_map.apply([&](phmap::flat_hash_map<std::pair<TUniqueId, int>,
-
std::shared_ptr<PipelineFragmentContext>>& map)
- -> Status {
+ _pipeline_map.apply(
+ [&](phmap::flat_hash_map<std::pair<TUniqueId, int>,
+
std::shared_ptr<PipelineFragmentContext>>& map) -> Status {
+ auto& entries = shard_entries.emplace_back();
+ for (auto& it : map) {
+ auto elapsed = it.second->elapsed_time() / 1000000000;
+ if (elapsed < duration) {
+ // Only display tasks which has been running for
more than {duration} seconds.
+ continue;
+ }
+ entries.push_back({it.first.first, it.second,
elapsed});
+ }
+ return Status::OK();
+ });
+
+ // Rendering can acquire RF context locks and task locks. Do not hold
a shard
+ // lock here: RF publish failure can cancel a query and remove its
fragments.
+ for (const auto& entries : shard_entries) {
std::set<TUniqueId> query_id_set;
- for (auto& it : map) {
- auto elapsed = it.second->elapsed_time() / 1000000000;
- if (elapsed < duration) {
- // Only display tasks which has been running for more than
{duration} seconds.
- continue;
+ for (const auto& entry : entries) {
+ std::shared_ptr<QueryContext> query_ctx;
+ std::string task_debug_string;
+ int timeout_second;
+ bool is_timeout;
+ {
+ auto pfc = entry.pfc.lock();
+ // A fragment may naturally retire after the shard
snapshot was taken.
+ if (!pfc) {
+ continue;
+ }
+ timeout_second = pfc->timeout_second();
+ is_timeout = pfc->is_timeout(now);
+ task_debug_string = pfc->debug_string();
+ if (query_id_set.insert(entry.query_id).second) {
+ query_ctx = pfc->get_query_ctx()->shared_from_this();
+ }
}
- if (!query_id_set.contains(it.first.first)) {
- query_id_set.insert(it.first.first);
- fmt::format_to(
- debug_string_buffer, "QueryId: {},
global_runtime_filter_mgr: {}\n",
- print_id(it.first.first),
-
it.second->get_query_ctx()->runtime_filter_mgr()->debug_string());
-
- if
(it.second->get_query_ctx()->get_merge_controller_handler()) {
- fmt::format_to(debug_string_buffer, "{}\n",
- it.second->get_query_ctx()
- ->get_merge_controller_handler()
- ->debug_string());
+ // In particular, do not retain a PFC while waiting for RF
diagnostics:
+ // a recursive CTE WAIT_FOR_DESTROY response depends on its
destruction.
+ if (query_ctx) {
+ fmt::format_to(debug_string_buffer,
+ "QueryId: {}, global_runtime_filter_mgr:
{}\n",
+ print_id(entry.query_id),
+
query_ctx->runtime_filter_mgr()->debug_string());
Review Comment:
[P2] Release local Bloom merger snapshots under the query tracker
This call now runs after releasing the fragment and its shard lock. If
`RuntimeFilterMgr::debug_string()` snapshots a populated local Bloom merger,
`WAIT_FOR_DESTROY` can finish and the next recursive round can replace that
merger while the dump still owns it. If the dump drops the last reference,
`BlockBloomFilter::close()` releases the directory against the HTTP worker's
limiter, leaving the live query charged for those bytes. Keep the query limiter
active through this diagnostic call and its snapshot destruction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]