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

Method GetRuntimeProfileOutput

be/src/service/impala-server.cc:808–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

806}
807
808Status ImpalaServer::GetRuntimeProfileOutput(const string& user,
809 const QueryHandle& query_handle, TRuntimeProfileFormat::type format,
810 RuntimeProfileOutput* profile) {
811 // For queries in INITIALIZED state, the profile information isn't populated yet.
812 if (query_handle->exec_state() == ClientRequestState::ExecState::INITIALIZED) {
813 return Status::Expected("Query plan is not ready.");
814 }
815 lock_guard<mutex> l(*query_handle->lock());
816 int64_t start_time_ns = MonotonicNanos();
817 RETURN_IF_ERROR(CheckProfileAccess(
818 user, query_handle->effective_user(), query_handle->user_has_profile_access()));
819 if (query_handle->GetCoordinator() != nullptr) {
820 UpdateExecSummary(query_handle);
821 }
822 if (format == TRuntimeProfileFormat::BASE64) {
823 RETURN_IF_ERROR(
824 query_handle->profile()->SerializeToArchiveString(profile->string_output));
825 } else if (format == TRuntimeProfileFormat::THRIFT) {
826 query_handle->profile()->ToThrift(profile->thrift_output);
827 } else if (format == TRuntimeProfileFormat::JSON) {
828 query_handle->profile()->ToJson(profile->json_output);
829 } else {
830 DCHECK_EQ(format, TRuntimeProfileFormat::STRING);
831 query_handle->profile()->PrettyPrint(profile->string_output);
832 }
833 int64_t elapsed_time_ns = MonotonicNanos() - start_time_ns;
834 if (elapsed_time_ns > FLAGS_slow_profile_dump_warning_threshold_ms * 1000 * 1000) {
835 LOG(WARNING) << "Slow in dumping " << format << " profile of "
836 << PrintId(query_handle->query_id()) << ". User " << user
837 << " held the lock for " << PrettyPrinter::Print(elapsed_time_ns, TUnit::TIME_NS)
838 << " (" << elapsed_time_ns << "ns). This might block client in fetching query "
839 << "results.";
840 }
841 query_handle->UpdateGetInFlightProfileTime(elapsed_time_ns);
842 return Status::OK();
843}
844
845Status ImpalaServer::GetQueryRecord(const TUniqueId& query_id,
846 shared_ptr<QueryStateRecord>* query_record,

Callers 3

QueryProfileHandlerMethod · 0.80
QueryProfileHelperMethod · 0.80

Calls 15

MonotonicNanosFunction · 0.85
CheckProfileAccessFunction · 0.85
PrintIdFunction · 0.85
OKFunction · 0.85
SubstituteFunction · 0.85
exec_stateMethod · 0.80
effective_userMethod · 0.80
GetCoordinatorMethod · 0.80
PrettyPrintMethod · 0.80

Tested by

no test coverage detected