Skip to content

Commit

Permalink
fix(Dgraph): Sort manifests by BackupNum in file handler. (#6263) (#6279
Browse files Browse the repository at this point in the history
)

This was being done in the S3 handler but not in the file handler.
By default the paths are sorted by the filename but sorting by backup
number is more robust.

(cherry picked from commit df63d6c)
  • Loading branch information
martinmr authored Aug 28, 2020
1 parent 18867ab commit 7b91391
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions worker/file_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func (h *fileHandler) GetManifests(uri *url.URL, backupId string) ([]*Manifest,
return nil, 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
})
return manifests, nil
}

Expand Down

0 comments on commit 7b91391

Please sign in to comment.