Is there a complete documentation kit for mysql-proxy lua scripts?

I play with scripts for mysql-proxy. What I'm trying to do does not matter. However, I found that the lua interface elements seemed to be undocumented. Big "smoking gun" I have a disconnect_client() hook. I can not find it documented in the official documentation , although it was used in the example to explain the admin interface . It is also widely used in sample documents. Quick grep shows its use in the following scripts included in the 5.5.8 distribution:

active-queries.lua
active transactions.lua
multi.lua loads
ro-pooling.lua
RW-splitting.lua
tutorial-keepalive.lua

Another example, in my opinion, is a list of attributes for entries in the proxy.global.backends table. The documentation lists the following attributes:

 dst.name dst.address dst.port connected_clients state type 

However, several sample scripts refer to a rather complex element called a pool. Take tutorial-keepalive.lua for example:

 local s = proxy.global.backends[i] local pool = s.pool local cur_idle = pool.users[proxy.connection.client.username].cur_idle_connections 

At first I thought it was being added somewhere else in lua, but I looked and I could not find the code assigned in proxy.global.backends [i] .pool.

So, the two questions I assume are:

  • Am I nuts? Please feel free to demonstrate how I overlooked the obvious and the documentation is really clear.
  • Assuming I'm right, is there any place to find the full documentation? A good link would be great (although I could not do google alone), but even “take a look at this .c file from the mysql-proxy distribution that defines the interface”. At least this will give me something to poke.

thanks

+6
mysql-proxy
source share
1 answer

Just opened Proxy / Lua. I'm afraid, like all Mysql stuff, once you plunge into covers, you are on your own. The same goes for LUA. You need other additions to LUA to do what you want to do, I would suggest: http://peterodding.com/code/lua/apr/docs/#shared_memory to link the Apache Protable library ... saved me from time. As for the internal components of MySql, you probably have to look in the C source files, unfortunately, since we are in uncharted territory here.

One thing I discovered is that the LUA structures in Mysql are not Lua tables, but Lua "user data". This means that they are effectively sharing memory, so Lua will not change since Mysql also uses them. I am going to try the luaposix library to see if I can get them inbto, as there are elements that I would like to change, if possible.

Good luck.

peter.colclough@toolstation.com

+1
source share

All Articles