mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-25 00:27:11 +00:00
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:
@@ -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),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user