Skip to content

Commit

Permalink
Relax commit order preservation during restore
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Oct 25, 2024
1 parent be0bca3 commit 8626a36
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions go/vt/mysqlctl/mycnf.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,14 @@ func ReadMycnf(mycnf *Mycnf, waitTime time.Duration) (*Mycnf, error) {

return mycnf, nil
}

// SetServerParam can be used *after* ReadMycnf() is called to
// customize the base configuration in the file with additional
// settings that are applicable to a specific scenario such as
// doing a backup restore.
// This is NOT concurrent safe with, together with ReadMycnf() or
// alone.
func (cnf *Mycnf) SetServerParam(key, val string) {
key = normKey([]byte(key))
cnf.mycnfMap[key] = val
}
11 changes: 10 additions & 1 deletion go/vt/vttablet/tabletmanager/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,17 @@ func (tm *TabletManager) restoreDataLocked(ctx context.Context, logger logutil.L
startTime = protoutil.TimeFromProto(keyspaceInfo.SnapshotTime).UTC()
}

// Customize our base config specifically for backup restores.
backupCnf := *tm.Cnf
// We only care that we are eventually consistent when the restore
// process ends, we do not care about intermediate states as the
// tablet is not serving during the restore process.
backupCnf.SetServerParam("replica_preserve_commit_order", "OFF")
backupCnf.SetServerParam("sync_relay_log", "0")
backupCnf.SetServerParam("relay_log_recovery", "ON")

params := mysqlctl.RestoreParams{
Cnf: tm.Cnf,
Cnf: &backupCnf,
Mysqld: tm.MysqlDaemon,
Logger: logger,
Concurrency: restoreConcurrency,
Expand Down

0 comments on commit 8626a36

Please sign in to comment.