[ESDB-106-5] Bump up the chunk format version to 4 (Transformed)#4289
Merged
timothycoleman merged 1 commit intomasterfrom Jun 13, 2024
Merged
[ESDB-106-5] Bump up the chunk format version to 4 (Transformed)#4289timothycoleman merged 1 commit intomasterfrom
Transformed)#4289timothycoleman merged 1 commit intomasterfrom
Conversation
c0a8894 to
000d2b7
Compare
ylorph
reviewed
Jun 12, 2024
d1ea1ac to
4f67f32
Compare
009e649 to
7376737
Compare
v4 basically represents the addition of the `TransformType` field. We want to use v4 for all new chunks, whether a transformation is applied or not (i.e if we're using the `Identity` transform). However, the existing chunk version verification code throws an exception on startup whenever a chunk with an unknown version is opened. This means that old versions of the database will not be able to read/write to v4 chunks even if no transformation is applied. To work around this, we implement forward compatibility in the following way: - the current `Version` field is renamed to `MinCompatibleVersion` - the next free slot of the chunk header is used to store the actual version (`Version`) `MinCompatibleVersion` represents the minimum chunk version that the db needs to understand to be able to read/write to this chunk. If a new chunk format is forward compatible, then `MinCompatibleVersion` can still point to an older version. However, if a change is not forward compatible (e.g when a transform is applied), then `MinCompatibleVersion` must also be bumped up to a higher value.
Contributor
|
This PR adds a second version field to the Chunk header. Now there are two:
This facilitates the creation of forwards-compatible chunk versions and therefore facilitates rolling upgrades when the chunk version is changing. When a new chunk has no transformation, it will have Version 4 (because it is) and MinVersion 3 (because old versions of ESDB will open it fine) When a new chunk has a transformation, both versions will be 4. Old versions of ESDB will (correctly) refuse to open it. The MinimumCompatibleVersion can be thought of as a promise of compatibility from a newer version of ESDB to an older version. In other circumstances this role could be played by a schema registry but that isn't applicable here. |
timothycoleman
approved these changes
Jun 13, 2024
Transformed)Transformed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added: Chunk version 4 (
Transformed) file formatAdded: Support for forward compatibility in chunks
Thanks to @ylorph for the initial idea to bump up the chunk version and @timothycoleman and @sakno for their feedback.