@@ -1334,21 +1334,24 @@ func CheckForPreviousBackup(
13341334
13351335 // Check for the presence of a BACKUP-LOCK file with a job ID different from
13361336 // that of our job.
1337- if err := defaultStore .List (ctx , "" , backupbase .ListingDelimDataSlash , func (s string ) error {
1338- s = strings .TrimPrefix (s , "/" )
1339- if strings .HasPrefix (s , BackupLockFilePrefix ) {
1340- jobIDSuffix := strings .TrimPrefix (s , BackupLockFilePrefix )
1341- if len (jobIDSuffix ) == 0 {
1342- return errors .AssertionFailedf ("malformed BACKUP-LOCK file %s, expected a job ID suffix" , s )
1343- }
1344- if jobIDSuffix != strconv .FormatInt (int64 (jobID ), 10 ) {
1345- return pgerror .Newf (pgcode .FileAlreadyExists ,
1346- "%s already contains a `BACKUP-LOCK` file written by job %s" ,
1347- redactedURI , jobIDSuffix )
1337+ if err := defaultStore .List (
1338+ ctx , "" , cloud.ListOptions {Delimiter : backupbase .ListingDelimDataSlash },
1339+ func (s string ) error {
1340+ s = strings .TrimPrefix (s , "/" )
1341+ if strings .HasPrefix (s , BackupLockFilePrefix ) {
1342+ jobIDSuffix := strings .TrimPrefix (s , BackupLockFilePrefix )
1343+ if len (jobIDSuffix ) == 0 {
1344+ return errors .AssertionFailedf ("malformed BACKUP-LOCK file %s, expected a job ID suffix" , s )
1345+ }
1346+ if jobIDSuffix != strconv .FormatInt (int64 (jobID ), 10 ) {
1347+ return pgerror .Newf (pgcode .FileAlreadyExists ,
1348+ "%s already contains a `BACKUP-LOCK` file written by job %s" ,
1349+ redactedURI , jobIDSuffix )
1350+ }
13481351 }
1349- }
1350- return nil
1351- } ); err != nil {
1352+ return nil
1353+ },
1354+ ); err != nil {
13521355 // HTTP external storage does not support listing, and so we skip checking
13531356 // for a BACKUP-LOCK file.
13541357 if ! errors .Is (err , cloud .ErrListingUnsupported ) {
@@ -1536,7 +1539,7 @@ func readLatestCheckpointFile(
15361539
15371540 // We name files such that the most recent checkpoint will always
15381541 // be at the top, so just grab the first filename.
1539- err = exportStore .List (ctx , BackupProgressDirectory , "" , func (p string ) error {
1542+ err = exportStore .List (ctx , BackupProgressDirectory , cloud. ListOptions {} , func (p string ) error {
15401543 // The first file returned by List could be either the checkpoint or
15411544 // checksum file, but we are only concerned with the timestamped prefix.
15421545 // We resolve if it is a checkpoint or checksum file separately below.
0 commit comments