Skip to content

Commit 38e72ac

Browse files
committed
Write via leader only
1 parent ba1f06c commit 38e72ac

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/tarantool/counter.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
(cl/with-error-handling op
3939
(cl/with-txn-aborts op
4040
(case (:f op)
41-
:add (do (j/execute! conn
42-
[(str "UPDATE " table-name " SET count = count + ? WHERE id = 0") (:value op)])
41+
:add (let [con (cl/open (jepsen/primary test) test)]
42+
(do (j/execute! con
43+
[(str "UPDATE " table-name " SET count = count + ? WHERE id = 0") (:value op)]))
4344
(assoc op :type :ok))
4445

4546
:read (let [value (:COUNT

src/tarantool/register.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
:cas (let [[old new] (:value op)
6060
con (cl/open (jepsen/primary test) test)
6161
table (clojure.string/upper-case table-name)]
62-
(assoc op :type (if (->> (j/execute! conn
62+
(assoc op :type (if (->> (j/execute! con
6363
[(str "SELECT _CAS(1, " old ", " new ", '" table "')")])
6464
(first)
6565
(vals)

src/tarantool/sets.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
(cl/with-error-handling op
3838
(cl/with-txn-aborts op
3939
(case (:f op)
40-
:add (do (sql/insert! conn table-name {:value v})
41-
(assoc op :type :ok))
40+
:add (let [con (cl/open (jepsen/primary test) test)]
41+
(do (sql/insert! con table-name {:value v})
42+
(assoc op :type :ok)))
4243

4344
:read (->> (sql/query conn [(str "SELECT * FROM " table-name)])
4445
(mapv :VALUE)

0 commit comments

Comments
 (0)