We found transactional causal consistency (TCC) anomalies on the Dgraph Cluster. According to link1 (see the following comment), Dgraph provides SNAPSHOT ISOLATION that is stronger than TCC. See the bottom for TCC details.
In our experiment we set up the cluster on a local machine with 3 server nodes. Here is the configuration information:
Dgraph Version == 21.03.2
server_node = 3
client_num(session_num) = 2
client_stub_num = 1
txn_per_session = 10
operation_per_txn = 10
key_number = 20
key_distribution = uniform
We are using a simple table schema, just containing key-value pairs. Here is the initialized table:
KEY VALUE
0 0
1 0
2 0
⊠0
19 0
Note that, for each write on a key, the value (generated by the workload generator) is unique.
One anomaly was found on five transactions from two sessions, where r/w(A,B) denotes read/write value B on key A:
session 0 session 1
txn4 txn11
w(19,3) r(10,3)
w(19, 25)
txn5 txn13
w(10,3) w(0,22)
w(19, 25)
txn6
r(0,22)
r(19,3)
txn4 and txn6 have âwrite-readâ order on key 19, denoted by txn4 ->wr txn6; txn13 and txn6 have write-read order on key 0, i.e., txn13 â txn6.
To satisfy transactional causal consistency txn13 must be ordered before txn4 because we already know txn4 â txn6 and txn13 â txn6 and txn6 read the value of key 19 written by txn4. Thus we have commit order txn13 ->co txn4 (see the bottom for the definition of commit order). However, txn4 can reach txn13 via txn4 ->so txn5 ->wr txn11 ->so txn12 ->so txn13. Hence, there is a cycle between txn13 and txn4 that violates TCC.
*** Causal Consistency ***
The causal consistency we checked is defined in the paper published on SOSPâ11 (âDonât settle for eventual: scalable causal consistency for wide-area storage with COPSâ). In this paper the authors define a consistency modelâcausal+. Causal+ is slightly stronger than causal consistency because it adds convergent conflict handling. Another paper from POPLâ17 (On verifying causal consistency) also has the definition of this property as below:
âThere is a total order between non-causally dependent operations and each site can execute operations only in that order (when it sees them). Therefore, a site is not allowed to revise its ordering of non-causally dependent operations, and all sites execute in the same order the operations that are visible to them.â Also, causal+ consistency is strictly weaker than SNAPSHOT ISOLATION.
*** Ordering Transactions ***
The âwrâ order means two transactions contain write/read operations on the same key with the same value respectively, thus the transaction with write operation should happen before the transaction contains the read operation.