You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/05/15 07:20:04 UTC
[4/8] impala git commit: IMPALA-7024: Convert Coordinator::wait_lock_
to SpinLock
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 <ta...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/4ce9dbb4
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/4ce9dbb4
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/4ce9dbb4
Branch: refs/heads/master
Commit: 4ce9dbb475ef52812691d0cddae6df75ab496369
Parents: 33f90cc
Author: Dan Hecht <dh...@cloudera.com>
Authored: Mon May 14 11:45:25 2018 -0700
Committer: Impala Public Jenkins <im...@cloudera.com>
Committed: Mon May 14 22:17:58 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/4ce9dbb4/be/src/runtime/coordinator.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/coordinator.cc b/be/src/runtime/coordinator.cc
index 5a3722c..91f2e29 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/4ce9dbb4/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_