From a47705a75769504ad5c41173aefd496f7afa4d2a Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Tue, 15 Oct 2024 15:39:45 +0300 Subject: [PATCH] one more attempt --- .github/workflows/docker-jepsen.yml | 4 +++ .../jepsen_main/jepsen/src/jepsen/mysync.clj | 34 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-jepsen.yml b/.github/workflows/docker-jepsen.yml index 1985556b..3a945b6a 100644 --- a/.github/workflows/docker-jepsen.yml +++ b/.github/workflows/docker-jepsen.yml @@ -3,6 +3,10 @@ name: Jepsen tests on: schedule: - cron: '0 0 * * *' + push: + branches: [ master ] + pull_request: + branches: [ master ] env: GO_VERSION: 1.22.4 diff --git a/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj b/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj index 85a3e938..a2be1b8a 100644 --- a/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj +++ b/tests/images/jepsen_main/jepsen/src/jepsen/mysync.clj @@ -76,6 +76,15 @@ client/Reusable (reusable? [_ test] true))) +(defn read_portion [c n chunk_size] + (def q (str "select value from test1.test_set order by value desc limit " chunk_size " offset " (* n chunk_size))) + (info (str "Query: " q)) + (def result_value (->> (j/query c [q] + {:row-fn :value}) + (vec) + (set))) + result_value) + (defn mysql-client "MySQL client" [conn] @@ -93,15 +102,22 @@ (try (with-conn [c conn] (case (:f op) - :read (timeout 600000 (assoc op :type :info, :error "read-timeout") - (cond (= (count (j/query c ["show slave status for channel ''"])) 0) + :read (timeout 1200000 (assoc op :type :info, :error "read-timeout") + (cond (= (count (j/query c ["show slave status for channel ''"])) 0) + (do + (def value_cnt (:count (first (j/query c ["select count(*) as count from test1.test_set"])))) + (def chunk_size 5000) + (def total_cnt (Math/ceil (/ value_cnt chunk_size))) + (info (str "Values count: " value_cnt)) + (info (str "Values ceil: " total_cnt)) + (def result_set (set '())) + (dotimes [n (+ total_cnt 1)] + (info (str "Reading portion " n)) + (def result_set (set/union result_set (read_portion c n chunk_size)))) (assoc op :type :ok, - :value (->> (j/query c ["select value from test1.test_set"] - {:row-fn :value}) - (vec) - (set))) - true - (assoc op :type :info, :error "read-only"))) + :value result_set)) + true + (assoc op :type :info, :error "read-only"))) :add (timeout 5000 (assoc op :type :info, :error "add-timeout") (do (info (str "Adding: " (get op :value) " to " (get c :subname))) @@ -276,7 +292,7 @@ (gen/nemesis (fn [] (map gen/once [{:type :info, :f :stop} - {:type :sleep, :value 600}]))) + {:type :sleep, :value 1200}]))) (gen/time-limit 1200))) :checker mysync-set :remote control/ssh})