Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: remove unused debug logging of binlog file content (#2455)

Yilong Li5033d9db055d
diff --git a/plugin/db/mysql/restore.go b/plugin/db/mysql/restore.go
index 07f616a881..3da269af0e 100644
--- a/plugin/db/mysql/restore.go
+++ b/plugin/db/mysql/restore.go
@@ -9,7 +9,6 @@ package mysql
import (
"bufio"
- "bytes"
"context"
"database/sql"
"encoding/json"
@@ -321,7 +320,7 @@ func sortBinlogFiles(binlogFiles []BinlogFile) []BinlogFile {
// GetLatestBackupBeforeOrEqualTs finds the latest logical backup and corresponding binlog info whose time is before or equal to `targetTs`.
// The backupList should only contain DONE backups.
-func (driver *Driver) GetLatestBackupBeforeOrEqualTs(ctx context.Context, backupList []*api.Backup, targetTs int64, mode common.ReleaseMode) (*api.Backup, error) {
+func (driver *Driver) GetLatestBackupBeforeOrEqualTs(ctx context.Context, backupList []*api.Backup, targetTs int64) (*api.Backup, error) {
if len(backupList) == 0 {
return nil, errors.Errorf("no valid backup")
}
@@ -342,10 +341,10 @@ func (driver *Driver) GetLatestBackupBeforeOrEqualTs(ctx context.Context, backup
validBackupList = append(validBackupList, b)
}
- return driver.getLatestBackupBeforeOrEqualBinlogCoord(validBackupList, *targetBinlogCoordinate, mode)
+ return getLatestBackupBeforeOrEqualBinlogCoord(validBackupList, *targetBinlogCoordinate)
}
-func (driver *Driver) getLatestBackupBeforeOrEqualBinlogCoord(backupList []*api.Backup, targetBinlogCoordinate binlogCoordinate, mode common.ReleaseMode) (*api.Backup, error) {
+func getLatestBackupBeforeOrEqualBinlogCoord(backupList []*api.Backup, targetBinlogCoordinate binlogCoordinate) (*api.Backup, error) {
type backupBinlogCoordinate struct {
binlogCoordinate
backup *api.Backup
@@ -382,20 +381,6 @@ func (driver *Driver) getLatestBackupBeforeOrEqualBinlogCoord(backupList []*api.
}
if backup == nil {
- if mode == common.ReleaseModeDev {
- args := []string{
- "-v",
- "--base64-output=DECODE-ROWS",
- filepath.Join(driver.binlogDir, fmt.Sprintf("binlog.%06d", targetBinlogCoordinate.Seq)),
- }
- cmd := exec.Command(mysqlutil.GetPath(mysqlutil.MySQLBinlog, driver.resourceDir), args...)
- var out bytes.Buffer
- cmd.Stdout = &out
- if err := cmd.Run(); err != nil {
- return nil, err
- }
- log.Debug(out.String())
- }
oldestBackupBinlogCoordinate := backupCoordinateListSorted[len(backupCoordinateListSorted)-1]
log.Error("The target binlog coordinate is earlier than the oldest backup's binlog coordinate",
zap.Any("targetBinlogCoordinate", targetBinlogCoordinate),
diff --git a/server/task_executor_pitr_restore.go b/server/task_executor_pitr_restore.go
index b9f20af552..34be9b3491 100644
--- a/server/task_executor_pitr_restore.go
+++ b/server/task_executor_pitr_restore.go
@@ -221,7 +221,7 @@ func (exec *PITRRestoreTaskExecutor) doPITRRestore(ctx context.Context, server *
targetTs := *payload.PointInTimeTs
log.Debug("Getting latest backup before or equal to targetTs", zap.Int64("targetTs", targetTs))
- backup, err := mysqlSourceDriver.GetLatestBackupBeforeOrEqualTs(ctx, backupList, targetTs, server.profile.Mode)
+ backup, err := mysqlSourceDriver.GetLatestBackupBeforeOrEqualTs(ctx, backupList, targetTs)
if err != nil {
targetTsHuman := time.Unix(targetTs, 0).Format(time.RFC822)
log.Error("Failed to get backup before or equal to time",