-
Notifications
You must be signed in to change notification settings - Fork 27
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
Stored saga json state can cause custom tooling parsing issues on SQL Server #1331
Merged
Conversation
This file contains 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
…PDATE. Now only applied for `ExecuteReaderAsync` and `ExecuteReaderAsync`.
Seems like we need to use a separate table for the new test to not break others? |
andreasohlund
changed the title
Fix issue where sql parameter optimalisation was applied for INSERT/UPDATE
Stored json gets corrupted on SqlServer after an update with a smaller sized payload
Nov 15, 2023
andreasohlund
approved these changes
Nov 15, 2023
ramonsmits
added a commit
that referenced
this pull request
Nov 15, 2023
…r sized payload (#1331) * Fix issue where sql parameter optimalisation was applied for INSERT/UPDATE. Now only applied for `ExecuteReaderAsync` and `ExecuteReaderAsync`. * Fix failing CI tests due to new test using incorrect table for testing * Updated the test name to better express its intent
andreasohlund
pushed a commit
that referenced
this pull request
Nov 15, 2023
…r sized payload (#1332) * Stored json gets corrupted on SqlServer after an update with a smaller sized payload (#1331) * Fix issue where sql parameter optimalisation was applied for INSERT/UPDATE. Now only applied for `ExecuteReaderAsync` and `ExecuteReaderAsync`. * Fix failing CI tests due to new test using incorrect table for testing * Updated the test name to better express its intent * Version still supports NETFRAMEWORK and await using isn't supported in NETFX
ramonsmits
changed the title
Stored json gets corrupted on SqlServer after an update with a smaller sized payload
Stored saga json state can cause custom tooling parsing issues on SQL Server
Nov 16, 2023
what versions does this effect? |
Only 7.0.3 (see "Who's affected") |
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.
When updating saga state where the serialized json is smaller than whats already present in the database the updated payload is corrupted.
Expected Behavior
When string or array values are updated with shorted values that there will be not data left from previous versions:
Observed Behavior
In version 7.0.3 data of the previous version will remain in the database column for SQL server.
How to reproduce
111
)11
)Root cause
7.0.3 introduced logic to set the SQL command parameter length to either 4000 or -1 for strings and arrays. This to ensure that SQL server will not create a new query plan so it will use the query cache.
Unfortunately, this has a side effect that SQL Server does not remove trailing data in an existing column for INSERT/UPDATE if the new value is shorter than the previous.
Resolution
The length should only be set to 4000/-1 for SELECT queries
Versions
NServiceBus.Persistence.Sql
7.0.3Who's affected
Only version 7.0.3 is affected when using SQL Server
Additional Information