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

Validate command reply modes #320

Merged
merged 4 commits into from
Oct 19, 2022
Merged

Validate command reply modes #320

merged 4 commits into from
Oct 19, 2022

Conversation

the-mikedavis
Copy link
Member

Proposed Changes

Command reply modes (ra_server:command_reply_mode()) were not previously validated. If an old Ra system were sent a reply mode introduced in some new change, the Ra system would never reply or notify the caller. With this change, the caller receives an error tuple reply for the unknown mode.

This is necessary to mitigate the effects of adding new reply modes as in #314 in cases where senders of commands may be running newer Ra versions than a running Ra system.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

{call, From} ->
{keep_state, State0, [{reply, From, Error}]};
_ ->
{keep_state, State0, []}
Copy link
Member Author

Choose a reason for hiding this comment

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

For pipeline commands, the command is silently discarded here if the reply mode is unrecognized. Should we log a message or exit so it's more noticeable?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that is ok as pipelining always have to account for commands going missing and ensure resends when detected

Copy link
Contributor

Choose a reason for hiding this comment

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

On second thought we could add a counter for these. That would make them detectable at least

@the-mikedavis the-mikedavis marked this pull request as ready for review October 19, 2022 13:17
`ra_server:command_reply_mode()` was not previously validated on the
`ra_server`-side. If a command were sent with an unknown reply mode,
the Ra server would never reply or notify the caller.

Sending an unknown reply mode might happen when a client sends a new
command to a Ra server which is operating on an old version of Ra.

This change validates reply modes within the `ra_server`, replying with
an error tuple when an invalid reply mode is passed.
@the-mikedavis the-mikedavis force-pushed the md-validate-reply-mode branch from 3f1d74d to be203b9 Compare October 19, 2022 14:54
@michaelklishin michaelklishin added this to the 2.4.0 milestone Oct 19, 2022
@michaelklishin michaelklishin merged commit 17c0068 into main Oct 19, 2022
@michaelklishin michaelklishin deleted the md-validate-reply-mode branch October 19, 2022 17:23
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.

3 participants