-
Notifications
You must be signed in to change notification settings - Fork 480
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
CosmosDB state stores changes order of operations in transaction #1209
Comments
This requires the stored procedure to be rewritten. |
|
I was able to reproduce the issue with the following snippet. On every alternate run, I see that both k1 and k2 are present (problematic), and the other times only k2 is present (as expected). /**
* To reproduce #1209, perform the following in a transaction:
* upsert k1, v1
* delete k1
* upsert k2, v2
*
* Expected: k1 is not present, k2 is present with value v2
* Actual: k1 and k2 are present with values v1 and v2
*
* @param client DaprClient
*/
async function performOperations(client: DaprClient) {
var operations = [
{
operation: "upsert",
request: {
key: "key1",
value: {
part: "partition",
zipcode: 100
}
}
},
{
operation: "delete",
request: {
key: "key1"
}
},
{
operation: "upsert",
request: {
key: "key2",
value: {
part: "partition",
zipcode: 200
}
}
}
];
var metadata = {
partitionKey: "partition"
}
await client.state.transaction(STATE_STORE_NAME, operations, metadata);
} |
/assign |
@artursouza @yaron2 @shubham1172 In this case for transactions with first write concurrency, shouldn't all those transactions fail if the same key is updated more than once in the transaction? |
#1244 seems to be covering it. Looking at the code, Cosmos DB transaction API completely ignores ETags today. |
Expected Behavior
When an app performs the following transaction in state store:
The expected result in the database is that key1 is not present and key2 is present, respecting the order of the operations.
Actual Behavior
The result in the database is that key1 and key2 are present, not respecting the order of the operations.
Steps to Reproduce the Problem
Perform a transaction operation in CosmosDB state store.
Release Note
RELEASE NOTE: FIX CosmosDb transaction API to respect order of operations
The text was updated successfully, but these errors were encountered: