在HikariCP中的连接上重置(autoCommit)

问题描述:

在Hikari池中使用连接时,我一直看到此日志.

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.

这意味着:

  • 该池被配置为自动提交,但是代码将连接更改为autoCommit = false,然后将它们返回到该池,或者
  • 该池被配置为 not 自动提交,但是代码将连接更改为autoCommit = true,然后将它们返回到池中.
  • 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.

每当以不同的autoCommit模式返回连接时,HikariCP会将autoCommit重置为池默认值.通常,这可能会对性能产生负面影响;有时会很大.

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.