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

CreateItem will only retry for auto-extracted partition key in-case of container re-creation #1070

Merged
merged 5 commits into from
Dec 2, 2019

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Dec 2, 2019

Pull Request Template

Description

Fixed bug where if a user provided the wrong partition key value the request would be sent twice. The retry logic for the partition key extraction was always being used if it was a user provided partition key value or an extracted partition key value. The retry logic should only be used for SDK extracted partition key value in scenarios where the cache is stale.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

…request would be sent twice. The retry logic for the partition key extraction was always being used if it was a user provided partition key value or an extracted partition key value. The retry logic should only be used for SDK extracted partition key value in scenarios where the cache is stale.
@j82w j82w added the bug Something isn't working label Dec 2, 2019
@j82w j82w self-assigned this Dec 2, 2019
@j82w j82w changed the title Fixed bug where wrong partition key request might be sent twice Fixed bug where wrong partition key value might cause two requests Dec 2, 2019
@j82w j82w requested a review from ealsur December 2, 2019 15:46
ealsur
ealsur previously approved these changes Dec 2, 2019
…sts/NameRoutingTests.cs

Co-Authored-By: Matias Quaranta <ealsur@users.noreply.github.com>
Container container = await database.CreateContainerAsync(id: "coll1", partitionKeyPath: "/doesnotexist");
ToDoActivity toDoActivity = ToDoActivity.CreateRandomToDoActivity();

ItemResponse<ToDoActivity> response = await container.CreateItemAsync(toDoActivity, partitionKey: new Cosmos.PartitionKey(toDoActivity.status));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test for other case where retry are expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test above this is testing the happy path. This test is for specifically testing that if a user provides a partition key value it is not retried on.

changelog.md Outdated Show resolved Hide resolved
changelog.md Outdated Show resolved Hide resolved
@j82w j82w changed the title Fixed bug where wrong partition key value might cause two requests CreateItem will only retry for auto-extracted partition key in-case of container re-creation Dec 2, 2019
@j82w j82w merged commit aa33e53 into master Dec 2, 2019
@j82w j82w deleted the users/jawilley/bug/pkextract branch December 2, 2019 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants