Hi AZOK ,
GreetingS!!
It sounds like you’re trying to clarify a couple of points regarding the session consistency example in Azure Cosmos DB documentation.
What Session Consistency Guarantees
Session consistency ensures the following for a single client session:
- Read-your-writes: A client will always see its own writes.
- Monotonic reads: Once a client reads a value, it will not see an older value in subsequent reads.
- Monotonic writes: Writes are serialized in the order they were issued by the client.
- Writes-follow-reads: A write operation following a read is guaranteed to be based on the latest read.
The Confusion in the Documentation
The documentation example says:
"Whereas the 'Australia East' region is using 'Session B' so, it receives data later but in the same order as the writes."
This can be misleading if interpreted as a cross-session guarantee. Here's why:
- Session B is a different session from the writer's session (Session A).
- Session consistency does not guarantee ordering across sessios.
- Therefore, Session B may see writes out of order or not at all, unless it happens to read after the data has propagated and is available in the correct order.
So you're correct: Session B should not expect consistent prefix or ordered reads unless it is the same session as the writer.
Does Session Consistency Include Consistent Prefix?
No, session consistency does not include consistent prefix guarantees for other sessions. The consistent prefix level ensures that all clients see writes in the order they were committed, but it does not guarantee read-your-writes or monotonic reads.
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.