Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set super_read_only off during restore; achieves same as PR #8929 #9240

Merged
merged 2 commits into from
Nov 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions go/vt/mysqlctl/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const (
const (
// replicationStartDeadline is the deadline for starting replication
replicationStartDeadline = 30

Error1193 = "Unknown system variable"
aquarapid marked this conversation as resolved.
Show resolved Hide resolved
)

var (
Expand Down Expand Up @@ -334,6 +336,21 @@ func Restore(ctx context.Context, params RestoreParams) (*BackupManifest, error)
return nil, err
}

// We disable super_read_only, in case it is in the default MySQL startup
// parameters and will be blocking the writes we need to do in
// PopulateMetadataTables(). We do it blindly, since
// this will fail on MariaDB, which doesn't have super_read_only
// This is safe, since we're restarting MySQL after the restore anyway
params.Logger.Infof("Restore: disabling super_read_only")
if err := params.Mysqld.SetSuperReadOnly(false); err != nil {
aquarapid marked this conversation as resolved.
Show resolved Hide resolved
if strings.Contains(err.Error(), Error1193) {
deepthi marked this conversation as resolved.
Show resolved Hide resolved
params.Logger.Warningf("Restore: server does not know about super_read_only; maybe MariaDB? Continuing anyway.")
} else {
params.Logger.Errorf("Restore: unexpected error while trying to set super_read_only: %v", err)
return nil, err
}
}

params.Logger.Infof("Restore: running mysql_upgrade")
if err := params.Mysqld.RunMysqlUpgrade(); err != nil {
return nil, vterrors.Wrap(err, "mysql_upgrade failed")
Expand Down