Patrick Galbraith (capttofu) wrote,
  • Location: Sharon, NH
  • Mood: cheerful
  • Music: Eric Clapton & Steve Winwood
I'm pleased to announce the release of the Memcached Functions for MySQL, version 1.0.

This release contains several changes, per the ChangeLog:

1.0 Thursday, July 30, 2009 12:00:00 EST 2009
* Fixed issue of setting NULLs with user-defined variables (Thanks to
Jean-Jacques Moortgat at aol dot com !)
* Fixed issue of obtaining a NULL value FROM memcached
* All set functions now return 0 (failure) or 1 (success)
* Other cleanups
* More tests

Importantly, there was an issue that I blogged about several days ago where in the UDF API, if you pass a user-defined variable that is set to NULL to memc_set(), the length of the argument is 8192 even though the value of the argument itself is NULL, which caused much unhappiness in MySQL (crash). That is fixed by setting the length to 0 if the argument itself is NULL. Also fixed is obtaining the NULL value from memcached using the memc_get() UDF. If the value is NULL (meaning libmemcached sees a value stored but the length is 0), the "is_null" boolean pointer in the value function must be set to true.

This bug is a great find and possible due to the work of Jean-Jacques Moortgat from AOL. I added a test containing this bug and can happily report that there is no longer a crash.

Another change, and this is one you may want to check any triggers you use or functionality where you rely on the return value of any set function - set, append, prepend, delete, add, replace. Formerly, the return value from the C underlying C libmemcached function was returned. This resulted in success being 0, and any > 0 number was the error code from the libmemcached library. While I was working on the memcached UDFs in Drizzle, I decided to use 1 for success, 0 for error, which makes more sense logically.

You can get the latest source via Launchpad Bazaar repo:

lp:memcached-udfs

There is also a source download at Launchpad:

https://launchpad.net/memcached-udfs/+download

As well as:

http://patg.net/downloads/memcached_functions_mysql-1.0.tar.gz

Have fun, and thanks for any feedback or bug reports!
Tags: memcached, mysql, udf
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic
  • 0 comments