Chris Lu
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
10 deletions
-
weed/server/volume_grpc_vacuum.go
-
weed/storage/store_vacuum.go
|
|
@ -44,19 +44,14 @@ func (vs *VolumeServer) VacuumVolumeCommit(ctx context.Context, req *volume_serv |
|
|
|
|
|
|
|
resp := &volume_server_pb.VacuumVolumeCommitResponse{} |
|
|
|
|
|
|
|
err := vs.store.CommitCompactVolume(needle.VolumeId(req.VolumeId)) |
|
|
|
readOnly, err := vs.store.CommitCompactVolume(needle.VolumeId(req.VolumeId)) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
glog.Errorf("commit volume %d: %v", req.VolumeId, err) |
|
|
|
} else { |
|
|
|
glog.V(1).Infof("commit volume %d", req.VolumeId) |
|
|
|
} |
|
|
|
if err == nil { |
|
|
|
if vs.store.GetVolume(needle.VolumeId(req.VolumeId)).IsReadOnly() { |
|
|
|
resp.IsReadOnly = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
resp.IsReadOnly = readOnly |
|
|
|
return resp, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
@ -25,11 +25,11 @@ func (s *Store) CompactVolume(vid needle.VolumeId, preallocate int64, compaction |
|
|
|
} |
|
|
|
return fmt.Errorf("volume id %d is not found during compact", vid) |
|
|
|
} |
|
|
|
func (s *Store) CommitCompactVolume(vid needle.VolumeId) error { |
|
|
|
func (s *Store) CommitCompactVolume(vid needle.VolumeId) (bool, error) { |
|
|
|
if v := s.findVolume(vid); v != nil { |
|
|
|
return v.CommitCompact() |
|
|
|
return v.IsReadOnly(), v.CommitCompact() |
|
|
|
} |
|
|
|
return fmt.Errorf("volume id %d is not found during commit compact", vid) |
|
|
|
return false, fmt.Errorf("volume id %d is not found during commit compact", vid) |
|
|
|
} |
|
|
|
func (s *Store) CommitCleanupVolume(vid needle.VolumeId) error { |
|
|
|
if v := s.findVolume(vid); v != nil { |
|
|
|