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

Question: Cosmos Db Consistency #212

Closed
mpaul31 opened this issue Mar 31, 2020 · 1 comment
Closed

Question: Cosmos Db Consistency #212

mpaul31 opened this issue Mar 31, 2020 · 1 comment

Comments

@mpaul31
Copy link

mpaul31 commented Mar 31, 2020

Hello,

I am reading through the documentation and trying to understand how this are setup and work with Cosmos Db. First, which consistency model must be used? Is multi readers / writers supported? I'm reading through the section Reading from the Storage Model and trying to work out in my head how we can be sure we are reading the latest state when IfNoneMatch is Found in the presence of multiple writers or not currently in cache. Isn't it possible we could be returned a document that is not the most recent and our command processing logic may in turn not emit emits thus leaving the system in an inconsistent state?

Thank you and any information you could provide would be great!

@bartelink
Copy link
Collaborator

bartelink commented Mar 31, 2020

TL;DR Ultimately every write is subject to an etag or expectedVersion matching in the write (in the sync stored proc)

The writing loop / consistency check scheme means it doesnt matter if the initial sync of the Stream.Transact fails to get the latest version, it will all get reconciled (even if it guaranteed latest, it can still be superseded). Any starting point will do (see xmldoc re AllowStale)

related: Equinox uses session consistency - there's some missing wiring wrt that :- #195 - this would provide am full read-your-writes guarantee (but would be similarly not critical from the point of view of guaranteeing writes are consistent and non-corrupting)

I'm working on diagrams atm that'll likely be relevant for you: https://github.com/jet/equinox/blob/diag/DOCUMENTATION.md#code-diagrams-for-equinoxcosmos

@mpaul31 mpaul31 closed this as completed Mar 31, 2020
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

No branches or pull requests

2 participants