Skip to content

Commit 3e48127

Browse files
committed
Choose data engine to use
Fix setting data engine broken in commit "Rewrite client in a register workload" 3214905 and add option validation. Blocked by tarantool/tarantool-java#63 Closes #52
1 parent 8fa9039 commit 3e48127

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/tarantool/counter.clj

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
(Thread/sleep 10000) ; wait for leader election and joining to a cluster
2929
(when (= node (first (db/primaries test)))
3030
(cl/with-conn-failure-retry conn
31+
(j/execute! conn [(str "SET SESSION \"sql_default_engine\" = '" (:engine test) "'")])
3132
(j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
3233
" (id INT NOT NULL PRIMARY KEY,
3334
count INT NOT NULL)")]))

src/tarantool/register.clj

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
(Thread/sleep 10000) ; wait for leader election and joining to a cluster
3838
(if (= node (first (db/primaries test)))
3939
(cl/with-conn-failure-retry conn
40+
(j/execute! conn [(str "SET SESSION \"sql_default_engine\" = '" (:engine test) "'")])
4041
(j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
4142
" (id INT NOT NULL PRIMARY KEY,
4243
value INT NOT NULL)")])

src/tarantool/runner.clj

+8-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
(def minimal-concurrency
2727
10)
2828

29+
(def engines
30+
"Types of engines."
31+
#{:memtx :vinyl})
32+
2933
(def workloads
3034
"A map of workload names to functions that can take opts and construct
3135
workloads.
@@ -96,7 +100,9 @@
96100
:validate [#(and (number? %) (pos? %)) "must be a positive number"]]
97101
["-e" "--engine NAME"
98102
"What Tarantool data engine should we use?"
99-
:default "memtx"]])
103+
:parse-fn keyword
104+
:validate [engines (cli/one-of engines)]
105+
:default :memtx]])
100106

101107
(def test-all-opts
102108
"Command line options for testing everything."
@@ -178,7 +184,7 @@
178184
:name (str "tarantool-" (:version opts))
179185
:os ubuntu/os
180186
:db (db/db (:version opts))
181-
:engine (:engine opts)
187+
:engine (name (:engine opts))
182188
:mvcc (:mvcc opts)
183189
:pure-generators true
184190
:concurrency (if (and (< (:concurrency opts) minimal-concurrency)

src/tarantool/sets.clj

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
(Thread/sleep 10000) ; wait for leader election and joining to a cluster
3131
(if (= node (first (db/primaries test)))
3232
(cl/with-conn-failure-retry conn
33+
(j/execute! conn [(str "SET SESSION \"sql_default_engine\" = '" (:engine test) "'")])
3334
(j/execute! conn [(str "CREATE TABLE IF NOT EXISTS " table-name
3435
" (id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
3536
value INT NOT NULL)")])

0 commit comments

Comments
 (0)