Skip to content

Commit 6984e9d

Browse files
Shivaji KharseShivaji Kharse
authored andcommitted
resolve review comments
1 parent e9143f0 commit 6984e9d

5 files changed

Lines changed: 15 additions & 13 deletions

File tree

graphql/admin/list_backups.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ func resolveListBackups(ctx context.Context, q schema.Query) *resolve.Resolved {
105105
return resolve.EmptyResult(q, err)
106106
}
107107

108+
filter, err := buildBackupDateFilter(input)
109+
if err != nil {
110+
return resolve.EmptyResult(q, err)
111+
}
112+
108113
creds := &x.MinioCredentials{
109114
AccessKey: input.AccessKey,
110115
SecretKey: input.SecretKey,
@@ -115,11 +120,6 @@ func resolveListBackups(ctx context.Context, q schema.Query) *resolve.Resolved {
115120
if err != nil {
116121
return resolve.EmptyResult(q, errors.Errorf("%s: %s", x.Error, err.Error()))
117122
}
118-
119-
filter, err := buildBackupDateFilter(input)
120-
if err != nil {
121-
return resolve.EmptyResult(q, err)
122-
}
123123
manifests = worker.FilterManifestsByDate(manifests, filter)
124124

125125
convertedManifests := convertManifests(manifests)

systest/backup/filesystem/testdata/manifest_summary.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"manifests": [
2+
"Manifests": [
33
{
44
"type": "full",
55
"since": 0,

systest/backup/minio/backup_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,10 @@ func copyToLocalFs(t *testing.T) {
387387
minio.ListObjectsOptions{Prefix: "", Recursive: false})
388388
for object := range objectCh1 {
389389
require.NoError(t, object.Err)
390-
if object.Key != "manifest.json" {
391-
dstDir := backupDir + "/" + object.Key
390+
// Only create local directories for backup sub-folder keys (end with "/").
391+
// Root-level files like manifest.json and manifest_summary.json are not directories.
392+
if strings.HasSuffix(object.Key, "/") {
393+
dstDir := backupDir + "/" + strings.TrimSuffix(object.Key, "/")
392394
require.NoError(t, os.MkdirAll(dstDir, os.ModePerm))
393395
}
394396

systest/integration2/backup_summary_compat_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ type masterManifest struct {
3434
}
3535

3636
// masterManifestSummary mirrors the top-level shape of manifest_summary.json
37-
// (lowercase "manifests", matches the MasterManifestSummary JSON tag).
37+
// (capital "Manifests", matching Go's default JSON encoding for MasterManifestSummary).
3838
type masterManifestSummary struct {
39-
Manifests []manifestEntry `json:"manifests"`
39+
Manifests []manifestEntry `json:"Manifests"`
4040
}
4141

4242
// queryNames runs {q(func: has(name)) {name}} and returns a sorted list of

worker/backup.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ type ManifestBase struct {
5858
BackupNum uint64 `json:"backup_num"`
5959
// Version specifies the Dgraph predicate-encoding version in use at backup time.
6060
// 0 means pre-21.03 (no namespace prefix). The restore path reads this to trigger upgrades.
61-
Version int `json:"version,omitempty"`
61+
Version int `json:"version"`
6262
// Path is the name of the backup directory that holds this backup's data files.
6363
Path string `json:"path"`
6464
// Encrypted indicates whether this backup was encrypted.
6565
Encrypted bool `json:"encrypted"`
6666
// Compression records the codec used to compress backup data files.
67-
Compression string `json:"compression,omitempty"`
67+
Compression string `json:"compression"`
6868
}
6969

7070
// ValidReadTs returns the effective read timestamp for this backup entry.
@@ -101,7 +101,7 @@ type ManifestSummary struct {
101101
}
102102

103103
type MasterManifestSummary struct {
104-
Manifests []*ManifestSummary `json:"manifests"`
104+
Manifests []*ManifestSummary
105105
}
106106

107107
func (m *Manifest) getPredsInGroup(gid uint32) predicateSet {

0 commit comments

Comments
 (0)