aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_check_disk.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-10-25 00:09:18 -0700
committerGitHub <noreply@github.com>2025-10-25 00:09:18 -0700
commit6a8c53bc44beb057f64d5ba1f7ac026f8410fe04 (patch)
tree2b3ceed66edd6dd141370bad3fbfce07886840bd /weed/shell/command_volume_check_disk.go
parent37af41fbfeaf2e9830e25b658b8bed409fa6fae6 (diff)
downloadseaweedfs-6a8c53bc44beb057f64d5ba1f7ac026f8410fe04.tar.xz
seaweedfs-6a8c53bc44beb057f64d5ba1f7ac026f8410fe04.zip
Filer: batch deletion operations to return individual error results (#7382)
* batch deletion operations to return individual error results Modify batch deletion operations to return individual error results instead of one aggregated error, enabling better tracking of which specific files failed to delete (helping reduce orphan file issues). * Simplified logging logic * Optimized nested loop * handles the edge case where the RPC succeeds but connection cleanup fails * simplify * simplify * ignore 'not found' errors here
Diffstat (limited to 'weed/shell/command_volume_check_disk.go')
-rw-r--r--weed/shell/command_volume_check_disk.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/weed/shell/command_volume_check_disk.go b/weed/shell/command_volume_check_disk.go
index fbad37f02..a8cc72d4d 100644
--- a/weed/shell/command_volume_check_disk.go
+++ b/weed/shell/command_volume_check_disk.go
@@ -11,6 +11,8 @@ import (
"sync"
"time"
+ "slices"
+
"github.com/seaweedfs/seaweedfs/weed/operation"
"github.com/seaweedfs/seaweedfs/weed/pb"
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
@@ -18,7 +20,6 @@ import (
"github.com/seaweedfs/seaweedfs/weed/server/constants"
"github.com/seaweedfs/seaweedfs/weed/storage/needle_map"
"google.golang.org/grpc"
- "slices"
)
func init() {
@@ -321,13 +322,15 @@ func doVolumeCheckDisk(minuend, subtrahend *needle_map.MemDb, source, target *Vo
fmt.Fprintf(writer, "delete %s %s => %s\n", needleValue.Key.FileId(source.info.Id), source.location.dataNode.Id, target.location.dataNode.Id)
}
}
- deleteResults, deleteErr := operation.DeleteFileIdsAtOneVolumeServer(
+ deleteResults := operation.DeleteFileIdsAtOneVolumeServer(
pb.NewServerAddressFromDataNode(target.location.dataNode),
grpcDialOption, fidList, false)
- if deleteErr != nil {
- return hasChanges, deleteErr
- }
+
+ // Check for errors in results
for _, deleteResult := range deleteResults {
+ if deleteResult.Error != "" && deleteResult.Error != "not found" {
+ return hasChanges, fmt.Errorf("delete file %s: %v", deleteResult.FileId, deleteResult.Error)
+ }
if deleteResult.Status == http.StatusAccepted && deleteResult.Size > 0 {
hasChanges = true
}