fix: 修复数据库备份与恢复问题 (#85)

* fix: 修复数据库备份与恢复问题

* fix: 修复数据库备份与恢复问题
This commit is contained in:
kanzihuang
2024-01-15 20:11:28 +08:00
committed by GitHub
parent b873855b44
commit c0232c4c75
12 changed files with 53 additions and 32 deletions

View File

@@ -232,10 +232,13 @@ func (s *dbScheduler) restoreMysql(ctx context.Context, job entity.DbJob) error
if ok {
latestBinlogSequence = binlogHistory.Sequence
} else {
backupHistory, err := s.backupHistoryRepo.GetEarliestHistory(restore.DbInstanceId)
backupHistory, ok, err := s.backupHistoryRepo.GetEarliestHistory(restore.DbInstanceId)
if err != nil {
return err
}
if !ok {
return nil
}
earliestBackupSequence = backupHistory.BinlogSequence
}
binlogFiles, err := dbProgram.FetchBinlogs(ctx, true, earliestBackupSequence, latestBinlogSequence)
@@ -300,12 +303,12 @@ func (s *dbScheduler) runnable(job entity.DbJob, next runner.NextFunc) bool {
itemBase := item.(entity.DbJob).GetJobBase()
if jobBase.DbInstanceId == itemBase.DbInstanceId {
countByInstanceId++
if countByInstanceId > maxCountByInstanceId {
if countByInstanceId >= maxCountByInstanceId {
return false
}
if jobBase.DbName == itemBase.DbName {
countByDbName++
if countByDbName > maxCountByDbName {
if countByDbName >= maxCountByDbName {
return false
}
}