Bug #95541 mysqlpump didn't check mysql version before set information_schema_stats_expiry
Submitted: 27 May 2019 12:00 Modified: 28 May 2019 6:50
Reporter: jia liu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqlpump Command-line Client Severity:S3 (Non-critical)
Version:8.0.16, 8.0.11 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysqlpump;information_schema_stats_expiry;

[27 May 2019 12:00] jia liu
Description:
As the NOTE in https://dev.mysql.com/doc/refman/8.0/en/mysqlpump.html

"mysqlpump uses MySQL features introduced in MySQL 5.7, and thus assumes use with MySQL 5.7 or higher."

I assume that means it is allowed to use mysqlpump from 8.0 to backup an 5.7 instance.
But in file client/dump/mysql_crawler.cc, there is no version check before running "SET SESSION information_schema_stats_expiry", and information_schema_stats_expiry is a new variable introduced in 8.0.
Combine this two situation, mysqlpump from 8.0 will not work on an 5.7 instance.

How to repeat:
Use an mysqlpump from 8.0 to backup an 5.7 instance remotely.

[root@hotdb_210_223 ~]# mysqlpump --version
mysqlpump  Ver 8.0.16 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)

[root@hotdb_210_223 ~]# mysql -utest -p123456 -P3308 -h 192.168.210.41 test -e "select version()"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------------+
| version()  |
+------------+
| 5.7.23-log |
+------------+

[root@hotdb_210_223 ~]# mysqlpump -utest -p123456 -P3308 -h 192.168.210.41 test>/tmp/test.sql
mysqlpump: [Warning] Using a password on the command line interface can be insecure.
mysqlpump: [ERROR] (1193) Unknown system variable 'information_schema_stats_expiry'
Dump process encountered error and will not continue.
mysqlpump: [ERROR] (1193) Unknown system variable 'information_schema_stats_expiry'
Dump process encountered error and will not continue.
mysqlpump: [ERROR] (1193) Unknown system variable 'information_schema_stats_expiry'
Dump process encountered error and will not continue.

Suggested fix:
Add an version check in code, or document that mysqlpump from 8.0 will only work on 8.0 .
[28 May 2019 6:50] MySQL Verification Team
Hello!

Thank you for the report.

regards,
Umesh
[1 Jul 2019 12:30] Cara Selvio
To encourage you to consider adding the version check and supporting backwards compatibility, I'd point out that one valuable use case which is blocked by this is attempting to migrate data from an AWS RDS to a MySQL dedicated instance.  Whilst it might not be that common,this is something which might make particular sense for people who currently have an RDS instance (mostly stuck on a MySQL 5.x derived codebase) and would like to use new 8.0 and upwards features - thus valuable potential customers.
[6 Aug 2019 9:13] Gopal Shankar
Posted by developer:
 
Yes, bug#29889253 makes SET SESSION information_schema_stats_expiry statement embedded in a version comments like below:

/*!80000 SET SESSION information_schema_stats_expiry=default */

Please close your bug.

Regards
Satish.B