From 93720670d2acd2cf5b0584c876bff1aba4c7d84a Mon Sep 17 00:00:00 2001 From: yito88 Date: Sat, 23 Nov 2024 21:40:12 +0100 Subject: [PATCH 1/2] add a log for each transfer transaction --- scalardb/src/scalardb/transfer.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scalardb/src/scalardb/transfer.clj b/scalardb/src/scalardb/transfer.clj index ac20329..1e794fb 100644 --- a/scalardb/src/scalardb/transfer.clj +++ b/scalardb/src/scalardb/transfer.clj @@ -1,6 +1,6 @@ (ns scalardb.transfer (:require [clojure.core.reducers :as r] - [clojure.tools.logging :refer [warn]] + [clojure.tools.logging :refer [info warn]] [jepsen [client :as client] [checker :as checker] @@ -86,6 +86,7 @@ (defn- tx-transfer [tx from to amount] + (info "Transferring" amount "from" from "to" to "by tx" (.getId tx)) (let [fromResult (.get tx (prepare-get from)) toResult (.get tx (prepare-get to))] (->> (calc-new-balance fromResult (- amount)) From b740b6950df0f88ddc3b1d9a7cbd251fcfb892dc Mon Sep 17 00:00:00 2001 From: yito88 Date: Sat, 23 Nov 2024 21:53:43 +0100 Subject: [PATCH 2/2] fix tests --- scalardb/test/scalardb/transfer_test.clj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scalardb/test/scalardb/transfer_test.clj b/scalardb/test/scalardb/transfer_test.clj index b750c60..ffff6fb 100644 --- a/scalardb/test/scalardb/transfer_test.clj +++ b/scalardb/test/scalardb/transfer_test.clj @@ -52,6 +52,7 @@ (def mock-transaction (reify DistributedTransaction + (^String getId [_] "dummy-tx-id") (^Optional get [_ ^Get g] (mock-get g)) (^void put [_ ^Put p] (mock-put p)) (^void commit [_] (swap! commit-count inc)))) @@ -65,6 +66,7 @@ (def mock-transaction-throws-exception (reify DistributedTransaction + (^String getId [_] "dummy-tx-id") (^Optional get [_ ^Get _] (throw (CrudException. "get failed" nil))) (^void put [_ ^Put _] (throw (CrudException. "put failed" nil))) (^void commit [_] (throw (CommitException. "commit failed" nil)))))