Skip to content

Commit 4d3483d

Browse files
committed
Make spaces used in tests synchronous
Synchronous replication should be enabled per-space using the `is_sync` option. This option has been accidentally lost in a commit "Rewrite client in a register workload" 3214905 Closes #51
1 parent d2b34f5 commit 4d3483d

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/tarantool/counter.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
(j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
3232
" (id INT NOT NULL PRIMARY KEY,
3333
count INT NOT NULL)")]))
34-
(sql/insert! conn table-name {:id 0 :count 0}))
34+
(sql/insert! conn table-name {:id 0 :count 0})
35+
(let [table (clojure.string/upper-case table-name)]
36+
(j/execute! conn [(str "SELECT LUA('return box.space." table ":alter{ is_sync = true } or 1')")])))
3537
(assoc this :conn conn :node node)))
3638

3739
(invoke! [this test op]

src/tarantool/register.clj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@
3737
(setup! [this test node]
3838
(let [conn (cl/open node test)]
3939
(assert conn)
40-
(cl/with-conn-failure-retry conn
41-
(j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
42-
" (id INT NOT NULL PRIMARY KEY,
43-
value INT NOT NULL)")]))
40+
(if (= node (jepsen/primary test))
41+
(cl/with-conn-failure-retry conn
42+
(j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
43+
" (id INT NOT NULL PRIMARY KEY,
44+
value INT NOT NULL)")])
45+
(let [table (clojure.string/upper-case table-name)]
46+
(j/execute! conn [(str "SELECT LUA('return box.space." table ":alter{ is_sync = true } or 1')")]))))
4447
(assoc this :conn conn :node node)))
4548

4649
(invoke! [this test op]

src/tarantool/sets.clj

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@
2626

2727
(setup! [this test node]
2828
(let [conn (cl/open node test)]
29-
(assert conn)
30-
(cl/with-conn-failure-retry conn
31-
(j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
32-
" (id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
33-
value INT NOT NULL)")]))
34-
(assoc this :conn conn :node node)))
29+
(assert conn)
30+
(if (= node (jepsen/primary test))
31+
(cl/with-conn-failure-retry conn
32+
(j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
33+
" (id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
34+
value INT NOT NULL)")])
35+
(let [table (clojure.string/upper-case table-name)]
36+
(j/execute! conn [(str "SELECT LUA('return box.space." table ":alter{ is_sync = true } or 1')")]))))
37+
(assoc this :conn conn :node node)))
3538

3639
(invoke! [this test op]
3740
(let [[k v] (:value op)]

0 commit comments

Comments
 (0)