From f4073107cb0aac4f16f04506b5ff795f6b6ff9a6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 17 Mar 2026 13:47:54 -0700 Subject: [PATCH] fix: clean up orphaned needles on remote.cache partial download failure (#8675) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When remote.cache downloads a file in parallel chunks and a gRPC connection drops mid-transfer, chunks already written to volume servers were not cleaned up. Since the filer metadata was never updated, these needles became orphaned — invisible to volume.vacuum and never referenced by the filer. On subsequent cache cycles the file was still treated as uncached, creating more orphans each attempt. Call DeleteUncommittedChunks on the download-error path, matching the cleanup already present for the metadata-update-failure path. Fixes #8481 --- weed/server/filer_grpc_server_remote.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/weed/server/filer_grpc_server_remote.go b/weed/server/filer_grpc_server_remote.go index e790a12ef..3174c4206 100644 --- a/weed/server/filer_grpc_server_remote.go +++ b/weed/server/filer_grpc_server_remote.go @@ -241,6 +241,12 @@ func (fs *FilerServer) doCacheRemoteObjectToLocalCluster(ctx context.Context, re }) chunksMu.Unlock() if err != nil { + // Clean up any chunks that were successfully written before the error. + // Without this, partial downloads leave orphaned needles in volume servers + // that accumulate across retry cycles and cannot be reclaimed by vacuum. + if len(chunks) > 0 { + fs.filer.DeleteUncommittedChunks(ctx, chunks) + } return nil, err }