Skip to content

Commit

Permalink
fix(updatemanifest): update the version of manifest after update (#7828)
Browse files Browse the repository at this point in the history
We were not updating the manifest version after the updation. This PR fixes that.
  • Loading branch information
NamanJain8 authored and Harshil Goel committed Feb 2, 2023
1 parent 67f9056 commit 95b0684
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 183 deletions.
133 changes: 0 additions & 133 deletions ee/updatemanifest/run.go

This file was deleted.

40 changes: 2 additions & 38 deletions systest/backup/filesystem/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,44 +86,6 @@ func sendRestoreRequest(t *testing.T, location string) {
return
}

// This test restores the old backups.
// The backup dir contains:
// - Full backup with pred "p1", "p2", "p3". (insert k1, k2, k3).
// - Incremental backup after drop data was called and "p2", "p3", "p4" inserted. --> (insert k4,k5)
// - Incremental backup after "p3" was dropped.
func TestRestoreOfOldBackup(t *testing.T) {
test := func(dir string) {
common.DirSetup(t)
common.CopyOldBackupDir(t)

conn, err := grpc.Dial(testutil.SockAddr,
grpc.WithTransportCredentials(credentials.NewTLS(testutil.GetAlphaClientConfig(t))))
require.NoError(t, err)
dg := dgo.NewDgraphClient(api.NewDgraphClient(conn))
require.NoError(t, err)

testutil.DropAll(t, dg)
time.Sleep(2 * time.Second)

sendRestoreRequest(t, dir)
testutil.WaitForRestore(t, dg)

queryAndCheck := func(pred string, cnt int) {
q := fmt.Sprintf(`{ me(func: has(%s)) { count(uid) } }`, pred)
r := fmt.Sprintf("{\"me\":[{\"count\":%d}]}", cnt)
resp, err := dg.NewTxn().Query(context.Background(), q)
require.NoError(t, err)
require.JSONEq(t, r, string(resp.Json))
}
queryAndCheck("p1", 0)
queryAndCheck("p2", 2)
queryAndCheck("p3", 0)
queryAndCheck("p4", 2)
}
t.Run("backup of 20.11", func(t *testing.T) { test(oldBackupDir2) })
t.Run("backup of 21.03", func(t *testing.T) { test(oldBackupDir3) })
}

// This test takes a backup and then restores an old backup in a cluster incrementally.
// Next, cleans up the cluster and tries restoring the backups above.
// Regression test for DGRAPH-2775
Expand Down Expand Up @@ -192,12 +154,14 @@ func TestRestoreOfOldBackup(t *testing.T) {
require.NoError(t, err)
require.JSONEq(t, r, string(resp.Json))
}

queryAndCheck("p1", 0)
queryAndCheck("p2", 2)
queryAndCheck("p3", 0)
queryAndCheck("p4", 2)
}
t.Run("backup of 20.11", func(t *testing.T) { test(oldBackupDir2) })
t.Run("backup of 21.03", func(t *testing.T) { test(oldBackupDir3) })
}

func TestBackupFilesystem(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion worker/backup_ee.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ func (pr *BackupProcessor) CompleteBackup(ctx context.Context, m *Manifest) erro
manifest.Manifests = append(manifest.Manifests, m)

if err := CreateManifest(handler, uri, manifest); err != nil {
return errors.Wrap(err, "Complete backup failed")
return errors.Wrap(err, "complete backup failed")
}
glog.Infof("Backup completed OK.")
return nil
Expand Down
5 changes: 0 additions & 5 deletions worker/backup_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,6 @@ func GetManifest(h UriHandler, uri *url.URL) (*MasterManifest, error) {

func CreateManifest(h UriHandler, uri *url.URL, manifest *MasterManifest) error {
var err error
if !h.DirExists("./") {
if err := h.CreateDir("./"); err != nil {
return errors.Wrap(err, "createManifest failed to create path: ")
}
}

w, err := h.CreateFile(tmpManifest)
if err != nil {
Expand Down
8 changes: 2 additions & 6 deletions worker/restore_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,15 +735,11 @@ func RunMapper(req *pb.RestoreRequest, mapDir string) (*mapResult, error) {
}
ns, err := strconv.ParseUint(op.DropValue, 0, 64)
if err != nil {
return nil, errors.Wrap(err, "Map phase failed to parse namespace")
return nil, errors.Wrap(err, "map phase failed to parse namespace")
}
dropNs[ns] = struct{}{}
case pb.DropOperation_ATTR:
p := op.DropValue
if manifest.Version == 0 {
p = x.NamespaceAttr(x.GalaxyNamespace, p)
}
dropAttr[p] = struct{}{}
dropAttr[op.DropValue] = struct{}{}
case pb.DropOperation_NS:
// pstore will be nil for export_backup tool. In that case we don't need to ban ns.
if pstore == nil {
Expand Down

0 comments on commit 95b0684

Please sign in to comment.