Remove channelz linkage. (#27514)

* Remove channelz linkage.

* one more removal.
pull/27521/head
donnadionne 3 years ago committed by GitHub
parent 82c99362b5
commit e244812a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
  2. 12
      src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc
  3. 24
      src/core/ext/xds/xds_client.cc
  4. 12
      src/core/ext/xds/xds_client.h

@ -572,13 +572,6 @@ XdsClusterResolverLb::XdsClusterResolverLb(RefCountedPtr<XdsClient> xds_client,
}
// EDS-only flow.
if (!is_xds_uri_) {
// Setup channelz linkage.
channelz::ChannelNode* parent_channelz_node =
grpc_channel_args_find_pointer<channelz::ChannelNode>(
args.args, GRPC_ARG_CHANNELZ_CHANNEL_NODE);
if (parent_channelz_node != nullptr) {
xds_client_->AddChannelzLinkage(parent_channelz_node);
}
// Couple polling.
grpc_pollset_set_add_pollset_set(xds_client_->interested_parties(),
interested_parties());
@ -602,13 +595,6 @@ void XdsClusterResolverLb::ShutdownLocked() {
MaybeDestroyChildPolicyLocked();
discovery_mechanisms_.clear();
if (!is_xds_uri_) {
// Remove channelz linkage.
channelz::ChannelNode* parent_channelz_node =
grpc_channel_args_find_pointer<channelz::ChannelNode>(
args_, GRPC_ARG_CHANNELZ_CHANNEL_NODE);
if (parent_channelz_node != nullptr) {
xds_client_->RemoveChannelzLinkage(parent_channelz_node);
}
// Decouple polling.
grpc_pollset_set_del_pollset_set(xds_client_->interested_parties(),
interested_parties());

@ -766,12 +766,6 @@ void XdsResolver::StartLocked() {
}
grpc_pollset_set_add_pollset_set(xds_client_->interested_parties(),
interested_parties_);
channelz::ChannelNode* parent_channelz_node =
grpc_channel_args_find_pointer<channelz::ChannelNode>(
args_, GRPC_ARG_CHANNELZ_CHANNEL_NODE);
if (parent_channelz_node != nullptr) {
xds_client_->AddChannelzLinkage(parent_channelz_node);
}
auto watcher = absl::make_unique<ListenerWatcher>(Ref());
listener_watcher_ = watcher.get();
xds_client_->WatchListenerData(server_name_, std::move(watcher));
@ -790,12 +784,6 @@ void XdsResolver::ShutdownLocked() {
xds_client_->CancelRouteConfigDataWatch(
server_name_, route_config_watcher_, /*delay_unsubscription=*/false);
}
channelz::ChannelNode* parent_channelz_node =
grpc_channel_args_find_pointer<channelz::ChannelNode>(
args_, GRPC_ARG_CHANNELZ_CHANNEL_NODE);
if (parent_channelz_node != nullptr) {
xds_client_->RemoveChannelzLinkage(parent_channelz_node);
}
grpc_pollset_set_del_pollset_set(xds_client_->interested_parties(),
interested_parties_);
xds_client_.reset();

@ -1878,12 +1878,10 @@ grpc_millis GetRequestTimeout(const grpc_channel_args* args) {
}
grpc_channel_args* ModifyChannelArgs(const grpc_channel_args* args) {
absl::InlinedVector<grpc_arg, 2> args_to_add = {
absl::InlinedVector<grpc_arg, 1> args_to_add = {
grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS),
5 * 60 * GPR_MS_PER_SEC),
grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_CHANNELZ_IS_INTERNAL_CHANNEL), 1),
};
return grpc_channel_args_copy_and_add(args, args_to_add.data(),
args_to_add.size());
@ -1920,26 +1918,6 @@ XdsClient::~XdsClient() {
grpc_pollset_set_destroy(interested_parties_);
}
void XdsClient::AddChannelzLinkage(
channelz::ChannelNode* parent_channelz_node) {
MutexLock lock(&mu_);
channelz::ChannelNode* xds_channelz_node =
grpc_channel_get_channelz_node(chand_->channel());
if (xds_channelz_node != nullptr) {
parent_channelz_node->AddChildChannel(xds_channelz_node->uuid());
}
}
void XdsClient::RemoveChannelzLinkage(
channelz::ChannelNode* parent_channelz_node) {
MutexLock lock(&mu_);
channelz::ChannelNode* xds_channelz_node =
grpc_channel_get_channelz_node(chand_->channel());
if (xds_channelz_node != nullptr) {
parent_channelz_node->RemoveChildChannel(xds_channelz_node->uuid());
}
}
void XdsClient::Orphan() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
gpr_log(GPR_INFO, "[xds_client %p] shutting down xds client", this);

@ -102,18 +102,6 @@ class XdsClient : public DualRefCounted<XdsClient> {
grpc_pollset_set* interested_parties() const { return interested_parties_; }
// TODO(roth): When we add federation, there will be multiple channels
// inside the XdsClient, and the set of channels may change over time,
// but not every channel may use every one of the child channels, so
// this API will need to change. At minumum, we will need to hold a
// ref to the parent channelz node so that we can update its list of
// children as the set of xDS channels changes. However, we may also
// want to make this a bit more selective such that only those
// channels on which a given parent channel is actually requesting
// resources will actually be marked as its children.
void AddChannelzLinkage(channelz::ChannelNode* parent_channelz_node);
void RemoveChannelzLinkage(channelz::ChannelNode* parent_channelz_node);
void Orphan() override;
// Start and cancel listener data watch for a listener.

Loading…
Cancel
Save