12

I keep seeing this log when I use connections in Hikari pool.

[com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314
[com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314
[com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314
[com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314
[com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314
[com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314
[com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314

What does that mean? Is this something I should worry about/fix, or is it normal? I'm trying to understand what really happens there.

Bee
  • 12,251
  • 11
  • 46
  • 73

1 Answers1

20

It means either:

  • the pool is configured as auto-commit, but code is changing connections to autoCommit=false, and then returning them to the pool, or
  • the pool is configured as not auto-commit, but code is changing the connections to autoCommit=true, and then returning them to the pool.

HikariCP will reset autoCommit to the pool default whenever a connection is returned with a different autoCommit mode. In general this can have a negative impact on performance; sometimes quite large.

brettw
  • 10,664
  • 2
  • 42
  • 59
  • Thank you. In my case, it's the former. So, if letting HikariCP change the autocommit to default is expensive, am I supposed to make `autocommit=true` before closing the connection? – Bee Dec 18 '16 at 06:29
  • 1 more question. If I do above, I get `Reset (nothing) on connection conn0`. Is that expected and normal? – Bee Dec 18 '16 at 06:53
  • 1
    Ideally, pool ``autoCommit`` should be configured to match whatever your persistence is doing *most often*. If your persistence is sometimes ``autoCommit=true`` and sometimes ``autoCommit=false``, then whether *you* reset the connection to the pool default yourself, or let HikariCP do it, the cost will be the same. However, if you do it yourself, at least you will avoid a debug log message. The ``Reset (nothing)...`` message is no longer logged, so I suggest you upgrade HikariCP; but it is harmless. – brettw Dec 18 '16 at 15:03
  • @brettw What is that negative impact ? We have faced issue with both (autocommit = true/false). – dReAmEr Jan 15 '19 at 10:00