conn_pool: Remove startDrain() and replace it with an argument to drainConnections#17960
conn_pool: Remove startDrain() and replace it with an argument to drainConnections#17960mattklein123 merged 10 commits intoenvoyproxy:mainfrom
Conversation
|
/assign @mattklein123 |
|
/assign @ggreenway |
|
Hopefully this is what we discussed! :) |
Signed-off-by: Ryan Hamilton <rch@google.com>
ggreenway
left a comment
There was a problem hiding this comment.
Interface changes look good.
/wait
| void ConnPoolImplBase::drainConnectionsImpl() { | ||
| void ConnPoolImplBase::drainConnectionsImpl(DrainBehavior drain_behavior) { | ||
| if (drain_behavior == Envoy::ConnectionPool::DrainBehavior::DrainAndDelete) { | ||
| checkForIdleAndCloseIdleConnsIfDraining(); |
There was a problem hiding this comment.
This function behaves differently depending on the value of is_draining_. You've re-ordered these operations, which changes the behavior. I think the behavior was correct with is_draining_ = true before the function call.
There was a problem hiding this comment.
Oh shoot! Thanks. I think I screwed that up during a cleanup. Fixed.
| * Controls the behavior when draining a connection pool. | ||
| */ | ||
| enum class DrainBehavior { | ||
| // Starts draining a pool, by gracefully completing all requests and gracefully closing all |
There was a problem hiding this comment.
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.
Good idea. Done.
envoy/common/conn_pool.h
Outdated
| enum class DrainBehavior { | ||
| // Starts draining a pool, by gracefully completing all requests and gracefully closing all | ||
| // connections, in preparation for deletion. | ||
| // can be immediately drained. |
There was a problem hiding this comment.
Oh whoop. That should just be removed. Done.
Signed-off-by: Ryan Hamilton <rch@google.com>
| void ConnPoolImplBase::drainConnectionsImpl() { | ||
| void ConnPoolImplBase::drainConnectionsImpl(DrainBehavior drain_behavior) { | ||
| if (drain_behavior == Envoy::ConnectionPool::DrainBehavior::DrainAndDelete) { | ||
| checkForIdleAndCloseIdleConnsIfDraining(); |
There was a problem hiding this comment.
Oh shoot! Thanks. I think I screwed that up during a cleanup. Fixed.
| * Controls the behavior when draining a connection pool. | ||
| */ | ||
| enum class DrainBehavior { | ||
| // Starts draining a pool, by gracefully completing all requests and gracefully closing all |
There was a problem hiding this comment.
Good idea. Done.
envoy/common/conn_pool.h
Outdated
| enum class DrainBehavior { | ||
| // Starts draining a pool, by gracefully completing all requests and gracefully closing all | ||
| // connections, in preparation for deletion. | ||
| // can be immediately drained. |
There was a problem hiding this comment.
Oh whoop. That should just be removed. Done.
mattklein123
left a comment
There was a problem hiding this comment.
Awesome, thanks. One question.
/wait-any
| void ConnPoolImplBase::drainConnectionsImpl() { | ||
| void ConnPoolImplBase::drainConnectionsImpl(DrainBehavior drain_behavior) { | ||
| if (drain_behavior == Envoy::ConnectionPool::DrainBehavior::DrainAndDelete) { | ||
| is_draining_ = true; |
There was a problem hiding this comment.
I thought we wanted to add more asserts that no new streams are created if is_draining_ is true? Am I missing that?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Sure renaming SGTM (or just store the enum itself somehow)
There was a problem hiding this comment.
Renamed. I notice this matches the description in the .h file nicely now:
// Whether the connection pool is currently in the process of closing
// all connections so that it can be gracefully deleted.
It's like we planned it or something :)
Signed-off-by: Ryan Hamilton <rch@google.com>
Signed-off-by: Ryan Hamilton <rch@google.com>
|
Thanks. Check format? /wait |
facepalm Done. |
|
Sorry looks like tidy is failing also. Might be pre-existing. Do you mind trying to fix? /wait |
…inConnections (envoyproxy#17960) Signed-off-by: Ryan Hamilton <rch@google.com>
conn_pool: Remove startDrain() and replace it with an argument to drainConnections
Add a new DrainBehavior enum argument to drainConnections() and use that to replace startDrain().
Risk Level: Low
Testing: Unit tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A