-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(Dgraph): Add badger.compression to Dgraph restore #6987
Conversation
Deploy preview for dgraph-docs ready! Built with commit 239336b |
@@ -158,10 +158,6 @@ func run() { | |||
if opt.Version { | |||
os.Exit(0) | |||
} | |||
if opt.BadgerCompressionLevel < 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been removed because this is derived from x.ParseCompression
, which calls glog.Fatal
in case of a negative compression level. Thus, there is no need to check over here.
@@ -111,6 +112,10 @@ $ dgraph restore -p . -l /var/backups/dgraph -z localhost:5080 | |||
} | |||
|
|||
flag := Restore.Cmd.Flags() | |||
flag.StringVar(&opt.compression, "badger.compression", "snappy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the third place in the code where this exact description has been duplicated. Perhaps we could extract it out elsewhere.
@@ -35,7 +36,7 @@ import ( | |||
) | |||
|
|||
// RunRestore calls badger.Load and tries to load data into a new DB. | |||
func RunRestore(pdir, location, backupId string, key x.SensitiveByteSlice) LoadResult { | |||
func RunRestore(pdir, location, backupId string, key x.SensitiveByteSlice, ctype options.CompressionType, clevel int) LoadResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like too many arguments. Should this function be changed to take in the entire opt
struct instead?
@@ -354,7 +355,7 @@ func runFailingRestore(t *testing.T, backupLocation, lastDir string, commitTs ui | |||
require.NotNil(t, k) | |||
require.NoError(t, err) | |||
|
|||
result := worker.RunRestore("./data/restore", backupLocation, lastDir, k) | |||
result := worker.RunRestore("./data/restore", backupLocation, lastDir, k, options.Snappy, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: these tests did not use any form of compression earlier, but I've changed them to use snappy
by default.
dgraph restore
does not currently use any form of compression. This PR adds a--badger.compression
flag (similar to other Dgraph subcommands) and defaults all compression tosnappy
.This change is