Bug #45408 MySQL proxy strict.lua not found error
Submitted: 9 Jun 2009 16:15 Modified: 7 Dec 2009 9:16
Reporter: Vinod Sugur Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Scripts Severity:S2 (Serious)
Version:mysql-proxy-0.7.1-solaris10-sparc-64bit OS:Any (sun solaris 64bit)
Assigned to: Jan Kneschke CPU Architecture:Any
Tags: strict.lua

[9 Jun 2009 16:15] Vinod Sugur
Description:
I am getting the below error after connecting to mysql-proxy.

============================================
2009-06-09 08:21:43: (critical) (lua-error) [/usr/local/mysql-5.1.33-solaris10-sparc-64bit/mysql-proxy-0.7.1-solaris10-sparc-64bit/share/doc/mysql-proxy/ro-balance.lua]
[string "/usr/local/mysql-5.1.33-solaris10-sparc-64b..."]:39: module 'proxy.strict' not found:
        no field package.preload['proxy.strict']
        no file '/usr/local/mysql-5.1.33-solaris10-sparc-64bit/mysql-proxy-0.7.1-solaris10-sparc-64bit/lib/mysql-proxy/lua/proxy/strict.lua'
        no file '/usr/local/mysql-5.1.33-solaris10-sparc-64bit/mysql-proxy-0.7.1-solaris10-sparc-64bit/lib/mysql-proxy/lua/proxy/strict.so'
        no file '/usr/local/mysql-5.1.33-solaris10-sparc-64bit/mysql-proxy-0.7.1-solaris10-sparc-64bit/lib/mysql-proxy/lua/proxy.so'
2009-06-09 08:22:03: (message) last message repeated 1 times
============================================

How to repeat:
MySQL proxy has been started with following command:

sbin/mysql-proxy --proxy-backend-addresses=myslave1:3306 \
--proxy-backend-addresses=myslave2.com:3308 \
--admin-username='vinod' \
--proxy-lua-script=share/doc/mysql-proxy/ro-balance.lua  \
--log-level=debug \
--log-file=/tmp/mysql-proxy.log

I am connecting to mysql-proxy using mysql client at default port 4040

mysql -h myproxyserver -u xiqa -pxiqa --port 4040

Suggested fix:
It seems that script strict.lua is not present in following directory:

$ ls -ltr
total 64
-rw-r--r--   1 mysql    mysql       5913 May 18 14:27 tokenizer.lua
-rw-r--r--   1 mysql    mysql       6164 May 18 14:27 test.lua
-rw-r--r--   1 mysql    mysql       5157 May 18 14:27 parser.lua
-rw-r--r--   1 mysql    mysql       3575 May 18 14:27 commands.lua
-rw-r--r--   1 mysql    mysql       1737 May 18 14:27 balance.lua
-rw-r--r--   1 mysql    mysql       6653 May 18 14:27 auto-config.lua
$ pwd
/usr/local/mysql-5.1.33-solaris10-sparc-64bit/mysql-proxy-0.7.1-solaris10-sparc-64bit/lib/mysql-proxy/lua/proxy
[9 Jun 2009 16:50] Diego Medina
Thank you for your detailed bug report.

Verified as described.
A workaround is to comment the line that says 
require("proxy.strict")
to look like

-- require("proxy.strict")

(I'll try to find out what the strict file was supposed to do.)

You will also need to make a few other changes to the lua script to account for the latest changes on the proxy code. I will attach a patch file.
[9 Jun 2009 16:51] Diego Medina
Changed .address for .dst.name and added { resultset_is_needed = true }

Attachment: ro-balance.lua (application/octet-stream, text), 6.56 KiB.

[11 Jun 2009 14:48] Jan Kneschke
revno: 663
committer: jan@mysql.com
branch nick: 0.7
timestamp: Thu 2009-06-11 16:47:04 +0200
message:
  removed the use of the strict.lua (fixes #45408)

revno: 675
committer: jan@mysql.com
branch nick: trunk
timestamp: Thu 2009-06-11 16:45:52 +0200
message:
  removed the reference to the 'strict' module (fixes #45408)
[23 Jun 2009 11:37] Danila Lelaev
Hello, all.

I start mysql-proxy whith latest ro-balance.lua (by Diego Medina http://bugs.mysql.com/file.php?id=12245), using next command:

mysql-proxy --proxy-address=x.x.x.x:3306 --proxy-backend-addresses=y.y.y.y:3307 --proxy-backend-addresses=z.z.z.z:3307  --proxy-read-only-backend-addresses=y.y.y.y:3308 --proxy-read-only-backend-addresses=z.z.z.z:3308  --admin-lua-script=/usr/local/mysql/share/doc/mysql-proxy/ro-balance.lua  --log-level=debug --log-file=/proxy.log --daemon

Then I trying execute any commands in mysql-shell, and I get next error:
<code>
2009-06-23 15:19:02: (debug) [network-mysqld.c:784]: error on a connection (fd: -1 event: 0). closing client connection.
2009-06-23 15:29:04: (debug) last message repeated 1 times
2009-06-23 15:29:04: (debug) [network-mysqld.c:784]: error on a connection (fd: -1 event: 0). closing client connection.
</code>
[23 Jun 2009 12:02] Danila Lelaev
Of course version mysql-proxy is 0.7.1;
OS - Solaris10-i386-64bit

If I doing any requests to mysql-proxy, I recive proper answer, but all response come only one back-end.

How to create load-balancer to are several back-ends?

Thanks to all.
[1 Sep 2009 16:44] Enterprise Tools JIRA Robot
Diego Medina writes: 
Verified fixed on 0.8.0
[7 Dec 2009 9:16] MC Brown
A note has been added to the 0.8.0 changelog: 

The supplied script <filename>ro-balance.lua</filename> had not been updated to use the <literal>resultset_is_needed</literal> and updated <literal>proxy.connection.dst.name</literal> structure