Patrick Galbraith (capttofu) wrote,
Patrick Galbraith

memcached Functions for MySQL now on launchpad

Hi all,

This is a quick post to let you know that the memcached functions for MySQL have been moved to Launchpad. The project page is:

I think this will help to get the project more exposure, as well as making it easier for people to contribute to the project. I've found Launchpad to be quite useful for managing projects and so decided to move the UDFs there.

I'm working on getting out another version soon. I just fixed a bug the deals with user-defined variables that were set to NULL causing the UDFs to crash the server. It was a bug in the length of the argument being set to 8192

For instance, the first explicitly:

mysql> select memc_set('nullval', null);

(gdb) p args->args[1]
$3 = 0x0
(gdb) p args->lengths[1]
$4 = 0

The second case, wrong:

mysql> select @nullvar= NULL;
| @nullvar= NULL |
| NULL |
1 row in set (0.00 sec)

mysql> select memc_set('nullval', @nullvar);

(gdb) p args->args[1]
$5 = 0x0
(gdb) p args->lengths[1]
$6 = 8192

This is totally a bug. I used to pass the length unmodified to memcached_set() in the value function:

rc= memcached_set(&container->memc,
args->args[0], (size_t)args->lengths[0],
args->args[1], (size_t)args->lengths[1],
container->expiration, (uint16_t)0);

And MySQL would crash!

This one line fixed it:

if (args->args[1] == NULL)
args->lengths[1]= 0;

BTW - thanks to Jean-Jacques Moortgat at AOL for finding this bug!

I need to file this bug, also meant to send this to Monty to look at. I was showing him at OSCON but we were both really busy last week.
Tags: memcached, mysql, udfs
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic