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

Method UpdateExecState

be/src/runtime/coordinator.cc:837–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

835}
836
837Status Coordinator::UpdateExecState(const Status& status,
838 const TUniqueId* failed_finst, const string& instance_hostname) {
839 Status ret_status;
840 ExecState old_state, new_state;
841 {
842 lock_guard<SpinLock> l(exec_state_lock_);
843 old_state = exec_state_.Load();
844 if (old_state == ExecState::EXECUTING) {
845 DCHECK(exec_status_.ok()) << exec_status_;
846 if (!status.ok()) {
847 // Error while executing - go to ERROR state.
848 exec_status_ = status;
849 exec_state_.Store(ExecState::ERROR);
850 }
851 } else if (old_state == ExecState::RETURNED_RESULTS) {
852 // Already returned all results. Leave exec status as ok, stay in this state.
853 DCHECK(exec_status_.ok()) << exec_status_;
854 } else if (old_state == ExecState::CANCELLED) {
855 // Client requested cancellation already, stay in this state. Ignores errors
856 // after requested cancellations.
857 DCHECK(exec_status_.IsCancelled()) << exec_status_;
858 } else {
859 // Already in the ERROR state, stay in this state but update status to be the
860 // first non-cancelled status.
861 DCHECK_EQ(old_state, ExecState::ERROR);
862 DCHECK(!exec_status_.ok());
863 if (!status.ok() && !status.IsCancelled() && exec_status_.IsCancelled()) {
864 exec_status_ = status;
865 }
866 }
867 new_state = exec_state_.Load();
868 ret_status = exec_status_;
869 }
870 // Log interesting status: a non-cancelled error or a cancellation if was executing.
871 if (!status.ok() && (!status.IsCancelled() || old_state == ExecState::EXECUTING)) {
872 VLOG_QUERY << Substitute(
873 "ExecState: query id=$0 finstance=$1 on host=$2 ($3 -> $4) status=$5",
874 PrintId(query_id()), failed_finst != nullptr ? PrintId(*failed_finst) : "N/A",
875 instance_hostname, ExecStateToString(old_state), ExecStateToString(new_state),
876 status.GetDetail());
877 }
878 // After dropping the lock, apply the state transition (if any) side-effects.
879 HandleExecStateTransition(old_state, new_state);
880 return ret_status;
881}
882
883void Coordinator::HandleExecStateTransition(
884 const ExecState old_state, const ExecState new_state) {

Callers

nothing calls this directly

Calls 7

SubstituteFunction · 0.85
PrintIdFunction · 0.85
GetDetailMethod · 0.80
LoadMethod · 0.45
okMethod · 0.45
StoreMethod · 0.45
IsCancelledMethod · 0.45

Tested by

no test coverage detected