filer: repack keeps the entry TTL and notifies subscribers

New chunks were assigned with the TTL the request query implied while
the entry kept its own, so repacking a permanent file with ?ttl= made
its chunks expire under permanent metadata. Force the entry TTL onto
the storage option instead.

Filer.UpdateEntry only writes the store, so metadata subscribers never
heard about the new chunk ids while the old ones were queued for
deletion. Emit the update event the way the gRPC UpdateEntry path does.
This commit is contained in:
Chris Lu
2026-08-10 00:31:16 -07:00
parent 77a2b1b378
commit 9cb7dc7204
+7
View File
@@ -262,6 +262,10 @@ func (fs *FilerServer) formatRepack(ctx context.Context, w http.ResponseWriter,
}
}
// Repack rewrites where bytes are cut, never their lifetime: new chunks
// must carry the entry's TTL, not whatever the request query implies.
so.TtlSeconds = entry.TtlSec
size := int64(entry.FileSize)
lookup := fs.filer.MasterClient.GetLookupFileIdFunction()
chunkViews := filer.ViewFromChunks(ctx, lookup, oldChunks, 0, size)
@@ -343,6 +347,9 @@ func (fs *FilerServer) formatRepack(ctx context.Context, w http.ResponseWriter,
return
}
fs.filer.DeleteChunks(context.WithoutCancel(ctx), fullPath, oldChunks)
// Filer.UpdateEntry only writes the store; notify subscribers (sync,
// backup, replication) of the new chunk ids like the gRPC path does.
fs.filer.NotifyUpdateEvent(ctx, entry, &newEntry, true, false, nil)
writeJsonQuiet(w, r, http.StatusOK, map[string]interface{}{
"name": entry.Name(), "size": size, "extents": len(layout.ExtentSizes),
})