当前位置:网站首页>[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code

[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code

2022-07-06 07:14:00 Game programming

colleagues There's something wrong with the code

 Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();try{    // Create order     agOrderRelationSwjList.forEach(e->{        // If there's a record   Delete the original         //LambdaQueryWrapper<AgSwjMfiveOrder> queryWrapper = new LambdaQueryWrapper();        //queryWrapper.eq( AgSwjMfiveOrder::getMfiveOrder, order.getOrderCode() ).eq( AgSwjMfiveOrder::getSchemeId,e.getSchemeCode() );        //agSwjMfiveOrderService.remove(  queryWrapper);        operationFactory.getOperationService(SwjConstants.SWJ_L).createOrder(order.getOrderCode(),e.getSchemeCode());    });} catch (Exception e){    TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);    throw new ServiceException(" abnormal !");}

In the above fault code Deletion performed , Why do you lock the watch ? The transaction was not committed ? Transactions are automatically committed ... Go back and check the code
First processing MYSQL
select * from information_schema.innodb_trx
Inside trx There is no way kill Dropped
Sure
show engine innodb status
Get the data Search the corresponding trx_id
Will find Can be in show processlist The corresponding thread in ID, In this way, we can kill
The transaction thread of this failure ID Namely 194788882, You can see The information is still very comprehensive

【 Online problem solving 】 Caused by code mysql The problem of table deadlock , How to kill the corresponding process - The first 1 Zhang

author : Fang Dongxin

Game programming , A game development favorite ~

If the picture is not displayed for a long time , Please use Chrome Kernel browser .

原网站

版权声明
本文为[Game programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060711250291.html