data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

Cosmos DB: Mutations should be done in the same transaction as other mutations in the same request

Open PaulOst opened this issue 2 years ago • 1 comments

What happened?

Multiple mutations should be part of the same transaction (assuming the items are in the same container and logical partition). That way they can be rolled back in an atomic way. It also ensures that no unexpected data is returned in the result of a mutation in case of concurrent updates.

Version

0.7.6

What database are you using?

CosmosDB NoSQL

What hosting model are you using?

Static Web Apps (SWA)

Which API approach are you accessing DAB through?

GraphQL

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

PaulOst avatar Aug 06 '23 00:08 PaulOst

This is a must have. Professional developers won't accept a data API that doesn't support ACID transactions if their use cases include mutations. The raw cosmos db api does support transactions: "The database engine in Azure Cosmos DB supports full ACID (Atomicity, Consistency, Isolation, Durability) compliant transactions with snapshot isolation. All the database operations within the scope of a container's [logical partition] are transactionally executed within the database engine that is hosted by the replica of the partition. These operations include both write (updating one or more items within the logical partition) and read operations."

PaulOst avatar Aug 06 '23 00:08 PaulOst