mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Style
This commit is contained in:
parent
077a2019b6
commit
8cf8265d47
@ -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)))
|
||||
|
@ -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}]))}})
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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 <<
|
||||
|
Loading…
Reference in New Issue
Block a user