MCPcopy Create free account
hub / github.com/apache/impala / ReleaseQueryBackendsLocked

Method ReleaseQueryBackendsLocked

be/src/scheduling/admission-controller.cc:2017–2064  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2015}
2016
2017void AdmissionController::ReleaseQueryBackendsLocked(const UniqueIdPB& query_id,
2018 const UniqueIdPB& coord_id, const vector<NetworkAddressPB>& host_addrs) {
2019 auto host_it = running_queries_.find(coord_id);
2020 if (host_it == running_queries_.end()) {
2021 // In the context of the admission control service, this may happen, e.g. if a
2022 // coordinator is reported as failed by the statestore but a ReleaseQuery rpc from
2023 // it is delayed in the network and arrives much later.
2024 LOG(WARNING) << "Unable to find host " << PrintId(coord_id)
2025 << " to get resources to release backends for query "
2026 << PrintId(query_id) << ", may have already been released.";
2027 return;
2028 }
2029 auto it = host_it->second.find(query_id);
2030 if (it == host_it->second.end()) {
2031 // In the context of the admission control service, this may happen, e.g. if a
2032 // ReleaseQueryBackends rpc is delayed in the network and arrives after the
2033 // ReleaseQuery rpc, so only log as a WARNING.
2034 LOG(WARNING) << "Unable to find resources to release backends for query "
2035 << PrintId(query_id) << ", may have already been released.";
2036 return;
2037 }
2038
2039 RunningQuery& running_query = it->second;
2040 UpdateStatsOnReleaseForBackends(query_id, running_query, host_addrs);
2041
2042 // Update num_released_backends_.
2043 auto released_backends = num_released_backends_.find(query_id);
2044 if (released_backends != num_released_backends_.end()) {
2045 released_backends->second -= host_addrs.size();
2046 } else {
2047 // In the context of the admission control service, this may happen, e.g. if a
2048 // ReleaseQueryBackends rpc is delayed in the network and arrives after the
2049 // ReleaseQuery rpc, so only log as a WARNING.
2050 string err_msg = Substitute(
2051 "Unable to find num released backends for query $0", PrintId(query_id));
2052 LOG(WARNING) << err_msg;
2053 }
2054
2055 if (VLOG_IS_ON(2)) {
2056 stringstream ss;
2057 ss << "Released query backend(s) ";
2058 for (const auto& host_addr : host_addrs) ss << host_addr << " ";
2059 ss << "for query id=" << PrintId(query_id) << " "
2060 << GetPoolStats(running_query.request_pool)->DebugString();
2061 VLOG(2) << ss.str();
2062 }
2063 pending_dequeue_ = true;
2064}
2065
2066vector<UniqueIdPB> AdmissionController::CleanupQueriesForHost(
2067 const UniqueIdPB& coord_id, const std::unordered_set<UniqueIdPB>& query_ids) {

Callers

nothing calls this directly

Calls 7

PrintIdFunction · 0.85
SubstituteFunction · 0.85
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
DebugStringMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected