otter 底层表retl.retl_mark报锁超时

jbose2ul  于 3个月前  发布在  其他
关注(0)|答案(5)|浏览(72)

在凌晨2:00到2:20数据库之间大批量数据同步的时候报错。报错信息如下:
2017-06-24 02:25:16.682 [DbLoadAction] WARN com.alibaba.otter.node.etl.load.loader.db.DbLoadAction - ##load phase one failed!
java.util.concurrent.ExecutionException: com.alibaba.otter.node.etl.load.exception.LoadException: org.springframework.dao.CannotAcquireLockException: PreparedStatemen
tCallback; SQL [INSERT INTO retl.retl_mark (id, channel_id) VALUES (?, ?) ON DUPLICATE KEY UPDATE channel_id = VALUES(channel_id)]; Lock wait timeout exceeded; try re
starting transaction; nested exception is java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:261)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:812)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:868)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:876)
at com.alibaba.otter.node.etl.load.loader.db.interceptor.operation.AbstractOperationInterceptor.updateMark(AbstractOperationInterceptor.java:167)
at com.alibaba.otter.node.etl.load.loader.db.interceptor.operation.AbstractOperationInterceptor.transactionBegin(AbstractOperationInterceptor.java:119)
at com.alibaba.otter.node.etl.load.loader.db.interceptor.operation.AbstractOperationInterceptor.transactionBegin(AbstractOperationInterceptor.java:51)
at com.alibaba.otter.node.etl.load.loader.db.interceptor.operation.OperationInterceptorFactory.transactionBegin(OperationInterceptorFactory.java:49)
at com.alibaba.otter.node.etl.load.loader.db.interceptor.operation.OperationInterceptorFactory.transactionBegin(OperationInterceptorFactory.java:39)
at com.alibaba.otter.node.etl.load.loader.interceptor.ChainLoadInterceptor.transactionBegin(ChainLoadInterceptor.java:61)
at com.alibaba.otter.node.etl.load.loader.interceptor.ChainLoadInterceptor.transactionBegin(ChainLoadInterceptor.java:26)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker$1.doInTransaction(DbLoadAction.java:585)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.doCall(DbLoadAction.java:578)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.call(DbLoadAction.java:541)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.call(DbLoadAction.java:513)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2535)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1911)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2145)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2081)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2066)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:818)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:1)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)
... 19 more

retl.retl_mark锁超时,不知道是不是同步数据太多导致锁表?这个怎么解决啊?

kzmpq1sx

kzmpq1sx1#

环境信息: 数据库是两套MYSQL 5.6.27,分别部署在同城不同机房。同步方式:双向同步。

dgtucam1

dgtucam12#

一个mysql上配置了多个同步任务么?

6xfqseft

6xfqseft3#

我配置了链式同步的。比如: B <-> A <-> C。在A库上有两个同步任务,即要同步到B,也要同步到C。后边我调整了库的锁超时时间,没有出现问题了

3wabscal

3wabscal4#

我也遇到这个问题,是什么原理呢?数据库锁超时设置的是3s ,按理说已经比较长了,retl_mark表总共才1000条数据。是锁竞争太激烈吗? @agapple

gojuced7

gojuced75#

我配置了链式同步的。比如: B <-> A <-> C。在A库上有两个同步任务,即要同步到B,也要同步到C。后边我调整了库的锁超时时间,没有出现问题了

我们目前设置的是3s有这个问题,兄台从多少调整到多少就好了呢?调整的原则是什么

相关问题