Description:
When the following is set on startup:
super_read_only=ON
myisam_recover_options=BACKUP,FORCE
and MyISAM table is crashed. myisam_recover_options will not work and start up fails. Removing super_read_only=ON allows myisam_recover_options to work and repair crashed myisam tables.
Affects MySQL v5.7.31
How to repeat:
In my.cnf:
super_read_only=ON
myisam_recover_options=BACKUP,FORCE
T1 - run
set @@global.super_read_only=OFF; <-- execute from mysql client connection
while ; do mysql -uroot -e “create user ‘mytest’@‘localhost’ identified by ‘mypass’; grant all privileges on . to ‘mytest’@‘localhost’; flush privileges;”; sleep 1; mysql -uroot -e “drop user ‘mytest’@‘localhost’;”; done;
T2 - kill -11 $(pgrep mysqld)
This would crash mysqld causing mysql.user table myisam table to be on crashed state.
Startup would fail with this error:
2020-07-22T07:29:34.981978Z 0 [Note] Server socket created on IP: '::'.
2020-07-22T07:29:34.989095Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired
2020-07-22T07:29:34.989193Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and should be repaired
2020-07-22T07:29:34.989315Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2020-07-22T07:29:34.989501Z 0 [ERROR] Aborting
This will be an endless startup loop
Edit my.cnf to comment out super_read_only=ON afterwhich startup works and myisam_recover_options will then kick in:
2020-07-22T07:29:38.735818Z 0 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired
2020-07-22T07:29:38.736274Z 0 [Warning] Checking table: './mysql/user'
2020-07-22T07:29:38.736398Z 0 [ERROR] 1 client is using or hasn't closed the table properly
2020-07-22T07:29:38.752046Z 0 [Note] Event Scheduler: Loaded 0 events
2020-07-22T07:29:38.752390Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.31' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
Suggested fix:
Do not block myisam_recover_options if super_read_only is enabled.
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders. It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.