Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FiV0 committed Oct 17, 2024
1 parent 1bab35c commit 0f8fbc8
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions core/src/main/clojure/xtdb/pgwire.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1338,22 +1338,22 @@
(cmd-send-error conn (or err (err-protocol-violation "transaction failed")))

(let [{:keys [error] :as tx-res} (execute-tx conn dml-buf {:default-tz (.getZone clock)
:system-time tx-system-time})
skip (skip-until-sync? conn)]
(if (or error skip)
(do
(swap! conn-state (fn [conn-state]
(cond-> conn-state
true (update :transaction assoc :failed true, :err error)
error (assoc :latest-submitted-tx tx-res))))
(when-not skip
(cmd-send-error conn (err-protocol-violation (ex-message error)))))
(do
(swap! conn-state (fn [conn-state]
(-> conn-state
(dissoc :transaction)
(assoc :latest-submitted-tx tx-res))))
(cmd-write-msg conn msg-command-complete {:command "COMMIT"})))))))
:system-time tx-system-time})]
(cond
(skip-until-sync? conn) nil

error (do
(swap! conn-state (fn [conn-state]
(-> conn-state
(update :transaction assoc :failed true, :err error)
(assoc :latest-submitted-tx tx-res))))
(cmd-send-error conn (err-protocol-violation (ex-message error))))
:else (do
(swap! conn-state (fn [conn-state]
(-> conn-state
(dissoc :transaction)
(assoc :latest-submitted-tx tx-res))))
(cmd-write-msg conn msg-command-complete {:command "COMMIT"})))))))

(defn cmd-rollback [{:keys [conn-state] :as conn}]
(swap! conn-state dissoc :transaction)
Expand Down

0 comments on commit 0f8fbc8

Please sign in to comment.