IMPALA-7024: Convert Coordinator::wait_lock_ to SpinLock

For consistency with the other locks in this class, use
SpinLock rather than boost::mutex. We expect SpinLock to
work okay for locks that block since it is adaptive.

This came up in the code review for IMPALA-5384, but I
wanted to make this change separately, just in case of
unforseen side-effects.

Change-Id: I48b2e7f819b1180f82811abf5701c8d07e6505e3
Reviewed-on: http://gerrit.cloudera.org:8080/10392
Reviewed-by: Tim Armstrong <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/670cd55b
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/670cd55b
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/670cd55b

Branch: refs/heads/2.x
Commit: 670cd55b3910f9e4a488254eaee14321935b108e
Parents: 42d68ed
Author: Dan Hecht <[email protected]>
Authored: Mon May 14 11:45:25 2018 -0700
Committer: Impala Public Jenkins <[email protected]>
Committed: Tue May 15 21:10:11 2018 +0000

----------------------------------------------------------------------
 be/src/runtime/coordinator.cc | 2 +-
 be/src/runtime/coordinator.h  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/670cd55b/be/src/runtime/coordinator.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/coordinator.cc b/be/src/runtime/coordinator.cc
index db07a3f..7e12f94 100644
--- a/be/src/runtime/coordinator.cc
+++ b/be/src/runtime/coordinator.cc
@@ -586,7 +586,7 @@ void Coordinator::WaitForBackends() {
 }
 
 Status Coordinator::Wait() {
-  lock_guard<mutex> l(wait_lock_);
+  lock_guard<SpinLock> l(wait_lock_);
   SCOPED_TIMER(query_profile_->total_time_counter());
   if (has_called_wait_) return Status::OK();
   has_called_wait_ = true;

http://git-wip-us.apache.org/repos/asf/impala/blob/670cd55b/be/src/runtime/coordinator.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/coordinator.h b/be/src/runtime/coordinator.h
index a0b9b4c..36c9f26 100644
--- a/be/src/runtime/coordinator.h
+++ b/be/src/runtime/coordinator.h
@@ -21,7 +21,6 @@
 #include <string>
 #include <vector>
 #include <boost/scoped_ptr.hpp>
-#include <boost/thread/mutex.hpp>
 #include <boost/unordered_map.hpp>
 #include <rapidjson/document.h>
 
@@ -33,6 +32,7 @@
 #include "util/condition-variable.h"
 #include "util/progress-updater.h"
 #include "util/runtime-profile-counters.h"
+#include "util/spinlock.h"
 
 namespace impala {
 
@@ -205,7 +205,7 @@ class Coordinator { // NOLINT: The member variables could 
be re-ordered to save
   PlanRootSink* coord_sink_ = nullptr;
 
   /// ensures single-threaded execution of Wait(). See lock ordering class 
comment.
-  boost::mutex wait_lock_;
+  SpinLock wait_lock_;
 
   bool has_called_wait_ = false;  // if true, Wait() was called; protected by 
wait_lock_
 

Reply via email to