surrealdb / surrealkv

A low-level, versioned, embedded, ACID-compliant, key-value database for Rust
https://surrealdb.com
Apache License 2.0
293 stars 18 forks source link

G2 Anomaly Fails for SSI for range reads because of write skew #28

Closed arriqaaq closed 6 months ago

arriqaaq commented 7 months ago

Description

SKV uses SSI for serializability. For individual get/set/delete operations, it avoids write skews. But on range reads, there is still a possibility of write skews which is akin to the g2 (G2: Anti-Dependency Cycles (write skew on predicate read)) test from hermitage.

  "g2")
    echo "Running g2 test."
    tell 0 "begin"
    tell 1 "begin"
    tell 0 "select * from test where value % 3 = 0"
    tell 1 "select * from test where value % 3 = 0"
    tell 0 "insert into test (id, value) values(3, 30)"
    tell 1 "insert into test (id, value) values(4, 42)"
    tell 0 "commit"
    tell 1 "commit" # Rejected with ERROR: FoundationDB commit aborted: 1020 - not_committed
    ;;