This commit is contained in:
alesapin 2021-03-16 15:37:46 +03:00
parent 077a2019b6
commit 8cf8265d47
5 changed files with 46 additions and 30 deletions

View File

@ -75,9 +75,9 @@
db/LogFiles
(log-files [_ test node]
(c/su
(cu/stop-daemon! (str binary-path "/clickhouse") pidfile)
(c/cd dir
(c/exec :tar :czf "coordination.tar.gz" "coordination")))
(cu/stop-daemon! (str binary-path "/clickhouse") pidfile)
(c/cd dir
(c/exec :tar :czf "coordination.tar.gz" "coordination")))
[logfile serverlog (str dir "/coordination.tar.gz")])))
(def workloads
@ -105,7 +105,8 @@
:concurrency, ...), constructs a test map."
[opts]
(let [quorum (boolean (:quorum opts))
workload ((get workloads (:workload opts)) opts)]
workload ((get workloads (:workload opts)) opts)
current-nemesis (get custom-nemesis/custom-nemesises "killer")]
(merge tests/noop-test
opts
{:name (str "clickhouse-keeper quorum=" quorum " " (name (:workload opts)))

View File

@ -1,12 +1,28 @@
(ns jepsen.nukeeper.nemesis
(:require [jepsen
[nemesis :as nemesis]]
[nemesis :as nemesis]
[generator :as gen]]
[jepsen.nukeeper.utils :refer :all]))
(defn random-single-node-killer-nemesis
[]
(nemesis/node-start-stopper
rand-nth
(fn start [test node] (kill-clickhouse! node test))
(fn stop [test node] (start-clickhouse! node test))))
rand-nth
(fn start [test node] (kill-clickhouse! node test))
(fn stop [test node] (start-clickhouse! node test))))
(def custom-nemesises
{"killer" {:nemesis (random-single-node-killer-nemesis)
:generator
(gen/nemesis
(cycle [(gen/sleep 5)
{:type :info, :f :start}
(gen/sleep 5)
{:type :info, :f :stop}]))}
"simple-partitioner" {:nemesis (nemesis/partition-random-halves)
:generator
(gen/nemesis
(cycle [(gen/sleep 5)
{:type :info, :f :start}
(gen/sleep 5)
{:type :info, :f :stop}]))}})

View File

@ -1,12 +1,12 @@
(ns jepsen.nukeeper.set
(:require
[clojure.tools.logging :refer :all]
[jepsen
[checker :as checker]
[client :as client]
[generator :as gen]]
[jepsen.nukeeper.utils :refer :all]
[zookeeper :as zk])
[clojure.tools.logging :refer :all]
[jepsen
[checker :as checker]
[client :as client]
[generator :as gen]]
[jepsen.nukeeper.utils :refer :all]
[zookeeper :as zk])
(:import (org.apache.zookeeper ZooKeeper KeeperException KeeperException$BadVersionException)))
(defrecord SetClient [k conn nodename]
@ -26,8 +26,8 @@
(do (info "LIST ON NODE" nodename (zk-list conn "/"))
(info "EXISTS NODE" (zk/exists conn "/a-set"))
(assoc op
:type :ok
:value (read-string (:data (zk-get-str conn k)))))
:type :ok
:value (read-string (:data (zk-get-str conn k)))))
;(catch Exception _ (assoc op :type :fail, :error :connect-error)))
:add (try
(do

View File

@ -63,13 +63,12 @@
[conn path data]
(zk/create conn path :data (data/to-bytes (str data))))
(defn clickhouse-alive?
[node test]
(info "Checking server alive on" node)
(try
(c/exec (str binary-path "/clickhouse") :client :--query "SELECT 1")
(catch Exception _ false)))
(c/exec (str binary-path "/clickhouse") :client :--query "SELECT 1")
(catch Exception _ false)))
(defn wait-clickhouse-alive!
[node test & {:keys [maxtries] :or {maxtries 30}}]
@ -82,17 +81,17 @@
[node test]
(info "Killing server on node" node)
(c/su
(cu/stop-daemon! (str binary-path "/clickhouse") pidfile)))
(cu/stop-daemon! (str binary-path "/clickhouse") pidfile)))
(defn start-clickhouse!
[node test]
(info "Starting server on node" node)
(c/su
(cu/start-daemon!
{:pidfile pidfile
:logfile logfile
:chdir dir}
(str binary-path "/clickhouse")
:server
:--config "/etc/clickhouse-server/config.xml"))
(cu/start-daemon!
{:pidfile pidfile
:logfile logfile
:chdir dir}
(str binary-path "/clickhouse")
:server
:--config "/etc/clickhouse-server/config.xml"))
(wait-clickhouse-alive! node test))

View File

@ -22,8 +22,8 @@ void dumpMachine(std::shared_ptr<NuKeeperStateMachine> machine)
{
auto key = keys.front();
keys.pop();
auto value = storage.container.getValue(key);
std::cout << key << "\n";
auto value = storage.container.getValue(key);
std::cout << "\tStat: {version: " << value.stat.version <<
", mtime: " << value.stat.mtime <<
", emphemeralOwner: " << value.stat.ephemeralOwner <<