Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ $ docker exec -it jepsen-control bash
4. Run a test
```
# cd /scalar-jepsen/cassandra
# lein run test --test lwt --ssh-private-key ~/.ssh/id_rsa
# lein run test --workload lwt --ssh-private-key ~/.ssh/id_rsa
```
- Check README in each test for more detail
- `--ssh-private-key` should be always set to specify the SSH key
- `--workload` specifies a test workload. previously we used `--test`.
- `--nemesis` sets `none`, `partition`, `clock`, or `crash` (default: `none`)
- `--admin` sets `none`, `join` or `flush` (default: `none`)

# Run tests without Docker
1. Launch debian machines as a control machine and Cassandra nodes
Expand Down Expand Up @@ -54,5 +57,5 @@ EOF"

```sh
$ cd ${SCALAR_JEPSEN}/cassandra
$ lein run test --test lwt --ssh-private-key ~/.ssh/id_rsa
$ lein run test --workload lwt --ssh-private-key ~/.ssh/id_rsa
```
2 changes: 1 addition & 1 deletion cassandra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You will probably need to increase the amount of memory that you make available
# in jepsen-control

$ cd ${SCALAR_JEPSEN}/cassandra
$ lein run test --test lwt --nemesis bridge --join bootstrap
$ lein run test --workload lwt --nemesis partition --admin join
```

- See `lein run test --help` for full options
51 changes: 22 additions & 29 deletions cassandra/src/cassandra/batch.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns cassandra.batch
(:require [cassandra.core :refer :all]
[cassandra.conductors :as conductors]
[clojure.tools.logging :refer [debug info warn]]
[jepsen
[client :as client]
Expand Down Expand Up @@ -29,7 +28,7 @@
:value :int
:primary-key [:pid :cid]}}))))

(invoke! [_ _ op]
(invoke! [_ test op]
(try
(alia/execute session (use-keyspace :jepsen_keyspace))
(case (:f op)
Expand All @@ -43,20 +42,21 @@
"APPLY BATCH;")
{:consistency :quorum})
(assoc op :type :ok))
:read (let [results (alia/execute session
(select :bat)
{:consistency :all})
value-a (->> results
(filter (fn [ret] (= (:cid ret) 0)))
(map :value)
(into (sorted-set)))
value-b (->> results
(filter (fn [ret] (= (:cid ret) 1)))
(map :value)
(into (sorted-set)))]
(if (= value-a value-b)
(assoc op :type :ok :value value-a)
(assoc op :type :fail :value [value-a value-b]))))
:read (do (wait-rf-nodes test)
(let [results (alia/execute session
(select :bat)
{:consistency :all})
value-a (->> results
(filter (fn [ret] (= (:cid ret) 0)))
(map :value)
(into (sorted-set)))
value-b (->> results
(filter (fn [ret] (= (:cid ret) 1)))
(map :value)
(into (sorted-set)))]
(if (= value-a value-b)
(assoc op :type :ok :value value-a)
(assoc op :type :fail :value [value-a value-b])))))

(catch ExceptionInfo e
(handle-exception op e))))
Expand All @@ -66,16 +66,9 @@

(teardown! [_ _]))

(defn batch-test
[opts]
(merge (cassandra-test (str "batch-set-" (:suffix opts))
{:client (->BatchSetClient (atom false) nil nil)
:checker (checker/set)
:generator (gen/phases
(->> [(adds)]
(conductors/std-gen opts))
(conductors/terminate-nemesis opts)
; read after waiting for batchlog replay
(gen/sleep 60)
(read-once))})
opts))
(defn workload
[_]
{:client (->BatchSetClient (atom false) nil nil)
:generator [(adds)]
:final-generator (read-once)
:checker (checker/set)})
42 changes: 17 additions & 25 deletions cassandra/src/cassandra/collections/map.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
(:require [clojure.tools.logging :refer [debug info warn]]
[jepsen
[client :as client]
[checker :as checker]
[generator :as gen]]
[checker :as checker]]
[qbits.alia :as alia]
[qbits.hayt.dsl.clause :refer :all]
[qbits.hayt.dsl.statement :refer :all]
[qbits.hayt.utils :refer [map-type]]
[cassandra.core :refer :all]
[cassandra.conductors :as conductors])
[cassandra.core :refer :all])
(:import (clojure.lang ExceptionInfo)))

(defrecord CQLMapClient [tbl-created? cluster session writec]
Expand Down Expand Up @@ -41,14 +39,15 @@
(where [[= :id 0]]))
{:consistency writec})
(assoc op :type :ok))
:read (let [value (->> (alia/execute session
(select :maps (where [[= :id 0]]))
{:consistency :all})
first
:elements
vals
(into (sorted-set)))]
(assoc op :type :ok, :value value)))
:read (do (wait-rf-nodes test)
(let [value (->> (alia/execute session
(select :maps (where [[= :id 0]]))
{:consistency :all})
first
:elements
vals
(into (sorted-set)))]
(assoc op :type :ok, :value value))))

(catch ExceptionInfo e
(handle-exception op e))))
Expand All @@ -58,16 +57,9 @@

(teardown! [_ _]))

(defn map-test
[opts]
(merge (cassandra-test (str "map-" (:suffix opts))
{:client (->CQLMapClient (atom false)
nil nil :quorum)
:generator (gen/phases
(->> [(adds)]
(conductors/std-gen opts))
(conductors/terminate-nemesis opts)
(gen/sleep 60)
(read-once))
:checker (checker/set)})
opts))
(defn workload
[_]
{:client (->CQLMapClient (atom false) nil nil :quorum)
:generator [(adds)]
:final-generator (read-once)
:checker (checker/set)})
42 changes: 17 additions & 25 deletions cassandra/src/cassandra/collections/set.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns cassandra.collections.set
(:require [clojure.pprint :refer :all]
[clojure.tools.logging :refer [debug info warn]]
(:require [clojure.tools.logging :refer [debug info warn]]
[jepsen
[client :as client]
[checker :as checker]
Expand All @@ -9,8 +8,7 @@
[qbits.hayt.dsl.clause :refer :all]
[qbits.hayt.dsl.statement :refer :all]
[qbits.hayt.utils :refer [set-type]]
[cassandra.core :refer :all]
[cassandra.conductors :as conductors])
[cassandra.core :refer :all])
(:import (clojure.lang ExceptionInfo)))

(defrecord CQLSetClient [tbl-created? cluster session writec]
Expand All @@ -34,7 +32,7 @@
[:elements #{}]])
(if-exists false))))))

(invoke! [_ _ op]
(invoke! [_ test op]
(try
(alia/execute session (use-keyspace :jepsen_keyspace))
(case (:f op)
Expand All @@ -44,13 +42,14 @@
(where [[= :id 0]]))
{:consistency writec})
(assoc op :type :ok))
:read (let [value (->> (alia/execute session
(select :sets (where [[= :id 0]]))
{:consistency :all})
first
:elements
(into (sorted-set)))]
(assoc op :type :ok, :value value)))
:read (do (wait-rf-nodes test)
(let [value (->> (alia/execute session
(select :sets (where [[= :id 0]]))
{:consistency :all})
first
:elements
(into (sorted-set)))]
(assoc op :type :ok, :value value))))

(catch ExceptionInfo e
(handle-exception op e))))
Expand All @@ -60,16 +59,9 @@

(teardown! [_ _]))

(defn set-test
[opts]
(merge (cassandra-test (str "set-" (:suffix opts))
{:client (->CQLSetClient (atom false)
nil nil :quorum)
:generator (gen/phases
(->> [(adds)]
(conductors/std-gen opts))
(conductors/terminate-nemesis opts)
(gen/sleep 60)
(read-once))
:checker (checker/set)})
opts))
(defn workload
[_]
{:client (->CQLSetClient (atom false) nil nil :quorum)
:generator [(adds)]
:final-generator (read-once)
:checker (checker/set)})
104 changes: 0 additions & 104 deletions cassandra/src/cassandra/conductors.clj

This file was deleted.

Loading