Integrating into jepsen

This commit is contained in:
alesapin 2021-04-14 12:01:33 +03:00
parent 9a59c12f7e
commit a893cd3fe6
4 changed files with 54 additions and 25 deletions

View File

@ -9,5 +9,6 @@
:dependencies [[org.clojure/clojure "1.10.1"]
[jepsen "0.2.3"]
[zookeeper-clj "0.9.4"]
[me.raynes/conch "0.8.0"]
[org.apache.zookeeper/zookeeper "3.6.1" :exclusions [org.slf4j/slf4j-log4j12]]]
:repl-options {:init-ns jepsen.clickhouse-keeper.main})

View File

@ -125,22 +125,22 @@
(c/exec :rm :-rf logs-dir)
(c/exec :rm :-rf configs-dir)))
db/LogFiles
(log-files [_ test node]
(c/su
(if (cu/exists? pid-file-path)
(do
(info node "Collecting traces")
(collect-traces test node))
(info node "Pid files doesn't exists"))
(kill-clickhouse! node test)
(if (cu/exists? coordination-data-dir)
(do
(info node "Coordination files exists, going to compress")
(c/cd data-dir
(c/exec :tar :czf "coordination.tar.gz" "coordination")))))
(let [common-logs [stderr-file (str logs-dir "/clickhouse-server.log") (str data-dir "/coordination.tar.gz")]
gdb-log (str logs-dir "/gdb.log")]
(if (cu/exists? (str logs-dir "/gdb.log"))
(conj common-logs gdb-log)
common-logs)))))
));db/LogFiles
;(log-files [_ test node]
; (c/su
; (if (cu/exists? pid-file-path)
; (do
; (info node "Collecting traces")
; (collect-traces test node))
; (info node "Pid files doesn't exists"))
; (kill-clickhouse! node test)
; (if (cu/exists? coordination-data-dir)
; (do
; (info node "Coordination files exists, going to compress")
; (c/cd data-dir
; (c/exec :tar :czf "coordination.tar.gz" "coordination")))))
; (let [common-logs [stderr-file (str logs-dir "/clickhouse-server.log") (str data-dir "/coordination.tar.gz")]
; gdb-log (str logs-dir "/gdb.log")]
; (if (cu/exists? (str logs-dir "/gdb.log"))
; (conj common-logs gdb-log)
; common-logs)))))

View File

@ -9,6 +9,7 @@
[jepsen.clickhouse-keeper.unique :as unique]
[jepsen.clickhouse-keeper.queue :as queue]
[jepsen.clickhouse-keeper.counter :as counter]
[jepsen.clickhouse-keeper.bench :as bench]
[jepsen.clickhouse-keeper.constants :refer :all]
[clojure.string :as str]
[jepsen
@ -72,12 +73,15 @@
:validate [pos? "Must be a positive integer."]]
[nil, "--lightweight-run" "Subset of workloads/nemesises which is simple to validate"]
[nil, "--reuse-binary" "Use already downloaded binary if it exists, don't remove it on shutdown"]
[nil, "--bench" "Run perf-test mode"]
[nil, "--bench-opts STR" "Run perf-test mode"
:default "--generator list_medium_nodes -c 30 -i 1000"]
["-c" "--clickhouse-source URL" "URL for clickhouse deb or tgz package"
:default "https://clickhouse-builds.s3.yandex.net/21677/ef82333089156907a0979669d9374c2e18daabe5/clickhouse_build_check/clang-11_relwithdebuginfo_none_bundled_unsplitted_disable_False_deb/clickhouse-common-static_21.4.1.6313_amd64.deb"]])
:default "https://clickhouse-builds.s3.yandex.net/21677/ef82333089156907a0979669d9374c2e18daabe5/clickhouse_build_check/clang-11_relwithdebuginfo_none_bundled_unsplitted_disable_False_deb/clickhouse-common-static_21.4.1.6313_amd64.deb"]
[nil "--bench-path path" "Path to keeper-bench util"
:default "/home/alesap/code/cpp/BuildCH/utils/keeper-bench/keeper-bench"]])
(defn clickhouse-keeper-test
"Given an options map from the command line runner (e.g. :nodes, :ssh,
:concurrency, ...), constructs a test map."
(defn clickhouse-func-tests
[opts]
(info "Test opts\n" (with-out-str (pprint opts)))
(let [quorum (boolean (:quorum opts))
@ -105,6 +109,30 @@
(gen/sleep 10)
(gen/clients (:final-generator workload)))})))
(defn clickhouse-perf-test
[opts]
(info "Starting performance test")
(let [dct {:type :invoke :bench-opts (:bench-opts opts) :bench-path (:bench-path opts)}]
(merge tests/noop-test
opts
{:name (str "clickhouse-keeper-perf")
:os ubuntu/os
:db (db (:clickhouse-source opts) (boolean (:reuse-binary opts)))
:pure-generators true
:client (bench/bench-client)
:nemesis nemesis/noop
:generator (->> dct
(gen/stagger 1)
(gen/nemesis nil))})))
(defn clickhouse-keeper-test
"Given an options map from the command line runner (e.g. :nodes, :ssh,
:concurrency, ...), constructs a test map."
[opts]
(if (boolean (:bench opts))
(clickhouse-perf-test opts)
(clickhouse-func-tests opts)))
(def all-nemesises (keys custom-nemesis/custom-nemesises))
(def all-workloads (keys workloads))

View File

@ -24,8 +24,8 @@ std::string generateRandomString(size_t length)
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
thread_local static pcg64 rng(randomSeed());
thread_local static std::uniform_int_distribution<size_t> pick(0, sizeof(chars) - 2);
static pcg64 rng(randomSeed());
static std::uniform_int_distribution<size_t> pick(0, sizeof(chars) - 2);
std::string s;