[MDEV-16657] Function mysql_get_option() is not available in libmariadbd.so Created: 2018-07-02  Updated: 2018-07-03  Resolved: 2018-07-02

Status: Closed
Project: MariaDB Server
Component/s: Embedded Server
Affects Version/s: 10.2.6, 10.2.7, 10.2.8, 10.2.9, 10.2.10, 10.2.11, 10.2.12, 10.3.1, 10.3.2, 10.3.3, 10.3.4, 10.2.13, 10.2.15, 10.3.5, 10.3.6, 10.3.7
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Pali Assignee: Sergei Golubchik
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

In MariaDB 10.2.2 was added support for calling

mysql_get_option(mysql, MYSQL_OPT_MAX_ALLOWED_PACKET, &packet_size);

to retrieve current maximum packet size.

But since MariaDB 10.2.6 version, libmariadbd.so has broken support for mysql_get_option function. At runtime it just throw error:

undefined symbol: mysql_get_option

Same problem is also in MariaDB 10.3 series, since version 10.3.1.

Version 10.2.2 (where MYSQL_OPT_MAX_ALLOWED_PACKET was introduced), 10.2.3, 10.2.4, 10.2.5 and 10.3.0 are working fine. Therefore this regression was introduced in MariaDB versions 10.3.1 and 10.2.5.

Please note that function mysql_get_option() is properly defined in header files, just symbol is missing in libmariadbd.so library (or it is not marked as exported).

This problem was detected by Travis tests for perl DBI driver DBD::MariaDB:

https://travis-ci.org/gooddata/DBD-MariaDB/builds/391252563

As a workaround we added detection if that function is present at configure time (commit)



 Comments   
Comment by Elena Stepanova [ 2018-07-02 ]

As wlad explained, we didn't lose the symbol, it had never been added: "MariaDB 10.2 uses C/C as client, but embedded does not; so it was never added to embedded".

Given that we have the task for removing embedded entirely (MDEV-16535), I am not sure whether it makes sense to do major development in its regard. I'll leave it to ratzpo and serg to decide.

Comment by Sergei Golubchik [ 2018-07-02 ]

We don't do any new development of the old libmysqlclient API that embedded is using now.

There are two alternative futures for embedded: either it'll be removed entirely (MDEV-16535), or it'll be changed to use Connector/C (MDEV-9295).

In this latter case it'll get mysql_get_option.

Comment by Pali [ 2018-07-03 ]

"MariaDB 10.2 uses C/C as client, but embedded does not; so it was never added to embedded".

Mhm... why it is working in version 10.2.5 and symbol is present there? If it was never added, then it cannot work which contract test results.

Comment by Sergei Golubchik [ 2018-07-03 ]

It is not. it is working with libmariadbclient, that is with Connector/C client library. In 10.2.5 or any later version.
But it is not working with 10.2.5 libmysqld embedded library, it does not have this symbol:

MariaDB-10.2.5-fedora24-x86_64-server/usr/lib64 $ grep mysql_get_option libmysqld.so.19
MariaDB-10.2.5-fedora24-x86_64-server/usr/lib64 $ echo $?
1

Comment by Pali [ 2018-07-03 ]

Interesting... But it does not answer why it is working...

Comment by Pali [ 2018-07-03 ]

Ok, anomalies found...

Check for MariaDB version needed for mysql_get_option() is done via defined(MARIADB_VERSION_ID) && MARIADB_VERSION_ID >= 100202. And #include <mysql.h> does not define MARIADB_VERSION_ID in MariaDB version 10.2.5. But in MariaDB version 10.2.6 it is defined to 100205 (which is incorrect).

So MARIADB_VERSION_ID is not defined always and when is, then contains bogus values. Which confuse tests a lot.

Generated at Thu Feb 08 08:30:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.