Trond Norbye's Weblog

« Open position in the... | Main | Memcached UDF for... »

http://blogs.sun.com/trond/date/20080902 Tuesday September 02, 2008

Memcached UDF for MySQL on OpenSolaris

I have been hearing about the Memcached UDF for MySQL for a while now, so I decided to spend some time playing with them. Being the geek I am, playing for me is to get my hands dirty with the code so I cloned the source repository from: http://hg.tangent.org/memcached_functions_mysql/.

With the source code and a cup of coffee available I ran:

trond@opensolaris:compile> ./config/bootstrap
trond@opensolaris:compile> ./configure CC=cc --with-myslq=/usr/mysql/bin/mysql_config
[... cut ...]
checking for DEPS... configure: error: Package requirements (libmemcached >= 0.17) were not met:
[... cut ...]
    

I know that there is a version of libmemcached in OpenSolaris (I was involved during the integration), so the version is either too old or configure isn't picking it up..

trond@opensolaris:compile> pkginfo -l SUNWlibmemcached | grep DESC
      DESC:  memcached C API 0.16
    

It turns out that the version of libmemcached integrated in OpenSolaris is too old, so I filed 6743510 to get it upgraded.

I have been contributing to libmemcached (adding support for the binary protocol), so I have a "fresh-from-the-oven" version installed in /opt/memcached". All I needed to do was to get the configure script to pick it up... There was at least two different roads I could go:

  • I could just comment out the test in configure.ac, regenerate the configure script and run it as:
    trond@opensolaris:compile> ./configure CC=cc CFLAGS=-I/opt/memcached/include \
           LDFLAGS="-L/opt/memcached/lib -R/opt/memcached/lib" \
           --with-myslq=/usr/mysql/bin/mysql_config
          
  • I could do it the "clean" way and be nice to the community and add a: --with-libmemcached option

For unknown reasons I decided to do it the clean way and submitted a patch back to the project (use hg import if you would like to use it before it is included in the upstream repository).

With the lib installed as /opt/memcached/lib/libmemcached_functions_mysql.so, I tried to figure out how to load it in MySQL. The documentation told me to copy the library to /usr/local/mysql/lib/mysql/plugins/, but my OpenSolaris delivers MySQL in /usr/mysql so I tried to copy the file to /usr/mysql/lib/mysql/plugins/ without success.

A quick truss on mysqld revealed that it did not search any other directories than ld does. Being a MySQL novice I didn't know if my setup was mis-configured or not, so I returned to the MySQL documentation and found the following page. I don't want to expose the library to everything on my system, so creating a link from /usr/lib or using crle was out of the question. Instead I modified /lib/svc/method/mysql and exported LD_LIBRARY_PATH.

I am now able to use the Memcached UDF for MySQL on my OpenSolaris box, but I don't like the LD_LIBRARY_PATH hack so I am looking forward for the MySQL 5.1 release. Perhaps I should try to compile a version myself and test it out.

Comments:

I have created http://bugs.mysql.com/bug.php?id=39238 for the documentation inconsistencies

Posted by Trond Norbye on September 04, 2008 at 01:05 PM CEST #

[Trackback] Trond Norbye recently blogged about how he installed Memcached user-defined functions for MySQL on OpenSolaris. Of course, I told him I could do the same thing in Java DB in less than half an hour, so now he won't stop nagging me until I can sh...

Posted by Knut Anders Hatlen's Weblog on September 10, 2008 at 03:53 PM CEST #

I got an email from Paul DuBois who is assigned to the bug I created about the documentation inconsistencies ( http://bugs.mysql.com/bug.php?id=39238 ), telling me that the plugin_dir system variable has been backported into the 5.0 (this affects the search path for the libraries). I know that there is work in progress to get this version integrated into OpenSolaris ( http://bugs.opensolaris.org/view_bug.do?bug_id=6693315 ), but I am curious to see if the plugin_dir is what I am looking for. I tried to install the community download available from http://dev.mysql.com/downloads/mysql/5.0.html#solaris-pgadd , but the Solaris 10 version does not install on OpenSolaris (I filed http://bugs.mysql.com/bug.php?id=39383"#39383 to address this issue.

I am still waiting for the bzr branch command to complete for the check-out of 5.1 ...

Posted by Trond Norbye on September 11, 2008 at 01:46 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.