BackupGroup backs up the group specified in the backup request.
(ctx context.Context, in *pb.BackupRequest)
| 204 | |
| 205 | // BackupGroup backs up the group specified in the backup request. |
| 206 | func 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 |
no test coverage detected