-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clusterinfo consistency #4600
Clusterinfo consistency #4600
Changes from 8 commits
76a4cd5
abcdad0
1118f33
9090f16
dda83c1
b4f0c53
0fe3b68
d1ffe37
30925c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -951,6 +951,13 @@ void ConnectionManagerImpl::ActiveStream::refreshCachedRoute() { | |
Router::RouteConstSharedPtr route = snapped_route_config_->route(*request_headers_, stream_id_); | ||
stream_info_.route_entry_ = route ? route->routeEntry() : nullptr; | ||
cached_route_ = std::move(route); | ||
if (nullptr == stream_info_.route_entry_) { | ||
cached_cluster_info_ = nullptr; | ||
} else { | ||
Upstream::ThreadLocalCluster* local_cluster = | ||
connection_manager_.cluster_manager_.get(stream_info_.route_entry_->clusterName()); | ||
cached_cluster_info_ = (nullptr == local_cluster) ? nullptr : local_cluster->info(); | ||
} | ||
} | ||
|
||
void ConnectionManagerImpl::ActiveStream::sendLocalReply( | ||
|
@@ -1477,8 +1484,17 @@ Tracing::Span& ConnectionManagerImpl::ActiveStreamFilterBase::activeSpan() { | |
|
||
Tracing::Config& ConnectionManagerImpl::ActiveStreamFilterBase::tracingConfig() { return parent_; } | ||
|
||
Upstream::ClusterInfoConstSharedPtr ConnectionManagerImpl::ActiveStreamFilterBase::clusterInfo() { | ||
// NOTE: Refreshing route caches clusterInfo as well. | ||
if (!parent_.cached_route_.has_value()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is necessary as we don't do this for the route call. The HCM will initialize the cache before calling any filters? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we did the same for route(), see route() right below? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, sorry, makes sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ack |
||
parent_.refreshCachedRoute(); | ||
} | ||
|
||
return parent_.cached_cluster_info_.value(); | ||
} | ||
|
||
Router::RouteConstSharedPtr ConnectionManagerImpl::ActiveStreamFilterBase::route() { | ||
if (!parent_.cached_route_) { | ||
if (!parent_.cached_route_.has_value()) { | ||
parent_.refreshCachedRoute(); | ||
} | ||
|
||
|
@@ -1487,6 +1503,7 @@ Router::RouteConstSharedPtr ConnectionManagerImpl::ActiveStreamFilterBase::route | |
|
||
void ConnectionManagerImpl::ActiveStreamFilterBase::clearRouteCache() { | ||
parent_.cached_route_ = absl::optional<Router::RouteConstSharedPtr>(); | ||
parent_.cached_cluster_info_ = absl::optional<Upstream::ClusterInfoConstSharedPtr>(); | ||
} | ||
|
||
Buffer::WatermarkBufferPtr ConnectionManagerImpl::ActiveStreamDecoderFilter::createBuffer() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: newline after this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Thought fix_format would catch this.