yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.99k stars 1.07k forks source link

[Jepsen][YSQL] A lot of transaction consistency violations in Jepsen Elle while using REPEATABLE READ transactions. #11516

Closed qvad closed 2 years ago

qvad commented 2 years ago

Jira Link: DB-2786

Description

Added REPEATABLE READ Elle test in Jepsen. Since we threat REPEATABLE READ transactions as SNAPSHOT, following configuration used for test.

(defn workload-si
  [opts]
  (-> (append/test {:key-count          32
                    :max-txn-length     4
                    :max-writes-per-key 1024
                    :anomalies          [:internal :G-nonadjacent :G1 :G-SI]
                    :consistency-models [:snapshot-isolation]
                    :additional-graphs  [elle/realtime-graph]})))

Current test implementation is the same for all isolation levels, but only REPEATABLE READ case failed PR Draft - https://github.com/yugabyte/jepsen/pull/69/files Common code (only isolation level changed and checker params)

    (let [txn (:value op)
           use-txn? (< 1 (count txn))
           txn' (if use-txn?
                  (j/with-db-transaction [c c {:isolation isolation}]
                                         (mapv (partial mop! c test) txn))
                  (mapv (partial mop! c test) txn))]

There is a lot consistency violations in analysis result. Serialisable and read committed test are fine and doesn't fail so easily.

:not #{:read-atomic :read-uncommitted},
            :also-not #{:ROLA
                        :causal-cerone
                        :consistent-view
                        :cursor-stability
                        :forward-consistent-view
                        :monotonic-atomic-view
                        :monotonic-snapshot-read
                        :monotonic-view
                        :parallel-snapshot-isolation
                        :prefix
                        :read-committed
                        :repeatable-read
                        :serializable
                        :snapshot-isolation
                        :strict-serializable
                        :strong-session-serializable
                        :strong-session-snapshot-isolation
                        :strong-snapshot-isolation
                        :update-serializable}

20220217T170008.000Z.zip

Here is some examples:

  1. Dirty write

We append In single transaction 953 and 954 values into key 54, while in other transaction we read only 954

G0 #0
Let:
  T1 = {:type :ok, :f :txn, :value [[:append 54 805] [:append 54 806] [:r 54 [... 828 804 954 805 806]]], :time 264394623833, :process 894, :op-timing ["2022-02-17_17:04:50.339" "2022-02-17_17:04:58.664"], :index 46494}
  T2 = {:type :ok, :f :txn, :value [[:append 54 953] [:append 54 954]], :time 263078557704, :process 585, :op-timing ["2022-02-17_17:04:52.684" "2022-02-17_17:04:57.348"], :index 46242}
  1. Read skew
    
    G-single #3
    Let:
    T1 = {:type :ok, :f :txn, :value [[:append 47 753] [:r 47 [...  1023 987 1024 923 605]]], :time 194520931638, :process 504, :op-timing ["2022-02-17_17:03:43.205" "2022-02-17_17:03:48.791"], :index 32776}
    T2 = {:type :ok, :f :txn, :value [[:append 47 604] [:r 47 [.... 987 1024 923]] [:append 47 605] ... ], :time 193951238563, :process 767, :op-timing ["2022-02-17_17:03:40.461" "2022-02-17_17:03:48.210"], :index 32686}

Then:

Then:

m-iancu commented 2 years ago

^cc @spolitov @pkj415 @robertsami

qvad commented 2 years ago

According to bisect testing this commit is related to consistency issue