Skip to content

Commit

Permalink
(release/v1.2) fix(Dgraph): Sort manifests by backup number. (#6281)
Browse files Browse the repository at this point in the history
Original change was not cherry-picked originally because the change was
made during the addition of online restores, which is a new feature in
the 20.07 version.
  • Loading branch information
martinmr authored Aug 31, 2020
1 parent 8f496d6 commit 70cc6d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ee/backup/file_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ func (h *fileHandler) Load(uri *url.URL, backupId string, fn loadFn) LoadResult
return LoadResult{0, 0, err}
}

// Sort manifests in the ascending order of their BackupNum so that the first
// manifest corresponds to the first full backup and so on.
sort.Slice(manifests, func(i, j int) bool {
return manifests[i].BackupNum < manifests[j].BackupNum
})

// Process each manifest, first check that they are valid and then confirm the
// backup files for each group exist. Each group in manifest must have a backup file,
// otherwise this is a failure and the user must remedy.
Expand Down
6 changes: 6 additions & 0 deletions ee/backup/s3_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ func (h *s3Handler) Load(uri *url.URL, backupId string, fn loadFn) LoadResult {
return LoadResult{0, 0, err}
}

// Sort manifests in the ascending order of their BackupNum so that the first
// manifest corresponds to the first full backup and so on.
sort.Slice(manifests, func(i, j int) bool {
return manifests[i].BackupNum < manifests[j].BackupNum
})

// Process each manifest, first check that they are valid and then confirm the
// backup manifests for each group exist. Each group in manifest must have a backup file,
// otherwise this is a failure and the user must remedy.
Expand Down

0 comments on commit 70cc6d8

Please sign in to comment.