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

[Java, C#, C++] Fix precedence checks to account for non-contiguous versions. #989

Merged
merged 1 commit into from Apr 11, 2024

Conversation

ZachBray
Copy link
Contributor

Relates to issue #988.

An SBE message might not change in every version of a schema. For example, another message might change.

Previously, the field precedence checking model would expect an exact match for actingVersion in wrap to enter one of its initial states. However, it is only aware of the versions in which a message schema has changed. Therefore, it was possible for actingVersion not to match any of these versions, in which case the initial state that represented a codec wrapped around the latest known version of the format was picked.

Now, we do not expect an exact match in wrap. Instead, we select the "best" match. For example, if a codec was changed in v1 and v3, and the acting version is v2, we will decode using v1. However, if the acting version is v4, we would decode as v3.

…ersions.

Relates to issue #988.

An SBE message might not change in every version of a schema. For
example, another message might change.

Previously, the field precedence checking model would expect an exact
match for `actingVersion` in `wrap` to enter one of its initial states.
However, it is only aware of the versions in which a message schema has
changed. Therefore, it was possible for `actingVersion` not to match any
of these versions, in which case the initial state that represented a
codec wrapped around the latest known version of the format was picked.

Now, we do _not_ expect an exact match in `wrap`. Instead, we select the
"best" match. For example, if a codec was changed in v1 and v3, and the
acting version is v2, we will decode using v1. However, if the acting
version is v4, we would decode as v3.
@ZachBray ZachBray changed the title Fix precedence checks to account for non-contiguous versions. [Java, C#, C++] Fix precedence checks to account for non-contiguous versions. Apr 11, 2024
@vyazelenko
Copy link
Contributor

vyazelenko commented Apr 11, 2024

@ZachBray LGTM but the C# tests fail.

@vyazelenko
Copy link
Contributor

@ZachBray

Error Message:
   Test method Org.SbeTool.Sbe.Tests.FieldAccessOrderCheckTests.AllowsOldDecoderToSkipAddedPrimitiveFieldBeforeGroup threw exception: 
Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with '
', and was translated to Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException to avoid terminating the process hosting the test.
  Stack Trace:
      at Org.SbeTool.Sbe.Tests.FieldAccessOrderCheckTests.ModifyHeaderToLookLikeVersion1() in /home/runner/work/simple-binary-encoding/simple-binary-encoding/csharp/sbe-tests/FieldAccessOrderCheckTests.cs:line 3197
   at Org.SbeTool.Sbe.Tests.FieldAccessOrderCheckTests.AllowsOldDecoderToSkipAddedPrimitiveFieldBeforeG

@vyazelenko vyazelenko merged commit 7e6e503 into master Apr 11, 2024
33 of 34 checks passed
@vyazelenko vyazelenko deleted the bugfix/issue-988 branch April 11, 2024 21:49
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.

None yet

2 participants