-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
xds: share rds configuration among envoy 2/2 #9209
Conversation
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
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.
Looks good, I think it would make sense to have @stevenzzzz also take a pass, thanks.
/wait
std::shared_ptr<RdsRouteConfigProviderImpl> new_provider{ | ||
new RdsRouteConfigProviderImpl(std::move(subscription), factory_context)}; | ||
dynamic_route_config_providers_.insert( | ||
{manager_identifier, std::weak_ptr<RdsRouteConfigProviderImpl>(new_provider)}); |
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.
Do we have to hold a strong reference to ensure this doesn't destruct on one of the worker threads?
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.
Subscription holds a strong reference of Provider here:
envoy/source/common/router/rds_impl.cc
Line 218 in fb628ce
subscription_->routeConfigProviders().insert(this); |
And map look up will only see two possibility:
- no such key in map, no matter worker threads hold a strong reference or not.
- map has such key. It means the
subscription
is not destructed. That subscription hold a strong ref to the provider.
Both possibilities are under the assumption that
subscription exist iff key exists in this dynamic_route_config_providers_ map
I think this assumption is correct because both the CRUD on map and construct/destruct on subscription occurs on main thread.
See Xin's comments 4 lines below.
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.
My above comment could be wrong. I will add some ASSERT
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.
might worth check if the proviider is destructed in main thread instead, with my most recent change to thread_local_impl, a SlotImpl owner is free to be destructed on any thread.
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
I don't have a complete sense of the life time of
Does above make sense? |
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
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.
LGTM.
As we've discussed, migrating RDS to the new config-provide-framework would revert most of your work here tho.
test/common/router/rds_impl_test.cc
Outdated
|
||
// provider2 should have route config immediately after create | ||
EXPECT_TRUE(provider2->configInfo().has_value()); | ||
|
||
EXPECT_EQ(provider_.get(), provider2.get()) | ||
<< "fail to obtain the same rds config provider object"; |
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.
is this for debugging?
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.
The .get()
part or the message?
The former: Yes, that's verbose. Will fix.
The latter: goal is to provide more details to debugging a test failure in the future.
std::shared_ptr<RdsRouteConfigProviderImpl> new_provider{ | ||
new RdsRouteConfigProviderImpl(std::move(subscription), factory_context)}; | ||
dynamic_route_config_providers_.insert( | ||
{manager_identifier, std::weak_ptr<RdsRouteConfigProviderImpl>(new_provider)}); |
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.
might worth check if the proviider is destructed in main thread instead, with my most recent change to thread_local_impl, a SlotImpl owner is free to be destructed on any thread.
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.
Thanks! I will address the small fixes.
And leave the provider frame work in the following PRs
test/common/router/rds_impl_test.cc
Outdated
|
||
// provider2 should have route config immediately after create | ||
EXPECT_TRUE(provider2->configInfo().has_value()); | ||
|
||
EXPECT_EQ(provider_.get(), provider2.get()) | ||
<< "fail to obtain the same rds config provider object"; |
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.
The .get()
part or the message?
The former: Yes, that's verbose. Will fix.
The latter: goal is to provide more details to debugging a test failure in the future.
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@htuch @stevenzzzz |
@stevenzzzz and i don't have further action on this PR. |
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.
Thanks!
Full context is here The above PR is split into envoyproxy#9008 and this one. In this PR envoy will maintain only one copy of rds config for each resource name. Also fixed a the bug of early listener notified ready describe in envoyproxy#8781 The test case is included in this PR. Signed-off-by: Yuchen Dai <silentdai@gmail.com> Signed-off-by: Prakhar <prakhar_au@yahoo.com>
Full context is here
The above PR is split into #9008 and this one.
In this PR envoy will maintain only one copy of rds config for each resource name.
Also fixed a the bug of early listener notified ready describe in #8781
The test case is included in this PR.