MCPcopy
hub / github.com/dgraph-io/dgraph / BackupGroup

Function BackupGroup

worker/backup.go:206–224  ·  view source on GitHub ↗

BackupGroup backs up the group specified in the backup request.

(ctx context.Context, in *pb.BackupRequest)

Source from the content-addressed store, hash-verified

204
205// BackupGroup backs up the group specified in the backup request.
206func BackupGroup(ctx context.Context, in *pb.BackupRequest) (*pb.BackupResponse, error) {
207 glog.V(2).Infof("Sending backup request: %+v\n", in)
208 if groups().groupId() == in.GroupId {
209 return backupCurrentGroup(ctx, in)
210 }
211
212 // This node is not part of the requested group, send the request over the network.
213 pl := groups().AnyServer(in.GroupId)
214 if pl == nil {
215 return nil, errors.Errorf("Couldn't find a server in group %d", in.GroupId)
216 }
217 res, err := pb.NewWorkerClient(pl.Get()).Backup(ctx, in)
218 if err != nil {
219 glog.Errorf("Backup error group %d: %s", in.GroupId, err)
220 return nil, err
221 }
222
223 return res, nil
224}
225
226// backupLock is used to synchronize backups to avoid more than one backup request
227// to be processed at the same time. Multiple requests could lead to multiple

Callers 1

ProcessBackupRequestFunction · 0.85

Calls 9

NewWorkerClientFunction · 0.92
groupsFunction · 0.85
backupCurrentGroupFunction · 0.85
InfofMethod · 0.80
groupIdMethod · 0.80
AnyServerMethod · 0.80
BackupMethod · 0.65
GetMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected