Joe McDonnell has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/18439 )

Change subject: IMPALA-11263: Coordinator hang when cancelling a query
......................................................................


Patch Set 4:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/18439/4/be/src/runtime/coordinator-backend-state.cc
File be/src/runtime/coordinator-backend-state.cc:

http://gerrit.cloudera.org:8080/#/c/18439/4/be/src/runtime/coordinator-backend-state.cc@204
PS4, Line 204:   if (!exec_done_) {
             :     if (timeout_ms <= 0) {
             :       exec_done_cv_.Wait(*l);
             :       DCHECK(exec_done_);
             :       return true;
             :     } else {
             :       bool notified = exec_done_cv_.WaitFor(*l, timeout_ms * 
MICROS_PER_MILLI);
             :       if (notified) DCHECK(exec_done_);
             :       return notified;
             :     }
             :   }
After reading our existing uses of condition variables, I'm changing my mind. 
It seems like it is safer if we can handle spurious wakeups by using a while 
loop. All our other code calls Wait() in a loop. Sorry I missed that before, we 
should probably do something similar to this:

bool timed_out = false;
while (!exec_done_ && !timed_out) {
  if (timeout_ms <= 0) {
    exec_done_cv_.Wait(*l);
  } else {
    // WaitFor returns true if notified
    timed_out = !exec_done_cv_.WaitFor(*l, timeout_ms * MICROS_PER_MILLI);
  }
}
return !timed_out;

We may want to track the time for the second case and sleep the remainder.



--
To view, visit http://gerrit.cloudera.org:8080/18439
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I915511afe2df3017cbbf37f6aff3c5ff7f5473be
Gerrit-Change-Number: 18439
Gerrit-PatchSet: 4
Gerrit-Owner: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <joemcdonn...@cloudera.com>
Gerrit-Reviewer: Qifan Chen <qc...@cloudera.com>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Comment-Date: Thu, 28 Apr 2022 22:01:41 +0000
Gerrit-HasComments: Yes

Reply via email to