impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zoltan Borok-Nagy (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Date Fri, 03 Nov 2017 10:05:26 GMT
Zoltan Borok-Nagy has posted comments on this change. (

Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable

Patch Set 1:

File be/src/util/condition-variable.h:
PS1, Line 48:  const timespec* timeout
> I feel like this should be a const&, since it has to be non-null. That woul
OK, will do it.
PS1, Line 65:   bool TimedWait(boost::unique_lock<boost::mutex>& lock,
> This looks like it only has one callsite. There's another callsite in Block
Now that I looked into the callsites more carefully, I realized that there are two use cases
for TimedWait. In Impala both of them are used. One use case is when we wait until a point
in time:

 auto deadline = calculate_deadline();
 while (! condition) {
   if (!cv.TimedWait(lock, deadline) {
     // deadline reached without notification
     return Status::ERROR;

The other use case is waiting in a loop, and signaling some status periodically:

 while (! condition) {
   cv.TimedWait(lock, seconds(1));
   if (condition) break;
   else SendReport();

Both API can be expressed in terms of the other, however it is a bit awkward (expressing deadline
in terms of duration is more awkward, so if we have to choose, I think we should go with supporting

There are examples for both in the code base:

FragmentInstanceState::ReportProfileThread: wait duration in terms of wait until deadline.

Promise::Get: wait until deadline in terms of wait duration.

Now I am on the side of support both use case with the two APIs, like std::condition_variable
has wait_for and wait_until member functions. Maybe we can use these names also to be more

What do you think?

To view, visit
To unsubscribe, visit

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9
Gerrit-Change-Number: 8428
Gerrit-PatchSet: 1
Gerrit-Owner: Zoltan Borok-Nagy <>
Gerrit-Reviewer: Philip Zeyliger <>
Gerrit-Reviewer: Tim Armstrong <>
Gerrit-Reviewer: Zoltan Borok-Nagy <>
Gerrit-Comment-Date: Fri, 03 Nov 2017 10:05:26 +0000
Gerrit-HasComments: Yes

  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message