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

UpsertItemAsync with ItemOptions.IfMatchEtag not work sometimes #4449

Closed
htzhang2 opened this issue Apr 23, 2024 · 3 comments
Closed

UpsertItemAsync with ItemOptions.IfMatchEtag not work sometimes #4449

htzhang2 opened this issue Apr 23, 2024 · 3 comments

Comments

@htzhang2
Copy link

We are continuously addressing and improving the SDK, if possible, make sure the problem persist in the latest SDK version.

Describe the bug
UpsertItemAsync with same IfMatchEtag value both return success

To Reproduce

  1. Retrieve etag value from existing item with ReadItemAsync
  2. Call to UpsertItemAsync with IfMatchEtag value from step 1.
  3. Another call to UpsertItemAsync with IfMatchEtag value.

Expected behavior

  1. One call succeed
  2. Another call fail with CosmosException.PreConditionFailed

Actual behavior
Both calls succeed sometimes

Environment summary
SDK Version: 3.38.1
OS Version (e.g. Windows, Linux, MacOSX): Windows

Additional context
CosmosDb is strong consistency

@bartelink
Copy link
Contributor

bartelink commented Apr 24, 2024

Both calls succeed sometimes

So you're saying you have a repro where two different writes succeed based off the same etag, i.e. the written data from one of the cases is lost?
That's declaring SELECT broken, and is highly unlikely to be the case - you'll need to rig a real test case harness for this rather than just loosely alleging 'sometimes'; strong allegations require strong evidence.
If this is not what you mean, I'd suggest to modify the expecation

@ealsur
Copy link
Member

ealsur commented Apr 24, 2024

If this is really happening you will probably need to file a Support Request. What you are describing would be a failure on the Service behavior enforcing ETag matching.

Can you share a repro? Are you certain you are using the same ETag?

From the SDK perspective, the SDK just sends the headers, it does not perform any validation, so there is really nothing that we can do if this ends up being true.

Copy link
Contributor

@htzhang2 this issue requires more information for the team to be able to help. In case this information is available, please add it and re-open the Issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants