Bug #96848 SET PERSIST_ONLY of bool/enum and not allowed int value prevents server to start
Submitted: 12 Sep 2019 11:11 Modified: 3 Feb 2020 10:18
Reporter: Kamil Holubicki (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:8.0.15, 8.0.17 OS:Any
Assigned to: CPU Architecture:Any

[12 Sep 2019 11:11] Kamil Holubicki
Description:
This bug is related to https://bugs.mysql.com/bug.php?id=94573 but I believe it is separate issue.

When bool or enum variable is set with PERSIST_ONLY option and allowed value is provided as int (0 or 1 for bool) it is not possible to start server again.

Please note that it is not about validation of the value. Value is correct, but provided as int, not string literal.

The same with PERSIST option works fine.

How to repeat:
SET PERSIST_ONLY super_read_only=1;

Restart the server.

Suggested fix:
The problem is that when PERSIST_ONLY flag is used, value is written to the mysqld-auto.cnf file "as is".
When server starts, it reads values from mysqld-auto.cnf and for bool/int always creates Item_string object instead of Item_string/Item_int accordingly (Persisted_variables_cache::set_persist_options())
[12 Sep 2019 12:28] MySQL Verification Team
Hello Kamil,

Thank you for the report.
Verified as described with 8.0.17 build.

regards,
Umesh
[13 Sep 2019 8:38] Kamil Holubicki
The patch that fixes the problem at reading from mysqld-auto.cnf file stage

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug96848.patch (text/x-patch), 12.72 KiB.

[22 Oct 2019 12:35] Paul DuBois
Posted by developer:
 
Fixed in 8.0.19.

Using SET PERSIST_ONLY to set a boolean system variable to a numeric
value resulted in the server being unable to restart.
[3 Feb 2020 10:18] Kamil Holubicki
Hi @Paul Dubois,
I see that for bool variables it is fixed indeed, but the problem still exists for enum variables

set persist_only binlog_row_image=2;

2020-02-03T10:18:11.185115Z 5 [ERROR] [MY-011268] [Server] Configuring persisted options failed: "Variable 'binlog_row_image' can't be set to the value of '2'".
2020-02-03T10:18:11.185489Z 0 [ERROR] [MY-010175] [Server] Setting persistent options failed.

However 2 is vaid value for binlog_row_image