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>
htuch
left a comment
There was a problem hiding this comment.
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.
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.
Subscription holds a strong reference of Provider here:
envoy/source/common/router/rds_impl.cc
Line 218 in fb628ce
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
subscriptionis 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.
My above comment could be wrong. I will add some ASSERT
There was a problem hiding this comment.
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>
stevenzzzz
left a comment
There was a problem hiding this comment.
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
| 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.
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.
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.
lambdai
left a comment
There was a problem hiding this comment.
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
| 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.
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. |
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.