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

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

         mysql>explain select * from travelrecord order by id limit 100000,100 ;
+-----------+--------------------------------------------------------+
|DATA_NODE | SQL |
+-----------+--------------------------------------------------------+
|dn1 | SELECT * FROM travelrecordORDER BY id LIMIT 0, 100100 |
|dn2 | SELECT * FROM travelrecordORDER BY id LIMIT 0, 100100 |
|dn3 | SELECT * FROM travelrecordORDER BY id LIMIT 0, 100100 |
+-----------+--------------------------------------------------------+
3rows in set (0.01 sec) mysql>

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


1.2看后台mycat.log日志:

         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
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
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={
1 -> dn1{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
2 -> dn2{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
3 -> dn3{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
}
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
02/1417:52:33.881 DEBUG [$_NIOREACTOR-0-RW](EnchachePool.java:76) -SQLRouteCache miss cache ,key:TESTDBselect * from travelrecord order by id limit1000000,100
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={
1 -> dn1{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
2 -> dn2{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
3 -> dn3{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
}
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={
1 -> dn1{SELECT *
FROMtravelrecord
ORDERBY id 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={
1 -> dn1{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
2 -> dn2{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
3 -> dn3{SELECT *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100}
}rrs
02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:82) -execute mutinode query select * from travelrecordorder by id limit 1000000,100
02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:97) -has data merge logic
02/1417:52:33.882 DEBUG [$_NIOREACTOR-0-RW](PhysicalDBPool.java:452) -select read source hostM1 for dataHost:wgq_idc_mon_1_12
02/1417:52:33.883 DEBUG [$_NIOREACTOR-0-RW](PhysicalDBPool.java:452) -select read source hostM1 fordataHost:wgq_idc_mon_1_12
02/1417:52:33.883 DEBUG [$_NIOREACTOR-0-RW](PhysicalDBPool.java:452) -select read source hostM1 for dataHost:wgq_idc_mon_1_12
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 *
FROMtravelrecord
ORDERBY id
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]
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 *
FROMtravelrecord 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 *
FROMtravelrecord
ORDERBY id
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]
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 *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=false] 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]]
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 *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=false] 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]
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 *
FROMtravelrecord
ORDERBY id
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]
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]
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 *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686,host=110.254.11.111, port=3317, statusSync=null, writeQueue=0,modifiedSQLExecuted=false]
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 *
FROMtravelrecord
ORDERBY id
LIMIT0, 1000100},respHandler=org.opencloudb.mysql.nio.handler.MultiNodeQueryHandler@f35a686, host=110.254.11.111,port=3317, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]
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]
02/1417:52:33.887 DEBUG [BusinessExecutor5](DataMergeService.java:296) -prepare mpp merge result for select * fromtravelrecord order by id limit 1000000,100
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 正常的跨分片事务分析

运行情况:

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

mycat.log日志显示:

         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')
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={
1 -> dn21{update order040302 setSN=concat(SN,'-mycat')}
2 -> dn22{update order040302 setSN=concat(SN,'-mycat')}
}rrs
02/1800:01:24.356 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:82) -execute mutinode query update order040302 setSN=concat(SN,'-mycat')
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]
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]
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]
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]
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]
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事务运行,有一处报错的情况下(失败经过)

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

2.2.1 查看表结构:

 mysql>show create table order040302;
+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|Table | Create Table |
+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|order040302 | CREATE TABLE `order040302` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`CODE` varchar(64) DEFAULT NULL,
`SN` varchar(64) DEFAULT NULL,
`CREATE_TIME` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
)ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 |
+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1row in set (0.00 sec) mysql>

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

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

2.2.2 mycat.log日志例如以下:

         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)
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={
1 -> dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}
2 -> dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}
}rrs
02/2205:44:39.827 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:82) -execute mutinode query update order040302 setSN = concat('fenpianyigechenggong_yigeshibai_',SN)
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]
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]
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]
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]
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]
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
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]
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]
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不会回退。这是怎么回事呢?查看运行后的数据结果例如以下:

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

