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

Use pre-allocated protobufs during backups. #5404

Merged
merged 10 commits into from
May 22, 2020
Prev Previous commit
Next Next commit
Update logic to use thread id from the iterator.
  • Loading branch information
martinmr committed May 18, 2020
commit 7e38b1ed1b388ebccc15a3f3bcc7cb4016870200
6 changes: 3 additions & 3 deletions worker/backup_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (pr *BackupProcessor) WriteBackup(ctx context.Context) (*pb.Status, error)
stream := pr.DB.NewStreamAt(pr.Request.ReadTs)
stream.LogPrefix = "Dgraph.Backup"
stream.NumGo = backupNumGo
stream.KeyToListWithThreadNum = pr.toBackupList
stream.KeyToList = pr.toBackupList
stream.ChooseKey = func(item *badger.Item) bool {
parsedKey, err := x.Parse(item.Key())
if err != nil {
Expand Down Expand Up @@ -216,7 +216,7 @@ func (m *Manifest) GoString() string {
m.Since, m.Groups, m.Encrypted)
}

func (pr *BackupProcessor) toBackupList(key []byte, itr *badger.Iterator, threadNum int) (
func (pr *BackupProcessor) toBackupList(key []byte, itr *badger.Iterator) (
*bpb.KVList, error) {
list := &bpb.KVList{}

Expand Down Expand Up @@ -248,7 +248,7 @@ func (pr *BackupProcessor) toBackupList(key []byte, itr *badger.Iterator, thread
}
kv.Key = backupKey

backupPl, err := pr.toBackupPostingList(kv.Value, threadNum)
backupPl, err := pr.toBackupPostingList(kv.Value, itr.ThreadId)
if err != nil {
return nil, err
}
Expand Down