Reset (autoCommit) on connection in HikariCP
Asked Answered
T

1

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.

Teter answered 17/12, 2016 at 19:25 Comment(0)
A
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.

Appellee answered 18/12, 2016 at 6:21 Comment(4)
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?Teter
1 more question. If I do above, I get Reset (nothing) on connection conn0. Is that expected and normal?Teter
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.Appellee
@Appellee What is that negative impact ? We have faced issue with both (autocommit = true/false).Salina

© 2022 - 2024 — McMap. All rights reserved.