问题
I am trying to understand the exact guarantees provided by DocumentDB when using session consistency.
Is it possible for the following to happen (lets assume a,b,c,d are all values of the same document)
Session 1 W(a) W(b)
Session 2..................W(c)W(d)
Session 3................................. R(b)R(c)
Session 4................................ R(c)R(b)
In other words, are writes across sessions ordered (in which case, either b happens before c or c happens before b, so one of C3 or C4 will violate monotonic reads)?
In what order will the updates a,b,c,d (assuming they are all made with session consistency) be applied?
回答1:
Session Consistency provides following guarantees to user.
1) Read Your Own Write- Any write performed inside the session is immediately visible inside the session.
2) Monotonic Read - Any read seen inside a session will not regress within a session.
Assuming A,B,C,D are increasing version of same document.
C, B is not a monotonic increasing history and will be violation of session guarantee.
Note: The assumption here is read requests by Session(4) are issued in serial order. i.e. Second read is issued after completion of first read.
来源:https://stackoverflow.com/questions/36415310/session-guarantee-on-documentdb