-
Notifications
You must be signed in to change notification settings - Fork 5.5k
conn_pool: Remove startDrain() and replace it with an argument to drainConnections #17960
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
Changes from 6 commits
8844951
f618ce6
f580f4e
485688c
2f2a280
179cdd4
8d5f90e
ea6bf0f
4307372
606f3cf
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 |
|---|---|---|
|
|
@@ -331,11 +331,6 @@ void ConnPoolImplBase::transitionActiveClientState(ActiveClient& client, | |
|
|
||
| void ConnPoolImplBase::addIdleCallbackImpl(Instance::IdleCb cb) { idle_callbacks_.push_back(cb); } | ||
|
|
||
| void ConnPoolImplBase::startDrainImpl() { | ||
| is_draining_ = true; | ||
| checkForIdleAndCloseIdleConnsIfDraining(); | ||
| } | ||
|
|
||
| void ConnPoolImplBase::closeIdleConnectionsForDrainingPool() { | ||
| // Create a separate list of elements to close to avoid mutate-while-iterating problems. | ||
| std::list<ActiveClient*> to_close; | ||
|
|
@@ -359,7 +354,12 @@ void ConnPoolImplBase::closeIdleConnectionsForDrainingPool() { | |
| } | ||
| } | ||
|
|
||
| void ConnPoolImplBase::drainConnectionsImpl() { | ||
| void ConnPoolImplBase::drainConnectionsImpl(DrainBehavior drain_behavior) { | ||
| if (drain_behavior == Envoy::ConnectionPool::DrainBehavior::DrainAndDelete) { | ||
| is_draining_ = true; | ||
|
Member
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 thought we wanted to add more asserts that no new streams are created if is_draining_ is true? Am I missing that?
Contributor
Author
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. Ah yes, good point! I've added an ASSERT in ConnPoolImplBase::newStreamImpl. It did make me wonder if we should rename is_draining_ to is_draining_for_deletion_ to match the name of the enum (and sine it's not set on all drain behaviors, just one of them).
Member
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. Sure renaming SGTM (or just store the enum itself somehow)
Contributor
Author
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. Renamed. I notice this matches the description in the .h file nicely now: It's like we planned it or something :) |
||
| checkForIdleAndCloseIdleConnsIfDraining(); | ||
| return; | ||
| } | ||
| closeIdleConnectionsForDrainingPool(); | ||
|
|
||
| // closeIdleConnections() closes all connections in ready_clients_ with no active streams, | ||
|
|
||
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.
Please add that it is invalid to create new requests/streams/connections on this pool after this call.
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.
Good idea. Done.