今天测试了一下Mycat中的MySQL随机函数,又发现一个这样的Bug
2016-12-10 22:38:39,109 [INFO ][$_NIOREACTOR-2-RW] close connection,reason:quit cmd ,ServerConnection [id=4, schema=TESTDB, host=127.0.0.1, user=root,txIsolation=3, autocommit=true, schema=TESTDB] (io.mycat.net.AbstractConnection:AbstractConnection.java:508)
2016-12-10 22:40:22,953 [WARN ][$_NIOREACTOR-3-RW] caught exception java.lang.IllegalArgumentException: all columns in order by clause should be in the selected column list!RAND()
at io.mycat.sqlengine.mpp.DataMergeService.onRowMetaData(DataMergeService.java:156)
at io.mycat.backend.mysql.nio.handler.MultiNodeQueryHandler.fieldEofResponse(MultiNodeQueryHandler.java:650)
at io.mycat.backend.mysql.nio.MySQLConnectionHandler.handleFieldEofPacket(MySQLConnectionHandler.java:192)
at io.mycat.backend.mysql.nio.MySQLConnectionHandler.handleData(MySQLConnectionHandler.java:118)
at io.mycat.net.handler.BackendAsyncHandler.offerData(BackendAsyncHandler.java:36)
at io.mycat.backend.mysql.nio.MySQLConnectionHandler.handle(MySQLConnectionHandler.java:80)
at io.mycat.net.AbstractConnection.handle(AbstractConnection.java:263)
at io.mycat.net.AbstractConnection.onReadData(AbstractConnection.java:321)
at io.mycat.net.NIOSocketWR.asynRead(NIOSocketWR.java:190)
at io.mycat.net.AbstractConnection.asynRead(AbstractConnection.java:273)
at io.mycat.net.NIOReactor$RW.run(NIOReactor.java:102)
at java.lang.Thread.run(Thread.java:722)
(io.mycat.backend.mysql.nio.handler.MultiNodeQueryHandler:MultiNodeQueryHandler.java:663)
2016-12-10 22:40:22,984 [INFO ][$_NIOREACTOR-3-RW] close connection,reason:java.lang.IllegalArgumentException: all columns in order by clause should be in the selected column list!RAND() ,MySQLConnection [id=28, lastTime=1481380822875, user=root, schema=db3, old shema=db3, borrowed=true, fromSlaveDB=false, threadId=25, charset=utf8, txIsolation=3, autocommit=true, attachment=dn3{SELECT *
FROM t_gaojs
ORDER BY RAND()
LIMIT 5}, respHandler=io.mycat.backend.mysql.nio.handler.MultiNodeQueryHandler@4f27a1, host=localhost, port=3306, statusSync=io.mycat.backend.mysql.nio.MySQLConnection$StatusSync@b2d7e8, writeQueue=0, modifiedSQLExecuted=false] (io.mycat.net.AbstractConnection:AbstractConnection.java:508)
2016-12-10 22:40:22,984 [INFO ][$_NIOREACTOR-3-RW] close connection,reason:java.lang.IllegalArgumentException: all columns in order by clause should be in the selected column list!RAND() ,MySQLConnection [id=15, lastTime=1481380822875, user=root, schema=db1, old shema=db1, borrowed=true, fromSlaveDB=false, threadId=20, charset=utf8, txIsolation=3, autocommit=true, attachment=dn1{SELECT *
FROM t_gaojs
ORDER BY RAND()
测试语句如下:
select * from t_gaojs ORDER BY RAND() limit 3
select * from t_gaojs ORDER BY id R1AND() limit 1
select * from t_gaojs ORDER BY id RAND() limit