Bug #31121 rw-splitting script does not handle temporary tables
Submitted: 20 Sep 2007 22:02 Modified: 9 Dec 2014 19:14
Reporter: simon elliston ball Email Updates:
Status: Verified Impact on me:
Category:MySQL Proxy: Scripts Severity:S4 (Feature request)
Version:0.6.0, 0.8.5 OS:Any
Assigned to: CPU Architecture:Any

[20 Sep 2007 22:02] simon elliston ball
It suddenly occurs to me that while connections are kept consistent for insert id and transaction queries in the rw-splitting script it does not cover scripts which use temporary tables. When using temporary tables subsequent queries should be sent to the same connection, as with the transactions, but I cannot find anything in the script which treats temporary table scripts as transactions. 

How to repeat:
Use temporary tables in a query with rw-splitting.lua

Suggested fix:
Once a create temporary table function has been called, the connection should be marked as being part of a transaction.
[9 Dec 2014 19:14] Sveta Smirnova
Thank you for the report.

Verified as described.

Svetas-MacBook-Pro:mysql-test sveta$ ../client/mysql -uroot -h127.0.0.1 -P4040 test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.5.42-debug-log Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create temporary table t1(f1 int);
Query OK, 0 rows affected (0.01 sec)

mysql> show tables;
| Tables_in_test |
| tmp            |
1 row in set (0.00 sec)

mysql> show full tables;
| Tables_in_test | Table_type |
| tmp            | BASE TABLE |
1 row in set (0.00 sec)

mysql> insert into t1 values(1);
ERROR 1146 (42S02): Table 'test.t1' doesn't exist