Open lemmy opened 2 years ago
The issue in general-model was, we only allow clients writes to its own region. The write() macro should be fix with this:
(* Regular write at write region *)
macro write(v)
{
with (w \in WriteRegions)
{
when \A i, j \in Regions : Data[i] - Data[j] < Bound;
Database[w] := Append(@, v);
Data[w] := v;
History := Append(History, [type |-> "write",
data |-> v,
region |-> w,
client |-> self]);
session_token := v;
}
}
It seems my account cannot send PR for this or original repo. Can you please help verify and update? Thanks.
The spec general-model/cosmos_client.tla
intentionally models only one process per region and, thus, provides monotonic reads even under eventual consistency. This differs from scenario1/swscop.tla
and scenario2/swscrw.tla
, which model non-monotonic reads.
"In session consistency, within a single client session reads are guaranteed to honor the consistent-prefix, monotonic reads, monotonic writes, read-your-writes, and write-follows-reads guarantees." https://docs.microsoft.com/en-us/azure/cosmos-db/consistency-levels#session-consistency.
Checking the property
Session
with constantConsistency = "Eventual"
inscenario1/swscop.tla
(andscenario2/swscrw.tla
) does not cause a violation (Session
holds), even though reads are not monotonic. With the definition ofSession
strengthened by asserting monotonic reads, the property no longer holds, which is the expected behavior. Note that the original definition ofSession
is not violated by non-monotonic reads because the value ofses[1]
(session token) will be non-monotonic under eventual consistency.Original variant of Session:
Reproducible with the following TLC config file
swscop.cfg
: