Bug #118467 | MySQL user accounts lost after restoring backup on NDB data nodes | ||
---|---|---|---|
Submitted: | 17 Jun 8:38 | Modified: | 18 Jun 10:39 |
Reporter: | ZHAO SONG | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S2 (Serious) |
Version: | mysql-8.0.41 | OS: | Any |
Assigned to: | MySQL Verification Team | CPU Architecture: | Any |
[17 Jun 8:38]
ZHAO SONG
[17 Jun 11:50]
Mauritz Sundell
In scenario 2 "If MySQLd remains running during the restore,..." is restore started before the MySQL servers has completed their initialization? Does the problem remain if one first wait for MySQL servers to complete the initialization and then start the restore?
[17 Jun 13:57]
ZHAO SONG
A1: In both scenarios I tested, I did not re-initialize MySQL. From what I can tell after reading the code, there doesn’t seem to be any strict requirement to re-initialize MySQL when restoring data nodes. Is there a specific reason or documented case where re-initialization is required? A2: Regarding Bug #118337, re-initializing MySQL can serve as a workaround: a. Reset the data nodes (--initial) b. Re-initialize MySQL (e.g., remove datadir and run --initialize-insecure) c. Start MySQL so it can create its internal tables (e.g., ndb_index_stat) d. Shut down MySQL e. Restore data on the data nodes In this approach, steps (b) and (c) ensure that the ndb_index_stat_head table and related events are properly initialized, which avoids the startup hang in step (d). However, for the user loss issue, this workaround won’t help. The user data in mysql.ndb_metadata_sql will still be missing after restore, unless the five issues in the ndb_restore code I mentioned earlier are properly fixed.
[17 Jun 15:23]
Mauritz Sundell
I see the below bug is fixed in 8.0.42 Bug#117230 ndb_restore "--include-stored-grants" not restoring "ndb_sql_metadata" table. Does your problem persist also with 8.0.42?
[17 Jun 15:44]
ZHAO SONG
Just did a quick review of the 8.0.42 code. It appears to include a fix similar to my local one — all 5 code locations I mentioned above have been updated. So, the issue on the data node side seems to be resolved. However, I haven’t seen any changes related to the MySQL hang issue(https://bugs.mysql.com/bug.php?id=118337). I suspect that in 8.0.42, MySQL may still hang during restart after restoring the data nodes.
[17 Jun 16:59]
ZHAO SONG
Update on testing MySQL 8.0.42: a. Scenario 1: Restore while MySQL is down ndb_restore is now able to restore data from mysql.ndb_metadata_sql. However, MySQL still hangs on restart due to bug 118337.I applied my local workaround (modifying Ndb_util_table::create() and Util_table_creator::create_or_upgrade_in_NDB()), and with that, MySQL restarts successfully and retrieves the user information. So I think once bug 118337 is fixed upstream, this scenario should work as expected. b. Scenario 2: Restore while MySQL is running Even though ndb_restore is restoring data on the data node, the Ndb_binlog_thread detects a cluster restart and triggers re-setup of Ndb_grant_stores, wiping out user data in the local data dictionary. Fast Workaround: Introduce a delay in Ndb_binlog_setup after detecting "initial system restart" to give ndb_restore time to complete. Conclusion: 8.0.42 resolves part of the issue (roughly 1 out of 3 key areas)
[18 Jun 10:39]
MySQL Verification Team
Closing the report as this is fixed in .42