You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2017/02/14 16:21:25 UTC
[2/2] kudu git commit: [mini_master] reorder methods in .cc to match
.h order
[mini_master] reorder methods in .cc to match .h order
Re-ordered methods in the mini_master.cc to match their declaration
order in mini_master.h. Also, added const modifier and updated
a couple of getter methods to return const reference instead of a copy.
This patch does not contain any functional changes.
Change-Id: Id4d30f9e7611e5a3d62019d3c740c7e262bfbd26
Reviewed-on: http://gerrit.cloudera.org:8080/5993
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/a0945046
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/a0945046
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/a0945046
Branch: refs/heads/master
Commit: a094504655b645b1585a5611f1ecf29c9b04ec65
Parents: 186ac44
Author: Alexey Serbin <as...@cloudera.com>
Authored: Tue Feb 14 00:37:07 2017 -0800
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Tue Feb 14 16:02:45 2017 +0000
----------------------------------------------------------------------
src/kudu/master/master.cc | 2 +-
src/kudu/master/master.h | 2 +-
src/kudu/master/mini_master.cc | 61 ++++++++++++++++++-------------------
src/kudu/master/mini_master.h | 16 +++++-----
4 files changed, 40 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/a0945046/src/kudu/master/master.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master.cc b/src/kudu/master/master.cc
index 6cfe50c..79051c3 100644
--- a/src/kudu/master/master.cc
+++ b/src/kudu/master/master.cc
@@ -165,7 +165,7 @@ Status Master::InitCatalogManager() {
return Status::OK();
}
-Status Master::WaitForCatalogManagerInit() {
+Status Master::WaitForCatalogManagerInit() const {
CHECK_EQ(state_, kRunning);
return init_status_.Get();
http://git-wip-us.apache.org/repos/asf/kudu/blob/a0945046/src/kudu/master/master.h
----------------------------------------------------------------------
diff --git a/src/kudu/master/master.h b/src/kudu/master/master.h
index 365c58b..33db987 100644
--- a/src/kudu/master/master.h
+++ b/src/kudu/master/master.h
@@ -64,7 +64,7 @@ class Master : public server::ServerBase {
Status Start();
Status StartAsync();
- Status WaitForCatalogManagerInit();
+ Status WaitForCatalogManagerInit() const;
// Wait until this Master's catalog manager instance is the leader and is ready.
// This method is intended for use by unit tests.
http://git-wip-us.apache.org/repos/asf/kudu/blob/a0945046/src/kudu/master/mini_master.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/mini_master.cc b/src/kudu/master/mini_master.cc
index f5f0f87..f872dff 100644
--- a/src/kudu/master/mini_master.cc
+++ b/src/kudu/master/mini_master.cc
@@ -58,12 +58,18 @@ Status MiniMaster::Start() {
return master_->WaitForCatalogManagerInit();
}
-
Status MiniMaster::StartDistributedMaster(const vector<uint16_t>& peer_ports) {
CHECK(!running_);
return StartDistributedMasterOnPorts(rpc_port_, 0, peer_ports);
}
+Status MiniMaster::Restart() {
+ CHECK(!running_);
+ RETURN_NOT_OK(StartOnPorts(bound_rpc_.port(), bound_http_.port()));
+ CHECK(running_);
+ return WaitForCatalogManagerInit();
+}
+
void MiniMaster::Shutdown() {
if (running_) {
bound_rpc_ = bound_rpc_addr();
@@ -74,6 +80,29 @@ void MiniMaster::Shutdown() {
master_.reset();
}
+Status MiniMaster::WaitForCatalogManagerInit() const {
+ return master_->WaitForCatalogManagerInit();
+}
+
+const Sockaddr MiniMaster::bound_rpc_addr() const {
+ CHECK(running_);
+ return master_->first_rpc_address();
+}
+
+const Sockaddr MiniMaster::bound_http_addr() const {
+ CHECK(running_);
+ return master_->first_http_address();
+}
+
+std::string MiniMaster::permanent_uuid() const {
+ CHECK(master_);
+ return DCHECK_NOTNULL(master_->fs_manager())->uuid();
+}
+
+std::string MiniMaster::bound_rpc_addr_str() const {
+ return bound_rpc_addr().ToString();
+}
+
Status MiniMaster::StartOnPorts(uint16_t rpc_port, uint16_t web_port) {
CHECK(!running_);
CHECK(!master_);
@@ -116,35 +145,5 @@ Status MiniMaster::StartDistributedMasterOnPorts(uint16_t rpc_port, uint16_t web
return StartOnPorts(rpc_port, web_port, &opts);
}
-Status MiniMaster::Restart() {
- CHECK(!running_);
- RETURN_NOT_OK(StartOnPorts(bound_rpc_.port(), bound_http_.port()));
- CHECK(running_);
- return WaitForCatalogManagerInit();
-}
-
-Status MiniMaster::WaitForCatalogManagerInit() {
- return master_->WaitForCatalogManagerInit();
-}
-
-const Sockaddr MiniMaster::bound_rpc_addr() const {
- CHECK(running_);
- return master_->first_rpc_address();
-}
-
-const Sockaddr MiniMaster::bound_http_addr() const {
- CHECK(running_);
- return master_->first_http_address();
-}
-
-std::string MiniMaster::permanent_uuid() const {
- CHECK(master_);
- return DCHECK_NOTNULL(master_->fs_manager())->uuid();
-}
-
-std::string MiniMaster::bound_rpc_addr_str() const {
- return bound_rpc_addr().ToString();
-}
-
} // namespace master
} // namespace kudu
http://git-wip-us.apache.org/repos/asf/kudu/blob/a0945046/src/kudu/master/mini_master.h
----------------------------------------------------------------------
diff --git a/src/kudu/master/mini_master.h b/src/kudu/master/mini_master.h
index e50b45a..fe9777e 100644
--- a/src/kudu/master/mini_master.h
+++ b/src/kudu/master/mini_master.h
@@ -52,15 +52,15 @@ class MiniMaster {
Status StartDistributedMaster(const std::vector<uint16_t>& peer_ports);
- Status WaitForCatalogManagerInit();
+ // Restart the master on the same ports as it was previously bound.
+ // Requires that the master is currently started.
+ Status Restart();
void Shutdown();
- bool is_running() const { return running_; }
+ Status WaitForCatalogManagerInit() const;
- // Restart the master on the same ports as it was previously bound.
- // Requires that the master is currently started.
- Status Restart();
+ bool is_running() const { return running_; }
const Sockaddr bound_rpc_addr() const;
const Sockaddr bound_http_addr() const;
@@ -74,14 +74,14 @@ class MiniMaster {
std::string bound_rpc_addr_str() const;
private:
- Status StartDistributedMasterOnPorts(uint16_t rpc_port, uint16_t web_port,
- const std::vector<uint16_t>& peer_ports);
-
Status StartOnPorts(uint16_t rpc_port, uint16_t web_port);
Status StartOnPorts(uint16_t rpc_port, uint16_t web_port,
MasterOptions* options);
+ Status StartDistributedMasterOnPorts(uint16_t rpc_port, uint16_t web_port,
+ const std::vector<uint16_t>& peer_ports);
+
bool running_;
ATTRIBUTE_MEMBER_UNUSED Env* const env_;