| 177 | } |
| 178 | |
| 179 | void ControlService::ReportExecStatus(const ReportExecStatusRequestPB* request, |
| 180 | ReportExecStatusResponsePB* response, RpcContext* rpc_context) { |
| 181 | const TUniqueId query_id = ProtoToQueryId(request->query_id()); |
| 182 | QueryHandle query_handle; |
| 183 | Status status = |
| 184 | ExecEnv::GetInstance()->impala_server()->GetQueryHandle(query_id, &query_handle); |
| 185 | |
| 186 | // This failpoint is to allow jitter to be injected. |
| 187 | DebugActionNoFail(FLAGS_debug_actions, "REPORT_EXEC_STATUS_DELAY"); |
| 188 | |
| 189 | if (!status.ok()) { |
| 190 | // This is expected occasionally (since a report RPC might be in flight while |
| 191 | // cancellation is happening). Return an error to the caller to get it to stop. |
| 192 | const string& err = Substitute("ReportExecStatus(): Received report for unknown " |
| 193 | "query ID (probably closed or cancelled): $0 " |
| 194 | "remote host=$1", |
| 195 | PrintId(query_id), rpc_context->remote_address().ToString()); |
| 196 | VLOG(1) << err; |
| 197 | RespondAndReleaseRpc(Status::Expected(err), response, rpc_context); |
| 198 | return; |
| 199 | } |
| 200 | |
| 201 | // The runtime profile is sent as a Thrift serialized buffer via sidecar. Get the |
| 202 | // sidecar and deserialize the thrift profile if there is any. The sender may have |
| 203 | // failed to serialize the Thrift profile so an empty thrift profile is valid. |
| 204 | // TODO: Fix IMPALA-7232 to indicate incomplete profile in this case. |
| 205 | TRuntimeProfileForest thrift_profiles; |
| 206 | if (LIKELY(request->has_thrift_profiles_sidecar_idx())) { |
| 207 | const Status& profile_status = |
| 208 | GetProfile(*request, *query_handle, rpc_context, &thrift_profiles); |
| 209 | if (UNLIKELY(!profile_status.ok())) { |
| 210 | LOG(ERROR) << Substitute("ReportExecStatus(): Failed to deserialize profile " |
| 211 | "for query ID $0: $1", PrintId(query_handle->query_id()), |
| 212 | profile_status.GetDetail()); |
| 213 | // Do not expose a partially deserialized profile. |
| 214 | TRuntimeProfileForest empty_profiles; |
| 215 | swap(thrift_profiles, empty_profiles); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | Status resp_status = query_handle->UpdateBackendExecStatus(*request, thrift_profiles); |
| 220 | RespondAndReleaseRpc(resp_status, response, rpc_context); |
| 221 | } |
| 222 | |
| 223 | template <typename ResponsePBType> |
| 224 | void ControlService::RespondAndReleaseRpc( |
nothing calls this directly
no test coverage detected