-
Notifications
You must be signed in to change notification settings - Fork 154
Performance[MQB]: inline Put, Push, Ack, Confirm #177
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
Conversation
6d2f55e
to
e21c4cd
Compare
Hi @dorjesinpo, looking |
e21c4cd
to
51bc378
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.
Thank you for reviewing!
return; // RETURN | ||
} | ||
|
||
d_activeNode_p = activeNode; |
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.
Because d_activeNode_p
is (half) protected by d_gateActiveNode
- it is safe to use if mqbc::GateKeeper::Status(d_gateActiveNode).isOpen()
d_activeNodeManager.activeNode()
does not provide such guarantee.
I agree, this calls for refactoring, not in this PR, perhaps
@dorjesinpo thank you for fixes, added some comments in discussions and reassigned. You can assign this to @quarter-note later |
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 190 of commit 7d0e9c7 has completed with FAILURE
Assigning back to @dorjesinpo (to put in backlog) |
4becc94
to
36c49a8
Compare
Signed-off-by: Vitaly Dzhitenov <[email protected]>
Signed-off-by: Vitaly Dzhitenov <[email protected]>
Signed-off-by: Vitaly Dzhitenov <[email protected]>
36c49a8
to
d7feffd
Compare
Signed-off-by: dorjesinpo <[email protected]>
d7feffd
to
b3c2c64
Compare
Signed-off-by: dorjesinpo <[email protected]>
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 2613 of commit 615eb54 has completed with FAILURE
BSLS_ANNOTATION_UNUSED int partitionId, | ||
BSLS_ANNOTATION_UNUSED const bmqp::ConfirmMessage& message) |
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.
BSLS_ANNOTATION_UNUSED int partitionId, | |
BSLS_ANNOTATION_UNUSED const bmqp::ConfirmMessage& message) | |
BSLA_UNUSED int partitionId, | |
BSLA_UNUSED const bmqp::ConfirmMessage& message) |
Recent changes
appData, | ||
options, | ||
state, | ||
genCount); |
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.
I think there will be a segfault if we try to call a function that is not set. At least this is how it was in std c++ implementation.
Do you think it's worth handling empty d_putFunctor
for this mock class?
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.
BSLS_ASSERT_SAFE(d_putFunctor);
, d_isLeader(isLeader) | ||
, d_isRestoringState(false) | ||
, d_processor() | ||
, d_putFunctor() |
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_putFunctor() | |
, d_putFunctor(bsl::allocator_arg, d_allocator_p) |
Need to handle possibly non-default allocator. This allocator will also be used in operator=
// Signature of a functor method with one parameter, the processor | ||
// handle on which it is being executed. |
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.
I think this comment is misleading, since there is more than 1 parameter.
We can remove it or place the updated version in ///
block before PutFunctor
case e_SUCCESS: BSLS_ANNOTATION_FALLTHROUGH; | ||
case e_UNAVAILABLE: BSLS_ANNOTATION_FALLTHROUGH; | ||
case e_INVALID_PRIMARY: BSLS_ANNOTATION_FALLTHROUGH; | ||
case e_INVALID_GEN_COUNT: BSLS_ANNOTATION_FALLTHROUGH; |
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.
case e_INVALID_GEN_COUNT: BSLS_ANNOTATION_FALLTHROUGH; | |
case e_INVALID_GEN_COUNT: BSLA_FALLTHROUGH; |
Recent BSLA update
const int id = message.queueId(); | ||
const int subId = message.subQueueId(); |
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.
const int id = message.queueId(); | |
const int subId = message.subQueueId(); |
Can use directly in 1 place below
int partitionId, | ||
const bmqp::PutHeader& putHeader, | ||
const bsl::shared_ptr<bdlbb::Blob>& appData, | ||
BSLS_ANNOTATION_UNUSED const bsl::shared_ptr<bdlbb::Blob>& options, |
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.
BSLS_ANNOTATION_UNUSED const bsl::shared_ptr<bdlbb::Blob>& options, | |
BSLA_UNUSED const bsl::shared_ptr<bdlbb::Blob>& options, |
// CREATORS | ||
QueueHandle::Subscription::Subscription( | ||
unsigned int subId, | ||
unsigned int downstreamSubQueueId, |
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.
Can subQueueId have a special negative value?
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.
No. There is bmqp::Protocol::k_DEFAULT_SUBSCRIPTION_ID
(0
)
// cache producer stats to avoid lookup | ||
d_producerStats.reset(); |
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 comment says about caching, but the code does the opposite and resets a shared_ptr.
|
||
mqbi::InlineResult::Enum | ||
ClusterNodeSession::sendAck(const bmqp::AckMessage& ackMessage, | ||
unsigned int queueId) |
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.
unsigned int queueId) | |
int queueId) |
queueId can be negative?
closing in favor of #833 |
Messages that have fixed destination (such as PUSH/ACK/Relay PUT/Relay CONFIRM) do not have to go on Cluster thread - it is a bottleneck.
Instead, messages can go directly to mqbnet::Channel which enqueues them in thread-safe manner.
This needs synchronization based on AtomicGate which allows thread-safe, efficient checking of the cluster status and thread-safe opening/closing and draining.
PUSH and ACK require statistics update which we move from Cluster to Queue. For this reason the opening queue context (OpenQueueConfirmationCookie) conveys statistics from Queue to Cluster