Merge users from parent clusters with current users without changing credentials #1125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces enhancements to the backup and restore functionality for MySQL/MariaDB clusters, focusing on user data handling during logical backups and reseeding. Key changes include the addition of a new method for restoring MySQL user data, updates to existing methods to handle user data more effectively, and improvements to ensure compatibility with specific database versions.
Enhancements to Backup and Restore Functionality:
New Method for Restoring User Data: Added
JobReseedMysqldumpUser
to handle the restoration of MySQL user data during reseeding. This method processes themysql.user
file, removes sensitive information (e.g.,IDENTIFIED BY
clauses), and applies the data to the target server (cluster/srv_job.go
, cluster/srv_job.goR1028-R1076).Improved Logical Backup Handling:
JobBackupLogical
to always dump MySQL user data for reusable backups, ensuring compatibility with MariaDB 10.4+ (cluster/srv_job.go
, cluster/srv_job.goL2166-R2217).mysql.users.sql.gz
tomysql.user.sql.gz
for consistency (cluster/srv_job.go
, cluster/srv_job.goL1875-R1923).Modifications to Existing Methods:
Enhanced User Restoration in Reseeding:
JobReseedMyLoader
to invokeJobReseedMysqldumpUser
when restoring user data, simplifying the logic for handlingmysql.user
files (cluster/srv_job.go
, [1] [2].JobReseedMysqldump
to include additional checks for restoring user data based on metadata (cluster/srv_job.go
, cluster/srv_job.goL1143-R1179).Refactored
ReadMysqldumpUser
:backupfile
todir
for better clarity and flexibility.cluster/srv_job.go
, [1] [2] [3].These changes improve the robustness and security of the backup and restore processes, particularly for user data, while ensuring compatibility with newer database versions.