Skip to content
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

Inline Put, Push, Ack, Confirm #177

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dorjesinpo
Copy link
Collaborator

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

@dorjesinpo dorjesinpo added the enhancement New feature or request label Dec 22, 2023
@dorjesinpo dorjesinpo requested a review from a team as a code owner December 22, 2023 20:39
@dorjesinpo dorjesinpo force-pushed the inline-push-ack branch 3 times, most recently from 6d2f55e to e21c4cd Compare December 26, 2023 01:57
@678098
Copy link
Collaborator

678098 commented Jan 4, 2024

Hi @dorjesinpo, looking

src/groups/mqb/mqbnet/mqbnet_channel.h Show resolved Hide resolved
src/groups/mqb/mqbmock/mqbmock_queuehandle.h Show resolved Hide resolved
src/groups/mqb/mqbmock/mqbmock_cluster.cpp Outdated Show resolved Hide resolved
src/groups/mqb/mqbi/mqbi_queueengine.h Show resolved Hide resolved
src/groups/mqb/mqbi/mqbi_queue.h Outdated Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_clusterproxy.h Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.cpp Outdated Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_queuehandle.cpp Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_queuehandle.cpp Show resolved Hide resolved
@678098 678098 assigned dorjesinpo and unassigned 678098 Jan 8, 2024
Signed-off-by: Vitaly Dzhitenov <vdzhitenov@bloomberg.net>
Signed-off-by: Vitaly Dzhitenov <vdzhitenov@bloomberg.net>
Copy link
Collaborator Author

@dorjesinpo dorjesinpo left a 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!

src/groups/mqb/mqbnet/mqbnet_channel.h Show resolved Hide resolved
src/groups/mqb/mqba/mqba_clientsession.cpp Show resolved Hide resolved
src/groups/mqb/mqba/mqba_clientsession.cpp Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_cluster.cpp Show resolved Hide resolved
@@ -369,6 +345,8 @@ void ClusterProxy::onActiveNodeUp(mqbnet::ClusterNode* activeNode)
return; // RETURN
}

d_activeNode_p = activeNode;
Copy link
Collaborator Author

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

src/groups/mqb/mqbblp/mqbblp_queuehandle.cpp Show resolved Hide resolved
src/groups/mqb/mqbc/mqbc_clustermembership.cpp Outdated Show resolved Hide resolved
src/groups/mqb/mqbc/mqbc_clusternodesession.h Show resolved Hide resolved
pinfo.primaryLeaseId());
}
}

// TODO: this code assumes that it is safe to send PUTs and CONFIRMS at
// this point if the status is E_ACTIVE or close the gate otherwise.
// May need to open the gate later/close earlier by a separate call.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mimics the existing functionality. If the status is E_ACTIVE we call Channel::writeConfirm/writePut.
If the channel fails to write, confirm may get lost resulting in duplicate PUSH, and PUT will be retransmitted.

src/groups/mqb/mqbi/mqbi_queue.h Outdated Show resolved Hide resolved
@dorjesinpo dorjesinpo assigned 678098 and unassigned dorjesinpo Jan 10, 2024
@678098 678098 assigned dorjesinpo and unassigned 678098 Jan 10, 2024
@678098
Copy link
Collaborator

678098 commented Jan 10, 2024

@dorjesinpo thank you for fixes, added some comments in discussions and reassigned. You can assign this to @quarter-note later

Signed-off-by: Vitaly Dzhitenov <vdzhitenov@bloomberg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants