Showing entries 11 to 20 of 37
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: lua (reset)
MySQL Proxy - proxydb

What I really like about having Lua and MySQL Proxy together is that it turns out to be very flexible, you can have the proxy do all kinds of things. And the last thing I made the MySQL Proxy do is to act like memcached.

Well, maybe not, but it handles key => value pairs now :P

What does it do?

It handles 5 basic query types:

mysql> INSERT "key" = "value";

Very simple, insert a key => value pair on a table, if there is already a value for that query, it will overwrite it.

mysql> SELECT "key";

It retrieves the value for the specified key.

mysql> DELETE "key";

Deletes the key …

[Read more]
How do I use the MySQL Proxy Admin plugin?

We have an Admin plugin for the MySQL Proxy, but people started asking how to use it. I only found one example, thanks to Giuseppe, but people wanted more.

While the admin plugin is somehow limited, it already provides some nice features. One of the use cases is to give access to information to only authorized users. The Admin plugin uses its own username and password to authenticate users. This is not related to any user on your MySQL server.

The example.

I went ahead and put two scripts together in about an hour. They are basic, but should give you more of an idea of what you can do.

Number of queries …

[Read more]
A feature, a bug, a new feature and a bug fix

After I wrote about reading a file using the MySQL Proxy, I went ahead and added the missing piece. Creating a file using the MySQL Proxy.

A bug?
As I went back to lib/mysql-proto.c looking for a function that I could duplicate and modify to add the to_masterinfo_string() function, I realized that I missed a few master_ssl_* fields. It turned out that I was not exporting all the fields from the file.

This time, the bug fix was easy enough. After modifying the test case to account for the missing fields, I added a …

[Read more]
Reading files using the MySQL Proxy

After I wrote about a new feature on MySQL Proxy that helps you read files, I thought that showing an example could come handy.

You can find the complete file on the MySQL Forge and once I have a test case for this script, it will be available on Launchpad.

Explaining the code.
You can see at the top I have

local proto = assert(require("mysql.proto"))

This is important, as it makes the from_masterinfo_string() function available for use.

I also included a function called get_command(), which is a modification of code found …

[Read more]
MySQL Proxy and (contribution 2 of N)

This time I'll write about a nice featured we now have on the MySQL Proxy.

The is a file that the MySQL server creates when you are running a slave server, you can read the manual for more details.
And now you can use the MySQL Proxy to read that file and parse the data from it.

It all started when Jan emailed the proxy discuss mailing with the Changelog from 0.6.1 to 0.7.0. The part that got my attention was:
* added parser for files"
... "
As I was working on a Lua script that did some simulation, I …

[Read more]
Lua script repository for MySQL Proxy

Doing QA on the MySQL Proxy and the Enterprise tools, I started writing a Lua script to use with the proxy. The goal was to tell our monitoring agent that the server it was monitoring was very busy. It basically intercepts queries like SHOW GLOBAL VARIABLES or SHOW GLOBAL STATUS among others and returns a custom resultset. (More details on a future post)

It is still a work in progress, but I wanted to give the community access to it. After some emails on the MySQL Proxy Discuss mailing list, I created a project on Launchpad that will host this script …

[Read more]
MySQL Test Creation Tool Design Change

A few days ago the mysql proxy tool was released (link) and it does exactly what the name would suggest. But it does boast a few features that have changed the development of the test creation tool.

  • It has a Lua interpreter that allows user written scripts or modules to be run by the proxy. These scripts can intercept queries and responses between the client and the MySQL server, and also manipulate them in whatever way necessary. There are examples on the wiki of how to use the scripts.
  • Instead of writing an entirely new command line client, we can use the standard mysql client and focus on the scripts that will intercept the client-server communication and translate that into test cases.

For these reasons the test creation tool will not be written in C/C++ but instead as Lua modules that the proxy will run. This will hopefully …

[Read more]
A Utility Library for MySQL Workbench

Here is a small library with various helpful Lua functions for scripts and plugins for Workbench, making it easier to write your own plugins for exporting to some external format, generating reports etc. The library is meant for Workbench 5.0, but it will be ported to 5.1 as well, which should make transitioning plugins from one to the other somewhat easier in the future. Currently, most functions are meant for iterating through various objects so you can, but new functions will be added every once in a while and contributions, bug fixes and comments are welcome. To “install” the library, place the file in your equivalent for C:\Documents and Settings\user\Program data\MySQL\Workbench\librariesQuick list of places to get useful information for plugin writing:

  • the Structs list will list the available GRT object types and …
[Read more]
LuaSQL fetches results about 15% faster than MySQL Proxy?

While evaluating LuaSQL as backend connection replacement I came across this. I did a quick performance test using mysqlslap and it showed that just reading and copying the result can be significantly faster with LuaSQL.

Benchmark details

What I did was just sending the query to the backend and building up a new result-set in LUA.

This is the code for LuaSQL:

local _sqlEnv = assert(luasql.mysql())
local _con = nil

function read_auth(auth)
    local host, port = string.match(proxy.backends[1].address, "(.*):(.*)")
    – We explicitly connect to db "test" since mysqlslap …

[Read more]
Log4LUA version 0.2 and project page

Everything is available at the project page

Please report issues and feature request here.

Version 0.2 is a bug fix release but with 2 significant changes in syntax:

  1. Changed all constructor methods from create(...) to new. Seems to be more common in the LUA world.
  2. The logger class is now returned by the module. So it is local logger = require("optivo.common.log4lua.logger")
    local LOG =…)

    instead of

    local logger = require("optivo.common.log4lua.logger")
    local LOG = logger.Logger.create(…)

Some potential bugs have been spotted using (a slightly adopted version of) lualint and …

[Read more]
Showing entries 11 to 20 of 37
« 10 Newer Entries | 10 Older Entries »