-
Notifications
You must be signed in to change notification settings - Fork 482
[persist] Compatibility versioning #34027
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
751819c to
e3a343c
Compare
teskje
left a comment
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.
This looks good to me, at least as far as I'm grokking the persist details. There is still the piece missing where we call upgrade_version on all existing shards in the environment during leader startup, right?
|
I think this Cargo test failure might be caused by this PR? At least I haven't seen it before: https://buildkite.com/materialize/test/builds/111438: |
Probably related and probably not concerning - looks like a snapshot test that doesn't fully reflect the state of the merged branch - but thanks for linking; will keep an eye on it! |
A downside of repurposing the applier_version as the actual state version is that we can no longer determine what the actual version of the code was that made the change withought a serious investigation. Adding it to this string means it will be included in various places in state.
|
This doesn't yet include all the necessary |
teskje
left a comment
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.
LGTM! Might want a second review from someone with more persist knowledge.
DAlperin
left a comment
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.
This all looks fine to me. I have one question and I don't think we are using the new apis everywhere we need to but you mentioned thats for a followup PR so I'm fine with that. These are exciting changes!
| // FIXME: this passes the state version but the method requires the build version. | ||
| let diff = StateDiff::<T>::decode(&self.collections.version, data); |
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.
Why can't we pass the applier_version here? That is set from the build version, no? In many cases they will be equal but will diverge during upgrades.
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.
This is just a field move - can be seen most clearly in the individual commit.
(And yeah, generally the applier version would match the build version, but not always - eg. if we've just loaded up a state from an old version and haven't modified it yet. I will add fixing this fixme to the list of things I'll try and get in for Thursday...)
This PR:
versionfield... instead of indicating the highest version that has ever touched a bit of state, it indicates the lowest version which is guaranteed to be compatible with the existing state.StateCollections, to make it available to individual Persist commands. This will allow future Persist changes to check the version before making changes, which is essential for flexible backwards compatibility.Motivation
https://github.com/MaterializeInc/database-issues/issues/9870