|
|
@ -15,7 +15,10 @@ func batchVacuumVolumeCheck(vl *VolumeLayout, vid storage.VolumeId, locationlist |
|
|
|
for index, dn := range locationlist.list { |
|
|
|
go func(index int, url string, vid storage.VolumeId) { |
|
|
|
err := operation.WithVolumeServerClient(url, func(volumeServerClient volume_server_pb.VolumeServerClient) error { |
|
|
|
resp, err := volumeServerClient.VacuumVolumeCheck(context.Background(), &volume_server_pb.VacuumVolumeCheckRequest{ |
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second)) |
|
|
|
defer cancel() |
|
|
|
|
|
|
|
resp, err := volumeServerClient.VacuumVolumeCheck(ctx, &volume_server_pb.VacuumVolumeCheckRequest{ |
|
|
|
VolumdId: uint32(vid), |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
@ -48,6 +51,7 @@ func batchVacuumVolumeCompact(vl *VolumeLayout, vid storage.VolumeId, locationli |
|
|
|
ch := make(chan bool, locationlist.Length()) |
|
|
|
for index, dn := range locationlist.list { |
|
|
|
go func(index int, url string, vid storage.VolumeId) { |
|
|
|
// TODO: set timeout according to actual compact duration
|
|
|
|
glog.V(0).Infoln(index, "Start vacuuming", vid, "on", url) |
|
|
|
err := operation.WithVolumeServerClient(url, func(volumeServerClient volume_server_pb.VolumeServerClient) error { |
|
|
|
_, err := volumeServerClient.VacuumVolumeCompact(context.Background(), &volume_server_pb.VacuumVolumeCompactRequest{ |
|
|
@ -81,7 +85,10 @@ func batchVacuumVolumeCommit(vl *VolumeLayout, vid storage.VolumeId, locationlis |
|
|
|
for _, dn := range locationlist.list { |
|
|
|
glog.V(0).Infoln("Start Commiting vacuum", vid, "on", dn.Url()) |
|
|
|
err := operation.WithVolumeServerClient(dn.Url(), func(volumeServerClient volume_server_pb.VolumeServerClient) error { |
|
|
|
_, err := volumeServerClient.VacuumVolumeCommit(context.Background(), &volume_server_pb.VacuumVolumeCommitRequest{ |
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second)) |
|
|
|
defer cancel() |
|
|
|
|
|
|
|
_, err := volumeServerClient.VacuumVolumeCommit(ctx, &volume_server_pb.VacuumVolumeCommitRequest{ |
|
|
|
VolumdId: uint32(vid), |
|
|
|
}) |
|
|
|
return err |
|
|
@ -102,7 +109,10 @@ func batchVacuumVolumeCleanup(vl *VolumeLayout, vid storage.VolumeId, locationli |
|
|
|
for _, dn := range locationlist.list { |
|
|
|
glog.V(0).Infoln("Start cleaning up", vid, "on", dn.Url()) |
|
|
|
err := operation.WithVolumeServerClient(dn.Url(), func(volumeServerClient volume_server_pb.VolumeServerClient) error { |
|
|
|
_, err := volumeServerClient.VacuumVolumeCleanup(context.Background(), &volume_server_pb.VacuumVolumeCleanupRequest{ |
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second)) |
|
|
|
defer cancel() |
|
|
|
|
|
|
|
_, err := volumeServerClient.VacuumVolumeCleanup(ctx, &volume_server_pb.VacuumVolumeCleanupRequest{ |
|
|
|
VolumdId: uint32(vid), |
|
|
|
}) |
|
|
|
return err |
|
|
|