mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-22 22:11:39 +02:00
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
This commit is contained in:
1 parent
37af41fbfe
commit
6a8c53bc44
5 files changed
+86
-44
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user