MySQL Proxy Lua scripts cannot be written as a module?
Yesterday I went through hell while testing the MySQL Proxy partition Lua scripts I am working on in a high concurrency environment. I am sending multiple queries to the server and build up a combined result set in
read_query_result – something like this. The proxy returned weird results complaining about multiple result sets being sent from time to time at totally different places even though I was sure that for each query only one result set has been sent. And some of the results were just wrong, a lot of our tests failed unexpectedly.
After long hours flicking almost every switch I simply removed the Lua module declaration from the main LUA script passed to the proxy via
proxy-lua-script since it was the only thing left that changed. And then everything worked just fine!
I guess defining the proxy Lua script as a module messes up the scope of the script, but I haven’t researched that yet. So for now I just don’t declare the main proxy Lua script as a module and everything works fine.