Skip to content

Commit 79c72ae

Browse files
committed
backup: remove old manifest format from 20.1
Informs: #139159 Release note: none
1 parent e4db2dd commit 79c72ae

File tree

4 files changed

+19
-93
lines changed

4 files changed

+19
-93
lines changed

pkg/backup/backupbase/constants.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ const (
3535
// Also exported for testing backup inspection tooling.
3636
DateBasedIntoFolderName = "/2006/01/02-150405.00"
3737

38-
// BackupOldManifestName is an old name for the serialized BackupManifest
39-
// proto. It is used by 20.1 nodes and earlier.
40-
//
41-
// TODO(adityamaru): Remove this in 22.2 as part of disallowing backups
42-
// from >1 major version in the past.
43-
BackupOldManifestName = "BACKUP"
44-
4538
// BackupManifestName is the file name used for serialized BackupManifest
4639
// protos.
4740
//

pkg/backup/backupdest/incrementals.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,6 @@ func LegacyFindPriorBackups(
158158
prev = append(prev, p)
159159
return nil
160160
}
161-
162-
if ok, err := path.Match(incBackupSubdirGlob+backupbase.BackupOldManifestName, p); err != nil {
163-
return err
164-
} else if ok {
165-
if !includeManifest {
166-
p = strings.TrimSuffix(p, "/"+backupbase.BackupOldManifestName)
167-
}
168-
prev = append(prev, p)
169-
}
170161
return nil
171162
}); err != nil {
172163
return nil, errors.Wrap(err, "reading previous backup layers")

pkg/backup/backupdest/incrementals_test.go

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -504,18 +504,14 @@ func TestLegacyFindPriorBackups(t *testing.T) {
504504
execCfg := tc.Server(0).ApplicationLayer().ExecutorConfig().(sql.ExecutorConfig)
505505
emptyReader := bytes.NewReader(nil)
506506

507-
writeManifest := func(t *testing.T, store cloud.ExternalStorage, path string, useOldBackup bool) {
507+
writeManifest := func(t *testing.T, store cloud.ExternalStorage, path string) {
508508
manifestName := backupbase.BackupManifestName
509-
if useOldBackup {
510-
manifestName = backupbase.BackupOldManifestName
511-
}
512509
err := cloud.WriteFile(ctx, store, backuputils.JoinURLPath(path, manifestName), emptyReader)
513510
require.NoError(t, err)
514511
}
515512

516513
type backupPath struct {
517-
path string
518-
useOldBackup bool
514+
path string
519515
}
520516
type testcase struct {
521517
name string
@@ -527,9 +523,9 @@ func TestLegacyFindPriorBackups(t *testing.T) {
527523
{
528524
name: "all suffixed paths",
529525
paths: []backupPath{
530-
{path: "/20250320/001000.00-20250320-000000.00", useOldBackup: false},
531-
{path: "/20250320/002000.00-20250320-001000.00", useOldBackup: false},
532-
{path: "/20250320/003000.00-20250320-002000.00", useOldBackup: false},
526+
{path: "/20250320/001000.00-20250320-000000.00"},
527+
{path: "/20250320/002000.00-20250320-001000.00"},
528+
{path: "/20250320/003000.00-20250320-002000.00"},
533529
},
534530
expectedPaths: []string{
535531
"/20250320/001000.00-20250320-000000.00",
@@ -540,35 +536,9 @@ func TestLegacyFindPriorBackups(t *testing.T) {
540536
{
541537
name: "all non-suffixed paths",
542538
paths: []backupPath{
543-
{path: "/20250320/001000.00", useOldBackup: false},
544-
{path: "/20250320/002000.00", useOldBackup: false},
545-
{path: "/20250320/003000.00", useOldBackup: false},
546-
},
547-
expectedPaths: []string{
548-
"/20250320/001000.00",
549-
"/20250320/002000.00",
550-
"/20250320/003000.00",
551-
},
552-
},
553-
{
554-
name: "all old backup paths",
555-
paths: []backupPath{
556-
{path: "/20250320/001000.00", useOldBackup: true},
557-
{path: "/20250320/002000.00", useOldBackup: true},
558-
{path: "/20250320/003000.00", useOldBackup: true},
559-
},
560-
expectedPaths: []string{
561-
"/20250320/001000.00",
562-
"/20250320/002000.00",
563-
"/20250320/003000.00",
564-
},
565-
},
566-
{
567-
name: "mixed new and old backup paths",
568-
paths: []backupPath{
569-
{path: "/20250320/001000.00", useOldBackup: false},
570-
{path: "/20250320/002000.00", useOldBackup: true},
571-
{path: "/20250320/003000.00", useOldBackup: false},
539+
{path: "/20250320/001000.00"},
540+
{path: "/20250320/002000.00"},
541+
{path: "/20250320/003000.00"},
572542
},
573543
expectedPaths: []string{
574544
"/20250320/001000.00",
@@ -579,9 +549,9 @@ func TestLegacyFindPriorBackups(t *testing.T) {
579549
{
580550
name: "mixed suffixed and non-suffixed paths",
581551
paths: []backupPath{
582-
{path: "/20250320/001000.00-20250320-000000.00", useOldBackup: false},
583-
{path: "/20250320/002000.00", useOldBackup: false},
584-
{path: "/20250320/003000.00-20250320-002000.00", useOldBackup: false},
552+
{path: "/20250320/001000.00-20250320-000000.00"},
553+
{path: "/20250320/002000.00"},
554+
{path: "/20250320/003000.00-20250320-002000.00"},
585555
},
586556
expectedPaths: []string{
587557
"/20250320/001000.00-20250320-000000.00",
@@ -592,16 +562,14 @@ func TestLegacyFindPriorBackups(t *testing.T) {
592562
{
593563
name: "invalid backup paths with valid backup paths",
594564
paths: []backupPath{
595-
{path: "/20250320/001000.00-20250320-000000.00", useOldBackup: false},
596-
{path: "/20250320/001500.000", useOldBackup: false}, // invalid
597-
{path: "/20250320/002000.00", useOldBackup: false},
598-
{path: "/2025/03/20/002500.00", useOldBackup: false}, // invalid
599-
{path: "/20250320/003000.00", useOldBackup: true},
565+
{path: "/20250320/001000.00-20250320-000000.00"},
566+
{path: "/20250320/001500.000"}, // invalid
567+
{path: "/20250320/002000.00"},
568+
{path: "/2025/03/20/002500.00"}, // invalid
600569
},
601570
expectedPaths: []string{
602571
"/20250320/001000.00-20250320-000000.00",
603572
"/20250320/002000.00",
604-
"/20250320/003000.00",
605573
},
606574
},
607575
} {
@@ -617,7 +585,7 @@ func TestLegacyFindPriorBackups(t *testing.T) {
617585
tc.paths[i], tc.paths[j] = tc.paths[j], tc.paths[i]
618586
})
619587
for _, path := range tc.paths {
620-
writeManifest(t, store, path.path, path.useOldBackup)
588+
writeManifest(t, store, path.path)
621589
}
622590
prev, err := backupdest.LegacyFindPriorBackups(ctx, store, false)
623591
require.NoError(t, err)

pkg/backup/backupinfo/manifest_handling.go

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -171,36 +171,10 @@ func ReadBackupManifestFromStore(
171171
backupManifest, backupManifestMemSize, backupManifestErr := ReadBackupManifest(ctx, mem, exportStore,
172172
backupbase.BackupManifestName, encryption, kmsEnv)
173173
if backupManifestErr != nil {
174-
if !errors.Is(backupManifestErr, cloud.ErrFileDoesNotExist) {
175-
return backuppb.BackupManifest{}, 0, backupManifestErr
176-
}
177-
178-
// If we did not find a `BACKUP_MANIFEST` we look for a `BACKUP` file as
179-
// it is possible the backup was created by a pre-20.1 node.
180-
//
181-
// TODO(adityamaru): Remove this logic once we disallow restores beyond
182-
// the binary upgrade compatibility window.
183-
log.Dev.VInfof(ctx, 2, "could not find BACKUP_MANIFEST, falling back to BACKUP")
184-
oldBackupManifest, oldBackupManifestMemSize, oldBackupManifestErr := ReadBackupManifest(ctx, mem, exportStore,
185-
backupbase.BackupOldManifestName, encryption, kmsEnv)
186-
if oldBackupManifestErr != nil {
187-
if errors.Is(oldBackupManifestErr, cloud.ErrFileDoesNotExist) {
188-
log.Dev.VInfof(ctx, 2, "could not find any of the supported backup metadata files")
189-
return backuppb.BackupManifest{}, 0,
190-
errors.Wrapf(oldBackupManifestErr, "could not find BACKUP manifest file in any of the known locations: %s, %s, %s",
191-
backupbase.BackupMetadataName, backupbase.BackupManifestName, backupbase.BackupOldManifestName)
192-
}
193-
return backuppb.BackupManifest{}, 0, oldBackupManifestErr
194-
} else {
195-
// We found a `BACKUP` manifest file.
196-
manifest = oldBackupManifest
197-
memSize = oldBackupManifestMemSize
198-
}
199-
} else {
200-
// We found a `BACKUP_MANIFEST` file.
201-
manifest = backupManifest
202-
memSize = backupManifestMemSize
174+
return backuppb.BackupManifest{}, 0, backupManifestErr
203175
}
176+
manifest = backupManifest
177+
memSize = backupManifestMemSize
204178
}
205179
manifest.Dir = exportStore.Conf()
206180
manifest.Dir.URI = storeURI

0 commit comments

Comments
 (0)