1结合Mycat日志,分析select * from travelrecord order by id limit100000,100 的运行过程,解释下当limit M,N中的M非常大的情况下。为什么查询结果会变慢非常多

1.1mycat控制命令台显示。explain出来走了全部的节点

  1. mysql>explain select * from travelrecord order by id limit 100000,100 ;
  2. +-----------+--------------------------------------------------------+
  3. |DATA_NODE | SQL |
  4. +-----------+--------------------------------------------------------+
  5. |dn1 | SELECT * FROM travelrecordORDER BY id LIMIT 0, 100100 |
  6. |dn2 | SELECT * FROM travelrecordORDER BY id LIMIT 0, 100100 |
  7. |dn3 | SELECT * FROM travelrecordORDER BY id LIMIT 0, 100100 |
  8. +-----------+--------------------------------------------------------+
  9. 3rows in set (0.01 sec)
  10. mysql>

本文源自mchdba(黄杉)博客地址:http://blog.csdn.net/mchdba/article/details/50719120,未经过mchdba同意,谢绝转载


1.2看后台mycat.log日志:

  1. 02/1417:52:30.103 DEBUG [$_NIOREACTOR-0-RW](ServerQueryHandler.java:56) -ServerConnection [id=3, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]explainselect * from travelrecord order by id limit 1000000,100
  2. 02/1417:52:30.103 DEBUG [$_NIOREACTOR-0-RW](EnchachePool.java:76) -SQLRouteCache miss cache ,key:TESTDB select * from travelrecord order by id limit1000000,100
  3. 02/1417:52:30.105 DEBUG [$_NIOREACTOR-0-RW] (EnchachePool.java:59)-SQLRouteCache add cache ,key:TESTDB select * from travelrecord order by idlimit 1000000,100 value:select * from travelrecord order by id limit1000000,100, route={
  4. 1 -> dn1{SELECT *
  5. FROMtravelrecord
  6. ORDERBY id
  7. LIMIT0, 1000100}
  8. 2 -> dn2{SELECT *
  9. FROMtravelrecord
  10. ORDERBY id
  11. LIMIT0, 1000100}
  12. 3 -> dn3{SELECT *
  13. FROMtravelrecord
  14. ORDERBY id
  15. LIMIT0, 1000100}
  16. }
  17. 02/1417:52:33.880 DEBUG [$_NIOREACTOR-0-RW](ServerQueryHandler.java:56) -ServerConnection [id=3, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]select* from travelrecord order by id limit 1000000,100
  18. 02/1417:52:33.881 DEBUG [$_NIOREACTOR-0-RW](EnchachePool.java:76) -SQLRouteCache miss cache ,key:TESTDBselect * from travelrecord order by id limit1000000,100
  19. 02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](EnchachePool.java:59) -SQLRouteCache add cache ,key:TESTDBselect * fromtravelrecord order by id limit 1000000,100 value:select * from travelrecordorder by id limit 1000000,100, route={
  20. 1 -> dn1{SELECT *
  21. FROMtravelrecord
  22. ORDERBY id
  23. LIMIT0, 1000100}
  24. 2 -> dn2{SELECT *
  25. FROMtravelrecord
  26. ORDERBY id
  27. LIMIT0, 1000100}
  28. 3 -> dn3{SELECT *
  29. FROMtravelrecord
  30. ORDERBY id
  31. LIMIT0, 1000100}
  32. }
  33. 02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](NonBlockingSession.java:113) -ServerConnection [id=3, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]select* from travelrecord order by id limit 1000000,100, route={
  34. 1 -> dn1{SELECT *
  35. FROMtravelrecord
  36. ORDERBY id
  37. 02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](NonBlockingSession.java:113) -ServerConnection [id=3, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]select* from travelrecord order by id limit 1000000,100, route={
  38. 1 -> dn1{SELECT *
  39. FROMtravelrecord
  40. ORDERBY id
  41. LIMIT0, 1000100}
  42. 2 -> dn2{SELECT *
  43. FROMtravelrecord
  44. ORDERBY id
  45. LIMIT0, 1000100}
  46. 3 -> dn3{SELECT *
  47. FROMtravelrecord
  48. ORDERBY id
  49. LIMIT0, 1000100}
  50. }rrs
  51. 02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:82) -execute mutinode query select * from travelrecordorder by id limit 1000000,100
  52. 02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:97) -has data merge logic
  53. 02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](PhysicalDBPool.java:452) -select read source hostM1 for dataHost:wgq_idc_mon_1_12
  54. 02/1417:52:33.883 DEBUG [$_NIOREACTOR-0-RW](PhysicalDBPool.java:452) -select read source hostM1 fordataHost:wgq_idc_mon_1_12
  55. 02/1417:52:33.883 DEBUG [$_NIOREACTOR-0-RW](PhysicalDBPool.java:452) -select read source hostM1 for dataHost:wgq_idc_mon_1_12
  56. 02/1417:52:33.883 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=19, lastTime=1455443553868, user=root, schema=db1, oldshema=db1, borrowed=true, fromSlaveDB=false, threadId=220, charset=latin1,txIsolation=3, autocommit=true, attachment=dn1{SELECT *
  57. FROMtravelrecord
  58. ORDERBY id
  59. LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317, statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@b47af37,writeQueue=0, modifiedSQLExecuted=false]
  60. 02/1417:52:33.884 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:241) -on row end reseponse MySQLConnection [id=25,lastTime=1455443553868, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=227, charset=latin1, txIsolation=3,autocommit=true, attachment=dn3{SELECT *
  61. FROMtravelrecord
  62. 02/1417:52:33.883 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=19, lastTime=1455443553868, user=root, schema=db1, oldshema=db1, borrowed=true, fromSlaveDB=false, threadId=220, charset=latin1,txIsolation=3, autocommit=true, attachment=dn1{SELECT *
  63. FROMtravelrecord
  64. ORDERBY id
  65. LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@b47af37,writeQueue=0, modifiedSQLExecuted=false]
  66. 02/1417:52:33.884 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:241) -on row end reseponse MySQLConnection [id=25,lastTime=1455443553868, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=227, charset=latin1, txIsolation=3,autocommit=true, attachment=dn3{SELECT *
  67. FROMtravelrecord
  68. ORDERBY id
  69. LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=false]
  70. 02/1417:52:33.884 DEBUG [$_NIOREACTOR-3-RW](DataMergeService.java:94) -field metadata inf:[ID=ColMeta [colIndex=0,colType=8], DAYS=ColMeta [colIndex=4, colType=3], TRAVELDATE=ColMeta[colIndex=2, colType=10], USER_ID=ColMeta [colIndex=1, colType=253],FEE=ColMeta [colIndex=3, colType=246]]
  71. 02/1417:52:33.884 DEBUG [$_NIOREACTOR-1-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=25,lastTime=1455443553868, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=227, charset=latin1, txIsolation=3,autocommit=true, attachment=dn3{SELECT *
  72. FROMtravelrecord
  73. ORDERBY id
  74. LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=false]
  75. 02/1417:52:33.885 DEBUG [$_NIOREACTOR-1-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=25,lastTime=1455443553868, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=227, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
  76. 02/1417:52:33.886 DEBUG [$_NIOREACTOR-3-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=19,lastTime=1455443553868, user=root, schema=db1, old shema=db1, borrowed=true,fromSlaveDB=false, threadId=220, charset=latin1, txIsolation=3,autocommit=true, attachment=dn1{SELECT *
  77. FROMtravelrecord
  78. ORDERBY id
  79. LIMIT0, 1000100}, respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@b47af37,writeQueue=0, modifiedSQLExecuted=false]
  80. 02/1417:52:33.886 DEBUG [$_NIOREACTOR-3-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=19,lastTime=1455443553868, user=root, schema=db1, old shema=db1, borrowed=true,fromSlaveDB=false, threadId=220, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111, port=3317,statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
  81. 02/1417:52:33.886 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:241) -on row end reseponse MySQLConnection [id=42,lastTime=1455443553868, user=root, schema=db2, old shema=db2, borrowed=true,fromSlaveDB=false, threadId=234, charset=latin1, txIsolation=3,autocommit=true, attachment=dn2{SELECT *
  82. FROMtravelrecord
  83. ORDERBY id
  84. LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=false]
  85. 02/1417:52:33.886 DEBUG [$_NIOREACTOR-3-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=42,lastTime=1455443553868, user=root, schema=db2, old shema=db2, borrowed=true,fromSlaveDB=false, threadId=234, charset=latin1, txIsolation=3,autocommit=true, attachment=dn2{SELECT *
  86. FROMtravelrecord
  87. ORDERBY id
  88. LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
  89. 02/1417:52:33.886 DEBUG [$_NIOREACTOR-3-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=42,lastTime=1455443553868, user=root, schema=db2, old shema=db2, borrowed=true,fromSlaveDB=false, threadId=234, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
  90. 02/1417:52:33.887 DEBUG [BusinessExecutor5](DataMergeService.java:296) -prepare mpp merge result for select * fromtravelrecord order by id limit 1000000,100
  91. 02/1417:52:33.887 DEBUG [BusinessExecutor5](MultiNodeQueryHandler.java:324) -last packet id:8

路由里面是先查limit 0,1000000条。然后再查出limit 0,1000100条记录。在这个基础上查出100条(prepare mpp mergeresult for select * from travelrecord order by id limit 1000000,100),所以假设这个M=1000000越来越大,一次性拉的数据就越大,这样就越来越慢了,那么须要查询的数据就比較多


2结合Mycat日志。分析跨分片事务的运行过程。以一个正常的跨分片SQL的事务过程,以及,一个错误SQL为例(比方某个分片上主键冲突或其它SQL错误,导致无法运行成功)分别加, 以说明

2.1 正常的跨分片事务分析

运行情况:

  1. mysql>set autocommit=0
  2. mysql>update order040302 set SN=concat(SN,'-mycat');
  3. QueryOK, 2 rows affected (0.01 sec)
  4. Rowsmatched: 1 Changed: 1 Warnings: 0
  5. mysql>commit;

mycat.log日志显示:

  1. 02/1800:01:24.351 DEBUG [$_NIOREACTOR-1-RW](ServerQueryHandler.java:56) -ServerConnection [id=4, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]updateorder040302 set SN=concat(SN,'-mycat')
  2. 02/1800:01:24.356 DEBUG [$_NIOREACTOR-1-RW](NonBlockingSession.java:113) -ServerConnection [id=4, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]updateorder040302 set SN=concat(SN,'-mycat'), route={
  3. 1 -> dn21{update order040302 setSN=concat(SN,'-mycat')}
  4. 2 -> dn22{update order040302 setSN=concat(SN,'-mycat')}
  5. }rrs
  6. 02/1800:01:24.356 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:82) -execute mutinode query update order040302 setSN=concat(SN,'-mycat')
  7. 02/1800:01:24.357 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=7, lastTime=1455724884356, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=218, charset=latin1,txIsolation=3, autocommit=true, attachment=dn21{update order040302 setSN=concat(SN,'-mycat')},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@23eca0d1,host=110.254.11.111, port=3317, statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@71a27302,writeQueue=0, modifiedSQLExecuted=true]
  8. 02/1800:01:24.358 DEBUG [$_NIOREACTOR-2-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:truefrom MySQLConnection [id=30, lastTime=1455724884356, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=200, charset=latin1,txIsolation=3, autocommit=true, attachment=dn22{update order040302 setSN=concat(SN,'-mycat')},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@23eca0d1,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  9. 02/1800:01:24.359 DEBUG [$_NIOREACTOR-2-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=30,lastTime=1455724884356, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=200, charset=latin1, txIsolation=3,autocommit=true, attachment=dn22{update order040302 setSN=concat(SN,'-mycat')},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@23eca0d1,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  10. 02/1800:01:24.359 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:truefrom MySQLConnection [id=7, lastTime=1455724884356, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=218, charset=latin1,txIsolation=3, autocommit=true, attachment=dn21{update order040302 setSN=concat(SN,'-mycat')}, respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@23eca0d1,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  11. 02/1800:01:24.359 DEBUG [$_NIOREACTOR-3-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=7,lastTime=1455724884356, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=218, charset=latin1, txIsolation=3,autocommit=true, attachment=dn21{update order040302 setSN=concat(SN,'-mycat')}, respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@23eca0d1,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  12. 02/1800:01:24.359 DEBUG [$_NIOREACTOR-3-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=7,lastTime=1455724884356, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=218, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

分析结果:update语句是改动全部的节点上的数据,02/18 00:01:24.356处NonBlockingSession启动了分布式事务,以下就分别在02/18 00:01:24.359有2处 NonBlockingSession.java:229在dn21、dn22上面运行了2遍,大家看到在2个节点dn21和dn22都运行完毕后,才有(PhysicalDatasource.java:403)-release channel MySQLConnection開始关闭释放连接,也就是说等全部节点都运行完毕后才结束整个事务。


2.2 非正常的sql事务运行,有一处报错的情况下(失败经过)

  1. 准备数据。须要一个节点成功,一个节点失败,所以准备拿SN字段的长度来做实验。一个超过报错。一个没有超过不报错

2.2.1 查看表结构:

  1. mysql>show create table order040302;
  2. +-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  3. |Table | Create Table |
  4. +-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  5. |order040302 | CREATE TABLE `order040302` (
  6. `ID` int(11) NOT NULL AUTO_INCREMENT,
  7. `CODE` varchar(64) DEFAULT NULL,
  8. `SN` varchar(64) DEFAULT NULL,
  9. `CREATE_TIME` datetime DEFAULT NULL,
  10. PRIMARY KEY (`ID`)
  11. )ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 |
  12. +-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  13. 1row in set (0.00 sec)
  14. mysql>

改动数据,设置成如此,一会就能够update一个节点失败一个节点成功了,在ID=1的节点上由于长度超过64报错。而在ID=2的节点上面则长度小于64而正常运行:

  1. mysql> update order040302 set SN =concat('',SN,'___',SN) where ID=1;
  2. QueryOK, 1 row affected (0.01 sec)
  3. Rowsmatched: 1 Changed: 1 Warnings: 0
  4. mysql>select length(t1.SN),t1.* from order040302 t1;
  5. +---------------+----+------------+-------------------------------------------------------+---------------------+
  6. |length(t1.SN) | ID | CODE | SN | CREATE_TIME |
  7. +---------------+----+------------+-------------------------------------------------------+---------------------+
  8. | 53 | 1 | 0-10000020 |beijing_03-10000020-mycat___beijing_03-10000020-mycat | 2016-02-13 00:40:27 |
  9. | 26 | 2 | 1-10000020 |shanghai_10-10000020-mycat | 2016-02-1300:40:18 |
  10. +---------------+----+------------+-------------------------------------------------------+---------------------+
  11. 2rows in set (0.00 sec)
  12. mysql> update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN) ;

2.2.2 mycat.log日志例如以下:

  1. 02/2205:44:39.666 DEBUG [$_NIOREACTOR-0-RW](ServerQueryHandler.java:56) -ServerConnection [id=1, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]updateorder040302 set SN = concat('fenpianyigechenggong_yigeshibai_',SN)
  2. 02/2205:44:39.821 DEBUG [$_NIOREACTOR-0-RW](NonBlockingSession.java:113) -ServerConnection [id=1, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]updateorder040302 set SN = concat('fenpianyigechenggong_yigeshibai_',SN), route={
  3. 1 -> dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}
  4. 2 -> dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}
  5. }rrs
  6. 02/2205:44:39.827 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:82) -execute mutinode query update order040302 setSN = concat('fenpianyigechenggong_yigeshibai_',SN)
  7. 02/2205:44:39.830 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=7, lastTime=1456091079827, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=245, charset=latin1,txIsolation=3, autocommit=true, attachment=dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@1c70f0b1,host=110.254.11.111, port=3317, statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@64b49aaa,writeQueue=0, modifiedSQLExecuted=true]
  8. 02/2205:44:39.831 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=12, lastTime=1456091079827, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=222, charset=latin1,txIsolation=3, autocommit=true, attachment=dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}, respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@1c70f0b1,host=110.254.11.111, port=3327,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@306b3db1,writeQueue=0, modifiedSQLExecuted=true]
  9. 02/2205:44:39.831 DEBUG [$_NIOREACTOR-3-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=7,lastTime=1456091079827, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=245, charset=latin1, txIsolation=3,autocommit=true, attachment=dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@1c70f0b1,host=110.254.11.111, port=3317,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@64b49aaa,writeQueue=0, modifiedSQLExecuted=true]
  10. 02/2205:44:39.832 DEBUG [$_NIOREACTOR-3-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=7,lastTime=1456091079827, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=245, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
  11. 02/2205:44:39.832 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:truefrom MySQLConnection [id=12, lastTime=1456091079827, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=222, charset=latin1,txIsolation=3, autocommit=true, attachment=dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@1c70f0b1,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  12. 02/2205:44:39.832 WARN [$_NIOREACTOR-3-RW](MultiNodeHandler.java:127) -error response from MySQLConnection [id=7,lastTime=1456091079827, user=root, schema=db3, old shema=db3, borrowed=false,fromSlaveDB=false, threadId=245, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false] err Datatoo long for column 'SN' at row 1 code:1406
  13. 02/2205:44:39.833 DEBUG [$_NIOREACTOR-0-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=12,lastTime=1456091079827, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=222, charset=latin1, txIsolation=3,autocommit=true, attachment=dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@1c70f0b1,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  14. 02/2205:44:39.834 DEBUG [$_NIOREACTOR-0-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=12,lastTime=1456091079827, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=222, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111, port=3327,statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
  15. 02/2205:44:39.835 DEBUG [$_NIOREACTOR-0-RW](MultiNodeHandler.java:194) -error all end ,clear session resource

从日志记录里面能够看出:[NIOREACTOR−3−RW]dn21节点失败。报错errDatatoolongforcolumn′SN′atrow1code:1406。[_NIOREACTOR-0-RW]节点dn22成功了,所以最后提示-error all end ,clear sessionresource,整个事务退出。清空当前会话资源,结论就是一个节点dn21失败。单节点回退。可是成功的节点dn22不会回退。这是怎么回事呢?查看运行后的数据结果例如以下:

  1. mysql>select length(t1.SN),t1.* from order040302 t1;
  2. +---------------+----+------------+------------------------------------------------------------+---------------------+
  3. |length(t1.SN) | ID | CODE | SN | CREATE_TIME |
  4. +---------------+----+------------+------------------------------------------------------------+---------------------+
  5. | 53 | 1 | 0-10000020 |beijing_03-10000020-mycat___beijing_03-10000020-mycat | 2016-02-13 00:40:27 |
  6. | 58 | 2 | 1-10000020 |fenpianyigechenggong_yigeshibai_shanghai_10-10000020-mycat | 2016-02-1300:40:18 |
  7. +---------------+----+------------+------------------------------------------------------------+---------------------+
  8. 2rows in set (0.06 sec)
  9. mysql>
  1. 可见,我这个不是事务,事务会全部一起回退的。
  2. mycat窗体中怎样开启事务?

2.3 怎样mysql窗体那样,在mycat窗体开启事务

2.3.1 开启事务,手动提交

  1. mysql>set autocommit=0;
  2. QueryOK, 0 rows affected (0.00 sec)
  3. mysql>update order040302 set SN = concat('fenpianyigechenggong_yigeshibai_',SN) ;
  4. ERROR1105 (HY000): Data too long for column 'SN' at row 1
  5. mysql>commit;
  6. ERROR1003 (HY000): Transaction error, need to rollback.
  7. mysql>
  8. mysql>select length(t1.SN),t1.* from order040302 t1;
  9. ERROR1003 (HY000): Transaction error, need to rollback.Data too long for column 'SN'at row 1
  10. mysql>
  11. mysql>rollback;
  12. QueryOK, 0 rows affected (0.01 sec)
  13. mysql>
  14. mysql>select length(t1.SN),t1.* from order040302 t1;
  15. +---------------+----+------------+-------------------------------------------------------+---------------------+
  16. |length(t1.SN) | ID | CODE | SN | CREATE_TIME |
  17. +---------------+----+------------+-------------------------------------------------------+---------------------+
  18. | 53 | 1 | 0-10000020 |beijing_03-10000020-mycat___beijing_03-10000020-mycat | 2016-02-13 00:40:27 |
  19. | 26 | 2 | 1-10000020 |shanghai_10-10000020-mycat | 2016-02-1300:40:18 |
  20. +---------------+----+------------+-------------------------------------------------------+---------------------+
  21. 2rows in set (0.09 sec)
  22. mysql>

2.3.2 后台mycat.log日志例如以下,run失败信息例如以下:

  1. 02/2217:54:25.035 DEBUG [$_NIOREACTOR-1-RW](ServerQueryHandler.java:56) -ServerConnection [id=2, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=false, schema=TESTDB]updateorder040302 set SN = concat('fenpianyigechenggong_yigeshibai_',SN)
  2. 02/2217:54:25.187 DEBUG [$_NIOREACTOR-1-RW](NonBlockingSession.java:113) -ServerConnection [id=2, schema=TESTDB, host=127.0.0.1,user=test,txIsolation=3, autocommit=false, schema=TESTDB]update order040302 setSN = concat('fenpianyigechenggong_yigeshibai_',SN), route={
  3. 1 -> dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}
  4. 2 -> dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}
  5. }rrs
  6. 02/2217:54:25.193 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:82) -execute mutinode query update order040302 setSN = concat('fenpianyigechenggong_yigeshibai_',SN)
  7. 02/2217:54:25.195 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=7, lastTime=1456134865193, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=278, charset=latin1,txIsolation=0, autocommit=true, attachment=dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@243cc381,host=110.254.11.111, port=3317, statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@4ff5e91e,writeQueue=0, modifiedSQLExecuted=true]
  8. 02/2217:54:25.196 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=17, lastTime=1456134865193, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=259, charset=latin1,txIsolation=0, autocommit=true, attachment=dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@243cc381,host=110.254.11.111, port=3327,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@46e9d255,writeQueue=0, modifiedSQLExecuted=true]
  9. 02/2217:54:25.196 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=7, lastTime=1456134865193, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=278, charset=latin1,txIsolation=3, autocommit=false, attachment=dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@243cc381,host=110.254.11.111, port=3317, statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@4ff5e91e,writeQueue=0, modifiedSQLExecuted=true]
  10. 02/2217:54:25.196 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=17, lastTime=1456134865193, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=259, charset=latin1,txIsolation=3, autocommit=false, attachment=dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}, respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@243cc381,host=110.254.11.111, port=3327,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@46e9d255,writeQueue=0, modifiedSQLExecuted=true]
  11. 02/2217:54:25.197 WARN [$_NIOREACTOR-3-RW](MultiNodeHandler.java:127) -error response from MySQLConnection [id=7,lastTime=1456134865193, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=278, charset=latin1, txIsolation=3,autocommit=false, attachment=dn21{update order040302 set SN = concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@243cc381,host=110.254.11.111, port=3317,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@4ff5e91e,writeQueue=0, modifiedSQLExecuted=true] err Data too long for column 'SN' atrow 1 code:1406
  12. 02/2217:54:25.197 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:truefrom MySQLConnection [id=17, lastTime=1456134865193, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=259, charset=latin1,txIsolation=3, autocommit=false, attachment=dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@243cc381,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  13. 02/2217:54:25.199 DEBUG [$_NIOREACTOR-1-RW](MultiNodeHandler.java:194) -error all end ,clear session resource

2.3.3后台mycat.log日志,rollback操作日志例如以下:

  1. 02/2217:57:17.432 DEBUG [$_NIOREACTOR-1-RW](ServerQueryHandler.java:56) -ServerConnection [id=2, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=false,schema=TESTDB]rollback
  2. 02/2217:57:17.434 DEBUG [$_NIOREACTOR-1-RW] (RollbackNodeHandler.java:71)-rollback job run for MySQLConnection [id=7, lastTime=1456134865193, user=root,schema=db3, old shema=db3, borrowed=true, fromSlaveDB=false, threadId=278,charset=latin1, txIsolation=3, autocommit=false, attachment=dn21{updateorder040302 set SN = concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@243cc381,host=110.254.11.111, port=3317,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@4ff5e91e,writeQueue=0, modifiedSQLExecuted=true]
  3. 02/2217:57:17.435 DEBUG [$_NIOREACTOR-1-RW](RollbackNodeHandler.java:71) -rollback job run for MySQLConnection [id=17,lastTime=1456134865193, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=259, charset=latin1, txIsolation=3,autocommit=false, attachment=dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@243cc381,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  4. 02/2217:57:17.436 DEBUG [$_NIOREACTOR-1-RW](NonBlockingSession.java:361) -clear session resourcesorg.opencloudb.server.NonBlockingSession@4483dae0
  5. 02/2217:57:17.436 DEBUG [$_NIOREACTOR-1-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=7,lastTime=1456134865193, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=278, charset=latin1, txIsolation=3,autocommit=false, attachment=dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.RollbackNodeHandler@2c96cb44,host=110.254.11.111, port=3317, statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@4ff5e91e,writeQueue=0, modifiedSQLExecuted=true]
  6. 02/2217:57:17.438 DEBUG [$_NIOREACTOR-1-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=17,lastTime=1456134865193, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=259, charset=latin1, txIsolation=3,autocommit=false, attachment=dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)},respHandler=org.opencloudb.mysql.nio.handler.RollbackNodeHandler@2c96cb44,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  7. 02/2217:57:17.438 DEBUG [$_NIOREACTOR-3-RW](RollbackReleaseHandler.java:58) -autocomit is false,but no commit or rollback,so mycat rollbacked backend conn MySQLConnection [id=7,lastTime=1456134865193, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=278, charset=latin1, txIsolation=3,autocommit=false, attachment=null,respHandler=org.opencloudb.mysql.nio.handler.RollbackReleaseHandler@56683a8d,host=110.254.11.111, port=3317,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@4ff5e91e,writeQueue=0, modifiedSQLExecuted=true]
  8. 02/2217:57:17.439 DEBUG [$_NIOREACTOR-3-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=7,lastTime=1456134865193, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=278, charset=latin1, txIsolation=3,autocommit=false, attachment=null, respHandler=null, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
  9. 02/2217:57:17.439 DEBUG [$_NIOREACTOR-1-RW](RollbackReleaseHandler.java:58) -autocomit is false,but no commit or rollback,so mycat rollbacked backend conn MySQLConnection [id=17,lastTime=1456134865193, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=259, charset=latin1, txIsolation=3,autocommit=false, attachment=null,respHandler=org.opencloudb.mysql.nio.handler.RollbackReleaseHandler@429eb61a,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  10. 02/2217:57:17.440 DEBUG [$_NIOREACTOR-1-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=17,lastTime=1456134865193, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=259, charset=latin1, txIsolation=3,autocommit=false, attachment=null, respHandler=null, host=110.254.11.111,port=3327, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

看到在运行update的时候,有报错信息:在dn21节点上面err Data too long forcolumn ‘SN’ at row 1 code:1406,所以依照理论上不论什么节点错误发生了,就面临rollback的错误信息,不论什么不论什么都会提示报错信息。仅仅能运行rollback来恢复。PS:这里眼下的mycat版本号没有办法做到在update失败后自己主动rollback,须要手动rollback操作。


3创建一个在多个分片上存在的存储过程。存储过程能够是统计某个表的记录个数并返回。然后用Mycat注解方式完毕调用

3.1准备好的简单的存储过程

  1. DELIMITER$$
  2. CREATE
  3. PROCEDUREdb3.pro_select()
  4. BEGIN
  5. SELECTCOUNT(1) FROM order040302;
  6. END$$
  7. DELIMITER;

3.2在各mysql节点上运行创建存储过程

dn21节点上的mysql窗体上:

  1. mysql>DELIMITER $$
  2. mysql>CREATE
  3. -> PROCEDURE `db3`.`pro_select`()
  4. -> BEGIN
  5. ->SELECT COUNT(1) FROM order040302;
  6. -> END$$
  7. QueryOK, 0 rows affected (0.01 sec)
  8. mysql>DELIMITER ;
  9. mysql>

dn22节点上的mysql窗体上:

  1. mysql>DELIMITER $$
  2. mysql>CREATE
  3. -> PROCEDURE `db3`.`pro_select`()
  4. -> BEGIN
  5. ->SELECT COUNT(1) FROM order040302;
  6. -> END$$
  7. QueryOK, 0 rows affected (0.01 sec)
  8. mysql>DELIMITER ;
  9. mysql>

检查存储过程:

  1. mysql>select * from information_schema.ROUTINES\G
  2. ***************************1. row ***************************
  3. SPECIFIC_NAME: pro_select
  4. ROUTINE_CATALOG: def
  5. ROUTINE_SCHEMA: db3
  6. ROUTINE_NAME:pro_select
  7. ROUTINE_TYPE:PROCEDURE
  8. DATA_TYPE:
  9. CHARACTER_MAXIMUM_LENGTH:NULL
  10. CHARACTER_OCTET_LENGTH: NULL
  11. NUMERIC_PRECISION: NULL
  12. NUMERIC_SCALE: NULL
  13. DATETIME_PRECISION: NULL
  14. CHARACTER_SET_NAME: NULL
  15. COLLATION_NAME: NULL
  16. DTD_IDENTIFIER: NULL
  17. ROUTINE_BODY:SQL
  18. ROUTINE_DEFINITION: BEGIN
  19. SELECTCOUNT(1) FROM order040302;
  20. END
  21. EXTERNAL_NAME: NULL
  22. EXTERNAL_LANGUAGE: NULL
  23. PARAMETER_STYLE: SQL
  24. IS_DETERMINISTIC: NO
  25. SQL_DATA_ACCESS: CONTAINS SQL
  26. SQL_PATH:NULL
  27. SECURITY_TYPE: DEFINER
  28. CREATED: 2016-02-22 19:17:12
  29. LAST_ALTERED:2016-02-22 19:17:12
  30. SQL_MODE:STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
  31. ROUTINE_COMMENT:
  32. DEFINER: root@localhost
  33. CHARACTER_SET_CLIENT:latin1
  34. COLLATION_CONNECTION:latin1_swedish_ci
  35. DATABASE_COLLATION: utf8mb4_general_ci
  36. 1row in set (0.00 sec)
  37. mysql>

然后在mycat中运行:

  1. mysql>/*!mycat:sql=select * from order040302 where ID=2*/ call pro_select();
  2. +----------+
  3. |COUNT(1) |
  4. +----------+
  5. | 1 |
  6. | 1 |
  7. +----------+
  8. 2rows in set (0.01 sec)
  9. QueryOK, 0 rows affected (0.01 sec)
  10. mysql>

问题,为啥是2行记录,不知道能够不能够并成一行记录呢?

普通sql到了最后会有例如以下:

  1. 02/23 00:07:21.478 DEBUG [BusinessExecutor0] (DataMergeService.java:296) -prepare mpp merge result for select count(*) from order040302
  2. 02/23 00:07:21.479 DEBUG [BusinessExecutor0] (MultiNodeQueryHandler.java:324) -last packet id:5

的聚合操作,有了这个merge result操作后,就会把2条记录变成一条记录。可是mycat注解后的运行sql显示注解后,没有这一个merge result的操作,所以是2条记录。

哇塞。我好伟大,发现了当中的差别,可是那么新问题来了,怎么完好注解后生成的2条记录变成为1条记录额?


3.3看后台mycat.log日志:

看到日志中42.293记录。走的route路由进入dn21和dn22节点上面,终于运行的是注解的-execute mutinode query select * from order040302。例如以下所看到的:

  1. 02/22 20:19:42.292 DEBUG [$_NIOREACTOR-1-RW](ServerQueryHandler.java:56) -ServerConnection [id=10, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true,schema=TESTDB]/*!mycat:sql=select * from order040302*/ call pro_select()
  2. 02/22 20:19:42.293 DEBUG [$_NIOREACTOR-1-RW](NonBlockingSession.java:113) -ServerConnection [id=10, schema=TESTDB,host=127.0.0.1, user=test,txIsolation=3, autocommit=true, schema=TESTDB]select* from order040302, route={
  3. 1 -> dn21{call pro_select()}
  4. 2 -> dn22{call pro_select()}
  5. } rrs
  6. 02/22 20:19:42.293 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:82) -execute mutinode query select * fromorder040302
  7. 02/2220:19:42.295 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:falsefrom MySQLConnection [id=4, lastTime=1456143582284, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=280, charset=latin1,txIsolation=3, autocommit=true, attachment=dn21{call pro_select()},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@ba5d1a4,host=110.254.11.111, port=3317,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@939bc30,writeQueue=0, modifiedSQLExecuted=true]
  8. 02/2220:19:42.295 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:241) -on row end reseponse MySQLConnection [id=11,lastTime=1456143582284, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=254, charset=latin1, txIsolation=3, autocommit=true,attachment=dn22{call pro_select()},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@ba5d1a4,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  9. 02/2220:19:42.295 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:241) -on row end reseponse MySQLConnection [id=4,lastTime=1456143582284, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=280, charset=latin1, txIsolation=3,autocommit=true, attachment=dn21{call pro_select()},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@ba5d1a4,host=110.254.11.111, port=3317,statusSync=org.opencloudb.mysql.nio.MySQLConnection$StatusSync@939bc30,writeQueue=0, modifiedSQLExecuted=true]
  10. 02/2220:19:42.296 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:280) -last packet id:6
  11. 02/2220:19:42.295 DEBUG [$_NIOREACTOR-3-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:truefrom MySQLConnection [id=11, lastTime=1456143582284, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=254, charset=latin1,txIsolation=3, autocommit=true, attachment=dn22{call pro_select()},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@ba5d1a4,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  12. 02/2220:19:42.296 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:171) -received ok response ,executeResponse:truefrom MySQLConnection [id=4, lastTime=1456143582284, user=root, schema=db3, oldshema=db3, borrowed=true, fromSlaveDB=false, threadId=280, charset=latin1,txIsolation=3, autocommit=true, attachment=dn21{call pro_select()},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@ba5d1a4,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  13. 02/2220:19:42.296 DEBUG [$_NIOREACTOR-3-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=11,lastTime=1456143582284, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=254, charset=latin1, txIsolation=3,autocommit=true, attachment=dn22{call pro_select()},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@ba5d1a4,host=110.254.11.111, port=3327, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  14. 02/2220:19:42.296 DEBUG [$_NIOREACTOR-0-RW](NonBlockingSession.java:229) -release connection MySQLConnection [id=4,lastTime=1456143582284, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=280, charset=latin1, txIsolation=3,autocommit=true, attachment=dn21{call pro_select()},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@ba5d1a4,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=true]
  15. 02/2220:19:42.296 DEBUG [$_NIOREACTOR-3-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=11,lastTime=1456143582284, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveDB=false, threadId=254, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111, port=3327,statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
  16. 02/2220:19:42.297 DEBUG [$_NIOREACTOR-0-RW](PhysicalDatasource.java:403) -release channel MySQLConnection [id=4,lastTime=1456143582284, user=root, schema=db3, old shema=db3, borrowed=true,fromSlaveD**重点内容**B=false, threadId=280, charset=latin1, txIsolation=3,autocommit=true, attachment=null, respHandler=null, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

mycat 分页慢原理解析、mycat跨事务解惑、mycat注解调用存储过程分析的更多相关文章

  1. Mysql系列八:Mycat和Sharding-jdbc的区别、Mycat分片join、Mycat分页中的坑、Mycat注解、Catlet使用

    一.Mycat和Sharding-jdbc的区别 1)mycat是一个中间件的第三方应用,sharding-jdbc是一个jar包 2)使用mycat时不需要改代码,而使用sharding-jdbc时 ...

  2. Mysql系列六:(Mycat分片路由原理、Mycat常用分片规则及对应源码介绍)

    一.Mycat分片路由原理 我们先来看下面的一个SQL在Mycat里面是如何执行的: , ); 有3个分片dn1,dn2,dn3, id=5000001这条数据在dn2上,id=10000001这条数 ...

  3. 跨站请求伪造(CSRF)攻击原理解析:比你所想的更危险

    跨站请求伪造(CSRF)攻击原理解析:比你所想的更危险 跨站请求伪造(Cross-Site Request Forgery)或许是最令人难以理解的一种攻击方式了,但也正因如此,它的危险性也被人们所低估 ...

  4. JSONP跨域的原理解析

    JavaScript是一种在Web开发中经常使用的前端动态脚本技术.在JavaScript中,有一个很重要的安全性限制,被称为“Same- Origin Policy”(同源策略).这一策略对于Jav ...

  5. JSONP跨域的原理解析及其实现介绍

    JSONP跨域的原理解析及其实现介绍 作者: 字体:[增加 减小] 类型:转载 时间:2014-03-22 JSONP跨域GET请求是一个常用的解决方案,下面我们来看一下JSONP跨域是如何实现的,并 ...

  6. 【跨域】#001 JSONP原理解析【总结】

    一.JSONP 是什么? 1.1 概念 JSONP(JSON with Padding)是资料格式 JSON 的一种“使用模式”,可以让网页从别的网域要资料.由于同源策略,一般来说位于 server1 ...

  7. js跨域请求方式 ---- JSONP原理解析

    这篇文章主要介绍了js跨域请求的5中解决方式的相关资料,需要的朋友可以参考下     跨域请求数据解决方案主要有如下解决方法:   1 2 3 4 5 JSONP方式 表单POST方式 服务器代理 H ...

  8. RPC原理解析

    1.RPC原理解析 1.1 什么是RPC RPC(Remote Procedure Call Protocol) --远程过程调用协议,它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络 ...

  9. Hybrid App 原理解析

    目录 一.现有混合方案 二.Hybrid技术原理 三.Native 通知 H5 (Native 调用 JS) 3.1 Android 调 H5 3.2 iOS 调 H5 四.H5 通知 Native( ...

随机推荐

  1. Unity 脚本<2>

    UnityEngine; using System.Collections; public class PlayerControl : MonoBehaviour { [HideInInspector ...

  2. Lyft Level 5 Challenge 2018-Final Round(Open Div.2) B. Taxi drivers and Lyft

    http://codeforces.com/contest/1075/problem/B Palo Alto is an unusual city because it is an endless c ...

  3. sass和postcss

    sass是css预处理器 需要安装node-sass支持 核心是c++编写 集成 sass-loader 把scss装换成css css-loader 找出@import和url()导入的语法,告诉w ...

  4. Arcengine 基本操作(待更新)

    /// <summary> /// 删除fieldName属性值为1的弧段 /// </summary> /// <param name="fieldName& ...

  5. Mail.Ru Cup 2018 Round 2 Problem C Lucky Days

    设在第 $x$ 天二人都 lucky,则有 $\DeclareMathOperator{\lcm}{lcm}$ $ x = y_a t_a + R_a $ $ x= y_b t_ b + R_b$ 约 ...

  6. AutoDispose代替RxLifecycle优雅的解决RxJava内存泄漏问题

    使用过Rxjava的小伙伴都知道,在使用RxJava时如果处理不当,很可能会产生内存泄漏的问题. 我们使用rxjava最大的原因是响应式编程使我们的异步操作代码变得很优雅,在Android中,也使线程 ...

  7. 为MYSQL加注释--mysql注释符

    上午插入记录的时候一直没有成功,郁闷不知道为什么.因为是很多条记录一起插入,中间一些不用的数据就用"--"来注释了,结果没有效果. 没有办法,在网上找了找,才发现注释符" ...

  8. jmeter作接口测试入门的简单使用说明

    一.添加接口信息 1.添加线程组 (1)路径如下图: (2)部分内容解释 a.  Number of Threads(users):线程数 b.  Ramp-Up Period(in seconds) ...

  9. 面试:ios 批量上传图片

    这几天面试,被问到关于GCD的用法,想了想,之前项目好像确实用的比较少,只是知道怎么用,有思路,但是却从来没有试过,回来之后,就尝试写了下: 封装图片上传的方法 /**批量上传图片*/ + (NSUR ...

  10. O(∩_∩)O哈哈~

    原文发布时间为:2009-04-30 -- 来源于本人的百度文章 [由搬家工具导入]