Browse Source

fix has changes false if deleted result size eq zero (#4909)

* fix has changes false if deleted result size eq zero
https://github.com/seaweedfs/seaweedfs/issues/4171

* fix change respos status 202 to 304 if the file has already been deleted
https://github.com/seaweedfs/seaweedfs/issues/4171

* fix delete if set apply changes
https://github.com/seaweedfs/seaweedfs/issues/4171

---------

Co-authored-by: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.co>
pull/4911/head
Konstantin Lebedev 1 year ago
committed by GitHub
parent
commit
edee91ef0e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      weed/server/volume_grpc_batch_delete.go
  2. 4
      weed/shell/command_volume_check_disk.go

5
weed/server/volume_grpc_batch_delete.go

@ -87,6 +87,11 @@ func (vs *VolumeServer) BatchDelete(ctx context.Context, req *volume_server_pb.B
Status: http.StatusInternalServerError, Status: http.StatusInternalServerError,
Error: err.Error()}, Error: err.Error()},
) )
} else if size == 0 {
resp.Results = append(resp.Results, &volume_server_pb.DeleteResult{
FileId: fid,
Status: http.StatusNotModified},
)
} else { } else {
resp.Results = append(resp.Results, &volume_server_pb.DeleteResult{ resp.Results = append(resp.Results, &volume_server_pb.DeleteResult{
FileId: fid, FileId: fid,

4
weed/shell/command_volume_check_disk.go

@ -271,7 +271,7 @@ func doVolumeCheckDisk(minuend, subtrahend *needle_map.MemDb, source, target *Vo
} }
if doSyncDeletions && len(partiallyDeletedNeedles) > 0 {
if doSyncDeletions && applyChanges && len(partiallyDeletedNeedles) > 0 {
var fidList []string var fidList []string
for _, needleValue := range partiallyDeletedNeedles { for _, needleValue := range partiallyDeletedNeedles {
fidList = append(fidList, needleValue.Key.FileId(source.info.Id)) fidList = append(fidList, needleValue.Key.FileId(source.info.Id))
@ -286,7 +286,7 @@ func doVolumeCheckDisk(minuend, subtrahend *needle_map.MemDb, source, target *Vo
return hasChanges, deleteErr return hasChanges, deleteErr
} }
for _, deleteResult := range deleteResults { for _, deleteResult := range deleteResults {
if deleteResult.Status == http.StatusAccepted {
if deleteResult.Status == http.StatusAccepted && deleteResult.Size > 0 {
hasChanges = true hasChanges = true
return return
} }

Loading…
Cancel
Save