-
Notifications
You must be signed in to change notification settings - Fork 140
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
Feat[MQB]: Support listening on multiple ports #204
Conversation
1046055
to
679a99f
Compare
679a99f
to
3cb6921
Compare
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 and straightforward
Few comments, and probably will need to take another look after tests are fixed
@@ -661,7 +751,7 @@ void TCPSessionFactory::channelStateCallback( | |||
// is fine to do this here (since we have no other ways to | |||
// proactively-execute code in the IO threads created by the channelPool). | |||
if (mwcsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { | |||
mwcsys::ThreadUtil::setCurrentThreadNameOnce(d_threadName); | |||
mwcsys::ThreadUtil::setCurrentThreadNameOnce(d_config.name()); |
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.
d_threadName = "bmqIO_" + d_config.name().substr(0, 15 - 6);
What happens with the prefix? And with the d_threadName
?
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.
This was a mistake, reverting this.
</annotation> | ||
<sequence> | ||
<element name='name' type='string'/> | ||
<element name='port' type='int'/> |
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.
We may need to retire the above port
when all broker versions read new config.
We need to mark it as deprecated maybe?
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.
Yep, I can mark it deprecated in the schema documentation. The behavior of what the broker should do is probably better documented in other documentation sources too.
OperationContext* context = new (*d_allocator_p) OperationContext(); | ||
d_listenContext_mp.load(context, d_allocator_p); | ||
bsl::shared_ptr<OperationContext> contextSp; | ||
contextSp.reset(context, bslstl::SharedPtrNilDeleter()); |
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.
Yeah, this insisting on the ManagedPtr
looks strange
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.
Yeah I'm not in love with this pattern of trading around ManagedPtr
s as references wrapped in a shared_ptr
, either way now there's a reason to make it shared so this doesn't even work anymore 😄
3cb6921
to
394b4d9
Compare
@@ -528,7 +532,8 @@ class TCPSessionFactory { | |||
/// Listen to the specified `port` for incoming connection and invoke |
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 documentation comment here is out-of-date now: port
argument replaced with listener
; sentence should be changed.
@@ -468,6 +465,13 @@ class TCPSessionFactory { | |||
/// event scheduler processes it. | |||
void disableHeartbeat(const bsl::shared_ptr<ChannelInfo>& channelInfo); | |||
|
|||
/// \brief Check that the TCP interfaces are valid. |
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.
This is our first Doxygen \brief
. Two things:
CONTRIBUTING.md
says we should use Javadoc style@brief
.- We currently have Doxygen
AUTOBRIEF
turned off, but it seems likely we'll need to turn it on when we start using straight Doxygen rather than BDE-flavor docs, or we'll need to go through every docstring and add@brief
(yikes!). For the moment, it seems better to match the style of the rest of the docs here.
// Handle which can be used to | ||
// stop listening. Empty unless | ||
// listening. | ||
// Handles which can be used to stop listening. Empty unless listening. |
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.
///
? Change above uses Doxygen style. Seems like it's best to use Doxygen style throughout, and let Doxygen itself choose whether to output docs on private members.
// Handle which can be used to | ||
// stop listening. Empty unless | ||
// listening. | ||
// Handles which can be used to stop listening. Empty unless listening. |
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.
Handles which
-> Handles that
---had to look at the type to understand that handles
isn't a verb here.
errorDescription << "Failed listening to port '" << it->port() | ||
<< "' for TCPSessionFactory '" | ||
<< d_config.name() << "' [rc: " << rc << "]"; | ||
return rc; // RETURN |
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 need cleanup for ports in earlier iterations of the loop that we have successfully listen
ed on? Prior to this patch this wasn't a concern.
|
||
allocator_type get_allocator() const { return d_allocator; } | ||
|
||
/// viewFn :: NetworkInterface -> T |
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.
Haskell type notation 😂 But I'm not sure this is a useful docstring.
But had to look at the code to understand that T
is an arbitrary Regular
type to be used as a comparison key. More docs around the use and purpose of this private class, as well this function particularly, would be helpful.
UniqueProperty d_unique; | ||
|
||
// PRIVATE STATIC FUNCTIONS | ||
static int portView(const mqbcfg::TcpInterfaceListener& listener) |
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 a view?
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.
It could create a view, so technically no. The codegen'd API doesn't give me const ref access to this field, so it's a little unfortunate, but It's sufficient enough for our purposes.
|
||
class TcpInterfaceListener { |
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.
Documentation for publicly exposed class?
394b4d9
to
db65221
Compare
db65221
to
8b8f83a
Compare
38396bf
to
4bb16fd
Compare
src/groups/mqb/mqbcfg/doc/mqbcfg.txt
Outdated
@@ -15,6 +15,7 @@ broker, as well as the generated corresponding messages component. | |||
.. | |||
1. mqbcfg_messages | |||
2. mqbcfg_brokerconfig | |||
3. mqbcfg_tcpinterfaceconfigvalidator |
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.
nit: This adds another component/level, the synopsis can be updated
ad17ee8
to
67b14e6
Compare
67b14e6
to
144b59e
Compare
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.
Merge conflicts, can review again when you fix them.
144b59e
to
43ae680
Compare
- Add a new field for the broker config to list TCP interfaces with a port and name - Change how the port configuration is read to ignore the port field on the TCP interface when the new listeners are specified - Add a test fixture to support configuring clusters with multiple TCP interfaces open - Add an integration test to verify end-to-end connection on a cluster with multiple ports Signed-off-by: Taylor Foxhall <[email protected]>
43ae680
to
de2f583
Compare
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.
Build 342 of commit de2f583 has completed with FAILURE
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.
let's ship it
This extends the broker config to support listening to connections on multiple ports. This lays the groundwork for future extensions that will be added to
TcpInterfaceListener
. The broker will behave the same without the listener config, but with the listeners added the broker will open new listen operations for each one, ignoring theport
field in thenetworkInterfaces
. We also added an extra component for validating these new configs.