Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Jepsen][YCQL] Consistency check failure for improved bank workload #10328

Closed
qvad opened this issue Oct 18, 2021 · 3 comments
Closed

[Jepsen][YCQL] Consistency check failure for improved bank workload #10328

qvad opened this issue Oct 18, 2021 · 3 comments
Labels
area/docdb YugabyteDB core features area/ycql Yugabyte CQL (YCQL) kind/bug This issue is a bug kind/failing-test Tests and testing infra priority/medium Medium priority issue

Comments

@qvad
Copy link
Contributor

qvad commented Oct 18, 2021

Jira Link: DB-923
I've extended coverage for YCQL bank workload, and now it also trigger inserts with same invariant.
Pull request with improved bank workload yugabyte/jepsen#55

Here is source code for inserts. On each dice == "insert" there is automatically incremented counter, so there is no concurrent runs here and each insert statement gets unique value, even when operation is failed.
May occur seven w/o any nemesis running

(let [{:keys [from to amount]} (:value op)
        dice                     (rand-nth ["insert" "update"])]
    (cond
        (= dice "insert")
        (let [insert-key   (swap! counter-end inc)]
        (do
            (cassandra/execute
            conn
            (str "BEGIN TRANSACTION "
                "INSERT INTO " keyspace "." table-name
                " (id, balance) values (" insert-key "," amount ");"

                "UPDATE " keyspace "." table-name
                " SET balance = balance - " amount " WHERE id = " from ";"
                "END TRANSACTION;"))
            (assoc op :type :ok :value {:from from, :to insert-key, :amount amount})))

        (= dice "update")
        (do
        (cassandra/execute
        ... 

bank

Jepsen validation log cut:

 {:SI
  {:valid? false,
   :read-count 12015,
   :error-count 5,
   :first-error
   {:type :wrong-total,
    :total 101,
    :op
    {:type :ok,
     :f :read,
     :process 266,
     :time 571865348465,
     :value
     {0 -116,
      1 -333,
      2 -334,

@qvad qvad added the area/ycql Yugabyte CQL (YCQL) label Oct 18, 2021
@qvad
Copy link
Contributor Author

qvad commented Oct 19, 2021

@qvad
Copy link
Contributor Author

qvad commented Apr 5, 2022

20220405T111015.000Z.zip
Logs for case w/o any nemesis

@lnguyen-yugabyte
Copy link
Contributor

lnguyen-yugabyte commented Apr 8, 2022

EDIT:
Changing the statements to

ycqlsh1> BEGIN TRANSACTION INSERT INTO ybdemo_keyspace.bankaccounts (account, balance) VALUES (1,10) IF NOT EXISTS ELSE ERROR; UPDATE ybdemo_keyspace.bankaccounts SET balance = balance - 10 WHERE account = 0;

results in one transaction aborted. The end result state was still correct.

Reproducing on YCQL:

ycqlsh> describe table ybdemo_keyspace.bankaccounts;

CREATE TABLE ybdemo_keyspace.bankaccounts (
    account int PRIMARY KEY,
    balance int
) WITH default_time_to_live = 0
    AND transactions = {'enabled': 'true'};

ycqlsh> insert into ybdemo_keyspace.bankaccounts (account, balance) values (0, 20000);
Now on two ycqlsh shells, execute these:
ycqlsh1> BEGIN TRANSACTION INSERT INTO ybdemo_keyspace.bankaccounts (account, balance) VALUES (1,10); UPDATE ybdemo_keyspace.bankaccounts SET balance = balance - 10 WHERE account = 0;

ycqlsh2> BEGIN TRANSACTION INSERT INTO ybdemo_keyspace.bankaccounts (account, balance) VALUES (1,10); UPDATE ybdemo_keyspace.bankaccounts SET balance = balance - 10 WHERE account = 0;

ycqlsh1> END TRANSACTION;
ycqlsh2> END TRANSACTION;

And voila we hit the error:

ycqlsh> select * from ybdemo_keyspace.bankaccounts;

 account | balance
---------+---------
       1 |      10
       0 |   19980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docdb YugabyteDB core features area/ycql Yugabyte CQL (YCQL) kind/bug This issue is a bug kind/failing-test Tests and testing infra priority/medium Medium priority issue
Projects
Status: Done
Development

No branches or pull requests

5 participants