mycat窗体中怎样开启事务?

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

2.3.1 开启事务,手动提交

     mysql>set autocommit=0;
QueryOK, 0 rows affected (0.00 sec) mysql>update order040302 set SN = concat('fenpianyigechenggong_yigeshibai_',SN) ;
ERROR1105 (HY000): Data too long for column 'SN' at row 1
mysql>commit;
ERROR1003 (HY000): Transaction error, need to rollback.
mysql>
mysql>select length(t1.SN),t1.* from order040302 t1;
ERROR1003 (HY000): Transaction error, need to rollback.Data too long for column 'SN'at row 1
mysql>
mysql>rollback;
QueryOK, 0 rows affected (0.01 sec) mysql>
mysql>select length(t1.SN),t1.* from order040302 t1;
+---------------+----+------------+-------------------------------------------------------+---------------------+
|length(t1.SN) | ID | CODE | SN | CREATE_TIME |
+---------------+----+------------+-------------------------------------------------------+---------------------+
| 53 | 1 | 0-10000020 |beijing_03-10000020-mycat___beijing_03-10000020-mycat | 2016-02-13 00:40:27 |
| 26 | 2 | 1-10000020 |shanghai_10-10000020-mycat | 2016-02-1300:40:18 |
+---------------+----+------------+-------------------------------------------------------+---------------------+
2rows in set (0.09 sec) mysql>

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

         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)
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={
1 -> dn21{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}
2 -> dn22{update order040302 set SN =concat('fenpianyigechenggong_yigeshibai_',SN)}
}rrs
02/2217:54:25.193 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:82) -execute mutinode query update order040302 setSN = concat('fenpianyigechenggong_yigeshibai_',SN)
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]
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]
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]
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]
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
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]
02/2217:54:25.199 DEBUG [$_NIOREACTOR-1-RW](MultiNodeHandler.java:194) -error all end ,clear session resource

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

         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
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]
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]
02/2217:57:17.436 DEBUG [$_NIOREACTOR-1-RW](NonBlockingSession.java:361) -clear session resourcesorg.opencloudb.server.NonBlockingSession@4483dae0
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]
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]
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]
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]
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]
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准备好的简单的存储过程

         DELIMITER$$
CREATE
PROCEDUREdb3.pro_select()
BEGIN
SELECTCOUNT(1) FROM order040302;
END$$
DELIMITER;

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

dn21节点上的mysql窗体上:

         mysql>DELIMITER $$
mysql>CREATE
-> PROCEDURE `db3`.`pro_select`()
-> BEGIN
->SELECT COUNT(1) FROM order040302;
-> END$$
QueryOK, 0 rows affected (0.01 sec) mysql>DELIMITER ;
mysql>

dn22节点上的mysql窗体上:

         mysql>DELIMITER $$
mysql>CREATE
-> PROCEDURE `db3`.`pro_select`()
-> BEGIN
->SELECT COUNT(1) FROM order040302;
-> END$$
QueryOK, 0 rows affected (0.01 sec) mysql>DELIMITER ;
mysql>

检查存储过程:

         mysql>select * from information_schema.ROUTINES\G
***************************1. row ***************************
SPECIFIC_NAME: pro_select
ROUTINE_CATALOG: def
ROUTINE_SCHEMA: db3
ROUTINE_NAME:pro_select
ROUTINE_TYPE:PROCEDURE
DATA_TYPE:
CHARACTER_MAXIMUM_LENGTH:NULL
CHARACTER_OCTET_LENGTH: NULL
NUMERIC_PRECISION: NULL
NUMERIC_SCALE: NULL
DATETIME_PRECISION: NULL
CHARACTER_SET_NAME: NULL
COLLATION_NAME: NULL
DTD_IDENTIFIER: NULL
ROUTINE_BODY:SQL
ROUTINE_DEFINITION: BEGIN
SELECTCOUNT(1) FROM order040302;
END
EXTERNAL_NAME: NULL
EXTERNAL_LANGUAGE: NULL
PARAMETER_STYLE: SQL
IS_DETERMINISTIC: NO
SQL_DATA_ACCESS: CONTAINS SQL
SQL_PATH:NULL
SECURITY_TYPE: DEFINER
CREATED: 2016-02-22 19:17:12
LAST_ALTERED:2016-02-22 19:17:12
SQL_MODE:STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
ROUTINE_COMMENT:
DEFINER: root@localhost
CHARACTER_SET_CLIENT:latin1
COLLATION_CONNECTION:latin1_swedish_ci
DATABASE_COLLATION: utf8mb4_general_ci
1row in set (0.00 sec) mysql>

