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

command message versioning #104

Open
Geal opened this issue Jan 18, 2017 · 5 comments
Open

command message versioning #104

Geal opened this issue Jan 18, 2017 · 5 comments

Comments

@Geal
Copy link
Member

Geal commented Jan 18, 2017

The command protocol for the proxy does not include version numbers. Incremented version numbers should be fine.
How can we keep the protocol backward compatible?

@Geal
Copy link
Member Author

Geal commented Jan 20, 2017

version number added in 086d08c, but not checked yet

@Geal Geal added this to the needed for the release milestone Feb 2, 2017
@Geal Geal modified the milestones: nice to have, needed for the release Feb 23, 2017
@Geal Geal modified the milestones: nice to have, needed for the release Dec 21, 2017
@Geal
Copy link
Member Author

Geal commented Dec 21, 2017

in 2278726 we check if we receive a message with a higher version number.

Side note: what happens if someone updated sozu and sozuctl at the same time, the configuration protocol has changed, and they use the upgrade command? sozu might refuse that message.
ideas:

  • do not refuse an upgrade message even if the version is not the right one (problem: what if we want to change the upgrade message)
  • have sozuctl support different versions of the configuration language (which will already happen in the command lib anyway), so it can send a message with a lower version if necessary

@Geal
Copy link
Member Author

Geal commented Dec 21, 2017

Copying the message from #240 to have everything in one place:

Configuration messages hold a version number, that should be used when parsing messages, since people might use an older tool with a new version of sozu.

The solution would be based on serde's tagged enum feature: serde-rs/serde#745 (a PR is currently in progress for this: serde-rs/serde#973 )

Here's how the code would change in command/src/data.rs:

first define a ConfigMessageWrapper enum:

#[derive(Debug,Clone,PartialEq,Eq,Hash,Serialize,Deserialize)]
#[serde(tag = "version")]
pub enum ConfigMessageWrapper {
  #[serde(rename = "0")]
  V0(ConfigMessageV0),
  #[serde(rename = "1")]
  V1(ConfigMessage),
}

The latest version is always the currently used ConfigMessage. ConfigMessageWrapper implements Into, so we need a way to transform a V0 message in a V1 one. It also has a function to get the version number.

Duplicate the assets in command/assets, so that we have subfolders for v0, v1, etc.

When the master parses messages, it will get the version number and hold onto it in the Client structure, to answer with the same version number.

Until the version 1.0 of sozu is released, the message format will have breaking changes, so for now the version number stays at 0.

The related serde issues did not advance since September. If someone wants to help them, that would be nice

@Geal
Copy link
Member Author

Geal commented Mar 9, 2018

it might be a good idea to reuse an approach like serde-rs/serde#880
versioning is unfortunately an issue when upgrading sozu, as seen in #364

@Geal Geal modified the milestones: should be in the release, 1.0 Nov 13, 2018
@Geal Geal modified the milestones: 1.0, 0.14 Jul 29, 2021
@Geal
Copy link
Member Author

Geal commented Jul 29, 2021

we should make a clear policy for this in sozu 0.14, and make it testable in the command lib code. Major version upgrades should be easier to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants