Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: remove redundant function (#2450)
Yilong Lie4008d0af5b8
diff --git a/plugin/db/mysql/restore.go b/plugin/db/mysql/restore.goindex 54cafc4e3c..07f616a881 100644--- a/plugin/db/mysql/restore.go+++ b/plugin/db/mysql/restore.go@@ -117,16 +117,11 @@ func (driver *Driver) readBinlogMetaFile(fileName string) (binlogFileMeta, errorreturn meta, nil}-// ReplayBinlog replays the binlog for `originDatabase` from `startBinlogInfo.Position` to `targetTs`, read binlog from `driver.binlogDir“.-func (driver *Driver) replayBinlog(ctx context.Context, originalDatabase, targetDatabase string, startBinlogInfo api.BinlogInfo, targetTs int64) error {- return driver.replayBinlogReadFromDir(ctx, originalDatabase, targetDatabase, startBinlogInfo, targetTs, driver.binlogDir)-}--// replayBinlogReadFromDir replays the binlog for `originDatabase` from `startBinlogInfo.Position` to `targetTs`, read binlog from `binlogDir`.-func (driver *Driver) replayBinlogReadFromDir(ctx context.Context, originalDatabase, targetDatabase string, startBinlogInfo api.BinlogInfo, targetTs int64, binlogDir string) error {+// replayBinlogFromDir replays the binlog for `originDatabase` from `startBinlogInfo.Position` to `targetTs`, read binlog from `binlogDir`.+func (driver *Driver) replayBinlogFromDir(ctx context.Context, originalDatabase, targetDatabase string, startBinlogInfo api.BinlogInfo, targetTs int64, binlogDir string) error {replayBinlogPaths, err := GetBinlogReplayList(startBinlogInfo, binlogDir)if err != nil {- return err+ return errors.Wrapf(err, "failed to get binlog replay list in directory %s", binlogDir)}caseVariable := "lower_case_table_names"@@ -227,14 +222,14 @@ func (driver *Driver) GetReplayedBinlogBytes() int64 {// ReplayBinlogToDatabase replays the binlog of originDatabaseName to the targetDatabaseName.func (driver *Driver) ReplayBinlogToDatabase(ctx context.Context, originDatabaseName, targetDatabaseName string, startBinlogInfo api.BinlogInfo, targetTs int64, binlogDir string) error {- return driver.replayBinlogReadFromDir(ctx, originDatabaseName, targetDatabaseName, startBinlogInfo, targetTs, binlogDir)+ return driver.replayBinlogFromDir(ctx, originDatabaseName, targetDatabaseName, startBinlogInfo, targetTs, binlogDir)}// ReplayBinlogToPITRDatabase replays binlog to the PITR database.// It's the second step of the PITR process.func (driver *Driver) ReplayBinlogToPITRDatabase(ctx context.Context, databaseName string, startBinlogInfo api.BinlogInfo, suffixTs, targetTs int64) error {pitrDatabaseName := util.GetPITRDatabaseName(databaseName, suffixTs)- return driver.replayBinlog(ctx, databaseName, pitrDatabaseName, startBinlogInfo, targetTs)+ return driver.replayBinlogFromDir(ctx, databaseName, pitrDatabaseName, startBinlogInfo, targetTs, driver.binlogDir)}// RestoreBackupToDatabase create the database named `databaseName` and restores a full backup to the given database.