From 428af1c0eb74f9da96260e6c63ec5189a7040e5e Mon Sep 17 00:00:00 2001 From: "user.email" Date: Sat, 24 Oct 2026 10:03:24 -0700 Subject: [PATCH] filer: keep chunks a partially-committed format entry still references A failed CreateEntry can persist the entry before erroring on parent creation; deleting every uploaded chunk then leaves the stored entry pointing at gone data. Filter the cleanup through the same inline-append reference check, and apply it to repack's UpdateEntry failure path too. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- weed/server/filer_server_format.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/weed/server/filer_server_format.go b/weed/server/filer_server_format.go index e1c89f7397..6545c01e2a 100644 --- a/weed/server/filer_server_format.go +++ b/weed/server/filer_server_format.go @@ -281,7 +281,9 @@ func (fs *FilerServer) formatIngest(ctx context.Context, w http.ResponseWriter, return } if err := fs.filer.CreateEntry(context.WithoutCancel(ctx), entry, nil, false, false, nil, skipCheckParentDirEntry(r), so.MaxFileNameLength); err != nil { - cleanup() + // CreateEntry can persist the entry and then fail creating parents; + // keep chunks the stored entry still references + fs.filer.DeleteUncommittedChunks(context.WithoutCancel(ctx), fs.inlineAppendChunksNotReferenced(ctx, entry.FullPath, fileChunks)) writeJsonError(w, r, http.StatusInternalServerError, err) return } @@ -495,7 +497,7 @@ func (fs *FilerServer) formatRepack(ctx context.Context, w http.ResponseWriter, newEntry.Md5 = md5Hash.Sum(nil) } if err := fs.filer.UpdateEntry(context.WithoutCancel(ctx), current, &newEntry, false); err != nil { - cleanup() + fs.filer.DeleteUncommittedChunks(context.WithoutCancel(ctx), fs.inlineAppendChunksNotReferenced(ctx, fullPath, newChunks)) writeJsonError(w, r, http.StatusInternalServerError, err) return }