Skip to content

Commit

Permalink
This commit provides additional functionality that is logically relat…
Browse files Browse the repository at this point in the history
…ed to the

earlier commit 0ffbaaa

Original commit message:

ENG-3282: #313: Use HostPort in Proxy instead of Endpoint

Summary:
Use HostPort when creating Proxy.
So instead of preresolve endpoint before creating Proxy,
we could resolve it lazily.

Test Plan: Jenkins

Reviewers: mikhail, bogdan

Reviewed By: bogdan

Subscribers: kannan, hector, ybase, bharat

Differential Revision: https://phabricator.dev.yugabyte.com/D4901
  • Loading branch information
spolitov authored and mbautin committed Jul 11, 2019
1 parent 482e959 commit da3534c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ent/src/yb/integration-tests/external_mini_cluster_ent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ std::shared_ptr<MasterBackupServiceProxy> ExternalMiniCluster::master_backup_pro
std::shared_ptr<MasterBackupServiceProxy> ExternalMiniCluster::master_backup_proxy(int idx) {
CHECK_LT(idx, masters_.size());
return std::make_shared<MasterBackupServiceProxy>(
messenger_, CHECK_NOTNULL(master(idx))->bound_rpc_addr());
proxy_cache_.get(), CHECK_NOTNULL(master(idx))->bound_rpc_addr());
}

} // namespace enterprise
Expand Down
6 changes: 4 additions & 2 deletions ent/src/yb/integration-tests/snapshot-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ class SnapshotTest : public YBMiniClusterTestBase<MiniCluster> {

messenger_ = ASSERT_RESULT(
MessengerBuilder("test-msgr").set_num_reactors(1).Build());
proxy_.reset(new MasterServiceProxy(messenger_, cluster_->mini_master()->bound_rpc_addr()));
rpc::ProxyCache proxy_cache(messenger_);
proxy_.reset(new MasterServiceProxy(
&proxy_cache, cluster_->mini_master()->bound_rpc_addr()));
proxy_backup_.reset(new MasterBackupServiceProxy(
messenger_, cluster_->mini_master()->bound_rpc_addr()));
&proxy_cache, cluster_->mini_master()->bound_rpc_addr()));

// Connect to the cluster.
ASSERT_OK(cluster_->CreateClient(&client_));
Expand Down
2 changes: 1 addition & 1 deletion ent/src/yb/master/async_ts_rpc_tasks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Status RetryingTSRpcTask::ResetTSProxy() {
RETURN_NOT_OK(super::ResetTSProxy());

shared_ptr<tserver::TabletServerBackupServiceProxy> ts_backup_proxy;
RETURN_NOT_OK(target_ts_desc_->GetProxy(master_->messenger(), &ts_backup_proxy));
RETURN_NOT_OK(target_ts_desc_->GetProxy(&master_->proxy_cache(), &ts_backup_proxy));
ts_backup_proxy_.swap(ts_backup_proxy);

return Status::OK();
Expand Down
6 changes: 5 additions & 1 deletion ent/src/yb/tools/yb-admin_client_ent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <iostream>

#include "yb/common/wire_protocol.h"

#include "yb/rpc/messenger.h"

#include "yb/util/cast.h"
#include "yb/util/env.h"
#include "yb/util/pb_util.h"
Expand Down Expand Up @@ -53,7 +56,8 @@ Status ClusterAdminClient::Init() {
RETURN_NOT_OK(super::Init());
DCHECK(initted_);

master_backup_proxy_.reset(new master::MasterBackupServiceProxy(messenger_, leader_sock_));
rpc::ProxyCache proxy_cache(messenger_);
master_backup_proxy_.reset(new master::MasterBackupServiceProxy(&proxy_cache, leader_addr_));
return Status::OK();
}

Expand Down
3 changes: 2 additions & 1 deletion ent/src/yb/tserver/backup_service-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class BackupServiceTest : public TabletServerTestBase {
StartTabletServer();

backup_proxy_.reset(
new TabletServerBackupServiceProxy(client_messenger_, mini_server_->bound_rpc_addr()));
new TabletServerBackupServiceProxy(
proxy_cache_.get(), HostPort::FromBoundEndpoint(mini_server_->bound_rpc_addr())));
}

gscoped_ptr<TabletServerBackupServiceProxy> backup_proxy_;
Expand Down
3 changes: 1 addition & 2 deletions ent/src/yb/tserver/remote_bootstrap_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ class RemoteBootstrapClient : public yb::tserver::RemoteBootstrapClient {
public:
RemoteBootstrapClient(std::string tablet_id,
FsManager* fs_manager,
std::shared_ptr<rpc::Messenger> messenger,
std::string client_permanent_uuid)
: super(tablet_id, fs_manager, messenger, client_permanent_uuid) {}
: super(tablet_id, fs_manager, client_permanent_uuid) {}

CHECKED_STATUS FetchAll(tablet::TabletStatusListener* status_listener) override;

Expand Down

0 comments on commit da3534c

Please sign in to comment.