From 7b91391930073dfd7cbeca38e4582cb8c0d8e862 Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Fri, 28 Aug 2020 08:09:21 -0700 Subject: [PATCH] fix(Dgraph): Sort manifests by BackupNum in file handler. (#6263) (#6279) 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 df63d6ca2076f059961892b9a6f192cb05f88e31) --- worker/file_handler.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/worker/file_handler.go b/worker/file_handler.go index 26d8959eeae..c2e6e442fdc 100644 --- a/worker/file_handler.go +++ b/worker/file_handler.go @@ -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 }