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

Method CreateRetriedClientRequestState

be/src/runtime/query-driver.cc:455–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455void QueryDriver::CreateRetriedClientRequestState(ClientRequestState* request_state,
456 unique_ptr<ClientRequestState>* retry_request_state,
457 shared_ptr<ImpalaServer::SessionState>* session) {
458 // Make a copy of the exec_request_ rather than re-using it. The copy is necessary
459 // because the exec_request_ might still be used by the Coordinator even after the
460 // query has been retried. Making a copy avoids any race conditions on the
461 // exec_request_ since the retry_exec_request_ needs to set a new query id on the
462 // TExecRequest object.
463 unique_ptr<TExecRequest> exec_request = make_unique<TExecRequest>(*exec_request_);
464 TQueryCtx query_ctx = exec_request->query_exec_request.query_ctx;
465 if (query_ctx.client_request.query_options.spool_all_results_for_retries) {
466 // Reset this flag in the retry query since we won't retry again, so results can be
467 // returned immediately.
468 query_ctx.client_request.query_options.__set_spool_all_results_for_retries(false);
469 VLOG_QUERY << "Unset SPOOL_ALL_RESULTS_FOR_RETRIES when retrying query "
470 << PrintId(client_request_state_->query_id());
471 }
472 if (UNLIKELY(query_ctx.client_request.query_options.__isset.debug_action)) {
473 // We need to be able to test actions that don't reproduce in the retried query. If we
474 // later need to target retried queries, we can add a separate query option for that.
475 query_ctx.client_request.query_options.__set_debug_action("");
476 VLOG_QUERY << "Unset DEBUG_ACTION when retrying query "
477 << PrintId(client_request_state_->query_id());
478 }
479 parent_server_->PrepareQueryContext(&query_ctx);
480 exec_request->query_exec_request.__set_query_ctx(query_ctx);
481 // Move to a const owner to ensure TExecRequest will not be modified after this.
482 retry_exec_request_ = move(exec_request);
483
484 ScopedThreadContext tdi_context(GetThreadDebugInfo(), query_ctx.query_id);
485
486 // Create the ClientRequestState for the new query.
487 ExecEnv* exec_env = ExecEnv::GetInstance();
488 *retry_request_state =
489 make_unique<ClientRequestState>(query_ctx, exec_env->frontend(), parent_server_,
490 *session, request_state->parent_driver());
491 (*retry_request_state)->SetExecRequest(retry_exec_request_.get());
492 (*retry_request_state)->SetOriginalId(request_state->query_id());
493 (*retry_request_state)->set_user_profile_access(
494 retry_exec_request_->user_has_profile_access);
495 if (retry_exec_request_->__isset.result_set_metadata) {
496 (*retry_request_state)->set_result_metadata(retry_exec_request_->result_set_metadata);
497 }
498}
499
500void QueryDriver::HandleRetryFailure(Status* status, string* error_msg,
501 ClientRequestState* request_state, const TUniqueId& retry_query_id) {

Callers

nothing calls this directly

Calls 12

PrintIdFunction · 0.85
moveFunction · 0.85
GetThreadDebugInfoFunction · 0.85
PrepareQueryContextMethod · 0.80
parent_driverMethod · 0.80
SetExecRequestMethod · 0.80
SetOriginalIdMethod · 0.80
set_result_metadataMethod · 0.80
getMethod · 0.65
query_idMethod · 0.45
frontendMethod · 0.45

Tested by

no test coverage detected