{"action":"created","issue":{"url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/864","repository_url":"https://api.github.com/repos/MyCATApache/Mycat-Server","labels_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/864/labels{/name}","comments_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/864/comments","events_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/864/events","html_url":"https://github.com/MyCATApache/Mycat-Server/issues/864","id":153588491,"number":864,"title":"1.5.1 release版中，读写分离，事务内执行查询，balance指定为1，无法走从节点？","user":{"login":"snowqoo228","id":19237589,"avatar_url":"https://avatars.githubusercontent.com/u/19237589?v=3","gravatar_id":"","url":"https://api.github.com/users/snowqoo228","html_url":"https://github.com/snowqoo228","followers_url":"https://api.github.com/users/snowqoo228/followers","following_url":"https://api.github.com/users/snowqoo228/following{/other_user}","gists_url":"https://api.github.com/users/snowqoo228/gists{/gist_id}","starred_url":"https://api.github.com/users/snowqoo228/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowqoo228/subscriptions","organizations_url":"https://api.github.com/users/snowqoo228/orgs","repos_url":"https://api.github.com/users/snowqoo228/repos","events_url":"https://api.github.com/users/snowqoo228/events{/privacy}","received_events_url":"https://api.github.com/users/snowqoo228/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-05-07T10:51:07Z","updated_at":"2016-05-13T11:51:49Z","closed_at":null,"body":"balance注释为什么没有起作用，是写法问题，还是什么问题？大家帮忙看看\r\n\r\nschema.xml:\r\n\r\n`<dataHost name=\"mysql_newhaolyy\" maxCon=\"1000\" minCon=\"10\" balance=\"1\"\r\n             writeType=\"0\" dbType=\"mysql\" dbDriver=\"native\">\r\n                <!--<heartbeat>show slave status</heartbeat>-->\r\n                <heartbeat>select user()</heartbeat>\r\n                <!-- can have multi write hosts -->\r\n                <writeHost host=\"hostM1\" url=\"192.168.4.221:3306\" user=\"root\" password=\"sfsdfsd\">\r\n                        <!-- can have multi read hosts -->\r\n                        <readHost host=\"hostS1\" url=\"192.168.4.220:3306\" user=\"root\" password=\"sfsdfsd\" weight=\"1\"/>\r\n                </writeHost>\r\n        </dataHost>`\r\n\r\n1、做了个测试，跑了一段查询:\r\nselect * from haolyy_users where mobile='13903330000140' limit 1;\r\n走的是220，没有问题，\r\n\r\n2、事务内，跑一段查询\r\nset autocommit = 0;\r\nselect *  from haolyy_users where mobile='13900000140' limit 1;\r\ncommit;\r\n走的是221，\r\n\r\n根据1.5.1权威指南【事务内的SQL，默认走写节点，以注释/*balance*/开头，则会根据balance=“1”或“2”去获取】\r\n也没有问题，\r\n\r\n3、增加balance注释，想让他走220，hostS1\r\n/*balance*/ select * from haolyy_users where mobile='13903330000140' limit 1;\r\nselect /* + balance */ * from haolyy_users where mobile='13903330000140' limit 1;\r\n两种方法都试过，可结果走的还是221"},"comment":{"url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/comments/219022583","html_url":"https://github.com/MyCATApache/Mycat-Server/issues/864#issuecomment-219022583","issue_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/864","id":219022583,"user":{"login":"magicdoom","id":468657,"avatar_url":"https://avatars.githubusercontent.com/u/468657?v=3","gravatar_id":"","url":"https://api.github.com/users/magicdoom","html_url":"https://github.com/magicdoom","followers_url":"https://api.github.com/users/magicdoom/followers","following_url":"https://api.github.com/users/magicdoom/following{/other_user}","gists_url":"https://api.github.com/users/magicdoom/gists{/gist_id}","starred_url":"https://api.github.com/users/magicdoom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magicdoom/subscriptions","organizations_url":"https://api.github.com/users/magicdoom/orgs","repos_url":"https://api.github.com/users/magicdoom/repos","events_url":"https://api.github.com/users/magicdoom/events{/privacy}","received_events_url":"https://api.github.com/users/magicdoom/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T11:51:49Z","updated_at":"2016-05-13T11:51:49Z","body":"确认下是不是  不是bug    。如果不是就关闭吧"}}