[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. IMPALA-6134: Update code base to use impala::ConditionVariable boost::condtion_variable supports thread interruption which has some overhead. In some places we already use impala::ConditionVariable which is a very thin layer around pthread, therefore it has less overhead. This commit substitues every boost::condition_variable in the codebase (except under kudu/) to impala::ConditionVariable. It also extends impala::ConditionVariable class to support waiting with a given timeout. The WaitFor function takes a duration as parameter. The WaitUntil function takes an absolute time as parameter. Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Reviewed-on: http://gerrit.cloudera.org:8080/8428 Reviewed-by: Tim ArmstrongTested-by: Impala Public Jenkins --- M be/src/catalog/catalog-server.cc M be/src/catalog/catalog-server.h M be/src/exec/plan-root-sink.cc M be/src/exec/plan-root-sink.h M be/src/rpc/thrift-server.cc M be/src/runtime/coordinator.cc M be/src/runtime/coordinator.h M be/src/runtime/data-stream-mgr.h M be/src/runtime/data-stream-recvr.cc M be/src/runtime/data-stream-sender.cc M be/src/runtime/disk-io-mgr-internal.h M be/src/runtime/disk-io-mgr-reader-context.cc M be/src/runtime/disk-io-mgr-scan-range.cc M be/src/runtime/disk-io-mgr-stress.cc M be/src/runtime/disk-io-mgr-stress.h M be/src/runtime/disk-io-mgr-test.cc M be/src/runtime/disk-io-mgr.cc M be/src/runtime/disk-io-mgr.h M be/src/runtime/fragment-instance-state.cc M be/src/runtime/fragment-instance-state.h M be/src/scheduling/admission-controller.cc M be/src/scheduling/admission-controller.h M be/src/service/client-request-state.cc M be/src/service/client-request-state.h M be/src/service/impala-server.cc M be/src/service/impala-server.h M be/src/statestore/statestore.h M be/src/util/blocking-queue.h M be/src/util/condition-variable.h M be/src/util/promise.h M be/src/util/thread-pool.h 31 files changed, 137 insertions(+), 122 deletions(-) Approvals: Tim Armstrong: Looks good to me, approved Impala Public Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 5 Gerrit-Owner: Zoltan Borok-Nagy Gerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 4: Verified+1 -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 4 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Wed, 08 Nov 2017 02:16:25 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 4: Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/1443/ -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 4 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Tue, 07 Nov 2017 22:51:17 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 4: Looks like it hit IMPALA-6092 plus some network flakiness trying to send RPCs to itself. I don't see how they're likely to be related to the change. -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 4 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Tue, 07 Nov 2017 22:50:19 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 4: Verified-1 Build failed: https://jenkins.impala.io/job/gerrit-verify-dryrun/1441/ -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 4 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Tue, 07 Nov 2017 22:07:44 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 4: Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/1441/ -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 4 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Tue, 07 Nov 2017 18:49:37 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 4: Code-Review+2 Thanks Zoltan - I really appreciate the cleanup. -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 4 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Tue, 07 Nov 2017 18:49:26 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Hello Philip Zeyliger, Tim Armstrong, Dan Hecht, I'd like you to reexamine a change. Please visit http://gerrit.cloudera.org:8080/8428 to look at the new patch set (#3). Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. IMPALA-6134: Update code base to use impala::ConditionVariable boost::condtion_variable supports thread interruption which has some overhead. In some places we already use impala::ConditionVariable which is a very thin layer around pthread, therefore it has less overhead. This commit substitues every boost::condition_variable in the codebase (except under kudu/) to impala::ConditionVariable. It also extends impala::ConditionVariable class to support waiting with a given timeout. The WaitFor function takes a duration as parameter. The WaitUntil function takes an absolute time as parameter. Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 --- M be/src/catalog/catalog-server.cc M be/src/catalog/catalog-server.h M be/src/exec/plan-root-sink.cc M be/src/exec/plan-root-sink.h M be/src/rpc/thrift-server.cc M be/src/runtime/coordinator.cc M be/src/runtime/coordinator.h M be/src/runtime/data-stream-mgr.h M be/src/runtime/data-stream-recvr.cc M be/src/runtime/data-stream-sender.cc M be/src/runtime/disk-io-mgr-internal.h M be/src/runtime/disk-io-mgr-reader-context.cc M be/src/runtime/disk-io-mgr-scan-range.cc M be/src/runtime/disk-io-mgr-stress.cc M be/src/runtime/disk-io-mgr-stress.h M be/src/runtime/disk-io-mgr-test.cc M be/src/runtime/disk-io-mgr.cc M be/src/runtime/disk-io-mgr.h M be/src/runtime/fragment-instance-state.cc M be/src/runtime/fragment-instance-state.h M be/src/scheduling/admission-controller.cc M be/src/scheduling/admission-controller.h M be/src/service/client-request-state.cc M be/src/service/client-request-state.h M be/src/service/impala-server.cc M be/src/service/impala-server.h M be/src/statestore/statestore.h M be/src/util/blocking-queue.h M be/src/util/condition-variable.h M be/src/util/promise.h M be/src/util/thread-pool.h 31 files changed, 137 insertions(+), 122 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/28/8428/3 -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 3 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Zoltan Borok-Nagy has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 2: (4 comments) Thanks, updated the code and hopefully resolved the merge conflict. http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/data-stream-recvr.cc File be/src/runtime/data-stream-recvr.cc: http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/data-stream-recvr.cc@220 PS2, Line 220: unique_lock > This change is harmless but doesn't seem necessary. Oops, I rewrote it when I started to work on "the mutex should be released by the time we call notify". This shouldn't be in this commit. Done. http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/fragment-instance-state.cc File be/src/runtime/fragment-instance-state.cc: http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/fragment-instance-state.cc@332 PS2, Line 332: auto wait_duration = boost::posix_time::seconds(report_fragment_offset); > The use of "auto" here is probably marginal as far as our coding idioms go. Done http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/fragment-instance-state.cc@337 PS2, Line 337: auto wait_duration = boost::posix_time::seconds(FLAGS_status_report_interval); > This is pre-existing but we should avoid shadowing variables. Done http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/service/impala-server.cc File be/src/service/impala-server.cc: http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/service/impala-server.cc@1800 PS2, Line 1800: session_timeout_cv_.WaitFor(timeout_lock, wait_duration); > nit: could just be a one liner. Done -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 2 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Tue, 07 Nov 2017 14:58:17 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Dan Hecht has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 2: Code-Review+1 -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 2 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Dan Hecht Gerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Mon, 06 Nov 2017 23:08:03 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 2: Code-Review+1 (5 comments) http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/data-stream-recvr.cc File be/src/runtime/data-stream-recvr.cc: http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/data-stream-recvr.cc@220 PS2, Line 220: unique_lock This change is harmless but doesn't seem necessary. http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/fragment-instance-state.cc File be/src/runtime/fragment-instance-state.cc: http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/fragment-instance-state.cc@332 PS2, Line 332: auto wait_duration = boost::posix_time::seconds(report_fragment_offset); The use of "auto" here is probably marginal as far as our coding idioms go. I think this case is fine, but we're generally biased towards spelling out the type when it is reasonably concise and meaningful. I.e. we'd use auto to save typing and reading something like "vector::iterator", but usually avoid it when it's just a plain class name. http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/runtime/fragment-instance-state.cc@337 PS2, Line 337: auto wait_duration = boost::posix_time::seconds(FLAGS_status_report_interval); This is pre-existing but we should avoid shadowing variables. http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/service/impala-server.cc File be/src/service/impala-server.cc: http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/service/impala-server.cc@1800 PS2, Line 1800: session_timeout_cv_.WaitFor(timeout_lock, wait_duration); nit: could just be a one liner. http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/util/condition-variable.h File be/src/util/condition-variable.h: http://gerrit.cloudera.org:8080/#/c/8428/2/be/src/util/condition-variable.h@67 PS2, Line 67: bool WaitFor(boost::unique_lock& lock, Thanks, I like these new names. -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 2 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Mon, 06 Nov 2017 17:26:08 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Hello Philip Zeyliger, Tim Armstrong, I'd like you to reexamine a change. Please visit http://gerrit.cloudera.org:8080/8428 to look at the new patch set (#2). Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. IMPALA-6134: Update code base to use impala::ConditionVariable boost::condtion_variable supports thread interruption which has some overhead. In some places we already use impala::ConditionVariable which is a very thin layer around pthread, therefore it has less overhead. This commit substitues every boost::condition_variable in the codebase (except under kudu/) to impala::ConditionVariable. It also extends impala::ConditionVariable class to support waiting with a given timeout. The WaitFor function takes a duration as parameter. The WaitUntil function takes an absolute time as parameter. Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 --- M be/src/catalog/catalog-server.cc M be/src/catalog/catalog-server.h M be/src/exec/plan-root-sink.cc M be/src/exec/plan-root-sink.h M be/src/rpc/thrift-server.cc M be/src/runtime/coordinator.cc M be/src/runtime/coordinator.h M be/src/runtime/data-stream-mgr.h M be/src/runtime/data-stream-recvr.cc M be/src/runtime/data-stream-sender.cc M be/src/runtime/disk-io-mgr-internal.h M be/src/runtime/disk-io-mgr-reader-context.cc M be/src/runtime/disk-io-mgr-scan-range.cc M be/src/runtime/disk-io-mgr-stress.cc M be/src/runtime/disk-io-mgr-stress.h M be/src/runtime/disk-io-mgr-test.cc M be/src/runtime/disk-io-mgr.cc M be/src/runtime/disk-io-mgr.h M be/src/runtime/fragment-instance-state.cc M be/src/runtime/fragment-instance-state.h M be/src/scheduling/admission-controller.cc M be/src/scheduling/admission-controller.h M be/src/service/client-request-state.cc M be/src/service/client-request-state.h M be/src/service/impala-server.cc M be/src/service/impala-server.h M be/src/statestore/statestore.h M be/src/util/blocking-queue.h M be/src/util/condition-variable.h M be/src/util/promise.h M be/src/util/thread-pool.h 31 files changed, 139 insertions(+), 122 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/28/8428/2 -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 2 Gerrit-Owner: Zoltan Borok-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: (1 comment) http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h File be/src/util/condition-variable.h: http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@65 PS1, Line 65: bool TimedWait(boost::unique_lock& lock, > Now that I looked into the callsites more carefully, I realized that there I like those names - good to distinguish between the two cases. Seems reasonable, especially considering there's precedent in the standard library. -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Fri, 03 Nov 2017 22:22:34 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: I don't think it's necessary to unit-test it, given it's a thin wrapper. The test code would be more complex than the product code. -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Fri, 03 Nov 2017 17:45:16 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Philip Zeyliger has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: (1 comment) > Should I create tests for condition-variable.h? We don't seem to have unit > tests yet. I think ideally we'd have tests for helper code like this. I'm ok if we think it's not worth it here given the low complexity. http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h File be/src/util/condition-variable.h: http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@38 PS1, Line 38: void Wait(boost::unique_lock& lock) { > About the 'struct' keyword: it is something that C requires, but in C++ it Thanks! -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Fri, 03 Nov 2017 16:38:00 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Zoltan Borok-Nagy has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: (2 comments) http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h File be/src/util/condition-variable.h: http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@48 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. http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@65 PS1, Line 65: bool TimedWait(boost::unique_lock& 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 deadlines). 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 explicit. What do you think? -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Fri, 03 Nov 2017 10:05:26 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: I can take another look once you push the new patch set. I don't think we need to change the time duration thing :) -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Thu, 02 Nov 2017 22:51:01 + Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: (1 comment) http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h File be/src/util/condition-variable.h: http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@64 PS1, Line 64: template > IMHO it is easier for the callers to specify a time duration than forcing t Ah ok, I didn't see those callsites when I grepped the codebase. This makes sense then, no need to change it. -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Reviewer: Zoltan Borok-Nagy Gerrit-Comment-Date: Thu, 02 Nov 2017 20:15:48 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Zoltan Borok-Nagy has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: (3 comments) > (1 comment) > > Most of this looks mechanical, and it looked fine. You changed some > 1-line if's into 3-line ifs, which may be against house style. > > We don't seem to have any tests for condition-variable.h. How did > you test this? OK, I'll change the 3-line ifs back to 1-lines. After the modifications, I ran the backend test suites on my local desktop. Should I create tests for condition-variable.h? We don't seem to have unit tests yet. http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h File be/src/util/condition-variable.h: http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@38 PS1, Line 38: void Wait(boost::unique_lock& lock) { > I'm not yet familiar with this part of C++; why is 'inline' getting removed About the 'struct' keyword: it is something that C requires, but in C++ it can be omitted. If there were a function named 'timespec', then we would have to use the 'struct' keyword in C++ as well to resolve ambiguity. An example for that is 'stat' in POSIX, which is also a function and a struct. http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@38 PS1, Line 38: void Wait(boost::unique_lock& lock) { > "inline" is implied by the function being defined within the class body: ht Done http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@64 PS1, Line 64: template > It looks like this is only ever used with microseconds - maybe we should na IMHO it is easier for the callers to specify a time duration than forcing them to calculate a time point in the future. At least I think this is how it is used most of the time, so I would choose this direction. We also have calls with milliseconds(thrift-server.cc, impala-server.cc), and seconds (fragment-instance-state.cc) as well. We can also narrow the scope by templates (though it is a bit ugly): template ... subsecond_duration... Or, we can fix the callsites to always use microseconds. What do you think of it? -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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: Thu, 02 Nov 2017 18:02:26 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: (4 comments) No serious concerns, nice to make our code more consistent. http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h File be/src/util/condition-variable.h: http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@38 PS1, Line 38: void Wait(boost::unique_lock& lock) { > I'm not yet familiar with this part of C++; why is 'inline' getting removed "inline" is implied by the function being defined within the class body: https://isocpp.org/wiki/faq/inline-functions#inline-member-fns-more . So the inline specifier has no effect. I think in general we have a lot of unnecessary inline specifiers in the code. http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@48 PS1, Line 48: const timespec* timeout I feel like this should be a const&, since it has to be non-null. That would let us eliminate one overload. http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@64 PS1, Line 64: template It looks like this is only ever used with microseconds - maybe we should narrow the scope of the API to use only that type so it's a bit more obvious what is valid input. (We should definitely add a comment regardless documenting the behaviour). http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@65 PS1, Line 65: bool TimedWait(boost::unique_lock& lock, This looks like it only has one callsite. There's another callsite in BlockingQueue::BlockingPutWithTimeout() that does the addition in the caller. We should either consistently use this API or consistently do the calculation in the caller. I don't feel strongly either way. -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Comment-Date: Tue, 31 Oct 2017 18:12:33 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Philip Zeyliger has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: (1 comment) Most of this looks mechanical, and it looked fine. You changed some 1-line if's into 3-line ifs, which may be against house style. We don't seem to have any tests for condition-variable.h. How did you test this? http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h File be/src/util/condition-variable.h: http://gerrit.cloudera.org:8080/#/c/8428/1/be/src/util/condition-variable.h@38 PS1, Line 38: void Wait(boost::unique_lock& lock) { I'm not yet familiar with this part of C++; why is 'inline' getting removed here? And 'struct' in line 47? -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Comment-Date: Tue, 31 Oct 2017 17:23:37 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Philip Zeyliger has posted comments on this change. ( http://gerrit.cloudera.org:8080/8428 ) Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. Patch Set 1: (1 comment) http://gerrit.cloudera.org:8080/#/c/8428/1//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/8428/1//COMMIT_MSG@14 PS1, Line 14: This commit substitues every boost::condtion_variable in nit: condtion_variable -> condition_variable. -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings 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-NagyGerrit-Reviewer: Philip Zeyliger Gerrit-Reviewer: Tim Armstrong Gerrit-Comment-Date: Tue, 31 Oct 2017 17:15:37 + Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-6134: Update code base to use impala::ConditionVariable
Zoltan Borok-Nagy has uploaded this change for review. ( http://gerrit.cloudera.org:8080/8428 Change subject: IMPALA-6134: Update code base to use impala::ConditionVariable .. IMPALA-6134: Update code base to use impala::ConditionVariable boost::condtion_variable supports thread interruption which has some overhead. In some places we already use impala::ConditionVariable which is a very thin layer around pthread, therefore it has less overhead. This commit substitues every boost::condtion_variable in the codebase (except under kudu/) to impala::ConditionVariable. It also extends impala::ConditionVariable class to support TimedWait based on boost::system_time and boost::time_duration. Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 --- M be/src/catalog/catalog-server.cc M be/src/catalog/catalog-server.h M be/src/exec/plan-root-sink.cc M be/src/exec/plan-root-sink.h M be/src/rpc/thrift-server.cc M be/src/runtime/coordinator.cc M be/src/runtime/coordinator.h M be/src/runtime/data-stream-mgr.h M be/src/runtime/data-stream-recvr.cc M be/src/runtime/data-stream-sender.cc M be/src/runtime/disk-io-mgr-internal.h M be/src/runtime/disk-io-mgr-reader-context.cc M be/src/runtime/disk-io-mgr-scan-range.cc M be/src/runtime/disk-io-mgr-stress.cc M be/src/runtime/disk-io-mgr-stress.h M be/src/runtime/disk-io-mgr-test.cc M be/src/runtime/disk-io-mgr.cc M be/src/runtime/disk-io-mgr.h M be/src/runtime/fragment-instance-state.cc M be/src/runtime/fragment-instance-state.h M be/src/scheduling/admission-controller.cc M be/src/scheduling/admission-controller.h M be/src/service/client-request-state.cc M be/src/service/client-request-state.h M be/src/service/impala-server.cc M be/src/service/impala-server.h M be/src/statestore/statestore.h M be/src/util/blocking-queue.h M be/src/util/condition-variable.h M be/src/util/promise.h M be/src/util/thread-pool.h 31 files changed, 134 insertions(+), 114 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/28/8428/1 -- To view, visit http://gerrit.cloudera.org:8080/8428 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I3085c6dcb42350b61244df6e7f091a1e7db356c9 Gerrit-Change-Number: 8428 Gerrit-PatchSet: 1 Gerrit-Owner: Zoltan Borok-Nagy