diff --git a/cockroachdb/src/jepsen/cockroach/client.clj b/cockroachdb/src/jepsen/cockroach/client.clj index 9190e7fbb..fbb2396b6 100644 --- a/cockroachdb/src/jepsen/cockroach/client.clj +++ b/cockroachdb/src/jepsen/cockroach/client.clj @@ -116,6 +116,17 @@ (assoc op :type :fail) op)) +(defn with-idempotent-txn + "Takes a predicate on operation functions, and a txn op, presumably resulting + from a client call. If idempotent? is truthy for all of the txn's operations, + remaps :info types to :fail." + [idempotent? op] + (let [[_ txn] (:value op) + fs (map first txn)] + (if (and (every? idempotent? fs) (= :info (:type op))) + (assoc op :type :fail) + op))) + (defmacro with-timeout "Like util/timeout, but throws (RuntimeException. \"timeout\") for timeouts. Throwing means that when we time out inside a with-conn, the connection state diff --git a/cockroachdb/src/jepsen/cockroach/multiregister.clj b/cockroachdb/src/jepsen/cockroach/multiregister.clj index b65b86d6f..e94d1cd35 100644 --- a/cockroachdb/src/jepsen/cockroach/multiregister.clj +++ b/cockroachdb/src/jepsen/cockroach/multiregister.clj @@ -64,7 +64,7 @@ (info "Created table" t)))))) (invoke! [this test op] - (c/with-idempotent #{:read} + (c/with-idempotent-txn #{:read} (c/with-exception->op op (c/with-conn [c conn] (c/with-timeout @@ -73,7 +73,7 @@ (let [[ik txn] (:value op) txn' (mapv (fn [[f id val]] - (let [t (id->table id) + (let [t (id->table id) val' (case f :read (-> c @@ -115,7 +115,7 @@ (fn [k] (->> (gen/mix [r w]) (gen/stagger 1/100) - (gen/limit 100))))} + (gen/limit 60))))} :model (model/multi-register {}) :checker (checker/compose {:perf (checker/perf)