Skip to content

Commit

Permalink
fix: pg cluster enable backupschedule wal-g-archive config archive_co…
Browse files Browse the repository at this point in the history
…mmand twice (#8936)

(cherry picked from commit d5e1e07)
  • Loading branch information
wangyelei committed Feb 18, 2025
1 parent a720c7e commit a3a1821
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/dataprotection/backup/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,12 @@ func (s *Scheduler) reconfigure(schedulePolicy *dpv1alpha1.SchedulePolicy) error
if err := json.Unmarshal([]byte(reCfgRef), &configRef); err != nil {
return err
}
lastAppliedConfigsMap, err := s.getLastAppliedConfigsMap()
if err != nil {
return err
}
enable := boolptr.IsSetToTrue(schedulePolicy.Enabled)
if s.BackupSchedule.Annotations[dptypes.LastAppliedConfigsAnnotationKey] == "" && !enable {
if _, ok := lastAppliedConfigsMap[schedulePolicy.BackupMethod]; !ok && !enable {
// disable in the first policy created, no need reconfigure because default configs had been set.
return nil
}
Expand All @@ -453,10 +457,6 @@ func (s *Scheduler) reconfigure(schedulePolicy *dpv1alpha1.SchedulePolicy) error
// skip reconfigure if not found parameters.
return nil
}
lastAppliedConfigsMap, err := s.getLastAppliedConfigsMap()
if err != nil {
return err
}
updateParameterPairsBytes, _ := json.Marshal(parameters)
updateParameterPairs := string(updateParameterPairsBytes)
if updateParameterPairs == lastAppliedConfigsMap[schedulePolicy.BackupMethod] {
Expand Down

0 comments on commit a3a1821

Please sign in to comment.