@@ -21,7 +21,6 @@ import (
21
21
"github.com/cockroachdb/cockroach/pkg/backup/backuputils"
22
22
"github.com/cockroachdb/cockroach/pkg/cloud"
23
23
"github.com/cockroachdb/cockroach/pkg/cloud/cloudpb"
24
- "github.com/cockroachdb/cockroach/pkg/clusterversion"
25
24
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
26
25
"github.com/cockroachdb/cockroach/pkg/roachpb"
27
26
"github.com/cockroachdb/cockroach/pkg/security/username"
@@ -237,41 +236,40 @@ func ResolveDest(
237
236
}
238
237
prevBackupURIs = append ([]string {plannedBackupDefaultURI }, prevBackupURIs ... )
239
238
240
- // Within the chosenSuffix dir, differentiate incremental backups with partName.
241
- partName := endTime .GoTime ().Format (backupbase .DateBasedIncFolderName )
242
- if execCfg .Settings .Version .IsActive (ctx , clusterversion .V25_2 ) {
243
- if startTime .IsEmpty () {
244
- baseEncryptionOptions , err := backupencryption .GetEncryptionFromBase (
245
- ctx , user , execCfg .DistSQLSrv .ExternalStorageFromURI , prevBackupURIs [0 ],
246
- encryption , kmsEnv ,
247
- )
248
- if err != nil {
249
- return ResolvedDestination {}, err
250
- }
239
+ // If startTime is not already set, we will find it via the previous backup
240
+ // manifest.
241
+ if startTime .IsEmpty () {
242
+ baseEncryptionOptions , err := backupencryption .GetEncryptionFromBase (
243
+ ctx , user , execCfg .DistSQLSrv .ExternalStorageFromURI , prevBackupURIs [0 ],
244
+ encryption , kmsEnv ,
245
+ )
246
+ if err != nil {
247
+ return ResolvedDestination {}, err
248
+ }
251
249
252
- // TODO (kev-cao): Once we have completed the backup directory index work, we
253
- // can remove the need to read an entire backup manifest just to fetch the
254
- // start time. We can instead read the metadata protobuf.
255
- mem := execCfg .RootMemoryMonitor .MakeBoundAccount ()
256
- defer mem .Close (ctx )
257
- precedingBackupManifest , size , err := backupinfo .ReadBackupManifestFromURI (
258
- ctx , & mem , prevBackupURIs [len (prevBackupURIs )- 1 ], user ,
259
- execCfg .DistSQLSrv .ExternalStorageFromURI , baseEncryptionOptions , kmsEnv ,
260
- )
261
- if err != nil {
262
- return ResolvedDestination {}, err
263
- }
264
- if err := mem .Grow (ctx , size ); err != nil {
265
- return ResolvedDestination {}, err
266
- }
267
- defer mem .Shrink (ctx , size )
268
- startTime = precedingBackupManifest .EndTime
269
- if startTime .IsEmpty () {
270
- return ResolvedDestination {}, errors .Errorf ("empty end time in prior backup manifest" )
271
- }
250
+ // TODO (kev-cao): Once we have completed the backup directory index work, we
251
+ // can remove the need to read an entire backup manifest just to fetch the
252
+ // start time. We can instead read the metadata protobuf.
253
+ mem := execCfg .RootMemoryMonitor .MakeBoundAccount ()
254
+ defer mem .Close (ctx )
255
+ precedingBackupManifest , size , err := backupinfo .ReadBackupManifestFromURI (
256
+ ctx , & mem , prevBackupURIs [len (prevBackupURIs )- 1 ], user ,
257
+ execCfg .DistSQLSrv .ExternalStorageFromURI , baseEncryptionOptions , kmsEnv ,
258
+ )
259
+ if err != nil {
260
+ return ResolvedDestination {}, err
261
+ }
262
+ if err := mem .Grow (ctx , size ); err != nil {
263
+ return ResolvedDestination {}, err
264
+ }
265
+ defer mem .Shrink (ctx , size )
266
+ startTime = precedingBackupManifest .EndTime
267
+ if startTime .IsEmpty () {
268
+ return ResolvedDestination {}, errors .Errorf ("empty end time in prior backup manifest" )
272
269
}
273
- partName = partName + "-" + startTime .GoTime ().Format (backupbase .DateBasedIncFolderNameSuffix )
274
270
}
271
+
272
+ partName := ConstructDateBasedIncrementalFolderName (startTime .GoTime (), endTime .GoTime ())
275
273
defaultIncrementalsURI , urisByLocalityKV , err := GetURIsByLocalityKV (fullyResolvedIncrementalsLocation , partName )
276
274
if err != nil {
277
275
return ResolvedDestination {}, err
0 commit comments