Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the upgrade tool for CORS (depreciated predicates) change #7486

Merged
merged 23 commits into from
Mar 17, 2021
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5d6ab46
s3 handler for export backup
aman-bansal Feb 18, 2021
bd364b8
fixing leaks and bugs with export
aman-bansal Feb 18, 2021
18a62c5
fixing s3 restore
aman-bansal Feb 19, 2021
1b5cb7f
fixing export input option
aman-bansal Feb 19, 2021
92528db
adding cors to the schema
aman-bansal Feb 19, 2021
34e5277
fixing cors export
aman-bansal Feb 22, 2021
eb158cf
finalizing contract and everything
aman-bansal Feb 22, 2021
e7a0eaa
removing redundant
aman-bansal Feb 22, 2021
1b69747
adding comments to simplify
aman-bansal Feb 22, 2021
ff7bf34
refactoring export code a bit
aman-bansal Feb 23, 2021
894771d
making file handler, s3 handler refactor + export backup to work cons…
aman-bansal Feb 23, 2021
5bef5ab
fix the cors issue in backup backward compatibility
NamanJain8 Feb 25, 2021
08cfa22
address comments
NamanJain8 Mar 2, 2021
ea0e9cd
Merge branch 'master' into naman/export-backup
NamanJain8 Mar 2, 2021
2a7ed62
Merge branch 'master' into naman/export-backup
NamanJain8 Mar 3, 2021
5e3d2e5
basic working
NamanJain8 Mar 4, 2021
1a1827e
add support for TLS and slash in upgrade tool
NamanJain8 Mar 10, 2021
95d964d
fix export_backup tool for fixing cors
NamanJain8 Mar 14, 2021
29bc90d
Merge branch 'master' into naman/export-backup
NamanJain8 Mar 15, 2021
a909a27
clean up
NamanJain8 Mar 15, 2021
72b1887
Merge branch 'naman/export-backup' of github.com:dgraph-io/dgraph int…
NamanJain8 Mar 15, 2021
f92d558
add persistent query fix
NamanJain8 Mar 16, 2021
813d0aa
address comments
NamanJain8 Mar 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into naman/export-backup
NamanJain8 committed Mar 3, 2021
commit 2a7ed62c7c9031e2399c1c94bcb446e7c92d7eb0
30 changes: 16 additions & 14 deletions ee/backup/run.go
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ import (
"time"

"github.com/dgraph-io/badger/v3/options"
"golang.org/x/sync/errgroup"

"google.golang.org/grpc/credentials"

@@ -377,7 +378,7 @@ func runExportBackup() error {
return err
}
// Export the data from the p directories produced by the last step.
ch := make(chan error, len(files))
eg, _ := errgroup.WithContext(context.Background())
for _, f := range files {
if !f.IsDir() {
continue
@@ -386,22 +387,23 @@ func runExportBackup() error {
dir := filepath.Join(filepath.Join(tmpDir, f.Name()))
gid, err := strconv.ParseUint(strings.TrimPrefix(f.Name(), "p"), 32, 10)
if err != nil {
ch <- errors.Wrapf(err, "cannot export data inside DB at %s", dir)
fmt.Printf("WARNING WARNING WARNING: unable to get group id from directory "+
"inside DB at %s: %v", dir, err)
continue
}
go worker.StoreExport(&pb.ExportRequest{
GroupId: uint32(gid),
ReadTs: restore.Version,
UnixTs: time.Now().Unix(),
Format: opt.format,
Destination: exportDir,
}, dir, opt.key, ch)
eg.Go(func() error {
return worker.StoreExport(&pb.ExportRequest{
GroupId: uint32(gid),
ReadTs: restore.Version,
UnixTs: time.Now().Unix(),
Format: opt.format,
Destination: exportDir,
}, dir, opt.key)
})
}

for i := 0; i < len(files); i++ {
err := <-ch
if err != nil {
return err
}
if err := eg.Wait(); err != nil {
return errors.Wrapf(err, "error while exporting data")
}

// Clean up temporary directory.
10 changes: 3 additions & 7 deletions worker/backup_common.go
Original file line number Diff line number Diff line change
@@ -101,24 +101,20 @@ func GetCredentialsFromRequest(req *pb.BackupRequest) *x.MinioCredentials {
}
}

func StoreExport(request *pb.ExportRequest, dir string,
key x.SensitiveByteSlice, ch chan error) {

func StoreExport(request *pb.ExportRequest, dir string, key x.SensitiveByteSlice) error {
db, err := badger.OpenManaged(badger.DefaultOptions(dir).
WithSyncWrites(false).
WithValueThreshold(1 << 10).
WithNumVersionsToKeep(math.MaxInt32).
WithEncryptionKey(key))

if err != nil {
ch <- errors.Wrapf(err, "cannot open DB at %s", dir)
return
return err
}

_, err = exportInternal(context.Background(), request, db, true)
// It is important to close the db before sending err to ch. Else, we will see a memory
// leak.
db.Close()
ch <- errors.Wrapf(err, "cannot export data inside DB at %s", dir)
return
return errors.Wrapf(err, "cannot export data inside DB at %s", dir)
}
You are viewing a condensed version of this merge commit. You can view the full changes here.