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

[IMPROVED] Better attempt at delivering messages to queue subscriptions #638

Merged
merged 5 commits into from
Mar 16, 2018

Conversation

kozlovic
Copy link
Member

@kozlovic kozlovic commented Mar 9, 2018

This PR is based out of #633. It imroves parsing QRSID so that the
TestRouteQueueSemantics test now passes (when dealing with malformed
QRSID).
A test similar to what is reported in #632 was also added. This
test however, uncovers a race condition that will be fixed in a
separate PR.

Resolves #632

vkhorozvs and others added 4 commits March 5, 2018 18:36
This PR is based out of #633. It imroves parsing QRSID so that the
TestRouteQueueSemantics test now passes (when dealing with malformed
QRSID).
A test similar to what is reported in #632 was also added. This
test however, uncovers a race condition that will be fixed in a
separate PR.

Resolves #632
@coveralls
Copy link

coveralls commented Mar 9, 2018

Coverage Status

Coverage increased (+0.04%) to 92.126% when pulling 6f99832 on fix_632 into dd3dccc on master.

server/client.go Outdated
}
return
isRouteQsub = true
// for queue subscription try hard to deliver a message at least once.
Copy link
Member

Choose a reason for hiding this comment

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

We want to maintain strict at-most-once semantics. I do not think this violates it, but we should update the comment IMO.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess you commented from original PR, which in this PR the comments were already changed. Anyway, this comment has been removed.

server/client.go Outdated
// we didn't make a delivery attempt, because either a subscriber limit
// was exceeded or a subscription is already gone.
// So, let a code below find yet another matching subscription.
// We are at risk that a message might go forth and back
Copy link
Member

Choose a reason for hiding this comment

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

back and forth

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

server/client.go Outdated
// So, let a code below find yet another matching subscription.
// We are at risk that a message might go forth and back
// between routes during these attempts, but at the end
// it shall either be delivered (at most once) or drop.
Copy link
Member

Choose a reason for hiding this comment

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

dropped

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

server/client.go Outdated
// We are at risk that a message might go forth and back
// between routes during these attempts, but at the end
// it shall either be delivered (at most once) or drop.
c.Debugf("Re-sending message of a detached queue sid %s", c.pa.sid)
Copy link
Member

Choose a reason for hiding this comment

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

This causes concern here, I don't think we are re-sending a message here correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

Again, comment had been previously changed (and this debug statement removed).

server/client.go Outdated
c.deliverMsg(sub, mh, msg)
// Iterate over all subscribed clients starting at a random index
// until we find one that's able to deliver a message.
// Drop a message on the floor if there are noone.
Copy link
Member

Choose a reason for hiding this comment

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

none

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@kozlovic kozlovic changed the title [IMPROVED] Better attempt at delivering messages to routed queue subs [IMPROVED] Better attempt at delivering messages to queue subscriptions Mar 13, 2018
@kozlovic
Copy link
Member Author

@derekcollison I believe I have addressed the issues regarding comments. We need to think if we want this behavior to be merged or stick with the old one. I believe that this change still honor the at-most and there should not be duplicates. But original behavior was "correct" too (since we don't guarantee at-least-once, but at-most-once).

@derekcollison
Copy link
Member

As long as we can guarantee that we are still at most-once then LGTM. If we can not be sure of that then we need to revisit the changes.

@kozlovic
Copy link
Member Author

@derekcollison After careful review and to the best of my knowledge, as the code stands in this PR, we still honor at-most-once delivery but do a better job at delivery messages to a queue group. If you approve, please approve the PR (it is currently in Request Changes status).

@kozlovic kozlovic merged commit c16a1db into master Mar 16, 2018
@kozlovic kozlovic deleted the fix_632 branch March 16, 2018 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Defect: messages lost with non-zero max_msgs in 2-node cluster (bi-directional routes)
5 participants