Skip to content

Commit

Permalink
ENG-3866: #460: Add handling of controller status in GetMasterEntryFo…
Browse files Browse the repository at this point in the history
…rHosts

Summary:
We ignore controller status in GetMasterEntryForHosts, in this case response is empty and its http_addresses is also empty.
Added handling of controller status to address this issue.

Test Plan:
Add 127.0.0.1 as node1, and same for 2 & 3, in /etc/hosts.

Start masters of a local RF=3 cluster (on Mac) using:

```
./yb-master --webserver_interface 127.0.0.1 --rpc_bind_addresses=127.0.0.1 --server_broadcast_addresses=node1:7100 --use_private_ip=zone --master_addresses node1:7100,node2:7100,node3:7100 --fs_data_dirs "/tmp/yblocal1/"  >& /tmp/yb-master_1.out &
./yb-master --webserver_interface 127.0.0.2 --rpc_bind_addresses=127.0.0.2 --server_broadcast_addresses=node2:7100 --use_private_ip=zone --master_addresses node1:7100,node2:7100,node3:7100 --fs_data_dirs "/tmp/yblocal2/"  >& /tmp/yb-master_2.out &
./yb-master --webserver_interface 127.0.0.3 --rpc_bind_addresses=127.0.0.3 --server_broadcast_addresses=node3:7100 --use_private_ip=zone --master_addresses node1:7100,node2:7100,node3:7100 --fs_data_dirs "/tmp/yblocal3/"  >& /tmp/yb-master_3.out &
```

yb-master UI at 7000 shows the leader. kill -9 this master process.
New master leader should not crash when its UI is accessed.

Reviewers: robert, mikhail, bharat

Reviewed By: bharat

Subscribers: ybase, bogdan

Differential Revision: https://phabricator.dev.yugabyte.com/D5441
  • Loading branch information
spolitov committed Sep 7, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent d997a76 commit d4865d4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/yb/master/master_util.cc
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ Status GetMasterEntryForHosts(rpc::ProxyCache* proxy_cache,
latch.Wait();

for (const auto& data : datas) {
if (data.resp.has_error()) {
if (!data.controller.status().ok() || data.resp.has_error()) {
continue;
}
e->mutable_instance_id()->CopyFrom(data.resp.instance_id());
@@ -77,7 +77,12 @@ Status GetMasterEntryForHosts(rpc::ProxyCache* proxy_cache,
return Status::OK();
}

return StatusFromPB(last_data.load(std::memory_order_acquire)->resp.error().status());
auto last_data_value = last_data.load(std::memory_order_acquire);
if (last_data_value->controller.status().ok()) {
return StatusFromPB(last_data_value->resp.error().status());
} else {
return last_data_value->controller.status();
}
}

const HostPortPB& DesiredHostPort(const TSInfoPB& ts_info, const CloudInfoPB& from) {

0 comments on commit d4865d4

Please sign in to comment.