Skip to content

Commit 4215a94

Browse files
craig[bot]kev-cao
andcommitted
Merge #141790
141790: backup: refactor backup_job.go Resume into functions r=msbutler a=kev-cao `Resume` from the `backupResumer` contains large blocks of code that can be refactored into functions. This is part of the work for integrating backup compactions into the resumer. Epic: none Release note: None Co-authored-by: Kevin Cao <kevin.cao@cockroachlabs.com>
2 parents 3cf7434 + 693ea49 commit 4215a94

File tree

2 files changed

+217
-193
lines changed

2 files changed

+217
-193
lines changed

pkg/backup/backup_compaction.go

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -554,49 +554,6 @@ func resolveBackupDirs(
554554
return resolvedBaseDirs, resolvedIncDirs, resolvedSubdir, nil
555555
}
556556

557-
// maybeWriteBackupLock attempts to write a backup lock for the given jobID, if
558-
// it does not already exist. If another backup lock file for another job is
559-
// found, it will return an error.
560-
//
561-
// TODO (kev-cao): At some point should move this helper so it can be ysed by
562-
// the backup code as well.
563-
func maybeWriteBackupLock(
564-
ctx context.Context,
565-
execCtx sql.JobExecContext,
566-
dest backupdest.ResolvedDestination,
567-
jobID jobspb.JobID,
568-
) error {
569-
foundLockFile, err := backupinfo.CheckForBackupLock(
570-
ctx,
571-
execCtx.ExecCfg(),
572-
dest.DefaultURI,
573-
jobID,
574-
execCtx.User(),
575-
)
576-
if err != nil {
577-
return err
578-
}
579-
if foundLockFile {
580-
return nil
581-
}
582-
if err := backupinfo.CheckForPreviousBackup(
583-
ctx,
584-
execCtx.ExecCfg(),
585-
dest.DefaultURI,
586-
jobID,
587-
execCtx.User(),
588-
); err != nil {
589-
return err
590-
}
591-
return backupinfo.WriteBackupLock(
592-
ctx,
593-
execCtx.ExecCfg(),
594-
dest.DefaultURI,
595-
jobID,
596-
execCtx.User(),
597-
)
598-
}
599-
600557
// prepareCompactedBackupMeta prepares the manifest, job details,
601558
// and resolved destination for the compacted backup based on the chain of backups.
602559
func prepareCompactedBackupMeta(

0 commit comments

Comments
 (0)