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

Fix transaction API for Azure Cosmos DB #1518

Merged

Conversation

shubham1172
Copy link
Member

Signed-off-by: Shubham Sharma [email protected]

Description

Similar to #1516, this introduces a logic to fix the ordering in a transaction. For a given key, only the latest operation is executed. The other operations are ignored. (From related PR: ) This is similar to what was proposed in #1209 (comment). For example, say the original transaction is:

upsert k1 v1  # redundant, gets deleted later
delete k1
delete k2     # redundant, gets set to v2 later
upsert k2 v2

Issue reference

Please reference the issue this PR will close: #1209

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

@shubham1172 shubham1172 requested review from a team as code owners February 21, 2022 10:58
@shubham1172
Copy link
Member Author

Test from #1496
image

On master:
image

state/azure/cosmosdb/cosmosdb.go Outdated Show resolved Hide resolved
@shubham1172 shubham1172 changed the title Fix transaction API for Azure Cosmos DB [WIP] Fix transaction API for Azure Cosmos DB Feb 24, 2022
@shubham1172 shubham1172 changed the title [WIP] Fix transaction API for Azure Cosmos DB Fix transaction API for Azure Cosmos DB Mar 3, 2022
@codecov
Copy link

codecov bot commented Mar 7, 2022

Codecov Report

Merging #1518 (86e1401) into master (0f44be4) will decrease coverage by 0.00%.
The diff coverage is 21.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1518      +/-   ##
==========================================
- Coverage   35.40%   35.40%   -0.01%     
==========================================
  Files         160      160              
  Lines       14616    14618       +2     
==========================================
  Hits         5175     5175              
- Misses       8888     8890       +2     
  Partials      553      553              
Impacted Files Coverage Δ
bindings/alicloud/nacos/settings.go 33.33% <ø> (ø)
state/azure/cosmosdb/cosmosdb.go 13.71% <0.00%> (-0.21%) ⬇️
bindings/alicloud/nacos/nacos.go 35.60% <100.00%> (+0.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1209fb...86e1401. Read the comment docs.

@shubham1172
Copy link
Member Author

Ran the actors e2e test - actor_features, that covers state change scenarios, with changes from this PR.

image

@artursouza artursouza merged commit db670d2 into dapr:master Mar 9, 2022
berndverst pushed a commit to shivamkm07/components-contrib that referenced this pull request Mar 11, 2022
* Fix cosmos transaction API to respect ordering

Signed-off-by: Shubham Sharma <[email protected]>

* refactor to an idiomatic way

Signed-off-by: Shubham Sharma <[email protected]>

* Update storedproc caller to pass list of operations

Signed-off-by: Shubham Sharma <[email protected]>

* Update storedproc to operate sequentially

Signed-off-by: Shubham Sharma <[email protected]>

* Add doc

Signed-off-by: Shubham Sharma <[email protected]>

* Update storedproc

Signed-off-by: Shubham Sharma <[email protected]>

* Update storedproc to not throw error on delete failure due to missing document

Signed-off-by: Shubham Sharma <[email protected]>

Co-authored-by: Looong Dai <[email protected]>
Signed-off-by: Bernd Verst <[email protected]>
berndverst pushed a commit to shivamkm07/components-contrib that referenced this pull request Mar 11, 2022
* Fix cosmos transaction API to respect ordering

Signed-off-by: Shubham Sharma <[email protected]>

* refactor to an idiomatic way

Signed-off-by: Shubham Sharma <[email protected]>

* Update storedproc caller to pass list of operations

Signed-off-by: Shubham Sharma <[email protected]>

* Update storedproc to operate sequentially

Signed-off-by: Shubham Sharma <[email protected]>

* Add doc

Signed-off-by: Shubham Sharma <[email protected]>

* Update storedproc

Signed-off-by: Shubham Sharma <[email protected]>

* Update storedproc to not throw error on delete failure due to missing document

Signed-off-by: Shubham Sharma <[email protected]>

Co-authored-by: Looong Dai <[email protected]>
Signed-off-by: Bernd Verst <[email protected]>
@berndverst berndverst added this to the v1.7 milestone Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CosmosDB state stores changes order of operations in transaction
4 participants