You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2017/02/03 02:06:11 UTC
[1/3] kudu git commit: Fix some clang-tidy errors for std::move
Repository: kudu
Updated Branches:
refs/heads/master 85fd90996 -> cb06dd12a
Fix some clang-tidy errors for std::move
Clang-tidy reported a few errors in a recent code review
of moved code[1]. Rather than fix them in the commit that just moved the
code, I fixed them separately. This also fixes a few other similar cases
I spotted where shared_ptr<Messenger> should be std::moved, and other
cases where MonoTime/MonoDelta should not be std::moved.
[1] https://gerrit.cloudera.org/#/c/5864/1/src/kudu/client/master_rpc.cc
Change-Id: I61a51478685a50c50c84319bd32d506fe372c3c4
Reviewed-on: http://gerrit.cloudera.org:8080/5867
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Tested-by: Todd Lipcon <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/6aba5eff
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/6aba5eff
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/6aba5eff
Branch: refs/heads/master
Commit: 6aba5eff8e5a541fcd4b57460d5d33938327aecc
Parents: 85fd909
Author: Todd Lipcon <to...@apache.org>
Authored: Wed Feb 1 18:46:36 2017 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Fri Feb 3 01:06:59 2017 +0000
----------------------------------------------------------------------
src/kudu/client/batcher.cc | 6 +++---
src/kudu/client/client-internal.cc | 1 -
src/kudu/client/master_rpc.cc | 22 +++++++++++-----------
src/kudu/client/meta_cache.cc | 6 +++---
src/kudu/client/meta_cache.h | 2 +-
src/kudu/rpc/exactly_once_rpc-test.cc | 9 +++++----
src/kudu/rpc/proxy.cc | 6 +++---
src/kudu/rpc/proxy.h | 2 +-
src/kudu/rpc/reactor.cc | 10 +++++-----
src/kudu/rpc/reactor.h | 2 +-
src/kudu/rpc/retriable_rpc.h | 12 ++++++------
src/kudu/rpc/rpc-bench.cc | 2 +-
src/kudu/rpc/rpc.h | 6 +++---
src/kudu/tools/ksck.cc | 2 +-
src/kudu/tools/ksck_remote.h | 4 ++--
15 files changed, 46 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/client/batcher.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/batcher.cc b/src/kudu/client/batcher.cc
index 53a57d5..a3d9b7a 100644
--- a/src/kudu/client/batcher.cc
+++ b/src/kudu/client/batcher.cc
@@ -199,7 +199,7 @@ class WriteRpc : public RetriableRpc<RemoteTabletServer, WriteRequestPB, WriteRe
const scoped_refptr<RequestTracker>& request_tracker,
vector<InFlightOp*> ops,
const MonoTime& deadline,
- const shared_ptr<Messenger>& messenger,
+ shared_ptr<Messenger> messenger,
const string& tablet_id,
uint64_t propagated_timestamp);
virtual ~WriteRpc();
@@ -237,10 +237,10 @@ WriteRpc::WriteRpc(const scoped_refptr<Batcher>& batcher,
const scoped_refptr<RequestTracker>& request_tracker,
vector<InFlightOp*> ops,
const MonoTime& deadline,
- const shared_ptr<Messenger>& messenger,
+ shared_ptr<Messenger> messenger,
const string& tablet_id,
uint64_t propagated_timestamp)
- : RetriableRpc(replica_picker, request_tracker, deadline, messenger),
+ : RetriableRpc(replica_picker, request_tracker, deadline, std::move(messenger)),
batcher_(batcher),
ops_(std::move(ops)),
tablet_id_(tablet_id) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/client/client-internal.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client-internal.cc b/src/kudu/client/client-internal.cc
index f53f540..176d3d7 100644
--- a/src/kudu/client/client-internal.cc
+++ b/src/kudu/client/client-internal.cc
@@ -84,7 +84,6 @@ using strings::Substitute;
namespace client {
using internal::GetLeaderMasterRpc;
-using internal::GetTableSchemaRpc;
using internal::RemoteTablet;
using internal::RemoteTabletServer;
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/client/master_rpc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/master_rpc.cc b/src/kudu/client/master_rpc.cc
index 5878c58..4e032ec 100644
--- a/src/kudu/client/master_rpc.cc
+++ b/src/kudu/client/master_rpc.cc
@@ -62,9 +62,10 @@ class GetMasterRegistrationRpc : public rpc::Rpc {
// pointer for the lifetime of this object.
//
// Invokes 'user_cb' upon failure or success of the RPC call.
- GetMasterRegistrationRpc(StatusCallback user_cb, Sockaddr addr,
+ GetMasterRegistrationRpc(StatusCallback user_cb,
+ const Sockaddr& addr,
const MonoTime& deadline,
- const std::shared_ptr<rpc::Messenger>& messenger,
+ std::shared_ptr<rpc::Messenger> messenger,
ServerEntryPB* out);
~GetMasterRegistrationRpc();
@@ -86,11 +87,11 @@ class GetMasterRegistrationRpc : public rpc::Rpc {
GetMasterRegistrationRpc::GetMasterRegistrationRpc(
- StatusCallback user_cb, Sockaddr addr, const MonoTime& deadline,
- const shared_ptr<Messenger>& messenger, ServerEntryPB* out)
- : Rpc(deadline, messenger),
+ StatusCallback user_cb, const Sockaddr& addr, const MonoTime& deadline,
+ shared_ptr<Messenger> messenger, ServerEntryPB* out)
+ : Rpc(deadline, std::move(messenger)),
user_cb_(std::move(user_cb)),
- addr_(std::move(addr)),
+ addr_(addr),
out_(DCHECK_NOTNULL(out)) {}
GetMasterRegistrationRpc::~GetMasterRegistrationRpc() {
@@ -150,10 +151,10 @@ GetLeaderMasterRpc::GetLeaderMasterRpc(LeaderCallback user_cb,
MonoTime deadline,
MonoDelta rpc_timeout,
shared_ptr<Messenger> messenger)
- : Rpc(std::move(deadline), std::move(messenger)),
+ : Rpc(deadline, std::move(messenger)),
user_cb_(std::move(user_cb)),
addrs_(std::move(addrs)),
- rpc_timeout_(std::move(rpc_timeout)),
+ rpc_timeout_(rpc_timeout),
pending_responses_(0),
completed_(false) {
DCHECK(deadline.Initialized());
@@ -230,7 +231,7 @@ void GetLeaderMasterRpc::SendRpcCb(const Status& status) {
void GetLeaderMasterRpc::GetMasterRegistrationRpcCbForNode(const Sockaddr& node_addr,
const ServerEntryPB& resp,
const Status& status) {
- // TODO: handle the situation where one Master is partitioned from
+ // TODO(todd): handle the situation where one Master is partitioned from
// the rest of the Master consensus configuration, all are reachable by the client,
// and the partitioned node "thinks" it's the leader.
//
@@ -268,9 +269,8 @@ void GetLeaderMasterRpc::GetMasterRegistrationRpcCbForNode(const Sockaddr& node_
// a delayed re-try, which don't need to do unless we've
// been unable to find a leader so far.
return;
- } else {
- completed_ = true;
}
+ completed_ = true;
}
}
// Called if the leader has been determined, or if we've received
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/client/meta_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/meta_cache.cc b/src/kudu/client/meta_cache.cc
index 1cee1fd..eb40f68 100644
--- a/src/kudu/client/meta_cache.cc
+++ b/src/kudu/client/meta_cache.cc
@@ -516,7 +516,7 @@ class LookupRpc : public Rpc {
string partition_key,
scoped_refptr<RemoteTablet>* remote_tablet,
const MonoTime& deadline,
- const shared_ptr<Messenger>& messenger,
+ shared_ptr<Messenger> messenger,
bool is_exact_lookup);
virtual ~LookupRpc();
virtual void SendRpc() OVERRIDE;
@@ -583,9 +583,9 @@ LookupRpc::LookupRpc(const scoped_refptr<MetaCache>& meta_cache,
string partition_key,
scoped_refptr<RemoteTablet>* remote_tablet,
const MonoTime& deadline,
- const shared_ptr<Messenger>& messenger,
+ shared_ptr<Messenger> messenger,
bool is_exact_lookup)
- : Rpc(deadline, messenger),
+ : Rpc(deadline, std::move(messenger)),
meta_cache_(meta_cache),
user_cb_(std::move(user_cb)),
table_(table),
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/client/meta_cache.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/meta_cache.h b/src/kudu/client/meta_cache.h
index 8bb69ce..b013076 100644
--- a/src/kudu/client/meta_cache.h
+++ b/src/kudu/client/meta_cache.h
@@ -267,7 +267,7 @@ class MetaCacheEntry {
MetaCacheEntry(MonoTime expiration_time,
std::string lower_bound_partition_key,
std::string upper_bound_partition_key)
- : expiration_time_(std::move(expiration_time)),
+ : expiration_time_(expiration_time),
lower_bound_partition_key_(std::move(lower_bound_partition_key)),
upper_bound_partition_key_(std::move(upper_bound_partition_key)) {
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/rpc/exactly_once_rpc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/exactly_once_rpc-test.cc b/src/kudu/rpc/exactly_once_rpc-test.cc
index 28537e0..1fb945d 100644
--- a/src/kudu/rpc/exactly_once_rpc-test.cc
+++ b/src/kudu/rpc/exactly_once_rpc-test.cc
@@ -72,11 +72,12 @@ class CalculatorServiceRpc : public RetriableRpc<CalculatorServiceProxy,
CalculatorServiceRpc(const scoped_refptr<TestServerPicker>& server_picker,
const scoped_refptr<RequestTracker>& request_tracker,
const MonoTime& deadline,
- const shared_ptr<Messenger>& messenger,
+ shared_ptr<Messenger> messenger,
int value,
CountDownLatch* latch,
int server_sleep = 0)
- : RetriableRpc(server_picker, request_tracker, deadline, messenger), latch_(latch) {
+ : RetriableRpc(server_picker, request_tracker, deadline, std::move(messenger)),
+ latch_(latch) {
req_.set_value_to_add(value);
req_.set_randomly_fail(true);
req_.set_sleep_for_ms(server_sleep);
@@ -168,7 +169,7 @@ class ExactlyOnceRpcTest : public RpcTestBase {
struct RetriableRpcExactlyOnceAdder {
RetriableRpcExactlyOnceAdder(const scoped_refptr<TestServerPicker>& server_picker,
const scoped_refptr<RequestTracker>& request_tracker,
- const shared_ptr<Messenger>& messenger,
+ shared_ptr<Messenger> messenger,
int value,
int server_sleep = 0) : latch_(1) {
MonoTime now = MonoTime::Now();
@@ -176,7 +177,7 @@ class ExactlyOnceRpcTest : public RpcTestBase {
rpc_ = new CalculatorServiceRpc(server_picker,
request_tracker,
now,
- messenger,
+ std::move(messenger),
value,
&latch_);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/rpc/proxy.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/proxy.cc b/src/kudu/rpc/proxy.cc
index c8e5017..206aac3 100644
--- a/src/kudu/rpc/proxy.cc
+++ b/src/kudu/rpc/proxy.cc
@@ -47,12 +47,12 @@ using std::shared_ptr;
namespace kudu {
namespace rpc {
-Proxy::Proxy(const std::shared_ptr<Messenger>& messenger,
+Proxy::Proxy(std::shared_ptr<Messenger> messenger,
const Sockaddr& remote, string service_name)
: service_name_(std::move(service_name)),
- messenger_(messenger),
+ messenger_(std::move(messenger)),
is_started_(false) {
- CHECK(messenger != nullptr);
+ CHECK(messenger_ != nullptr);
DCHECK(!service_name_.empty()) << "Proxy service name must not be blank";
// By default, we set the real user to the currently logged-in user.
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/rpc/proxy.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/proxy.h b/src/kudu/rpc/proxy.h
index b1bc350..ddbbe60 100644
--- a/src/kudu/rpc/proxy.h
+++ b/src/kudu/rpc/proxy.h
@@ -55,7 +55,7 @@ class Messenger;
// After initialization, multiple threads may make calls using the same proxy object.
class Proxy {
public:
- Proxy(const std::shared_ptr<Messenger>& messenger, const Sockaddr& remote,
+ Proxy(std::shared_ptr<Messenger> messenger, const Sockaddr& remote,
std::string service_name);
~Proxy();
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/rpc/reactor.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/reactor.cc b/src/kudu/rpc/reactor.cc
index 4a78f8c..da185b0 100644
--- a/src/kudu/rpc/reactor.cc
+++ b/src/kudu/rpc/reactor.cc
@@ -490,12 +490,12 @@ void DelayedTask::TimerHandler(ev::timer& watcher, int revents) {
}
}
-Reactor::Reactor(const shared_ptr<Messenger>& messenger,
+Reactor::Reactor(shared_ptr<Messenger> messenger,
int index, const MessengerBuilder& bld)
- : messenger_(messenger),
- name_(StringPrintf("%s_R%03d", messenger->name().c_str(), index)),
- closing_(false),
- thread_(this, bld) {
+ : messenger_(std::move(messenger)),
+ name_(StringPrintf("%s_R%03d", messenger_->name().c_str(), index)),
+ closing_(false),
+ thread_(this, bld) {
}
Status Reactor::Init() {
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/rpc/reactor.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/reactor.h b/src/kudu/rpc/reactor.h
index f9f5662..a31392b 100644
--- a/src/kudu/rpc/reactor.h
+++ b/src/kudu/rpc/reactor.h
@@ -269,7 +269,7 @@ class ReactorThread {
// A Reactor manages a ReactorThread
class Reactor {
public:
- Reactor(const std::shared_ptr<Messenger>& messenger,
+ Reactor(std::shared_ptr<Messenger> messenger,
int index,
const MessengerBuilder &bld);
Status Init();
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/rpc/retriable_rpc.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/retriable_rpc.h b/src/kudu/rpc/retriable_rpc.h
index a81d160..3817bb9 100644
--- a/src/kudu/rpc/retriable_rpc.h
+++ b/src/kudu/rpc/retriable_rpc.h
@@ -52,12 +52,12 @@ class RetriableRpc : public Rpc {
RetriableRpc(const scoped_refptr<ServerPicker<Server>>& server_picker,
const scoped_refptr<RequestTracker>& request_tracker,
const MonoTime& deadline,
- const std::shared_ptr<Messenger>& messenger)
- : Rpc(deadline, messenger),
- server_picker_(server_picker),
- request_tracker_(request_tracker),
- sequence_number_(RequestTracker::NO_SEQ_NO),
- num_attempts_(0) {}
+ std::shared_ptr<Messenger> messenger)
+ : Rpc(deadline, std::move(messenger)),
+ server_picker_(server_picker),
+ request_tracker_(request_tracker),
+ sequence_number_(RequestTracker::NO_SEQ_NO),
+ num_attempts_(0) {}
virtual ~RetriableRpc() {
DCHECK_EQ(sequence_number_, RequestTracker::NO_SEQ_NO);
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/rpc/rpc-bench.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc-bench.cc b/src/kudu/rpc/rpc-bench.cc
index c4a051a..809697a 100644
--- a/src/kudu/rpc/rpc-bench.cc
+++ b/src/kudu/rpc/rpc-bench.cc
@@ -174,7 +174,7 @@ class ClientAsyncWorkload {
public:
ClientAsyncWorkload(RpcBench *bench, shared_ptr<Messenger> messenger)
: bench_(bench),
- messenger_(messenger),
+ messenger_(std::move(messenger)),
request_count_(0) {
controller_.set_timeout(MonoDelta::FromSeconds(10));
proxy_.reset(new CalculatorServiceProxy(messenger_, bench_->server_addr_));
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/rpc/rpc.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc.h b/src/kudu/rpc/rpc.h
index 6dd95fe..077c8f3 100644
--- a/src/kudu/rpc/rpc.h
+++ b/src/kudu/rpc/rpc.h
@@ -99,7 +99,7 @@ class RpcRetrier {
public:
RpcRetrier(MonoTime deadline, std::shared_ptr<rpc::Messenger> messenger)
: attempt_num_(1),
- deadline_(std::move(deadline)),
+ deadline_(deadline),
messenger_(std::move(messenger)) {
if (deadline_.Initialized()) {
controller_.set_deadline(deadline_);
@@ -168,8 +168,8 @@ class RpcRetrier {
class Rpc {
public:
Rpc(const MonoTime& deadline,
- const std::shared_ptr<rpc::Messenger>& messenger)
- : retrier_(deadline, messenger) {
+ std::shared_ptr<rpc::Messenger> messenger)
+ : retrier_(deadline, std::move(messenger)) {
}
virtual ~Rpc() {}
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/tools/ksck.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck.cc b/src/kudu/tools/ksck.cc
index 21cc6ba..67beac1 100644
--- a/src/kudu/tools/ksck.cc
+++ b/src/kudu/tools/ksck.cc
@@ -105,7 +105,7 @@ ChecksumOptions::ChecksumOptions()
ChecksumOptions::ChecksumOptions(MonoDelta timeout, int scan_concurrency,
bool use_snapshot, uint64_t snapshot_timestamp)
- : timeout(std::move(timeout)),
+ : timeout(timeout),
scan_concurrency(scan_concurrency),
use_snapshot(use_snapshot),
snapshot_timestamp(snapshot_timestamp) {}
http://git-wip-us.apache.org/repos/asf/kudu/blob/6aba5eff/src/kudu/tools/ksck_remote.h
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck_remote.h b/src/kudu/tools/ksck_remote.h
index ee049d6..698a678 100644
--- a/src/kudu/tools/ksck_remote.h
+++ b/src/kudu/tools/ksck_remote.h
@@ -91,9 +91,9 @@ class RemoteKsckMaster : public KsckMaster {
private:
RemoteKsckMaster(const std::vector<std::string>& master_addresses,
- const std::shared_ptr<rpc::Messenger>& messenger)
+ std::shared_ptr<rpc::Messenger> messenger)
: master_addresses_(master_addresses),
- messenger_(messenger) {
+ messenger_(std::move(messenger)) {
}
const std::vector<std::string> master_addresses_;
[3/3] kudu git commit: tablet copy: Include local peer UUID in
TabletCopyService log messages
Posted by to...@apache.org.
tablet copy: Include local peer UUID in TabletCopyService log messages
Also, log a detailed message when a BeginTabletCopySession request is
received, which can help with debugging.
Change-Id: I3fefc2ee54e180af478f134794400ea87a4c957a
Reviewed-on: http://gerrit.cloudera.org:8080/5873
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/cb06dd12
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/cb06dd12
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/cb06dd12
Branch: refs/heads/master
Commit: cb06dd12a83d6184741689a351de58eec8fd4370
Parents: 1ce41a4
Author: Mike Percy <mp...@apache.org>
Authored: Thu Feb 2 10:28:09 2017 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Fri Feb 3 01:41:14 2017 +0000
----------------------------------------------------------------------
src/kudu/tserver/tablet_copy_service.cc | 95 +++++++++++++++-------------
src/kudu/tserver/tablet_copy_service.h | 7 ++
2 files changed, 59 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/cb06dd12/src/kudu/tserver/tablet_copy_service.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service.cc b/src/kudu/tserver/tablet_copy_service.cc
index f3fcc7e..d3ff41b 100644
--- a/src/kudu/tserver/tablet_copy_service.cc
+++ b/src/kudu/tserver/tablet_copy_service.cc
@@ -36,18 +36,12 @@
#include "kudu/util/flag_tags.h"
#include "kudu/util/pb_util.h"
-// Note, this macro assumes the existence of a local var named 'context'.
-#define RPC_RETURN_APP_ERROR(app_err, message, s) \
+#define RPC_RETURN_NOT_OK(expr, app_err, message, context) \
do { \
- SetupErrorAndRespond(context, app_err, message, s); \
- return; \
- } while (false)
-
-#define RPC_RETURN_NOT_OK(expr, app_err, message) \
- do { \
- Status s = (expr); \
- if (!s.ok()) { \
- RPC_RETURN_APP_ERROR(app_err, message, s); \
+ const Status& s = (expr); \
+ if (PREDICT_FALSE(!s.ok())) { \
+ SetupErrorAndRespond(context, app_err, message, s); \
+ return; \
} \
} while (false)
@@ -74,20 +68,6 @@ using crc::Crc32c;
using strings::Substitute;
using tablet::TabletPeer;
-static void SetupErrorAndRespond(rpc::RpcContext* context,
- TabletCopyErrorPB::Code code,
- const string& message,
- const Status& s) {
- LOG(WARNING) << "Error handling TabletCopyService RPC request from "
- << context->requestor_string() << ": " << message << ": "
- << s.ToString();
- TabletCopyErrorPB error;
- StatusToPB(s, error.mutable_status());
- error.set_code(code);
- context->RespondApplicationError(TabletCopyErrorPB::tablet_copy_error_ext.number(),
- message, error);
-}
-
TabletCopyServiceImpl::TabletCopyServiceImpl(
FsManager* fs_manager,
TabletPeerLookupIf* tablet_peer_lookup,
@@ -109,6 +89,10 @@ void TabletCopyServiceImpl::BeginTabletCopySession(
const string& requestor_uuid = req->requestor_uuid();
const string& tablet_id = req->tablet_id();
+ LOG_WITH_PREFIX(INFO) << Substitute(
+ "Received BeginTabletCopySession request for tablet $0 from peer $1 ($2)",
+ tablet_id, requestor_uuid, context->requestor_string());
+
// For now, we use the requestor_uuid with the tablet id as the session id,
// but there is no guarantee this will not change in the future.
const string session_id = Substitute("$0-$1", requestor_uuid, tablet_id);
@@ -116,13 +100,14 @@ void TabletCopyServiceImpl::BeginTabletCopySession(
scoped_refptr<TabletPeer> tablet_peer;
RPC_RETURN_NOT_OK(tablet_peer_lookup_->GetTabletPeer(tablet_id, &tablet_peer),
TabletCopyErrorPB::TABLET_NOT_FOUND,
- Substitute("Unable to find specified tablet: $0", tablet_id));
+ Substitute("Unable to find specified tablet: $0", tablet_id),
+ context);
scoped_refptr<TabletCopySourceSession> session;
{
MutexLock l(sessions_lock_);
if (!FindCopy(sessions_, session_id, &session)) {
- LOG(INFO) << Substitute(
+ LOG_WITH_PREFIX(INFO) << Substitute(
"Beginning new tablet copy session on tablet $0 from peer $1"
" at $2: session id = $3",
tablet_id, requestor_uuid, context->requestor_string(), session_id);
@@ -130,11 +115,11 @@ void TabletCopyServiceImpl::BeginTabletCopySession(
requestor_uuid, fs_manager_));
RPC_RETURN_NOT_OK(session->Init(),
TabletCopyErrorPB::UNKNOWN_ERROR,
- Substitute("Error beginning tablet copy session for tablet $0",
- tablet_id));
+ Substitute("Error beginning tablet copy session for tablet $0", tablet_id),
+ context);
InsertOrDie(&sessions_, session_id, session);
} else {
- LOG(INFO) << Substitute(
+ LOG_WITH_PREFIX(INFO) << Substitute(
"Re-sending initialization info for existing tablet copy session on tablet $0"
" from peer $1 at $2: session_id = $3",
tablet_id, requestor_uuid, context->requestor_string(), session_id);
@@ -179,7 +164,8 @@ void TabletCopyServiceImpl::CheckSessionActive(
return;
} else {
RPC_RETURN_NOT_OK(status, app_error,
- Substitute("Error trying to check whether session $0 is active", session_id));
+ Substitute("Error trying to check whether session $0 is active", session_id),
+ context);
}
}
@@ -194,7 +180,7 @@ void TabletCopyServiceImpl::FetchData(const FetchDataRequestPB* req,
MutexLock l(sessions_lock_);
TabletCopyErrorPB::Code app_error;
RPC_RETURN_NOT_OK(FindSessionUnlocked(session_id, &app_error, &session),
- app_error, "No such session");
+ app_error, "No such session", context);
ResetSessionExpirationUnlocked(session_id);
}
@@ -206,7 +192,7 @@ void TabletCopyServiceImpl::FetchData(const FetchDataRequestPB* req,
const DataIdPB& data_id = req->data_id();
TabletCopyErrorPB::Code error_code = TabletCopyErrorPB::UNKNOWN_ERROR;
RPC_RETURN_NOT_OK(ValidateFetchRequestDataId(data_id, &error_code, session),
- error_code, "Invalid DataId");
+ error_code, "Invalid DataId", context);
DataChunkPB* data_chunk = resp->mutable_chunk();
string* data = data_chunk->mutable_data();
@@ -216,13 +202,13 @@ void TabletCopyServiceImpl::FetchData(const FetchDataRequestPB* req,
const BlockId& block_id = BlockId::FromPB(data_id.block_id());
RPC_RETURN_NOT_OK(session->GetBlockPiece(block_id, offset, client_maxlen,
data, &total_data_length, &error_code),
- error_code, "Unable to get piece of data block");
+ error_code, "Unable to get piece of data block", context);
} else {
// Fetching a log segment chunk.
uint64_t segment_seqno = data_id.wal_segment_seqno();
RPC_RETURN_NOT_OK(session->GetLogSegmentPiece(segment_seqno, offset, client_maxlen,
data, &total_data_length, &error_code),
- error_code, "Unable to get piece of log segment");
+ error_code, "Unable to get piece of log segment", context);
}
data_chunk->set_total_data_length(total_data_length);
@@ -242,10 +228,10 @@ void TabletCopyServiceImpl::EndTabletCopySession(
{
MutexLock l(sessions_lock_);
TabletCopyErrorPB::Code app_error;
- LOG(INFO) << "Request end of tablet copy session " << req->session_id()
- << " received from " << context->requestor_string();
+ LOG_WITH_PREFIX(INFO) << "Request end of tablet copy session " << req->session_id()
+ << " received from " << context->requestor_string();
RPC_RETURN_NOT_OK(DoEndTabletCopySessionUnlocked(req->session_id(), &app_error),
- app_error, "No such session");
+ app_error, "No such session", context);
}
context->RespondSuccess();
}
@@ -260,7 +246,8 @@ void TabletCopyServiceImpl::Shutdown() {
session_ids.push_back(entry.first);
}
for (const string& session_id : session_ids) {
- LOG(INFO) << "Destroying tablet copy session " << session_id << " due to service shutdown";
+ LOG_WITH_PREFIX(INFO) << "Destroying tablet copy session " << session_id
+ << " due to service shutdown";
TabletCopyErrorPB::Code app_error;
CHECK_OK(DoEndTabletCopySessionUnlocked(session_id, &app_error));
}
@@ -323,8 +310,8 @@ Status TabletCopyServiceImpl::DoEndTabletCopySessionUnlocked(
RETURN_NOT_OK(FindSessionUnlocked(session_id, app_error, &session));
// Remove the session from the map.
// It will get destroyed once there are no outstanding refs.
- LOG(INFO) << "Ending tablet copy session " << session_id << " on tablet "
- << session->tablet_id() << " with peer " << session->requestor_uuid();
+ LOG_WITH_PREFIX(INFO) << "Ending tablet copy session " << session_id << " on tablet "
+ << session->tablet_id() << " with peer " << session->requestor_uuid();
CHECK_EQ(1, sessions_.erase(session_id));
CHECK_EQ(1, session_expirations_.erase(session_id));
@@ -345,8 +332,8 @@ void TabletCopyServiceImpl::EndExpiredSessions() {
}
}
for (const string& session_id : expired_session_ids) {
- LOG(INFO) << "Tablet Copy session " << session_id
- << " has expired. Terminating session.";
+ LOG_WITH_PREFIX(INFO) << "Tablet Copy session " << session_id
+ << " has expired. Terminating session.";
TabletCopyErrorPB::Code app_error;
CHECK_OK(DoEndTabletCopySessionUnlocked(session_id, &app_error));
}
@@ -354,5 +341,27 @@ void TabletCopyServiceImpl::EndExpiredSessions() {
FLAGS_tablet_copy_timeout_poll_period_ms)));
}
+string TabletCopyServiceImpl::LogPrefix() const {
+ // We use a truncated form of the "T xxxx P yyyy" prefix here, with only the
+ // "P" part, because we don't want it to appear that tablet 'foo' is running
+ // when logging error messages like "Can't find tablet 'foo'".
+ return Substitute("P $0: ", fs_manager_->uuid());
+}
+
+void TabletCopyServiceImpl::SetupErrorAndRespond(
+ rpc::RpcContext* context,
+ TabletCopyErrorPB::Code code,
+ const string& message,
+ const Status& s) {
+ LOG_WITH_PREFIX(WARNING) << "Error handling TabletCopyService RPC request from "
+ << context->requestor_string()
+ << ": " << message << ": " << s.ToString();
+ TabletCopyErrorPB error;
+ StatusToPB(s, error.mutable_status());
+ error.set_code(code);
+ context->RespondApplicationError(TabletCopyErrorPB::tablet_copy_error_ext.number(),
+ message, error);
+}
+
} // namespace tserver
} // namespace kudu
http://git-wip-us.apache.org/repos/asf/kudu/blob/cb06dd12/src/kudu/tserver/tablet_copy_service.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service.h b/src/kudu/tserver/tablet_copy_service.h
index 4e912bd..58602eb 100644
--- a/src/kudu/tserver/tablet_copy_service.h
+++ b/src/kudu/tserver/tablet_copy_service.h
@@ -92,6 +92,13 @@ class TabletCopyServiceImpl : public TabletCopyServiceIf {
// removes them from the map.
void EndExpiredSessions();
+ std::string LogPrefix() const;
+
+ void SetupErrorAndRespond(rpc::RpcContext* context,
+ TabletCopyErrorPB::Code code,
+ const string& message,
+ const Status& s);
+
FsManager* fs_manager_;
TabletPeerLookupIf* tablet_peer_lookup_;
[2/3] kudu git commit: client: rename various function calls and
classes to ConnectToCluster
Posted by to...@apache.org.
client: rename various function calls and classes to ConnectToCluster
This is a straight rename patch in preparation for adding the fetching
of authentication tokens and CA information upon first connection to the
master.
Change-Id: I96bdfc1c6bb3758841d31d728b168bac8ac78ec0
Reviewed-on: http://gerrit.cloudera.org:8080/5868
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Todd Lipcon <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/1ce41a4a
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/1ce41a4a
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/1ce41a4a
Branch: refs/heads/master
Commit: 1ce41a4a5efc19d33e02b7179a98681b1ead43af
Parents: 6aba5ef
Author: Todd Lipcon <to...@apache.org>
Authored: Wed Feb 1 18:34:44 2017 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Fri Feb 3 01:08:12 2017 +0000
----------------------------------------------------------------------
src/kudu/client/client-internal.cc | 30 +++++++++---------
src/kudu/client/client-internal.h | 32 +++++++++-----------
src/kudu/client/client.cc | 4 +--
src/kudu/client/master_rpc.cc | 32 ++++++++++----------
src/kudu/client/master_rpc.h | 24 +++++++--------
src/kudu/client/meta_cache.cc | 2 +-
.../integration-tests/external_mini_cluster.cc | 18 +++++------
src/kudu/master/master.proto | 6 ++++
8 files changed, 75 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/1ce41a4a/src/kudu/client/client-internal.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client-internal.cc b/src/kudu/client/client-internal.cc
index 176d3d7..b8afa1d 100644
--- a/src/kudu/client/client-internal.cc
+++ b/src/kudu/client/client-internal.cc
@@ -83,7 +83,7 @@ using strings::Substitute;
namespace client {
-using internal::GetLeaderMasterRpc;
+using internal::ConnectToClusterRpc;
using internal::RemoteTablet;
using internal::RemoteTabletServer;
@@ -192,7 +192,7 @@ Status KuduClient::Data::SyncLeaderMasterRpc(
<< s.ToString();
if (client->IsMultiMaster()) {
LOG(INFO) << "Determining the new leader Master and retrying...";
- WARN_NOT_OK(SetMasterServerProxy(client, deadline),
+ WARN_NOT_OK(ConnectToCluster(client, deadline),
"Unable to determine the new leader Master");
continue;
}
@@ -206,7 +206,7 @@ Status KuduClient::Data::SyncLeaderMasterRpc(
<< "): " << s.ToString();
if (client->IsMultiMaster()) {
LOG(INFO) << "Determining the new leader Master and retrying...";
- WARN_NOT_OK(SetMasterServerProxy(client, deadline),
+ WARN_NOT_OK(ConnectToCluster(client, deadline),
"Unable to determine the new leader Master");
}
continue;
@@ -222,7 +222,7 @@ Status KuduClient::Data::SyncLeaderMasterRpc(
resp->error().code() == MasterErrorPB::CATALOG_MANAGER_NOT_INITIALIZED) {
if (client->IsMultiMaster()) {
KLOG_EVERY_N_SECS(INFO, 1) << "Determining the new leader Master and retrying...";
- WARN_NOT_OK(SetMasterServerProxy(client, deadline),
+ WARN_NOT_OK(ConnectToCluster(client, deadline),
"Unable to determine the new leader Master");
continue;
}
@@ -599,8 +599,8 @@ Status KuduClient::Data::GetTableSchema(KuduClient* client,
return Status::OK();
}
-void KuduClient::Data::LeaderMasterDetermined(const Status& status,
- const HostPort& host_port) {
+void KuduClient::Data::ConnectedToClusterCb(const Status& status,
+ const HostPort& host_port) {
Sockaddr leader_sock_addr;
Status new_status = status;
if (new_status.ok()) {
@@ -624,16 +624,16 @@ void KuduClient::Data::LeaderMasterDetermined(const Status& status,
}
}
-Status KuduClient::Data::SetMasterServerProxy(KuduClient* client,
- const MonoTime& deadline) {
+Status KuduClient::Data::ConnectToCluster(KuduClient* client,
+ const MonoTime& deadline) {
Synchronizer sync;
- SetMasterServerProxyAsync(client, deadline, sync.AsStatusCallback());
+ ConnectToClusterAsync(client, deadline, sync.AsStatusCallback());
return sync.Wait();
}
-void KuduClient::Data::SetMasterServerProxyAsync(KuduClient* client,
- const MonoTime& deadline,
- const StatusCallback& cb) {
+void KuduClient::Data::ConnectToClusterAsync(KuduClient* client,
+ const MonoTime& deadline,
+ const StatusCallback& cb) {
DCHECK(deadline.Initialized());
vector<Sockaddr> master_sockaddrs;
@@ -659,7 +659,7 @@ void KuduClient::Data::SetMasterServerProxyAsync(KuduClient* client,
master_sockaddrs.push_back(addrs[0]);
}
- // This ensures that no more than one GetLeaderMasterRpc is in
+ // This ensures that no more than one ConnectToClusterRpc is in
// flight at a time -- there isn't much sense in requesting this information
// in parallel, since the requests should end up with the same result.
// Instead, we simply piggy-back onto the existing request by adding our own
@@ -668,8 +668,8 @@ void KuduClient::Data::SetMasterServerProxyAsync(KuduClient* client,
leader_master_callbacks_.push_back(cb);
if (!leader_master_rpc_) {
// No one is sending a request yet - we need to be the one to do it.
- leader_master_rpc_.reset(new internal::GetLeaderMasterRpc(
- Bind(&KuduClient::Data::LeaderMasterDetermined,
+ leader_master_rpc_.reset(new internal::ConnectToClusterRpc(
+ Bind(&KuduClient::Data::ConnectedToClusterCb,
Unretained(this)),
std::move(master_sockaddrs),
deadline,
http://git-wip-us.apache.org/repos/asf/kudu/blob/1ce41a4a/src/kudu/client/client-internal.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/client-internal.h b/src/kudu/client/client-internal.h
index 1fbf15e..ca0aeba 100644
--- a/src/kudu/client/client-internal.h
+++ b/src/kudu/client/client-internal.h
@@ -52,7 +52,7 @@ class RpcController;
namespace client {
namespace internal {
-class GetLeaderMasterRpc;
+class ConnectToClusterRpc;
} // namespace internal
class KuduClient::Data {
@@ -134,11 +134,10 @@ class KuduClient::Data {
// Sets 'master_proxy_' from the address specified by
// 'leader_master_hostport_'. Called by
- // GetLeaderMasterRpc::SendRpcCb() upon successful completion.
+ // ConnectToClusterRpc::SendRpcCb() upon successful completion.
//
- // See also: SetMasterServerProxyAsync.
- void LeaderMasterDetermined(const Status& status,
- const HostPort& host_port);
+ // See also: ConnectToClusterAsync.
+ void ConnectedToClusterCb(const Status& status, const HostPort& host_port);
// Asynchronously sets 'master_proxy_' to the leader master by
// cycling through servers listed in 'master_server_addrs_' until
@@ -148,18 +147,15 @@ class KuduClient::Data {
// Invokes 'cb' with the appropriate status when finished.
//
// Works with both a distributed and non-distributed configuration.
- void SetMasterServerProxyAsync(KuduClient* client,
- const MonoTime& deadline,
- const StatusCallback& cb);
+ void ConnectToClusterAsync(KuduClient* client,
+ const MonoTime& deadline,
+ const StatusCallback& cb);
- // Synchronous version of SetMasterServerProxyAsync method above.
+ // Synchronous version of ConnectToClusterAsync method above.
//
// NOTE: since this uses a Synchronizer, this may not be invoked by
// a method that's on a reactor thread.
- //
- // TODO(todd): rename to ReconnectToMasters or something
- Status SetMasterServerProxy(KuduClient* client,
- const MonoTime& deadline);
+ Status ConnectToCluster(KuduClient* client, const MonoTime& deadline);
std::shared_ptr<master::MasterServiceProxy> master_proxy() const;
@@ -220,23 +216,23 @@ class KuduClient::Data {
MonoDelta default_rpc_timeout_;
// The host port of the leader master. This is set in
- // LeaderMasterDetermined, which is invoked as a callback by
- // SetMasterServerProxyAsync.
+ // ConnectedToClusterCb, which is invoked as a callback by
+ // ConnectToClusterAsync.
HostPort leader_master_hostport_;
// Proxy to the leader master.
std::shared_ptr<master::MasterServiceProxy> master_proxy_;
- // Ref-counted RPC instance: since 'SetMasterServerProxyAsync' call
+ // Ref-counted RPC instance: since 'ConnectToClusterAsync' call
// is asynchronous, we need to hold a reference in this class
// itself, as to avoid a "use-after-free" scenario.
- scoped_refptr<internal::GetLeaderMasterRpc> leader_master_rpc_;
+ scoped_refptr<internal::ConnectToClusterRpc> leader_master_rpc_;
std::vector<StatusCallback> leader_master_callbacks_;
// Protects 'leader_master_rpc_', 'leader_master_hostport_',
// and master_proxy_
//
- // See: KuduClient::Data::SetMasterServerProxyAsync for a more
+ // See: KuduClient::Data::ConnectToClusterAsync for a more
// in-depth explanation of why this is needed and how it works.
mutable simple_spinlock leader_master_lock_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/1ce41a4a/src/kudu/client/client.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client.cc b/src/kudu/client/client.cc
index 533e0af..99b37f2 100644
--- a/src/kudu/client/client.cc
+++ b/src/kudu/client/client.cc
@@ -244,8 +244,8 @@ Status KuduClientBuilder::Build(shared_ptr<KuduClient>* client) {
// Let's allow for plenty of time for discovering the master the first
// time around.
MonoTime deadline = MonoTime::Now() + c->default_admin_operation_timeout();
- RETURN_NOT_OK_PREPEND(c->data_->SetMasterServerProxy(c.get(), deadline),
- "Could not locate the leader master");
+ RETURN_NOT_OK_PREPEND(c->data_->ConnectToCluster(c.get(), deadline),
+ "Could not connect to the cluster");
c->data_->meta_cache_.reset(new MetaCache(c.get()));
c->data_->dns_resolver_.reset(new DnsResolver());
http://git-wip-us.apache.org/repos/asf/kudu/blob/1ce41a4a/src/kudu/client/master_rpc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/master_rpc.cc b/src/kudu/client/master_rpc.cc
index 4e032ec..a04cc32 100644
--- a/src/kudu/client/master_rpc.cc
+++ b/src/kudu/client/master_rpc.cc
@@ -143,14 +143,14 @@ void GetMasterRegistrationRpc::SendRpcCb(const Status& status) {
} // anonymous namespace
////////////////////////////////////////////////////////////
-// GetLeaderMasterRpc
+// ConnectToClusterRpc
////////////////////////////////////////////////////////////
-GetLeaderMasterRpc::GetLeaderMasterRpc(LeaderCallback user_cb,
- vector<Sockaddr> addrs,
- MonoTime deadline,
- MonoDelta rpc_timeout,
- shared_ptr<Messenger> messenger)
+ConnectToClusterRpc::ConnectToClusterRpc(LeaderCallback user_cb,
+ vector<Sockaddr> addrs,
+ MonoTime deadline,
+ MonoDelta rpc_timeout,
+ shared_ptr<Messenger> messenger)
: Rpc(deadline, std::move(messenger)),
user_cb_(std::move(user_cb)),
addrs_(std::move(addrs)),
@@ -163,20 +163,20 @@ GetLeaderMasterRpc::GetLeaderMasterRpc(LeaderCallback user_cb,
responses_.resize(addrs_.size());
}
-GetLeaderMasterRpc::~GetLeaderMasterRpc() {
+ConnectToClusterRpc::~ConnectToClusterRpc() {
}
-string GetLeaderMasterRpc::ToString() const {
+string ConnectToClusterRpc::ToString() const {
vector<string> sockaddr_str;
for (const Sockaddr& addr : addrs_) {
sockaddr_str.push_back(addr.ToString());
}
- return strings::Substitute("GetLeaderMasterRpc(addrs: $0, num_attempts: $1)",
+ return strings::Substitute("ConnectToClusterRpc(addrs: $0, num_attempts: $1)",
JoinStrings(sockaddr_str, ","),
num_attempts());
}
-void GetLeaderMasterRpc::SendRpc() {
+void ConnectToClusterRpc::SendRpc() {
// Compute the actual deadline to use for each RPC.
MonoTime rpc_deadline = MonoTime::Now() + rpc_timeout_;
MonoTime actual_deadline = MonoTime::Earliest(retrier().deadline(),
@@ -185,7 +185,7 @@ void GetLeaderMasterRpc::SendRpc() {
std::lock_guard<simple_spinlock> l(lock_);
for (int i = 0; i < addrs_.size(); i++) {
GetMasterRegistrationRpc* rpc = new GetMasterRegistrationRpc(
- Bind(&GetLeaderMasterRpc::GetMasterRegistrationRpcCbForNode,
+ Bind(&ConnectToClusterRpc::SingleNodeCallback,
this, ConstRef(addrs_[i]), ConstRef(responses_[i])),
addrs_[i],
actual_deadline,
@@ -196,11 +196,11 @@ void GetLeaderMasterRpc::SendRpc() {
}
}
-void GetLeaderMasterRpc::SendRpcCb(const Status& status) {
+void ConnectToClusterRpc::SendRpcCb(const Status& status) {
// To safely retry, we must reset completed_ so that it can be reused in the
// next round of RPCs.
//
- // The SendRpcCb invariant (see GetMasterRegistrationRpcCbForNode comments)
+ // The SendRpcCb invariant (see SingleNodeCallback comments)
// implies that if we're to retry, we must be the last response. Thus, it is
// safe to reset completed_ in this case; there's no danger of a late
// response reading it and entering SendRpcCb inadvertently.
@@ -228,9 +228,9 @@ void GetLeaderMasterRpc::SendRpcCb(const Status& status) {
user_cb_.Run(status, leader_master_);
}
-void GetLeaderMasterRpc::GetMasterRegistrationRpcCbForNode(const Sockaddr& node_addr,
- const ServerEntryPB& resp,
- const Status& status) {
+void ConnectToClusterRpc::SingleNodeCallback(const Sockaddr& node_addr,
+ const ServerEntryPB& resp,
+ const Status& status) {
// TODO(todd): handle the situation where one Master is partitioned from
// the rest of the Master consensus configuration, all are reachable by the client,
// and the partitioned node "thinks" it's the leader.
http://git-wip-us.apache.org/repos/asf/kudu/blob/1ce41a4a/src/kudu/client/master_rpc.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/master_rpc.h b/src/kudu/client/master_rpc.h
index 9159a7f..3170693 100644
--- a/src/kudu/client/master_rpc.h
+++ b/src/kudu/client/master_rpc.h
@@ -54,8 +54,8 @@ namespace internal {
// The class is reference counted to avoid a "use-after-free"
// scenario, when responses to the RPC return to the caller _after_ a
// leader has already been found.
-class GetLeaderMasterRpc : public rpc::Rpc,
- public RefCountedThreadSafe<GetLeaderMasterRpc> {
+class ConnectToClusterRpc : public rpc::Rpc,
+ public RefCountedThreadSafe<ConnectToClusterRpc> {
public:
typedef Callback<void(const Status&, const HostPort&)> LeaderCallback;
// The host and port of the leader master server is stored in
@@ -65,18 +65,18 @@ class GetLeaderMasterRpc : public rpc::Rpc,
// Calls 'user_cb' when the leader is found, or if no leader can be found
// until 'deadline' passes. Each RPC has 'rpc_timeout' time to complete
// before it times out and may be retried if 'deadline' has not yet passed.
- GetLeaderMasterRpc(LeaderCallback user_cb,
- std::vector<Sockaddr> addrs,
- MonoTime deadline,
- MonoDelta rpc_timeout,
- std::shared_ptr<rpc::Messenger> messenger);
+ ConnectToClusterRpc(LeaderCallback user_cb,
+ std::vector<Sockaddr> addrs,
+ MonoTime deadline,
+ MonoDelta rpc_timeout,
+ std::shared_ptr<rpc::Messenger> messenger);
virtual void SendRpc() OVERRIDE;
virtual std::string ToString() const OVERRIDE;
private:
- friend class RefCountedThreadSafe<GetLeaderMasterRpc>;
- ~GetLeaderMasterRpc();
+ friend class RefCountedThreadSafe<ConnectToClusterRpc>;
+ ~ConnectToClusterRpc();
virtual void SendRpcCb(const Status& status) OVERRIDE;
@@ -86,9 +86,9 @@ class GetLeaderMasterRpc : public rpc::Rpc,
// Invokes SendRpcCb if the response indicates that the specified
// master is a leader, or if responses have been received from all
// of the Masters.
- void GetMasterRegistrationRpcCbForNode(const Sockaddr& node_addr,
- const ServerEntryPB& resp,
- const Status& status);
+ void SingleNodeCallback(const Sockaddr& node_addr,
+ const ServerEntryPB& resp,
+ const Status& status);
LeaderCallback user_cb_;
std::vector<Sockaddr> addrs_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/1ce41a4a/src/kudu/client/meta_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/meta_cache.cc b/src/kudu/client/meta_cache.cc
index eb40f68..9be8d64 100644
--- a/src/kudu/client/meta_cache.cc
+++ b/src/kudu/client/meta_cache.cc
@@ -672,7 +672,7 @@ string LookupRpc::ToString() const {
}
void LookupRpc::ResetMasterLeaderAndRetry() {
- table_->client()->data_->SetMasterServerProxyAsync(
+ table_->client()->data_->ConnectToClusterAsync(
table_->client(),
retrier().deadline(),
Bind(&LookupRpc::NewLeaderMasterDeterminedCb,
http://git-wip-us.apache.org/repos/asf/kudu/blob/1ce41a4a/src/kudu/integration-tests/external_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster.cc b/src/kudu/integration-tests/external_mini_cluster.cc
index a9ee499..ff0cbae 100644
--- a/src/kudu/integration-tests/external_mini_cluster.cc
+++ b/src/kudu/integration-tests/external_mini_cluster.cc
@@ -51,7 +51,7 @@
#include "kudu/util/subprocess.h"
#include "kudu/util/test_util.h"
-using kudu::client::internal::GetLeaderMasterRpc;
+using kudu::client::internal::ConnectToClusterRpc;
using kudu::master::ListTablesRequestPB;
using kudu::master::ListTablesResponsePB;
using kudu::master::MasterServiceProxy;
@@ -474,7 +474,7 @@ void LeaderMasterCallback(HostPort* dst_hostport,
} // anonymous namespace
Status ExternalMiniCluster::GetLeaderMasterIndex(int* idx) {
- scoped_refptr<GetLeaderMasterRpc> rpc;
+ scoped_refptr<ConnectToClusterRpc> rpc;
Synchronizer sync;
vector<Sockaddr> addrs;
HostPort leader_master_hp;
@@ -483,13 +483,13 @@ Status ExternalMiniCluster::GetLeaderMasterIndex(int* idx) {
for (const scoped_refptr<ExternalMaster>& master : masters_) {
addrs.push_back(master->bound_rpc_addr());
}
- rpc.reset(new GetLeaderMasterRpc(Bind(&LeaderMasterCallback,
- &leader_master_hp,
- &sync),
- std::move(addrs),
- deadline,
- MonoDelta::FromSeconds(5),
- messenger_));
+ rpc.reset(new ConnectToClusterRpc(Bind(&LeaderMasterCallback,
+ &leader_master_hp,
+ &sync),
+ std::move(addrs),
+ deadline,
+ MonoDelta::FromSeconds(5),
+ messenger_));
rpc->SendRpc();
RETURN_NOT_OK(sync.Wait());
bool found = false;
http://git-wip-us.apache.org/repos/asf/kudu/blob/1ce41a4a/src/kudu/master/master.proto
----------------------------------------------------------------------
diff --git a/src/kudu/master/master.proto b/src/kudu/master/master.proto
index e17e73c..acdf0e9 100644
--- a/src/kudu/master/master.proto
+++ b/src/kudu/master/master.proto
@@ -627,6 +627,12 @@ service MasterService {
// Administrative/monitoring RPCs
rpc ListTabletServers(ListTabletServersRequestPB) returns (ListTabletServersResponsePB);
rpc ListMasters(ListMastersRequestPB) returns (ListMastersResponsePB);
+
+ // TODO(todd): rename this RPC to ConnectToCluster() or somesuch. It's only used by
+ // the client. However, we need to keep in mind compatibility. We'll probably have to
+ // do this by adding a new RPC which use the existing protos, and having the server
+ // implement it, but the client not send it. After it's been out for a few releases,
+ // we can start sending it from clients?
rpc GetMasterRegistration(GetMasterRegistrationRequestPB) returns
(GetMasterRegistrationResponsePB);
}