mysql大数据插入删除同时进行,删除出错 现在公司在做一个项目,需要对同一张表进行日志的插入与删除,插入采用批处理的方式,进行新日志的插入,删除用delete方式,删除过期的日志,每天插入的日志量大约是15个G左右,那删除过期日志也是按天,也大约是15个G,在删除过程中,总出现这样的问题,java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1605)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1524)
at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:196)
at com.lenovo.soc.logmgmt.logconfig.db.logmgmt_DelLogAuto.dellastlog(logmgmt_DelLogAuto.java:209)
at com.lenovo.soc.logmgmt.LogDelService.delEarliestLog(LogDelService.java:233)
at com.lenovo.soc.logmgmt.LogDelService.run(LogDelService.java:114)
(1281547 ms) INFO : com.lenovo.soc.logmgmt.logconfig.db.logmgmt_DelLogAuto#info : 删除最早一天的记录错误
16:03:34,937 INFO [ db.logmgmt_DelLogAuto] - 删除最早一天的记录错误
java.sql.SQLException: Connection is closed.
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.checkOpen(PoolingDataSource.java:219)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:337)
at com.lenovo.soc.logmgmt.logconfig.db.logmgmt_DelLogAuto.dellastlog(logmgmt_DelLogAuto.java:233)
at com.lenovo.soc.logmgmt.LogDelService.delEarliestLog(LogDelService.java:233)
at com.lenovo.soc.logmgmt.LogDelService.run(LogDelService.java:114)
请教各们高手,该如何解决?
--转自