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

[#6768] CosmosDBKeyEscape.TruncateKeyIfNeeded return different value after compiled #6860

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

ceciliaavila
Copy link
Collaborator

Fixes #6768

Description

This PR implements a custom GetHashCode method to return the same hash code even on different bots' runs. This code is used in CosmosDBKeyEscape to truncate keys that are longer than 255 characters.

Specific Changes

  • Created the GetDeterministicHashCode method in the CosmosDBKeyEscape class to replace the call to String.GetHashCode.
  • Updated Long_Key_Should_Be_Truncated unit test to use the new method and verify its result.

Testing

These images compare the hash codes returned by the GetHashCode and GetDeterministicHashCode methods in two different bot runs.
image

@ceciliaavila ceciliaavila added the Automation: No parity PR does not need to be applied to other languages. label Oct 21, 2024
@ceciliaavila ceciliaavila requested a review from a team as a code owner October 21, 2024 19:40
@tracyboehrer tracyboehrer merged commit e449b3c into main Nov 11, 2024
4 of 9 checks passed
@tracyboehrer tracyboehrer deleted the southworks/update/replace-get-hash-code-method branch November 11, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation: No parity PR does not need to be applied to other languages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CosmosDBKeyEscape.TruncateKeyIfNeeded return different value after compiled
2 participants