mycat 分页慢原理解析mycat跨事务解惑mycat注解调用存储过程分析
Posted brucemengbm
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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[email protected],host=110.254.11.111, port=3317, [email protected]47af37,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[email protected],host=110.254.11.111, port=3317,[email protected]47af37,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[email protected],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[email protected],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[email protected],host=110.254.11.111, port=3317,[email protected]47af37,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[email protected],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[email protected], 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[email protected]23eca0d1,host=110.254.11.111, port=3317, [email protected]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[email protected]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[email protected]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[email protected]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[email protected]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[email protected]1c70f0b1,host=110.254.11.111, port=3317, [email protected]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[email protected]1c70f0b1,host=110.254.11.111, port=3327,[email protected]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[email protected]1c70f0b1,host=110.254.11.111, port=3317,[email protected]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[email protected]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[email protected]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
从日志记录里面能够看出:[
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[email protected]243cc381,host=110.254.11.111, port=3317, [email protected]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[email protected]243cc381,host=110.254.11.111, port=3327,[email protected]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[email protected]243cc381,host=110.254.11.111, port=3317, [email protected]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[email protected]243cc381,host=110.254.11.111, port=3327,[email protected]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[email protected]243cc381,host=110.254.11.111, port=3317,[email protected]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[email protected]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[email protected]243cc381,host=110.254.11.111, port=3317,[email protected]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[email protected]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 [email protected]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[email protected]2c96cb44,host=110.254.11.111, port=3317, [email protected]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[email protected]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[email protected]56683a8d,host=110.254.11.111, port=3317,[email protected]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[email protected]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: [email protected]
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[email protected],host=110.254.11.111, port=3317,[email protected]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[email protected],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[email protected],host=110.254.11.111, port=3317,[email protected]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[email protected],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[email protected],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[email protected],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[email protected],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注解调用存储过程分析的主要内容,如果未能解决你的问题,请参考以下文章
Mycat和Sharding-jdbc的区别Mycat分片joinMycat分页中的坑Mycat注解