Bug #78926 MySQL-5.7.9 GA RHEL6 Source RPM breaks perl DBD::mysql installation
Submitted: 22 Oct 2015 16:06 Modified: 23 Oct 2015 14:43
Reporter: Xiang Rao Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S2 (Serious)
Version:5.7.9 OS:Red Hat (RHEL Server 6.5, Linux 2.6.32-431.23.3.el6.YAHOO.20140804.x86_64 x86_64, 64-bit)
Assigned to: Bernt Marius Johnsen CPU Architecture:Any

[22 Oct 2015 16:06] Xiang Rao
Description:
While testing xtrabackup with customized build from mysql-community-5.7.9-1.el6.src.rpm, our old perl-DBD-mysql failed. So I followed the instruction from http://dev.mysql.com/doc/refman/5.7/en/perl-installation.html and tried to manually install DBD::mysql, which failed with error:
mysql.xs: In function ‘XS_DBD__mysql__GetInfo_dbd_mysql_get_info’:
mysql.xs:906: error: ‘net_buffer_length’ undeclared (first use in this function)
mysql.xs:906: error: (Each undeclared identifier is reported only once
mysql.xs:906: error: for each function it appears in.)
make: *** [mysql.o] Error 1
  CAPTTOFU/DBD-mysql-4.032.tar.gz
  /usr/bin/make -- NOT OK

I didn't find net_buffer_length from mysql.h, from our own build or https://github.com/mysql/mysql-server/blob/5.7/include/mysql.h. Looks like it was removed in 5.7.9 release: https://github.com/mysql/mysql-server/commit/57dab49ff348fa2e67e2ff32397adc97855b6c1e#diff...

How to repeat:
1. Build and install mysql-5.7.9 from mysql-community-5.7.9-1.el6.src.rpm.
2. sudo perl -MCPAN -e shell
3. cpan[1]> install DBD::mysql
[23 Oct 2015 6:45] Erlend Dahl
We have a pull request with the perl DBD::mysql developers to fix this, you could perhaps apply that correction locally:

https://github.com/perl5-dbi/DBD-mysql/pull/42
[23 Oct 2015 14:32] Todd Farmer
Until the proposed patch is merged into DBD::MySQL, there are three possible workarounds:

1.  Install pre-compiled module instead of building locally.
2.  Apply patch (liked above) locally before building.
3.  Build locally using 5.7.8 or earlier MySQL Server.

The resulting modules will work against MySQL Server 5.7.9.
[23 Oct 2015 14:43] Xiang Rao
Thanks for the suggestions and will try them.

BTW, why  mysql-community-5.7.9-1.el6.src.rpm contains a tarball of mysql-5.1: mysql-5.1.72.tar.gz?

Thanks,

Xiang
[23 Oct 2015 15:06] Balasubramanian Kandasamy
We used the tarball of mysql-5.1: mysql-5.1.72.tar.gz to build the libs compat package.
[27 Nov 2015 9:26] Terje Røsten
DBD::mysql 4.033 released 2015-10-23 included a fix for this issue.

Installing DBD::mysql from CPAN with MySQL 5.7 installed should now work.
[9 Dec 2015 19:07] Paul DuBois
MySQL 5.7.9 included the following change, which caused the issue:

The mysql_options() C API function has two new options,
MYSQL_OPT_MAX_ALLOWED_PACKET and MYSQL_OPT_NET_BUFFER_LENGTH, that
set the max_allowed_packet and net_buffer_length system variables,
respectively. Each option name also now can be passed to the
mysql_get_option() C API function to retrieve its value. 

The (undocumented) mysql_get_parameters() function has been removed.
Applications that attempt to use it will get link errors and should
be modified to use mysql_options() and mysql_get_option() instead.

For DBD::mysql, resolve the issue as follows:

Upgrade to DBD::mysql 4.033 or higher, which includes a fix for
the C API change just described.