|
|
@ -768,6 +768,10 @@ void XdsLb::UpdateLocked(UpdateArgs args) { |
|
|
|
xds_client_ = MakeOrphanable<XdsClient>( |
|
|
|
xds_client_ = MakeOrphanable<XdsClient>( |
|
|
|
combiner(), interested_parties(), balancer_name_.get(), |
|
|
|
combiner(), interested_parties(), balancer_name_.get(), |
|
|
|
StringView(server_name_), nullptr /* service config watcher */, *args_); |
|
|
|
StringView(server_name_), nullptr /* service config watcher */, *args_); |
|
|
|
|
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
|
|
|
|
gpr_log(GPR_INFO, "[xdslb %p] Created xds client %p", this, |
|
|
|
|
|
|
|
xds_client_.get()); |
|
|
|
|
|
|
|
} |
|
|
|
endpoint_watcher_ = New<EndpointWatcher>(Ref()); |
|
|
|
endpoint_watcher_ = New<EndpointWatcher>(Ref()); |
|
|
|
xds_client_->WatchEndpointData( |
|
|
|
xds_client_->WatchEndpointData( |
|
|
|
StringView(server_name_), |
|
|
|
StringView(server_name_), |
|
|
@ -796,10 +800,9 @@ void XdsLb::UpdateLocked(UpdateArgs args) { |
|
|
|
|
|
|
|
|
|
|
|
void XdsLb::MaybeCancelFallbackAtStartupChecks() { |
|
|
|
void XdsLb::MaybeCancelFallbackAtStartupChecks() { |
|
|
|
if (!fallback_at_startup_checks_pending_) return; |
|
|
|
if (!fallback_at_startup_checks_pending_) return; |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
"[xdslb %p] Cancelling fallback timer and LB channel connectivity " |
|
|
|
gpr_log(GPR_INFO, "[xdslb %p] Cancelling fallback timer", this); |
|
|
|
"watch", |
|
|
|
} |
|
|
|
this); |
|
|
|
|
|
|
|
grpc_timer_cancel(&lb_fallback_timer_); |
|
|
|
grpc_timer_cancel(&lb_fallback_timer_); |
|
|
|
fallback_at_startup_checks_pending_ = false; |
|
|
|
fallback_at_startup_checks_pending_ = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -810,12 +813,10 @@ void XdsLb::OnFallbackTimerLocked(void* arg, grpc_error* error) { |
|
|
|
// this callback actually runs, don't fall back.
|
|
|
|
// this callback actually runs, don't fall back.
|
|
|
|
if (xdslb_policy->fallback_at_startup_checks_pending_ && |
|
|
|
if (xdslb_policy->fallback_at_startup_checks_pending_ && |
|
|
|
!xdslb_policy->shutting_down_ && error == GRPC_ERROR_NONE) { |
|
|
|
!xdslb_policy->shutting_down_ && error == GRPC_ERROR_NONE) { |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
"[xdslb %p] Child policy not ready after fallback timeout; " |
|
|
|
"[xdslb %p] Child policy not ready after fallback timeout; " |
|
|
|
"entering fallback mode", |
|
|
|
"entering fallback mode", |
|
|
|
xdslb_policy); |
|
|
|
xdslb_policy); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
xdslb_policy->fallback_at_startup_checks_pending_ = false; |
|
|
|
xdslb_policy->fallback_at_startup_checks_pending_ = false; |
|
|
|
xdslb_policy->UpdateFallbackPolicyLocked(); |
|
|
|
xdslb_policy->UpdateFallbackPolicyLocked(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1432,14 +1433,14 @@ XdsLb::PriorityList::LocalityMap::Locality::CreateChildPolicyLocked( |
|
|
|
if (GPR_UNLIKELY(lb_policy == nullptr)) { |
|
|
|
if (GPR_UNLIKELY(lb_policy == nullptr)) { |
|
|
|
gpr_log(GPR_ERROR, |
|
|
|
gpr_log(GPR_ERROR, |
|
|
|
"[xdslb %p] Locality %p %s: failure creating child policy %s", |
|
|
|
"[xdslb %p] Locality %p %s: failure creating child policy %s", |
|
|
|
locality_map_.get(), this, name_->AsHumanReadableString(), name); |
|
|
|
xds_policy(), this, name_->AsHumanReadableString(), name); |
|
|
|
return nullptr; |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
helper->set_child(lb_policy.get()); |
|
|
|
helper->set_child(lb_policy.get()); |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
"[xdslb %p] Locality %p %s: Created new child policy %s (%p)", |
|
|
|
"[xdslb %p] Locality %p %s: Created new child policy %s (%p)", |
|
|
|
locality_map_.get(), this, name_->AsHumanReadableString(), name, |
|
|
|
xds_policy(), this, name_->AsHumanReadableString(), name, |
|
|
|
lb_policy.get()); |
|
|
|
lb_policy.get()); |
|
|
|
} |
|
|
|
} |
|
|
|
// Add the xDS's interested_parties pollset_set to that of the newly created
|
|
|
|
// Add the xDS's interested_parties pollset_set to that of the newly created
|
|
|
@ -1537,7 +1538,7 @@ void XdsLb::PriorityList::LocalityMap::Locality::UpdateLocked( |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
gpr_log(GPR_INFO, |
|
|
|
"[xdslb %p] Locality %p %s: Creating new %schild policy %s", |
|
|
|
"[xdslb %p] Locality %p %s: Creating new %schild policy %s", |
|
|
|
locality_map_.get(), this, name_->AsHumanReadableString(), |
|
|
|
xds_policy(), this, name_->AsHumanReadableString(), |
|
|
|
child_policy_ == nullptr ? "" : "pending ", child_policy_name); |
|
|
|
child_policy_ == nullptr ? "" : "pending ", child_policy_name); |
|
|
|
} |
|
|
|
} |
|
|
|
auto& lb_policy = |
|
|
|
auto& lb_policy = |
|
|
@ -1556,7 +1557,7 @@ void XdsLb::PriorityList::LocalityMap::Locality::UpdateLocked( |
|
|
|
// Update the policy.
|
|
|
|
// Update the policy.
|
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
gpr_log(GPR_INFO, "[xdslb %p] Locality %p %s: Updating %schild policy %p", |
|
|
|
gpr_log(GPR_INFO, "[xdslb %p] Locality %p %s: Updating %schild policy %p", |
|
|
|
locality_map_.get(), this, name_->AsHumanReadableString(), |
|
|
|
xds_policy(), this, name_->AsHumanReadableString(), |
|
|
|
policy_to_update == pending_child_policy_.get() ? "pending " : "", |
|
|
|
policy_to_update == pending_child_policy_.get() ? "pending " : "", |
|
|
|
policy_to_update); |
|
|
|
policy_to_update); |
|
|
|
} |
|
|
|
} |
|
|
@ -1566,7 +1567,7 @@ void XdsLb::PriorityList::LocalityMap::Locality::UpdateLocked( |
|
|
|
void XdsLb::PriorityList::LocalityMap::Locality::ShutdownLocked() { |
|
|
|
void XdsLb::PriorityList::LocalityMap::Locality::ShutdownLocked() { |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) { |
|
|
|
gpr_log(GPR_INFO, "[xdslb %p] Locality %p %s: shutting down locality", |
|
|
|
gpr_log(GPR_INFO, "[xdslb %p] Locality %p %s: shutting down locality", |
|
|
|
locality_map_.get(), this, name_->AsHumanReadableString()); |
|
|
|
xds_policy(), this, name_->AsHumanReadableString()); |
|
|
|
} |
|
|
|
} |
|
|
|
// Remove the child policy's interested_parties pollset_set from the
|
|
|
|
// Remove the child policy's interested_parties pollset_set from the
|
|
|
|
// xDS policy.
|
|
|
|
// xDS policy.
|
|
|
|