-
Enhancement
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
False
-
None
-
False
Hi,
I use debezium with embeded mode. And recently I found that the Mysql connection failed to close gracefully when I stop the engine which is in snapshot progress.
It seems the close connection operation failed on connection rollback stage. But I think there is no need to do rollback operation as the snapshot stage only read data from db.
So IMHO we can set the Mysql Connection autoCommit flag to true, so as to skip the rollback operation on close the connection for snapshot.
Here is the current code setting the autoCommit flag for snapshot below:
public Connection createSnapshotConnection() throws SQLException { Connection connection = jdbcConnection.connection(); connection.setAutoCommit(false); return connection; }
The error log is as shown below.
2024-05-31 11:00:02.211 ERROR,Exception while closing JDBC connection java.sql.SQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:111) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:98) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:90) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:64) at com.mysql.cj.jdbc.ConnectionImpl.rollback$original$6grSIZml(ConnectionImpl.java:1807) at com.mysql.cj.jdbc.ConnectionImpl.rollback$original$6grSIZml$accessor$37h7qWO5(ConnectionImpl.java) at com.mysql.cj.jdbc.ConnectionImpl$auxiliary$MwBUxxO7.call(Unknown Source) at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86) at com.mysql.cj.jdbc.ConnectionImpl.rollback(ConnectionImpl.java) at com.mysql.cj.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:1667) at com.mysql.cj.jdbc.ConnectionImpl.close$original$6grSIZml(ConnectionImpl.java:710) at com.mysql.cj.jdbc.ConnectionImpl.close$original$6grSIZml$accessor$37h7qWO5(ConnectionImpl.java) at com.mysql.cj.jdbc.ConnectionImpl$auxiliary$EUx697Cz.call(Unknown Source) at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86) at com.mysql.cj.jdbc.ConnectionImpl.close(ConnectionImpl.java) at io.debezium.jdbc.JdbcConnection.lambda$doClose$4(JdbcConnection.java:946) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)