Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close connections to DBMS #35

Open
ligurio opened this issue Oct 5, 2020 · 0 comments
Open

Close connections to DBMS #35

ligurio opened this issue Oct 5, 2020 · 0 comments

Comments

@ligurio
Copy link
Member

ligurio commented Oct 5, 2020

Right now connections in a client stay opened and we should close them.
Unfortunatley there is no arbitrary method in next.jdbc to close a connection.

See discussion: https://clojureverse.org/t/how-to-manage-database-connection-in-clojure/5067/8

Possible solution in https://www.github.com/jepsen-io/redis/tree/master/src%2Fjepsen%2Fredis%2Fclient.clj

(defn close!
  "Closes a connection to a node."
  [^java.io.Closeable conn]
  (.close (:pool conn)))

Another approach is to use with-open, that will cleanup connection automatically - https://cljdoc.org/d/seancorfield/next.jdbc/1.1.610/doc/getting-started/prepared-statements

It is possible to log connect/disconnect operations in Tarantool with triggers - https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_session/#box-session-on-connect:

function log_connect ()
  local log = require('log')
  local m = 'Connection. user=' .. box.session.user() .. ' id=' .. box.session.id()
  log.info(m)
end

function log_disconnect ()
  local log = require('log')
  local m = 'Disconnection. user=' .. box.session.user() .. ' id=' .. box.session.id()
  log.info(m)
end

box.session.on_connect(log_connect)
box.session.on_disconnect(log_disconnect)

Logging shows that Jepsen performs about 500 connects in test Counter, i.e. one connection per operation.

@ligurio ligurio self-assigned this Nov 6, 2020
@ligurio ligurio removed their assignment Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant