mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 16:53:14 +08:00
Fix no more writable volumes by delay judgment (#4548)
* fix nomore writables volumes while disk free space is sufficient by time delay * reset --------- Co-authored-by: wang wusong <wangwusong@virtaitech.com>
This commit is contained in:
@@ -123,14 +123,20 @@ func (t *Topology) batchVacuumVolumeCompact(grpcDialOption grpc.DialOption, vl *
|
||||
func (t *Topology) batchVacuumVolumeCommit(grpcDialOption grpc.DialOption, vl *VolumeLayout, vid needle.VolumeId, vacuumLocationList, locationList *VolumeLocationList) bool {
|
||||
isCommitSuccess := true
|
||||
isReadOnly := false
|
||||
isFullCapacity := false
|
||||
for _, dn := range vacuumLocationList.list {
|
||||
glog.V(0).Infoln("Start Committing vacuum", vid, "on", dn.Url())
|
||||
err := operation.WithVolumeServerClient(false, dn.ServerAddress(), grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
|
||||
resp, err := volumeServerClient.VacuumVolumeCommit(context.Background(), &volume_server_pb.VacuumVolumeCommitRequest{
|
||||
VolumeId: uint32(vid),
|
||||
})
|
||||
if resp != nil && resp.IsReadOnly {
|
||||
isReadOnly = true
|
||||
if resp != nil {
|
||||
if resp.IsReadOnly {
|
||||
isReadOnly = true
|
||||
}
|
||||
if resp.VolumeSize > t.volumeSizeLimit {
|
||||
isFullCapacity = true
|
||||
}
|
||||
}
|
||||
return err
|
||||
})
|
||||
@@ -157,8 +163,13 @@ func (t *Topology) batchVacuumVolumeCommit(grpcDialOption grpc.DialOption, vl *V
|
||||
resp, err := volumeServerClient.VolumeStatus(context.Background(), &volume_server_pb.VolumeStatusRequest{
|
||||
VolumeId: uint32(vid),
|
||||
})
|
||||
if resp != nil && resp.IsReadOnly {
|
||||
isReadOnly = true
|
||||
if resp != nil {
|
||||
if resp.IsReadOnly {
|
||||
isReadOnly = true
|
||||
}
|
||||
if resp.VolumeSize > t.volumeSizeLimit {
|
||||
isFullCapacity = true
|
||||
}
|
||||
}
|
||||
return err
|
||||
})
|
||||
@@ -187,8 +198,13 @@ func (t *Topology) batchVacuumVolumeCommit(grpcDialOption grpc.DialOption, vl *V
|
||||
dn.Unlock()
|
||||
}
|
||||
|
||||
//record vacuum time of volume
|
||||
vl.accessLock.Lock()
|
||||
vl.vacuumedVolumes[vid] = time.Now()
|
||||
vl.accessLock.Unlock()
|
||||
|
||||
for _, dn := range vacuumLocationList.list {
|
||||
vl.SetVolumeAvailable(dn, vid, isReadOnly)
|
||||
vl.SetVolumeAvailable(dn, vid, isReadOnly, isFullCapacity)
|
||||
}
|
||||
}
|
||||
return isCommitSuccess
|
||||
|
||||
Reference in New Issue
Block a user