然后在mycat中运行:

         mysql>/*!mycat:sql=select * from order040302 where ID=2*/ call pro_select();
+----------+
|COUNT(1) |
+----------+
| 1 |
| 1 |
+----------+
2rows in set (0.01 sec) QueryOK, 0 rows affected (0.01 sec) mysql>

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

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

02/23 00:07:21.478  DEBUG [BusinessExecutor0] (DataMergeService.java:296) -prepare mpp merge result for select count(*) from order040302
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。例如以下所看到的:

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()
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={
1 -> dn21{call pro_select()}
2 -> dn22{call pro_select()}
} rrs
02/22 20:19:42.293 DEBUG [$_NIOREACTOR-1-RW](MultiNodeQueryHandler.java:82) -execute mutinode query select * fromorder040302
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]
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]
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]
02/2220:19:42.296 DEBUG [$_NIOREACTOR-0-RW](MultiNodeQueryHandler.java:280) -last packet id:6
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]
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]
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]
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]
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]
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. 【翻译】Apache软件基金会1

    最近有点看不进去书,所以就找点东西翻译下,正好很想了解Apache基金会都有什么开源项目,每天找点事时间翻译翻译,还可以扩展下视野. 今天就看了两个,第一个是关于.NET的,不再兴趣范围内.第二个还挺 ...

  2. [CQOI2016][bzoj4519] 不同的最小割 [最小割树]

    题面 传送门 思路 首先我们明确一点:这道题不是让你把$n^2$个最小割跑一遍[废话] 但是最小割过程是必要的,因为最小割并没有别的效率更高的算法(Stoer-Wagner之类的?) 那我们就要尽量找 ...

  3. python相关的编码,运算

    一 字符串的格式化 python中使用占位符%来实现. name=input('name:') age=input('age:') hobby=input('hobby:') print('%s的年龄 ...

  4. iOS - 倒计时封装

    +(NSString *)countdownStartTime:(NSString *)startTime{ NSString *TIME = [startTime substringToIndex: ...

  5. js Regex match, exec, test & jquery plugin, visit the official website!

    http://plugins.jquery.com/?s=bootstrap 1. /reg/.test(strval) 2."strval".match(/reg/g), a r ...

  6. unbuntu 矫正电脑系统时间

    sudo tzconfig,如果命令不存在请使用 dpkg-reconfigure tzdata

  7. LINUX CP命令直接覆盖不提示按Y/N的方法

    refer to: https://blog.csdn.net/qq_36741436/article/details/78732201 cp覆盖时,无论加什么参数-f之类的还是提示是否覆盖,当文件比 ...

  8. Linked List Cycle - LeetCode

    Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using ext ...

  9. [TJOI2016][HEOI2016]排序

    题目大意: 给定一个$1\sim n(n\leq10^5)$的全排列,有$m(m\leq10^5)$次操作,每次把区间$[l,r]$按照升序或降序排序.最后询问所有操作完成后,位置为$q$的数是多少. ...

  10. UVA 11100 The Trip, 2007 水题一枚

    题目链接:UVA - 11100 题意描述:n个旅行箱,形状相同,尺寸不同,尺寸小的可以放在尺寸大的旅行箱里.现在要求露在最外面的旅行箱的数量最少的同时满足一个旅行箱里放的旅行箱的数量最少.求出这样满 ...