Repository navigation
Refactor hot restart rpc stream - #29454
Conversation
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
| void sendHotRestartMessage(sockaddr_un& address, const envoy::HotRestartMessage& proto); | ||
| HotRestartingBase(uint64_t base_id) : main_rpc_stream_(base_id) {} | ||
|
|
||
| enum class Blocking { Yes, No }; |
There was a problem hiding this comment.
Should this be moved to RpcStream?
|
|
||
| // Returns a Gauge that tracks hot-restart generation, where every successive | ||
| // child increments this number. | ||
| static Stats::Gauge& hotRestartGeneration(Stats::Scope& scope); |
There was a problem hiding this comment.
This is the only method remaining in HotRestartingBase. Should we just rename HotRestartingBase to RpcStream and move this method to a util function?
On the other hand, the reason to extract RpcStream is because HotRestartingBase has code specific to TCP. But it seems that almost all the code will be reused.
There was a problem hiding this comment.
It's not just the methods, it's the protected members too. After this change, that's just the one rpc_stream, but with the following change it's both rpc_streams. To some extent it might make sense to refactor that significantly and make the parent and child instances of rpc streams have totally distinct initializers, but I'm trying to make the minimum change to the existing structure that will allow the necessary functionality to be added - I'd rather not add massive cleanup time to my roster.
There was a problem hiding this comment.
Can you do s/HotRestartingBase/RpcStream in the .h and .cc file and add a class definition somewhere?
class HotRestartingBase {
protected:
RpcStream main_rpc_stream_;
}
At the first glance, this will do what the same thing as the current PR does and have a smaller diff for code review.
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Commit Message: Refactor hot restart RPC stream
Additional Description: Before this PR, the RPC stream behavior is hardcoded into HotRestartingBase. This change breaks it out into a member class, as a precursor to udp forwarding during hot restart, which will require an additional channel for forwarded UDP. By unifying the RPC behavior into a separate class, we can have two instances of the class rather than duplicating a lot of code.
Risk Level: Very low, as this is essentially a no-op.
Testing: As covered as it was before. Coverage should be improved with the change that comes after this (#29328).
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a