mycat 分页慢原理解析、mycat跨事务解惑、mycat注解调用存储过程分析
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注解调用存储过程分析的更多相关文章
- Mysql系列八:Mycat和Sharding-jdbc的区别、Mycat分片join、Mycat分页中的坑、Mycat注解、Catlet使用
一.Mycat和Sharding-jdbc的区别 1)mycat是一个中间件的第三方应用,sharding-jdbc是一个jar包 2)使用mycat时不需要改代码,而使用sharding-jdbc时 ...
- Mysql系列六:(Mycat分片路由原理、Mycat常用分片规则及对应源码介绍)
一.Mycat分片路由原理 我们先来看下面的一个SQL在Mycat里面是如何执行的: , ); 有3个分片dn1,dn2,dn3, id=5000001这条数据在dn2上,id=10000001这条数 ...
- 跨站请求伪造(CSRF)攻击原理解析:比你所想的更危险
跨站请求伪造(CSRF)攻击原理解析:比你所想的更危险 跨站请求伪造(Cross-Site Request Forgery)或许是最令人难以理解的一种攻击方式了,但也正因如此,它的危险性也被人们所低估 ...
- JSONP跨域的原理解析
JavaScript是一种在Web开发中经常使用的前端动态脚本技术.在JavaScript中,有一个很重要的安全性限制,被称为“Same- Origin Policy”(同源策略).这一策略对于Jav ...
- JSONP跨域的原理解析及其实现介绍
JSONP跨域的原理解析及其实现介绍 作者: 字体:[增加 减小] 类型:转载 时间:2014-03-22 JSONP跨域GET请求是一个常用的解决方案,下面我们来看一下JSONP跨域是如何实现的,并 ...
- 【跨域】#001 JSONP原理解析【总结】
一.JSONP 是什么? 1.1 概念 JSONP(JSON with Padding)是资料格式 JSON 的一种“使用模式”,可以让网页从别的网域要资料.由于同源策略,一般来说位于 server1 ...
- js跨域请求方式 ---- JSONP原理解析
这篇文章主要介绍了js跨域请求的5中解决方式的相关资料,需要的朋友可以参考下 跨域请求数据解决方案主要有如下解决方法: 1 2 3 4 5 JSONP方式 表单POST方式 服务器代理 H ...
- RPC原理解析
1.RPC原理解析 1.1 什么是RPC RPC(Remote Procedure Call Protocol) --远程过程调用协议,它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络 ...
- Hybrid App 原理解析
目录 一.现有混合方案 二.Hybrid技术原理 三.Native 通知 H5 (Native 调用 JS) 3.1 Android 调 H5 3.2 iOS 调 H5 四.H5 通知 Native( ...
随机推荐
- 为MYSQL加注释--mysql注释符
上午插入记录的时候一直没有成功,郁闷不知道为什么.因为是很多条记录一起插入,中间一些不用的数据就用"--"来注释了,结果没有效果. 没有办法,在网上找了找,才发现注释符" ...
- 【08】Vue 之 vue-cli
8.1. 前置知识学习 npm 学习 官方文档 推荐资料 npm入门 npm介绍 需要了解的知识点 package.json 文件相关配置选项 npm 本地安装.全局安装.本地开发安装等区别及相关命令 ...
- rpm包安装mysql5.6.*版本
1.查看是否已经安装Mysql rpm -qa | grep -i mysql #删除已经安装的Mysql程序 rpm -ev *****.rpm 2.检查是否还有残留mysql文件夹 find / ...
- 常用“Request.ServerVariables()”汇总
原文发布时间为:2009-10-25 -- 来源于本人的百度文章 [由搬家工具导入] Request.ServerVariables("REMOTE_ADDR") ...
- The type or namespace name 'Html' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)
The type or namespace name 'Html' does not exist in the namespace 'System.Web.Mvc' (are you missing ...
- linux下不是很完美的提高android虚拟机的启动速度
去年双十一换的新电脑,华硕vivo4000的,配置的不算很好,4k的屏幕:3840×2160, 940M的显卡, core i7的CPU, 8G的内存,硬盘是1T的机械硬盘,除了硬盘基本感觉还可以吧. ...
- AutoResetEvent 和 ManualResetEvent 多线程应用
AutoResetEvent 1.用于在多线程,对线程进行阻塞放行 static AutoResetEvent auth0 = new AutoResetEvent(false); static Au ...
- android studio 按钮运行按钮后,不弹出选择运行模拟器的对话框
这个问题实际上很简单,奈何碰到的时候做了很多无用功.clean,rebulid... 特此记录,方便后来人. 解决步骤: 1.关闭AndroidStudio,并重启. 2. 把截图中的地方的勾去掉.检 ...
- NOIP 2016 天天爱跑步 80分暴力
题目描述 小c同学认为跑步非常有趣,于是决定制作一款叫做<天天爱跑步>的游戏.«天天爱跑步»是一个养成类游戏,需要玩家每天按时上线,完成打卡任务. 这个游戏的地图可以看作一一棵包含 个结点 ...
- SSH做反向代理
说实话,我对反向代理这个概念并不熟悉,只是感觉以下要做的事是一个代理的逆向过程,故借此名词一用. 问题场景是这样的:我有两套Linux集群的访问权限,分别为A和B,它们互相独立.其中A.B集群均能访问 ...