Thursday, September 16, 2010

MySQL 5.1 federated engine fix

In 5.1.50 version of MySQL if you attempt to install the "federated" plugin you get this:

mysql> install plugin federated soname 'ha_federated.so';
ERROR 1126 (HY000): Can't open shared library '/usr/lib/mysql/plugin/ha_federated.so' (errno: 2 undefined symbol: dynstr_append_mem)
mysql>
Apparently dynstr_append_menu is not used anywhere else in mysqld. But it is defined in libmysqlclient. So, we can try to build a frankestein library like this:

levi plugin # cd /usr/lib/mysql/plugin
levi plugin # gcc -shared -o ha_federated_am.so ha_federated.so ../libmysqlclient.so

Now trying to load the federated engine plugin:

mysql> install plugin federated soname 'ha_federated_am.so';
Query OK, 0 rows affected, 1 warning (0.00 sec)
It works.

In the end I still abandoned the idea of splitting off a part of the database to a separate server using the federated engine. I could not make it use correct indexes and it kept trying to pull in huge datasets over the network, even if the query itself is very direct on a unique index.

This just looked like a neat trick, so here it goes. I could not google up any other easy solution at least.

Andrew.

4 Comments:

Blogger paranoiq said...

instead of your gcc... works for me the following linker command:

ld -shared -o ha_federated_am.so ha_federated.so ../libmysqlclient.so.16 --rpath=/usr/lib/mysql/plugin

the --rpath argument is important. before that the system cannot find one of the dependencies

thanks :]

January 31, 2011 6:21 AM  
Anonymous Anonymous said...

I think you may want to get a facebook button to your website. I just marked down this site, although I must complete it manually. Just my advice.

March 21, 2011 7:37 AM  
Anonymous Anonymous said...

Thank goodness I stumbled across this site. I too was able to get my FC12/5.1.45 version of MySQL to work w/ FEDERATED engine by using the comment provided by paranoiq - I just changed mine to reference the lib64 plugin folder and it worked perfectly!

April 18, 2011 1:15 PM  
Anonymous Anonymous said...

This is the right fix:

Just recompile and configure with --with-plugin-federated

Federated as a loadable plugin is not there yet.

Fif.

April 26, 2011 2:46 PM  

Post a Comment

<< Home