Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
RidRisR committed Sep 25, 2024
1 parent aebc1d5 commit 4fab351
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions pkg/apis/pingcap/v1alpha1/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,30 +321,30 @@ func ParseLogBackupSubcommand(backup *Backup) LogSubCommandType {
var subCommand LogSubCommandType

// Users can omit the LogSubcommand field and use the `LogStop` field to stop log backups as in older version.
if backup.Spec.LogSubcommand == "" {
if backup.Spec.LogStop || IsLogBackupAlreadyStop(backup) {
subCommand = LogStopCommand
} else if IsLogBackupAlreadyPaused(backup){
subCommand = LogResumeCommand
} else {
if backup.Spec.LogSubcommand == "" {
if backup.Spec.LogStop || IsLogBackupAlreadyStop(backup) {
subCommand = LogStopCommand
} else if IsLogBackupAlreadyPaused(backup) {
subCommand = LogResumeCommand
} else {
subCommand = LogStartCommand
}
} else {
switch backup.Spec.LogSubcommand {
case LogStartCommand:
if IsLogBackupAlreadyPaused(backup) {
subCommand = LogResumeCommand
} else {
subCommand = LogStartCommand
}
case LogStopCommand:
subCommand = LogStopCommand
case LogPauseCommand:
subCommand = LogPauseCommand
default:
return LogUnknownCommand
}
}
} else {
switch backup.Spec.LogSubcommand {
case LogStartCommand:
if IsLogBackupAlreadyPaused(backup) {
subCommand = LogResumeCommand
} else {
subCommand = LogStartCommand
}
case LogStopCommand:
subCommand = LogStopCommand
case LogPauseCommand:
subCommand = LogPauseCommand
default:
return LogUnknownCommand
}
}

// If the selected subcommand is already sync and logTruncateUntil is set, switch to LogTruncateCommand
if IsLogSubcommandAlreadySync(backup, subCommand) && backup.Spec.LogTruncateUntil != "" && backup.Spec.LogTruncateUntil != backup.Status.LogSuccessTruncateUntil {
Expand Down

0 comments on commit 4fab351

Please sign in to comment.