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

Method ShutdownThread

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

Source from the content-addressed store, hash-verified

3753}
3754
3755[[noreturn]] void ImpalaServer::ShutdownThread() {
3756 while (true) {
3757 SleepForMs(1000);
3758 const ShutdownStatusPB& shutdown_status = GetShutdownStatus();
3759 LOG(INFO) << "Shutdown status: " << ShutdownStatusToString(shutdown_status);
3760 if (shutdown_status.grace_remaining_ms() <= 0
3761 && shutdown_status.backend_queries_executing() == 0
3762 && shutdown_status.client_requests_registered() == 0) {
3763 break;
3764 } else if (shutdown_status.deadline_remaining_ms() <= 0) {
3765 break;
3766 } else if (FLAGS_shutdown_query_cancel_period_s > 0
3767 && !shutdown_deadline_cancel_queries_
3768 && shutdown_status.cancel_deadline_remaining_ms() <= 0) {
3769 shutdown_deadline_cancel_queries_ = CancelQueriesForGracefulShutdown();
3770 }
3771 }
3772
3773 // Clean up temporary files if needed.
3774 ExecEnv::GetInstance()->tmp_file_mgr()->CleanupAtShutdown();
3775
3776 if (FLAGS_is_coordinator && FLAGS_otel_trace_enabled) {
3777 shutdown_otel_tracer();
3778 }
3779
3780 // Drain the completed queries queue to the query log table.
3781 if (FLAGS_enable_workload_mgmt) {
3782 ShutdownWorkloadManagement();
3783 }
3784
3785 LOG(INFO) << "Shutdown complete, going down.";
3786 // Use _exit here instead since exit() does cleanup which interferes with the shutdown
3787 // signal handler thread causing a data race.
3788 ShutdownLogging();
3789 _exit(0);
3790}
3791
3792// This should never be inlined to prevent it potentially being optimized, e.g.
3793// by short-circuiting the comparisons.

Callers

nothing calls this directly

Calls 3

shutdown_otel_tracerFunction · 0.85
CleanupAtShutdownMethod · 0.80
tmp_file_mgrMethod · 0.45

Tested by

no test coverage detected