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

Match condition not being honored in Upsert item calls #11791

Closed
aalapatirvbd opened this issue Jun 3, 2020 · 5 comments
Closed

Match condition not being honored in Upsert item calls #11791

aalapatirvbd opened this issue Jun 3, 2020 · 5 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization.
Milestone

Comments

@aalapatirvbd
Copy link
Contributor

aalapatirvbd commented Jun 3, 2020

  • Package Name: azure.cosmos
  • Package Version: 4.0.0
  • Operating System: osx
  • Python Version: 3.8.1

Describe the bug
Upsert item function is ignoring the match_condition options. After looking at the code, found that the upsert_item method is ignoring the created request_options.

https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/cosmos/azure-cosmos/azure/cosmos/container.py#L451

Note that the request_options variable is not being passed to the subsequent UpsertItem call.

To Reproduce
Steps to reproduce the behavior:

  1. Have two clients trying to update the same entry in a given cosmos db container and observe that the etag match_condition is not honored.

Expected behavior
The upsert call should be rejected with azure.cosmos.exceptions.CosmosAccessConditionFailedError: (PreconditionFailed) Operation cannot be performed because one of the specified precondition is not met., error.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 3, 2020
@aalapatirvbd
Copy link
Contributor Author

Looks like the developer missed passing the request_options to the subsequent calls. I have made the change and verified the fix. Will open a PR shortly.

@kaerm kaerm added the Cosmos label Jun 3, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 3, 2020
@kaerm kaerm added the Client This issue points to a problem in the data-plane of the library. label Jun 3, 2020
@kaerm
Copy link
Contributor

kaerm commented Jun 3, 2020

Thanks @aalapatirvbd for opening the issue, @annatisch @southpolesteve could you take a look at this

@annatisch
Copy link
Member

Thanks for the report and investigation @aalapatirvbd!
Definitely looks like a bug - I will PR a fix.

@annatisch annatisch added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 3, 2020
@kaerm
Copy link
Contributor

kaerm commented Jun 3, 2020

@annatisch, @aalapatirvbd already submitted a PR here: #11792

@lmazuel lmazuel added this to the Backlog milestone Jun 9, 2020
@annatisch
Copy link
Member

This fix has now been released in 4.1.0.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

No branches or pull requests

5 participants