Bug #100458 clone_valid_donor_list length limitation
Submitted: 7 Aug 2020 15:13 Modified: 17 Feb 2021 11:28
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Clone Plugin Severity:S2 (Serious)
Version:8.0.21 OS:Any
Assigned to: CPU Architecture:Any

[7 Aug 2020 15:13] Daniël van Eeden
Description:
https://dev.mysql.com/doc/refman/8.0/en/clone-plugin-options-variables.html#sysvar_clone_v... says clone_valid_donor_list is a String.

However no maximum length is specified.

The problem with this is that if the length of this option in `my.cnf` is more than 4k this causes this to fail and the server won't start.

"my_print_defaults --defaults-file=/etc/my.cnf mysqld" also shows the issue like this:

--loose_clone_valid_donor_list=...
--...

Here the list is split over two options, the second one not being valid and being a continuation of the first.

From the mysqld logging:
2020-08-04T08:50:06.011303Z 0 [ERROR] [MY-000068] [Server] unknown option '--...'.
2020-08-04T08:50:06.012135Z 0 [ERROR] [MY-010119] [Server] Aborting

In both of these the list of servers is replaced with ...

How to repeat:
Put a clone_valid_donor_list of around 4k in the /my.cnf

Suggested fix:
1. Allow alternative syntax:

By specifying the option multiple times we can avoid the length limitation:
clone_valid_donor_list=foobar001:3306
clone_valid_donor_list=foobar002:3306

2. Proper error reporting:

An option of >4k should result in a proper error:
e.g. "Error: option clone_valid_donor_length is more than 4096 bytes, truncating value"

3. Documentation: The limitation should be in docs.

Be clear about the limitations in the docs for this and all other options.
[7 Aug 2020 15:36] Daniël van Eeden
mysys/my_default.cc

search_default_file_with_ext() calls mysql_file_getline with length of 4095
[8 Aug 2020 8:15] MySQL Verification Team
Hello Daniël,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[29 Jan 2021 9:16] Simon Mudd
Full comment attached as a file. Truncated here due to size limitations.

Also a concern is setting the value dynamically:

I installed the plugin:

root@mac [(none)]> INSTALL PLUGIN clone SONAME 'mysql_clone.so';
Query OK, 0 rows affected (0.23 sec)

I modified the setting using SQL:

mysql -vvvt <<EOF
set global clone_valid_donor_list ="100.100.100.100:3306,...big input...,100.100.100.100:3306";
EOF

and then checked the resulting value which is clearly truncated and generates no error:

$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.23 MySQL Community Server - GPL

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@mac [(none)]> show global variables like 'clone_valid_donor_list';
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name          | Value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| clone_valid_donor_list | 100.100.100.100:3306,100.100.100.100:3306,...removed some entries...,100.100.100.100:3306,100.100.100.100: |
+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

root@mac [(none)]>
[29 Jan 2021 9:17] Simon Mudd
full input of a comment

Attachment: text_that_does_not_fit_as_comment.txt (text/plain), 10.05 KiB.

[29 Jan 2021 9:44] MySQL Verification Team
innodb data file paths had the same issue.
to fetch the current value do this instead:

select @@global.clone_valid_donor_list ;

this is also faster than SHOW GLOBAL VARIABLES LIKE ....
[29 Jan 2021 11:18] Simon Mudd
Thanks for clarifying. I hadn't been aware of this but it is documented in https://dev.mysql.com/doc/refman/8.0/en/show-variables.htmlhttps://dev.mysql.com/doc/refma.... I also verified the larger value is stored correctly when using SQL.