背景
2019 双十一前走查异常日志,发现有一个死锁日志,现将排查过程记录如下。
排查过程
- 查看业务死锁日志,业务代码
全部业务死锁日志如下:
2019-11-05 15:02:44,990 |0b51153515729373648846445e1bf6| [HSFBizProcessor-DEFAULT-8-thread-47] ERROR c.a.c.c.manager.SessionUserManager - quitSession
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: ERR-CODE: [TDDL-4614][ERR_EXECUTE_ON_MYSQL] Error occurs when execute on GROUP 'CCO_XSPACE_SESSION_0003_GROUP' ATOM 'db198205096_cloud_eu126_cco_xspace_session_0003_3417': Deadlock found when trying to get lock; try restarting transaction More: [http://middleware.alibaba-inc.com/faq/faqByFaqCode.html?faqCode=TDDL-4614]
### The error may exist in class path resource [mappers/session_users_sqlmap_mapping.xml]
### The error may involve com.alibaba.cxdc.connected.dao.OcsSessionUserMapper.delete-Inline
### The error occurred while setting parameters
### SQL: delete from connected_session_users where sid = ? and user_id = ?
### Cause: ERR-CODE: [TDDL-4614][ERR_EXECUTE_ON_MYSQL] Error occurs when execute on GROUP 'CCO_XSPACE_SESSION_0003_GROUP' ATOM 'db198205096_cloud_eu126_cco_xspace_session_0003_3417': Deadlock found when trying to get lock; try restarting transaction More: [http://middleware.alibaba-inc.com/faq/faqByFaqCode.html?faqCode=TDDL-4614]
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy170.delete(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.delete(SqlSessionTemplate.java:310)
at com.alibaba.cxdc.connected.dao.base.DBCrmDAOBase.switchDelete(DBCrmDAOBase.java:311)
at com.alibaba.cxdc.connected.dao.impl.SessionUserDAOImpl.delete(SessionUserDAOImpl.java:96)
at com.alibaba.cxdc.connected.dao.impl.SessionUserDAOImpl$$FastClassBySpringCGLIB$$24a8bda3.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at com.taobao.csp.sentinel.entrypoint.proxy.TraceMethodInterceptor.invoke(TraceMethodInterceptor.java:81)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
at com.alibaba.cxdc.connected.dao.impl.SessionUserDAOImpl$$EnhancerBySpringCGLIB$$5a6023ad.delete(<generated>)
at sun.reflect.GeneratedMethodAccessor1029.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at com.alibaba.cxdc.connected.util.TenantDetectionAop.invoke(TenantDetectionAop.java:52)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy178.delete(Unknown Source)
at com.alibaba.cxdc.connected.manager.ConnectedSessionUserManager.delete(ConnectedSessionUserManager.java:161)
at com.alibaba.cxdc.connected.manager.SessionUserManager.quitSession(SessionUserManager.java:84)
at com.alibaba.cxdc.connected.service.impl.SessionServiceImpl.quitSession(SessionServiceImpl.java:151)
at com.alibaba.cxdc.connected.service.impl.XSpaceSessionUserServiceImpl.updateXSpaceSesionUser(XSpaceSessionUserServiceImpl.java:93)
at com.alibaba.cxdc.connected.service.impl.XSpaceSessionServiceImpl.resumeXSpaceSessionUsersAndHeart(XSpaceSessionServiceImpl.java:1074)
at sun.reflect.GeneratedMethodAccessor1160.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.taobao.csp.sentinel.entrypoint.entrance.HsfProviderInvocationHandler.invoke(HsfProviderInvocationHandler.java:96)
at com.sun.proxy.$Proxy206.resumeXSpaceSessionUsersAndHeart(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1160.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.taobao.hsf.remoting.provider.ReflectInvocationHandler.handleRequest0(ReflectInvocationHandler.java:83)
at com.taobao.hsf.remoting.provider.ReflectInvocationHandler.invoke(ReflectInvocationHandler.java:163)
at com.taobao.hsf2dubbo.DubboServerFilterAsyncInvocationHandlerInterceptor.invoke(DubboServerFilterAsyncInvocationHandlerInterceptor.java:54)
at com.taobao.hsf.filter.FilterInvocationHandler.invoke(FilterInvocationHandler.java:38)
at com.taobao.hsf.invocation.filter.RPCFilterBuilder$TailNode.invoke(RPCFilterBuilder.java:165)
at com.taobao.hsf.debug.DebugServerFilter.invoke(DebugServerFilter.java:25)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.common.filter.BidirectionServerResponseFilter.invoke(BidirectionServerResponseFilter.java:15)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.unit.service.impl.UnitServerFilter.invoke(UnitServerFilter.java:66)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.region.service.impl.RegionServerFilter.invoke(RegionServerFilter.java:42)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.plugins.octopus.OctopusServerFilter.invoke(OctopusServerFilter.java:72)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.plugins.spas.SpasServerFilter.invoke(SpasServerFilter.java:76)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.plugins.txc.TXCServerFilter.invoke(TXCServerFilter.java:35)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.tps.component.TPSServerFilter.invoke(TPSServerFilter.java:68)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.invocation.stats.InvocationStatsServerFilter.invoke(InvocationStatsServerFilter.java:47)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.monitor.log.filter.MonitorLogServerFilter.invoke(MonitorLogServerFilter.java:45)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.profiler.ProfilerServerFilter.invoke(ProfilerServerFilter.java:32)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.plugins.eagleeye.EagleEyeServerFilter.invoke(EagleEyeServerFilter.java:68)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.filter.QosServerFilter.invoke(QosServerFilter.java:60)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.rpc.server.MethodAbsenceFilter.invoke(MethodAbsenceFilter.java:48)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.rpc.server.EchoFilter.invoke(EchoFilter.java:45)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.rpc.generic.GenericInvocationServerFilter.invoke(GenericInvocationServerFilter.java:107)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf2dubbo.DubboGenericServerFilter.invoke(DubboGenericServerFilter.java:37)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.top.TopServerFilter.invoke(TopServerFilter.java:87)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.rpc.server.ServiceAbsenceFilter.invoke(ServiceAbsenceFilter.java:47)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.common.filter.CommonServerFilter.invoke(CommonServerFilter.java:24)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.common.filter.BidirectionServerRequestFilter.invoke(BidirectionServerRequestFilter.java:19)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf2dubbo.context.DubboRPCContextServerFilter.invoke(DubboRPCContextServerFilter.java:48)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.context.RPCContextServerFilter.invoke(RPCContextServerFilter.java:39)
at com.taobao.hsf.invocation.filter.RPCFilterNode.invoke(RPCFilterNode.java:71)
at com.taobao.hsf.invocation.filter.RPCFilterBuilder$HeadNode.invoke(RPCFilterBuilder.java:134)
at com.taobao.hsf.invocation.filter.FilterInvocationHandler.invoke(FilterInvocationHandler.java:28)
at com.taobao.hsf.remoting.provider.ServerContextInvocationHandler.invoke(ServerContextInvocationHandler.java:35)
at com.taobao.hsf.remoting.provider.ProviderProcessor.handleRequest(ProviderProcessor.java:70)
at com.taobao.hsf.io.remoting.hsf.message.HSFServerHandler$1.run(HSFServerHandler.java:189)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:756)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: ERR-CODE: [TDDL-4614][ERR_EXECUTE_ON_MYSQL] Error occurs when execute on GROUP 'CCO_XSPACE_SESSION_0003_GROUP' ATOM 'db198205096_cloud_eu126_cco_xspace_session_0003_3417': Deadlock found when trying to get lock; try restarting transaction More: [http://middleware.alibaba-inc.com/faq/faqByFaqCode.html?faqCode=TDDL-4614]
### The error may exist in class path resource [mappers/session_users_sqlmap_mapping.xml]
### The error may involve com.alibaba.cxdc.connected.dao.OcsSessionUserMapper.delete-Inline
### The error occurred while setting parameters
### SQL: delete from connected_session_users where sid = ? and user_id = ?
### Cause: ERR-CODE: [TDDL-4614][ERR_EXECUTE_ON_MYSQL] Error occurs when execute on GROUP 'CCO_XSPACE_SESSION_0003_GROUP' ATOM 'db198205096_cloud_eu126_cco_xspace_session_0003_3417': Deadlock found when trying to get lock; try restarting transaction More: [http://middleware.alibaba-inc.com/faq/faqByFaqCode.html?faqCode=TDDL-4614]
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:212)
at sun.reflect.GeneratedMethodAccessor985.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 94 common frames omitted
Caused by: com.taobao.tddl.common.exception.TddlRuntimeException: ERR-CODE: [TDDL-4614][ERR_EXECUTE_ON_MYSQL] Error occurs when execute on GROUP 'CCO_XSPACE_SESSION_0003_GROUP' ATOM 'db198205096_cloud_eu126_cco_xspace_session_0003_3417': Deadlock found when trying to get lock; try restarting transaction More: [http://middleware.alibaba-inc.com/faq/faqByFaqCode.html?faqCode=TDDL-4614]
at com.taobao.tddl.repo.mysql.spi.My_JdbcHandler.handleException(My_JdbcHandler.java:1426)
at com.taobao.tddl.repo.mysql.spi.My_JdbcHandler.executeUpdate(My_JdbcHandler.java:1088)
at com.taobao.tddl.repo.mysql.spi.My_Cursor.batchDelete(My_Cursor.java:435)
at com.taobao.tddl.repo.mysql.handler.DeleteMyHandler.executePut(DeleteMyHandler.java:26)
at com.taobao.tddl.repo.mysql.handler.PutMyHandlerCommon.handle(PutMyHandlerCommon.java:27)
at com.taobao.tddl.executor.AbstractGroupExecutor.executeInner(AbstractGroupExecutor.java:47)
at com.taobao.tddl.executor.AbstractGroupExecutor.execByExecPlanNode(AbstractGroupExecutor.java:36)
at com.taobao.tddl.executor.TopologyExecutor.execByExecPlanNode(TopologyExecutor.java:74)
at com.taobao.tddl.executor.MatrixExecutor.execByExecPlanNodeByOne(MatrixExecutor.java:800)
at com.taobao.tddl.executor.MatrixExecutor.execByExecPlanNode(MatrixExecutor.java:789)
at com.taobao.tddl.executor.MatrixExecutor.execute(MatrixExecutor.java:145)
at com.taobao.tddl.matrix.jdbc.TConnection.executeSQL(TConnection.java:275)
at com.taobao.tddl.matrix.jdbc.TPreparedStatement.executeSQL(TPreparedStatement.java:64)
at com.taobao.tddl.matrix.jdbc.TStatement.executeInternal(TStatement.java:142)
at com.taobao.tddl.matrix.jdbc.TPreparedStatement.execute(TPreparedStatement.java:49)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:52)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
... 99 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:951)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2009)
at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5098)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1994)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2723)
at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdate(FilterAdapter.java:1069)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeUpdate(FilterEventAdapter.java:491)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2721)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeUpdate(PreparedStatementProxyImpl.java:158)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:253)
at com.taobao.tddl.atom.jdbc.TPreparedStatementWrapper.executeUpdate(TPreparedStatementWrapper.java:137)
at com.taobao.tddl.group.jdbc.TGroupPreparedStatement.executeUpdateOnConnection(TGroupPreparedStatement.java:132)
at com.taobao.tddl.group.jdbc.TGroupStatement$1.tryOnDataSource(TGroupStatement.java:255)
at com.taobao.tddl.group.jdbc.TGroupStatement$1.tryOnDataSource(TGroupStatement.java:238)
at com.taobao.tddl.group.dbselector.EquityDbManager.tryExecuteInternal(EquityDbManager.java:280)
at com.taobao.tddl.group.dbselector.AbstractDBSelector.tryExecute(AbstractDBSelector.java:442)
at com.taobao.tddl.group.dbselector.AbstractDBSelector.tryExecute(AbstractDBSelector.java:449)
at com.taobao.tddl.group.jdbc.TGroupStatement.executeUpdateInternal(TGroupStatement.java:209)
at com.taobao.tddl.group.jdbc.TGroupStatement.executeUpdate(TGroupStatement.java:171)
at com.taobao.tddl.group.jdbc.TGroupPreparedStatement.executeUpdate(TGroupPreparedStatement.java:102)
at com.taobao.tddl.repo.mysql.spi.My_JdbcHandler.executeUpdate(My_JdbcHandler.java:1011)
... 117 common frames omitted
可以看到是如下 sql导致了死锁。
delete from connected_session_users where sid = ?
关键调用链如下:
at com.sun.proxy.$Proxy178.delete(Unknown Source)
at com.alibaba.cxdc.connected.manager.ConnectedSessionUserManager.delete(ConnectedSessionUserManager.java:161)
at com.alibaba.cxdc.connected.manager.SessionUserManager.quitSession(SessionUserManager.java:84)
at com.alibaba.cxdc.connected.service.impl.SessionServiceImpl.quitSession(SessionServiceImpl.java:151)
at com.alibaba.cxdc.connected.service.impl.XSpaceSessionUserServiceImpl.updateXSpaceSesionUser(XSpaceSessionUserServiceImpl.java:93)
at com.alibaba.cxdc.connected.service.impl.XSpaceSessionServiceImpl.resumeXSpaceSessionUsersAndHeart(XSpaceSessionServiceImpl.java:1074)
查看业务代码发现并没有使用事务,所以是 一条 sql
和 另一条 sql
,排查难度较大,所以需要进一步获取 mysql 死锁日志进行排查。
- 获取 mysql死锁日志,使用
show engine innodb status;
可以查看死锁日志。但是需要在主库上执行该语句,而从 idb 上查询是从备库查,经过与 dba,idb 同学,cloudDBA 同学沟通得到如下信息:
- 只有 owner 有权限在 idb 上直接查询主库
- cloudDBA 上的
死锁诊断
功能是无效的,且近期没有支持的打算。
最后在 idb 同学的帮助下获取了死锁日志,如下:
=====================================
2019-11-07 10:15:20 0x7fccf10ef700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 34 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 31988258 srv_active, 0 srv_shutdown, 5 srv_idle
srv_master_thread log flush and writes: 31987638
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 23203222
OS WAIT ARRAY INFO: reservation count 0
OS WAIT ARRAY INFO: reservation count 21341321
OS WAIT ARRAY INFO: reservation count 0
OS WAIT ARRAY INFO: reservation count 23210338
OS WAIT ARRAY INFO: reservation count 0
OS WAIT ARRAY INFO: reservation count 21337029
OS WAIT ARRAY INFO: reservation count 0
OS WAIT ARRAY INFO: reservation count 23188177
OS WAIT ARRAY INFO: reservation count 0
OS WAIT ARRAY INFO: reservation count 21338727
OS WAIT ARRAY INFO: reservation count 0
OS WAIT ARRAY INFO: reservation count 23198818
OS WAIT ARRAY INFO: reservation count 0
OS WAIT ARRAY INFO: reservation count 21337993
OS WAIT ARRAY INFO: reservation count 0
OS WAIT ARRAY INFO: signal count 231446746
RW-shared spins 0, rounds 542191924, OS waits 142503633
RW-excl spins 0, rounds 1167442614, OS waits 15206489
RW-sx spins 33729319, rounds 379378706, OS waits 6842293
Spin rounds per wait: 542191924.00 RW-shared, 1167442614.00 RW-excl, 11.25 RW-sx
------------------------
LATEST DETECTED DEADLOCK
------------------------
2019-11-05 15:02:44 0x7fcd2caef700
*** (1) TRANSACTION:
TRANSACTION 10476863046, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 3 lock struct(s), heap size 1136, 2 row lock(s)
MySQL thread id 3322429, OS thread handle 140493696530176, query id 5089036262 11.18.122.237 cco_xspace_sessi updating
/* 0b51153515729373648846445e1bf6/0.1.1.4.3//e21a688f// */delete from `connected_session_users_0102` where ((`sid` = '65c48fc3bcff47e1ac7a7ce787b2acde') AND (`user_id` = 417880447))
*** (1) HOLDS THE LOCK(S):
RECORD LOCKS space id 132 page no 15896 n bits 416 index idx_sid of table `cco_xspace_session_0003`.`connected_session_users_0102` trx id 10476863046 lock_mode X locks rec but not gap
Record lock, heap no 262 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
0: len 30; hex 363563343866633362636666343765316163376137636537383762326163; asc 65c48fc3bcff47e1ac7a7ce787b2ac; (total 32 bytes);
1: len 8; hex 0000000139ee46da; asc 9 F ;;
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 132 page no 16560 n bits 184 index PRIMARY of table `cco_xspace_session_0003`.`connected_session_users_0102` trx id 10476863046 lock_mode X locks rec but not gap waiting
Record lock, heap no 117 PHYSICAL RECORD: n_fields 13; compact format; info bits 32
0: len 8; hex 0000000139ee46da; asc 9 F ;;
1: len 6; hex 000270783e47; asc px>G;;
2: len 7; hex 37002180312260; asc 7 ! 1"`;;
3: len 5; hex 99a48af04c; asc L;;
4: len 5; hex 99a48af04c; asc L;;
5: len 30; hex 363563343866633362636666343765316163376137636537383762326163; asc 65c48fc3bcff47e1ac7a7ce787b2ac; (total 32 bytes);
6: len 8; hex 8000000018e8597f; asc Y ;;
7: len 18; hex e6b3a1e6b2abe4b98be5a48fe5a48fe69cab; asc ;;
8: len 1; hex 81; asc ;;
9: len 30; hex 303031326639303133636139336530653030303030303030313665363539; asc 0012f9013ca93e0e0000000016e659; (total 32 bytes);
10: len 8; hex 0000000000000003; asc ;;
11: SQL NULL;
12: SQL NULL;
*** (2) TRANSACTION:
TRANSACTION 10476863047, ACTIVE 0 sec updating or deleting, thread declared inside InnoDB 4999
mysql tables in use 1, locked 1
3 lock struct(s), heap size 1136, 2 row lock(s), undo log entries 1
MySQL thread id 4294902021, OS thread handle 140519194687232, query id 5089036263 11.178.251.210 drcwriter_shunit updating
DELETE FROM `cco_xspace_session_0003`.`connected_session_users_0102` WHERE `id`=5266884314
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 132 page no 16560 n bits 184 index PRIMARY of table `cco_xspace_session_0003`.`connected_session_users_0102` trx id 10476863047 lock_mode X locks rec but not gap
Record lock, heap no 117 PHYSICAL RECORD: n_fields 13; compact format; info bits 32
0: len 8; hex 0000000139ee46da; asc 9 F ;;
1: len 6; hex 000270783e47; asc px>G;;
2: len 7; hex 37002180312260; asc 7 ! 1"`;;
3: len 5; hex 99a48af04c; asc L;;
4: len 5; hex 99a48af04c; asc L;;
5: len 30; hex 363563343866633362636666343765316163376137636537383762326163; asc 65c48fc3bcff47e1ac7a7ce787b2ac; (total 32 bytes);
6: len 8; hex 8000000018e8597f; asc Y ;;
7: len 18; hex e6b3a1e6b2abe4b98be5a48fe5a48fe69cab; asc ;;
8: len 1; hex 81; asc ;;
9: len 30; hex 303031326639303133636139336530653030303030303030313665363539; asc 0012f9013ca93e0e0000000016e659; (total 32 bytes);
10: len 8; hex 0000000000000003; asc ;;
11: SQL NULL;
12: SQL NULL;
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 132 page no 15896 n bits 416 index idx_sid of table `cco_xspace_session_0003`.`connected_session_users_0102` trx id 10476863047 lock_mode X locks rec but not gap waiting
Record lock, heap no 262 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
0: len 30; hex 363563343866633362636666343765316163376137636537383762326163; asc 65c48fc3bcff47e1ac7a7ce787b2ac; (total 32 bytes);
1: len 8; hex 0000000139ee46da; asc 9 F ;;
*** WE ROLL BACK TRANSACTION (1)
------------
TRANSACTIONS
------------
Trx id counter 10717679978
Purge done for trx's n:o < 10717679978 undo n:o < 0 state: running but idle
History list length 1757
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421994453671584, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453669600, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453665632, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453664640, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453660672, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453656704, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453655712, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453589248, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453587264, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453584288, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453583296, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453580320, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453579328, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453578336, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453572384, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453571392, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453564448, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453563456, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453558496, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453557504, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453552544, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453551552, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453550560, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453545600, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453539648, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453538656, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453537664, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453582304, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453663648, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453704320, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453798560, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453585280, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453792608, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453784672, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453783680, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453780704, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453777728, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453765824, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453757888, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453753920, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453751936, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453746976, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453731104, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453725152, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453720192, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453719200, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453718208, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453717216, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453713248, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453710272, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453707296, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453706304, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453694400, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453693408, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453689440, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453684480, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453680512, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453679520, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453678528, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453674560, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453667616, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453666624, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453662656, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453661664, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453592224, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453591232, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453590240, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453575360, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453573376, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453569408, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453566432, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453560480, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453556512, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453555520, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453547584, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453544608, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453540640, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453536672, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453673568, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453670592, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453781696, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453775744, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453771776, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453769792, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453761856, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453758880, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453730112, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453722176, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453714240, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453697376, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453695392, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453686464, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453682496, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453677536, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453676544, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453594208, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453593216, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453588256, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453577344, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453574368, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453565440, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453561472, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453554528, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453543616, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453534688, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453721184, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453794592, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453790624, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453787648, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453776736, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453770784, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453764832, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453750944, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453748960, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453747968, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453743008, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453715232, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453702336, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453700352, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453672576, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453654720, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453581312, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453535680, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453548576, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453675552, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453546592, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453755904, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453739040, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453692416, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453586272, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453549568, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453779712, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453773760, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453709280, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453701344, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453657696, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453782688, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453658688, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453559488, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453756896, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453752928, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453727136, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453699360, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453690432, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453688448, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453681504, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453668608, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453659680, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453568416, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453763840, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453576352, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453542624, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453541632, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453653728, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453652736, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453651744, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453650752, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453649760, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453648768, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453647776, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453646784, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453645792, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453644800, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453643808, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453642816, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453641824, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453640832, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453639840, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453638848, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453637856, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453636864, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453635872, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453634880, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453633888, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453632896, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453631904, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453630912, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453629920, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453628928, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453627936, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453626944, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453625952, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453624960, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453623968, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453621984, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453620992, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453620000, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453610080, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453609088, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453608096, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453607104, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453606112, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453605120, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453604128, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453603136, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453602144, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453601152, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453600160, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453599168, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453598176, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453597184, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453596192, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453595200, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453570400, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453567424, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453562464, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421994453553536, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 10717679987, ACTIVE 0 sec starting index read, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902044, OS thread handle 140493710145280, query id 5218226974 11.178.251.210 drcwriter_shunit updating
UPDATE `cco_xspace_session_0002`.`xspace_session_heart_check_0095` SET `last_heart_time`='2019-11-07 10:15:20' , `gmt_modified`='2019-11-07 10:15:20' WHERE `id`=5498433091
---TRANSACTION 10717679986, ACTIVE 0 sec starting index read, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902042, OS thread handle 140514616604416, query id 5218226973 11.178.251.210 drcwriter_shunit updating
UPDATE `cco_xspace_session_0003`.`xspace_chat_robot_client_0125` SET `gmt_modified`='2019-11-07 10:15:20' , `status`=0 WHERE `id`=1762275607
---TRANSACTION 10717679985, ACTIVE 0 sec inserting, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902048, OS thread handle 140509053966080, query id 5218226972 11.178.251.210 drcwriter_shunit update
INSERT IGNORE INTO `cco_xspace_session_0002`.`xspace_chat_robot_log_0083` SET `id`=4899842401 , `gmt_create`='2019-11-07 10:15:20' , `gmt_modified`='2019-11-07 10:15:20' , `robot_id`=2 , `operater`=0 , `event`=CONVERT('{\"sid\": \"542214075eec4e878ac34f353f9c7355\", \"action\": \"init\", \"speech\": \"\", \"status\": 0, \"robotId\": 2, \"traceId\": \"0b16f58c15730929197795684d08c5\", \"servicerId\": 16704135, \"changeSource\": \"xspace\", \"channel_type\": \"OCS\", \"robotSessionId\": 1767584842}',JSON) , `operation`=_utf8mb4'send_robot_status' , `sid`=_utf8mb4'542214075eec4e878ac34f353f9c7355
---TRANSACTION 10717679984, ACTIVE 0 sec starting index read, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902041, OS thread handle 140520123766528, query id 5218226971 11.178.251.210 drcwriter_shunit updating
UPDATE `cco_xspace_session_0002`.`xspace_session_heart_check_0076` SET `last_heart_time`='2019-11-07 10:15:20' , `gmt_modified`='2019-11-07 10:15:20' WHERE `id`=5492066907
---TRANSACTION 10717679983, ACTIVE 0 sec inserting, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902043, OS thread handle 140515195418368, query id 5218226970 11.178.251.210 drcwriter_shunit update
INSERT IGNORE INTO `cco_xspace_session_0002`.`xspace_chat_robot_log_0083` SET `id`=4899842400 , `gmt_create`='2019-11-07 10:15:20' , `gmt_modified`='2019-11-07 10:15:20' , `robot_id`=2 , `operater`=0 , `event`=CONVERT('{\"sid\": \"542214075eec4e878ac34f353f9c7355\", \"action\": \"sys_end\", \"speech\": \"\", \"status\": -1, \"robotId\": 2, \"traceId\": \"0b16f58c15730929197795684d08c5\", \"servicerId\": 16704135, \"changeSource\": \"xspace\", \"channel_type\": \"OCS\", \"robotSessionId\": 1767584841}',JSON) , `operation`=_utf8mb4'send_robot_status' , `sid`=_utf8mb4'542214075eec4e878ac34f353f9c
---TRANSACTION 10717679982, ACTIVE 0 sec inserting, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902040, OS thread handle 140518339049216, query id 5218226969 11.178.251.210 drcwriter_shunit update
INSERT IGNORE INTO `cco_xspace_session_0002`.`xspace_chat_robot_log_0083` SET `id`=4899842399 , `gmt_create`='2019-11-07 10:15:20' , `gmt_modified`='2019-11-07 10:15:20' , `robot_id`=2 , `operater`=0 , `event`=CONVERT('{\"sid\": \"542214075eec4e878ac34f353f9c7355\", \"action\": \"init\", \"speech\": \"\", \"status\": 0, \"robotId\": 2, \"traceId\": \"0b16f58c15730929197795684d08c5\", \"servicerId\": 16704135, \"changeSource\": \"xspace\", \"channel_type\": \"OCS\", \"robotSessionId\": 1767584841}',JSON) , `operation`=_utf8mb4'send_robot_status' , `sid`=_utf8mb4'542214075eec4e878ac34f353f9c7355
---TRANSACTION 10717679981, ACTIVE 0 sec starting index read, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902037, OS thread handle 140510619432704, query id 5218226967 11.178.251.210 drcwriter_shunit updating
DELETE FROM `cco_xspace_session_0003`.`xspace_session_heart_check_0127` WHERE `id`=5498081814
---TRANSACTION 10717679980, ACTIVE 0 sec inserting, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902039, OS thread handle 140509237450496, query id 5218226968 11.178.251.210 drcwriter_shunit update
INSERT IGNORE INTO `cco_xspace_session_0002`.`xspace_chat_robot_client_0083` SET `id`=1767584841 , `gmt_create`='2019-11-07 10:15:20' , `gmt_modified`='2019-11-07 10:15:20' , `robot_id`=2 , `sid`=_utf8mb4'542214075eec4e878ac34f353f9c7355' , `status`=0 , `start_time`='2019-11-07 10:15:20' , `end_time`=NULL , `service_id`=16704135 , `service_buid`=NULL , `tenant_id`=3 , `member_id`=2206653888825 , `department_id`=250 , `group_id`=56038
---TRANSACTION 10717679979, ACTIVE 0 sec starting index read, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902036, OS thread handle 140520070309632, query id 5218226966 11.178.251.210 drcwriter_shunit updating
UPDATE `cco_xspace_session_0003`.`xspace_session_heart_check_0114` SET `last_heart_time`='2019-11-07 10:15:20' , `gmt_modified`='2019-11-07 10:15:20' WHERE `id`=5492354321
---TRANSACTION 10717679978, ACTIVE 0 sec starting index read, thread declared inside InnoDB 5000
mysql tables in use 1, locked 1
0 lock struct(s), heap size 1136, 0 row lock(s)
MySQL thread id 4294902038, OS thread handle 140519669733120, query id 5218226965 11.178.251.210 drcwriter_shunit updating
UPDATE `cco_xspace_session_0003`.`xspace_session_heart_check_0100` SET `last_heart_time`='2019-11-07 10:15:20' , `gmt_modified`='2019-11-07 10:15:20' WHERE `id`=5498113695
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (read thread)
I/O thread 7 state: waiting for completed aio requests (read thread)
I/O thread 8 state: waiting for completed aio requests (read thread)
I/O thread 9 state: waiting for completed aio requests (read thread)
I/O thread 10 state: waiting for completed aio requests (write thread)
I/O thread 11 state: waiting for completed aio requests (write thread)
I/O thread 12 state: waiting for completed aio requests (write thread)
I/O thread 13 state: waiting for completed aio requests (write thread)
I/O thread 14 state: waiting for completed aio requests (write thread)
I/O thread 15 state: waiting for completed aio requests (write thread)
I/O thread 16 state: waiting for completed aio requests (write thread)
I/O thread 17 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0, 0, 0, 0, 0] , aio writes: [0, 0, 0, 0, 0, 0, 0, 0] ,
ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
422118905 OS file reads, 5266550419 OS file writes, 671873711 OS fsyncs
88.35 reads/s, 16384 avg bytes/read, 786.57 writes/s, 208.96 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
insert 0, delete mark 0, delete 0
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 2212699, node heap has 114 buffer(s)
Hash table size 2212699, node heap has 63 buffer(s)
Hash table size 2212699, node heap has 46 buffer(s)
Hash table size 2212699, node heap has 13 buffer(s)
Hash table size 2212699, node heap has 34 buffer(s)
Hash table size 2212699, node heap has 81 buffer(s)
Hash table size 2212699, node heap has 79 buffer(s)
Hash table size 2212699, node heap has 98 buffer(s)
266.85 hash searches/s, 2031.85 non-hash searches/s
---
LOG
---
Log sequence number 5238953570974
Log flushed up to 5238953192067
Pages flushed up to 5238895690211
Last checkpoint at 5238893392118
0 pending log flushes, 0 pending chkp writes
4119025225 log i/o's done, 397.76 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 8795455488
Dictionary memory allocated 639935871
Buffer pool size 524288
Free buffers 8099
Database pages 515661
Old database pages 190270
Modified db pages 52049
Pending reads 1
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 550672254, not young 3566705046
79.97 youngs/s, 153.88 non-youngs/s
Pages read 422105577, created 44129950, written 1146979024
88.35 reads/s, 5.97 creates/s, 388.81 writes/s
Buffer pool hit rate 998 / 1000, young-making rate 2 / 1000 not 4 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 515661, unzip_LRU len: 0
I/O sum[96400]:cur[188], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size 131072
Free buffers 2024
Database pages 128912
Old database pages 47567
Modified db pages 15418
Pending reads 1
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 151501569, not young 916988519
25.47 youngs/s, 39.85 non-youngs/s
Pages read 110844585, created 12359044, written 286949498
22.88 reads/s, 1.44 creates/s, 97.20 writes/s
Buffer pool hit rate 999 / 1000, young-making rate 1 / 1000 not 2 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 128912, unzip_LRU len: 0
I/O sum[24100]:cur[47], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size 131072
Free buffers 2024
Database pages 128912
Old database pages 47566
Modified db pages 12382
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 133859239, not young 882471366
17.79 youngs/s, 36.62 non-youngs/s
Pages read 103654470, created 10585375, written 286673730
21.85 reads/s, 1.79 creates/s, 97.20 writes/s
Buffer pool hit rate 988 / 1000, young-making rate 10 / 1000 not 20 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 128912, unzip_LRU len: 0
I/O sum[24100]:cur[47], unzip sum[0]:cur[0]
---BUFFER POOL 2
Buffer pool size 131072
Free buffers 2032
Database pages 128912
Old database pages 47566
Modified db pages 11913
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 129400012, not young 884558406
17.50 youngs/s, 39.94 non-youngs/s
Pages read 102960280, created 10586551, written 286660470
21.03 reads/s, 1.15 creates/s, 97.20 writes/s
Buffer pool hit rate 987 / 1000, young-making rate 11 / 1000 not 25 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 128912, unzip_LRU len: 0
I/O sum[24100]:cur[47], unzip sum[0]:cur[0]
---BUFFER POOL 3
Buffer pool size 131072
Free buffers 2019
Database pages 128925
Old database pages 47571
Modified db pages 12336
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 135911434, not young 882686755
19.21 youngs/s, 37.47 non-youngs/s
Pages read 104646242, created 10598980, written 286695326
22.59 reads/s, 1.59 creates/s, 97.20 writes/s
Buffer pool hit rate 998 / 1000, young-making rate 2 / 1000 not 4 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 128925, unzip_LRU len: 0
I/O sum[24100]:cur[47], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
10 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=55859, Main thread ID=140509127366400, state: sleeping
Number of rows inserted 1165447625, updated 2799376983, deleted 600012204, read 15629490844
143.35 inserts/s, 281.84 updates/s, 28.12 deletes/s, 330.49 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================
关键日志如下:
------------------------
LATEST DETECTED DEADLOCK
------------------------
2019-11-05 15:02:44 0x7fcd2caef700
*** (1) TRANSACTION:
TRANSACTION 10476863046, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 3 lock struct(s), heap size 1136, 2 row lock(s)
MySQL thread id 3322429, OS thread handle 140493696530176, query id 5089036262 11.18.122.237 cco_xspace_sessi updating
/* 0b51153515729373648846445e1bf6/0.1.1.4.3//e21a688f// */delete from `connected_session_users_0102` where ((`sid` = '65c48fc3bcff47e1ac7a7ce787b2acde') AND (`user_id` = 417880447))
*** (1) HOLDS THE LOCK(S):
RECORD LOCKS space id 132 page no 15896 n bits 416 index idx_sid of table `cco_xspace_session_0003`.`connected_session_users_0102` trx id 10476863046 lock_mode X locks rec but not gap
Record lock, heap no 262 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
0: len 30; hex 363563343866633362636666343765316163376137636537383762326163; asc 65c48fc3bcff47e1ac7a7ce787b2ac; (total 32 bytes);
1: len 8; hex 0000000139ee46da; asc 9 F ;;
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 132 page no 16560 n bits 184 index PRIMARY of table `cco_xspace_session_0003`.`connected_session_users_0102` trx id 10476863046 lock_mode X locks rec but not gap waiting
Record lock, heap no 117 PHYSICAL RECORD: n_fields 13; compact format; info bits 32
0: len 8; hex 0000000139ee46da; asc 9 F ;;
1: len 6; hex 000270783e47; asc px>G;;
2: len 7; hex 37002180312260; asc 7 ! 1"`;;
3: len 5; hex 99a48af04c; asc L;;
4: len 5; hex 99a48af04c; asc L;;
5: len 30; hex 363563343866633362636666343765316163376137636537383762326163; asc 65c48fc3bcff47e1ac7a7ce787b2ac; (total 32 bytes);
6: len 8; hex 8000000018e8597f; asc Y ;;
7: len 18; hex e6b3a1e6b2abe4b98be5a48fe5a48fe69cab; asc ;;
8: len 1; hex 81; asc ;;
9: len 30; hex 303031326639303133636139336530653030303030303030313665363539; asc 0012f9013ca93e0e0000000016e659; (total 32 bytes);
10: len 8; hex 0000000000000003; asc ;;
11: SQL NULL;
12: SQL NULL;
*** (2) TRANSACTION:
TRANSACTION 10476863047, ACTIVE 0 sec updating or deleting, thread declared inside InnoDB 4999
mysql tables in use 1, locked 1
3 lock struct(s), heap size 1136, 2 row lock(s), undo log entries 1
MySQL thread id 4294902021, OS thread handle 140519194687232, query id 5089036263 11.178.251.210 drcwriter_shunit updating
DELETE FROM `cco_xspace_session_0003`.`connected_session_users_0102` WHERE `id`=5266884314
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 132 page no 16560 n bits 184 index PRIMARY of table `cco_xspace_session_0003`.`connected_session_users_0102` trx id 10476863047 lock_mode X locks rec but not gap
Record lock, heap no 117 PHYSICAL RECORD: n_fields 13; compact format; info bits 32
0: len 8; hex 0000000139ee46da; asc 9 F ;;
1: len 6; hex 000270783e47; asc px>G;;
2: len 7; hex 37002180312260; asc 7 ! 1"`;;
3: len 5; hex 99a48af04c; asc L;;
4: len 5; hex 99a48af04c; asc L;;
5: len 30; hex 363563343866633362636666343765316163376137636537383762326163; asc 65c48fc3bcff47e1ac7a7ce787b2ac; (total 32 bytes);
6: len 8; hex 8000000018e8597f; asc Y ;;
7: len 18; hex e6b3a1e6b2abe4b98be5a48fe5a48fe69cab; asc ;;
8: len 1; hex 81; asc ;;
9: len 30; hex 303031326639303133636139336530653030303030303030313665363539; asc 0012f9013ca93e0e0000000016e659; (total 32 bytes);
10: len 8; hex 0000000000000003; asc ;;
11: SQL NULL;
12: SQL NULL;
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 132 page no 15896 n bits 416 index idx_sid of table `cco_xspace_session_0003`.`connected_session_users_0102` trx id 10476863047 lock_mode X locks rec but not gap waiting
Record lock, heap no 262 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
0: len 30; hex 363563343866633362636666343765316163376137636537383762326163; asc 65c48fc3bcff47e1ac7a7ce787b2ac; (total 32 bytes);
1: len 8; hex 0000000139ee46da; asc 9 F ;;
*** WE ROLL BACK TRANSACTION (1)
死锁日志分析:
获取隔离级别(备库)
# sql
select @@tx_isolation,@@global.tx_isolation;
# 结果
@@tx_isolation @@global.tx_isolation
READ-COMMITTED READ-COMMITTED
# 可以看到是 rc 隔离级别
查看表结构,获取表上索引信息(主备一致)
- id 为 primary
- sid 为 normal 索引(非唯一索引)
- 获取 mysql 版本(备库)
# sql
select version();
# 结果
5.7.14.5-AliSQL-X-Cluster-1.4.1.12-20190912-log
事务 A:delete from connected_session_users_0102
where ((sid
= ‘65c48fc3bcff47e1ac7a7ce787b2acde’) AND (user_id
= 417880447))
事务 B:DELETE FROM cco_xspace_session_0003
.connected_session_users_0102
WHERE id
=5266884314
序号 | 事务 A | 事务 B |
---|---|---|
1 | 获取 sid 上的 写 锁 | |
2 | 获取 id 上的写锁 | |
3 | 尝试获取 id 上的写锁(失败) | |
4 | 尝试获取 sid 上的 写 锁 |
其中第 3 步和第 4 步形成死锁。
疑惑:
- 事务 A 持有 sid 锁,获取 id 锁我理解,但是事务 B 持有 id 锁,去获取 sid 锁我不理解。
死锁重现
- docker 安装 mysql
# 下载镜像
docker pull mysql:5.7
# 启动 mysql
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
# 进入 mysql 容器内部,使其可以被外网查询
docker exec -it mysql bash
# 以下为在 mysql 容器内部执行的命令
# 登陆 mysql
mysql -uroot -p123456
# 设置远程连接
grant all privileges on *.* to root@'%'identified by '123456';
flush privileges;
exit
- 创建测试表
CREATE DATABASE if not EXISTS pfjia;
use pfjia;
DROP TABLE IF EXISTS `test`;
CREATE TABLE IF NOT EXISTS `test`(
`id` int(11) DEFAULT NULL,
`sid` varchar(50) DEFAULT NULL,
KEY `idx_sid`(`sid`)
) ENGINE= InnoDB DEFAULT CHARSET= utf8mb4;
- 插入测试数据(通过脚本插入 1000 条数据)
insert into test values(?,?);
# 示例 sql
insert into test values(1,'1');
- 开启 innodb_lock_monitor (用来查看一条语句执行时的加锁信息)
# 5.6 及以前的方式
use pfjia;
create table innodb_lock_monitor(x int) engine=innodb;
# 5.7 及以后的方式
use pfjia;
SET GLOBAL innodb_status_output_locks=ON;
# 详情在 google 搜索关键字“innodb_lock_monitor”,选择不同版本的 mysql Reference Manual
- 修改事务隔离级别(因为此版本的 mysql 的默认隔离级别是 rr,需修改为 rc)
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
- 重建连接,check 事务隔离级别是否被修改
# sql
select @@tx_isolation,@@global.tx_isolation;
# 结果
@@tx_isolation @@global.tx_isolation
READ-COMMITTED READ-COMMITTED
# 可以看到是事务隔离级别已被修改为 rc
- 根据 sid 删除数据
begin;
delete from test where sid='55';
- 查看 innodb status
# sql
show engine innodb status;
# 关键结果
---TRANSACTION 2843, ACTIVE 1161 sec
3 lock struct(s), heap size 1136, 2 row lock(s), undo log entries 1
MySQL thread id 8, OS thread handle 140293095675648, query id 2251 42.120.74.114 root
TABLE LOCK table `pfjia`.`test` trx id 2843 lock mode IX
RECORD LOCKS space id 25 page no 8 n bits 1064 index idx_sid of table `pfjia`.`test` trx id 2843 lock_mode X locks rec but not gap
Record lock, heap no 291 PHYSICAL RECORD: n_fields 2; compact format; info bits 32
0: len 2; hex 3336; asc 36;;
1: len 6; hex 000000000223; asc #;;
RECORD LOCKS space id 25 page no 5 n bits 528 index GEN_CLUST_INDEX of table `pfjia`.`test` trx id 2843 lock_mode X locks rec but not gap
Record lock, heap no 37 PHYSICAL RECORD: n_fields 5; compact format; info bits 32
0: len 6; hex 000000000223; asc #;;
1: len 6; hex 000000000b1b; asc ;;
2: len 7; hex 29000001cc0110; asc ) ;;
3: len 4; hex 80000024; asc $;;
4: len 2; hex 3336; asc 36;;