Search code examples
azureazure-cosmosdbconsistency

Does CosmosDB with sessions consistency garantuee ordering


From the Microsoft documentation I don't fully understand whether or not CosmosDB using session consistency garantuees no out of order writes. The following quote makes it seem like it has the same garantuees as cosistent prefix:

The reads are guaranteed to honor the consistent-prefix (assuming a single “writer” session), ...

Although from the baseball example further down the page it seems like a reader could get a completely random order back, similar to eventual consistency. From other sources online I also can't find a definitive anwser, apart from the images shown on the Azure Portal that seem to implicitly suggest the same order as the writer.


Solution

  • (I'm from the Cosmos DB team)

    A given client using session consistency will see its own writes in order, but see other clients' writes with eventual consistency (assuming using a different session token).

    We're gonna update the docs to make that more clear. New text will read something like this:

    Session: Within a single client session reads are guaranteed to honor the consistent-prefix (assuming a single “writer” session), monotonic reads, monotonic writes, read-your-writes, and write-follows-reads guarantees. Clients outside of the session performing writes will see eventual consistency.