| 1031 | } |
| 1032 | |
| 1033 | void AdmissionController::UpdateStatsOnReleaseForBackends(const UniqueIdPB& query_id, |
| 1034 | RunningQuery& running_query, const vector<NetworkAddressPB>& host_addrs) { |
| 1035 | int64_t total_mem_to_release = 0; |
| 1036 | for (const auto& host_addr : host_addrs) { |
| 1037 | auto backend_allocation = running_query.per_backend_resources.find(host_addr); |
| 1038 | if (backend_allocation == running_query.per_backend_resources.end()) { |
| 1039 | // In the context of the admission control service, this may happen, e.g. if a |
| 1040 | // ReleaseQueryBackends rpc is delayed in the network and arrives after the |
| 1041 | // ReleaseQuery rpc, so only log as a WARNING. |
| 1042 | string err_msg = |
| 1043 | strings::Substitute("Error: Cannot find exec params of host $0 for query $1.", |
| 1044 | NetworkAddressPBToString(host_addr), PrintId(query_id)); |
| 1045 | LOG(WARNING) << err_msg; |
| 1046 | continue; |
| 1047 | } |
| 1048 | UpdateHostStats(host_addr, -backend_allocation->second.mem_to_admit, -1, |
| 1049 | -backend_allocation->second.slots_to_use); |
| 1050 | total_mem_to_release += backend_allocation->second.mem_to_admit; |
| 1051 | running_query.per_backend_resources.erase(backend_allocation); |
| 1052 | } |
| 1053 | PoolStats* pool_stats = GetPoolStats(running_query.request_pool); |
| 1054 | pool_stats->ReleaseMem(total_mem_to_release); |
| 1055 | pools_for_updates_.insert(running_query.request_pool); |
| 1056 | } |
| 1057 | |
| 1058 | void AdmissionController::UpdateStatsOnAdmission( |
| 1059 | const ScheduleState& state, bool is_trivial, PerUserTracking& per_user_tracking) { |
nothing calls this directly
no test coverage detected