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 2016/03/17 04:31:36 UTC
[2/3] incubator-kudu git commit: KUDU-418 (part 1): enforce that we
don't support changing TS hosts/ports
KUDU-418 (part 1): enforce that we don't support changing TS hosts/ports
This adds a check in the master that attempts to reject tablet servers which
have changed host/port. We don't currently support this, so allowing them to
register currently just ends up hitting other more hard-to-diagnose issues
later on.
This check will end up being rolled back when we actually implement a proper
fix for KUDU-418. In the meantime, this would have helped me troubleshoot some
issues with client-test where we hit this issue.
Change-Id: I16d9a91059b7dde63a2cac71e1fde0228b6a9f3d
Reviewed-on: http://gerrit.cloudera.org:8080/2513
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/99856b73
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/99856b73
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/99856b73
Branch: refs/heads/master
Commit: 99856b73ec6d776ca40a7abf46d0691bb64e95b1
Parents: 9f93dd4
Author: Todd Lipcon <to...@apache.org>
Authored: Wed Mar 9 17:25:59 2016 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Thu Mar 17 03:30:39 2016 +0000
----------------------------------------------------------------------
src/kudu/master/master-test.cc | 15 +++++++++++++++
src/kudu/master/ts_descriptor.cc | 13 +++++++++++++
2 files changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/99856b73/src/kudu/master/master-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master-test.cc b/src/kudu/master/master-test.cc
index aeebbf1..e1c8dc9 100644
--- a/src/kudu/master/master-test.cc
+++ b/src/kudu/master/master-test.cc
@@ -209,6 +209,21 @@ TEST_F(MasterTest, TestRegisterAndHeartbeat) {
ASSERT_EQ("my-ts-uuid", resp.servers(0).instance_id().permanent_uuid());
ASSERT_EQ(1, resp.servers(0).instance_id().instance_seqno());
}
+
+ // Ensure that trying to re-register with a different port fails.
+ {
+ TSHeartbeatRequestPB req;
+ TSHeartbeatResponsePB resp;
+ RpcController rpc;
+ req.mutable_common()->CopyFrom(common);
+ req.mutable_registration()->CopyFrom(fake_reg);
+ req.mutable_registration()->mutable_rpc_addresses(0)->set_port(1001);
+ Status s = proxy_->TSHeartbeat(req, &resp, &rpc);
+ ASSERT_TRUE(s.IsRemoteError());
+ ASSERT_STR_CONTAINS(s.ToString(),
+ "Tablet server my-ts-uuid is attempting to re-register "
+ "with a different host/port.");
+ }
}
Status MasterTest::CreateTable(const string& table_name,
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/99856b73/src/kudu/master/ts_descriptor.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/ts_descriptor.cc b/src/kudu/master/ts_descriptor.cc
index d92a600..7dbf5cc 100644
--- a/src/kudu/master/ts_descriptor.cc
+++ b/src/kudu/master/ts_descriptor.cc
@@ -61,6 +61,19 @@ Status TSDescriptor::Register(const NodeInstancePB& instance,
boost::lock_guard<simple_spinlock> l(lock_);
CHECK_EQ(instance.permanent_uuid(), permanent_uuid_);
+ // TODO(KUDU-418): we don't currently support changing IPs or hosts since the
+ // host/port is stored persistently in each tablet's metadata.
+ if (registration_ && registration_->ShortDebugString() != registration.ShortDebugString()) {
+ string msg = strings::Substitute(
+ "Tablet server $0 is attempting to re-register with a different host/port. "
+ "This is not currently supported. Old: {$1} New: {$2}",
+ instance.permanent_uuid(),
+ registration_->ShortDebugString(),
+ registration.ShortDebugString());
+ LOG(ERROR) << msg;
+ return Status::InvalidArgument(msg);
+ }
+
if (instance.instance_seqno() < latest_seqno_) {
return Status::AlreadyPresent(
strings::Substitute("Cannot register with sequence number $0:"