Bug #100640 | MyISAM table is damaged and read_only is turned on, causing startup failure | ||
---|---|---|---|
Submitted: | 26 Aug 2020 6:11 | Modified: | 26 Aug 2020 13:02 |
Reporter: | lei yue | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: MyISAM storage engine | Severity: | S2 (Serious) |
Version: | >=5.7.29, 5.7.31 | OS: | CentOS (7.5) |
Assigned to: | CPU Architecture: | x86 |
[26 Aug 2020 6:11]
lei yue
[26 Aug 2020 6:15]
lei yue
Modify the mysql version
[26 Aug 2020 6:23]
lei yue
The commit id of the code change is: 0405ebee and 05824063
[26 Aug 2020 12:15]
MySQL Verification Team
Hello lei yue, Thank you for the report and feedback. With the provided steps I couldn't inject the corruption and hence had to manually corrupt the user.MYD before trying kill -9 to trigger restart(which failed). - rm -rf 100640/ bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/100640 --log-error-verbosity=3 bin/mysqld --no-defaults --basedir=$PWD --datadir=$PWD/100640 --core-file --socket=/tmp/mysql_ushastry.sock --port=3333 --log-error=$PWD/100640/log.err --mysqlx=0 --log-error-verbosity=3 --secure-file-priv="" --read_only=1 2>&1 & - for i in {1..5000}; do bin/mysql -uroot -S /tmp/mysql_ushastry.sock -e "create user test${i}@'%' identified by '1234';grant all on *.* to test${i}@'%';"; done - kill -9 <pid_of_mysqld> - excerpt from error log 2020-08-26T08:13:18.114427Z 0 [ERROR] mysqld: Table 'user' is marked as crashed and should be repaired 2020-08-26T08:13:18.114477Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files. 2020-08-26T08:13:18.114566Z 0 [ERROR] Aborting regards, Umesh
[26 Aug 2020 13:02]
lei yue
hi, Yes. In our environment, we have used two methods to reproduce this problem; one is to manually create user xxx, and then kill -9 $(pidof mysqld) in a short period of time, which is the method I provided above ; The other is to create users in the for loop, and then kill -9 $(pidof mysqld), which is the method you use.
[5 May 2021 13:02]
Buchan Milne
We're currently running 5.7.27, and we're testing 5.7.33. We ran into the same problem in our integration tests, where a backup is created (using xtrabackup) on one host, and then restored on a second host. Our integration tests are failing on this issue, where the restored host cannot start with: 2021-05-05T11:45:50.321516Z 0 [ERROR] /usr/bin/mysqld_real: Table './mysql/user' is marked as crashed and should be repaired 2021-05-05T11:45:50.321559Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and should be repaired We configure all of our hosts with: [mysqld] read_only We have tooling that performs failovers as necessary, in the event of all hosts rebooting, manual intervention is required to promote a host to writable, but we would prefer to have a write outage than a "split brain" scenario at any point. This now leaves us with a (read-only) availability risk, where any host that experiences a power failure may not start MySQL, if table recovery is required. Alternatively, we need a more complex approach that starts MySQL without networking with read-only=OFF first, waits for it to start, and then restart it again with networking and read-only=ON. Or, this bugs needs more attention. Also, this seems to be a duplicate of https://bugs.mysql.com/bug.php?id=100283 which is also verified.