Bug #43467 MySQL Proxy/rw-splitting.lua Prepared Statements not returning results.
Submitted: 6 Mar 2009 22:19 Modified: 9 Jan 2015 19:12
Reporter: Hugh McLenaghan Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Proxy: Scripts Severity:S1 (Critical)
Version:0.7.0 including build 633 OS:Linux
Assigned to: CPU Architecture:Any
Tags: 0.7.0

[6 Mar 2009 22:19] Hugh McLenaghan
Description:
Using the latest code build 633 bzr. Also using the rw-splitting.lua. 

When I use rw-splitting.lua I don't get results most of the time, however if I remove rw-splitting.lua and just use MySQL proxy on it's own, then I get results every time! So there's something thats happening with the lua script that's causing results to not be returned. 

How to repeat:
Set up 2 mysql databases. create same table on each with multiple fields, and put test data in it.

    /usr/local/mysql-proxy/sbin/mysql-proxy \
        --proxy-address=:3307 \
        --admin-address=:4042 \
        --log-file=/usr/local/mysql-proxy/logs/proxy.log \
        --proxy-lua-script=/usr/local/mysql-proxy/share/mysql-proxy/rw-splitting.lua \
        --proxy-backend-addresses=a.b.c.d:3306 \
        --proxy-backend-addresses=a.b.c.e:3306

PHP/MySQLi script:-

$mysqli = new mysqli($dbHost, $dbUser, $dbPass, $dbName, $dbPort); 
if($stmt = $mysqli->prepare("select a, b, c, d, e from abcdeTable where a = ? order by b asc")) { 

/* Bind parameters 
s - string, b - boolean, i - int, etc */ 
$stmt->bind_param("i", $aValue); 

/* Execute it */ 
$stmt->execute(); 

/* Bind results */ 
$stmt->bind_result($resA, $resB, $resC, $resD, $resE); 

/* Fetch the value */ 
while ( $result = $stmt->fetch()) { 

print "Results: $resA, $resB, $resC, $resD, $resE\n"; 
} 

/* Close statement */ 
$stmt->close(); 
} 

/* Close connection */ 
$mysqli->close(); 

Sometimes you get a result, but most times you don't.   If you remove the rw-splitting.lua, then you always get results returned.
[6 Apr 2009 21:50] Hugh McLenaghan
Seems to be not restricted to just CentOS 5.2
[14 May 2010 8:13] antonio cozzolino
I have the same problem on ubuntu 10.04 with Mysql 5.1.41 and mysql-proxy-0.8.0.
My java application rise an SQLException, and the first message in "ResultSet is from UPDATE. No Data."....from mysql-proxy.
[9 Dec 2014 19:12] Sveta Smirnova
Thank you for the report.

Are you sure you have same data in all three servers? If not it is expected that you receive result set randomly when rw-splitting.lua is used.
[10 Jan 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".