Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Fix remote.meta.sync TTL issue (#8021) (#8030)

Chris Luf47bc8c5394a
diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go
index ef52251814..cd555f2c2c 100644
--- a/weed/server/filer_grpc_server.go
+++ b/weed/server/filer_grpc_server.go
@@ -153,7 +153,12 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
}
newEntry := filer.FromPbEntry(req.Directory, req.Entry)
newEntry.Chunks = chunks
- newEntry.TtlSec = so.TtlSeconds
+ // Don't apply TTL to remote entries - they're managed by remote storage
+ if newEntry.Remote == nil {
+ newEntry.TtlSec = so.TtlSeconds
+ } else {
+ newEntry.TtlSec = 0
+ }
createErr := fs.filer.CreateEntry(ctx, newEntry, req.OExcl, req.IsFromOtherCluster, req.Signatures, req.SkipCheckParentDirectory, so.MaxFileNameLength)
@@ -185,6 +190,11 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
newEntry := filer.FromPbEntry(req.Directory, req.Entry)
newEntry.Chunks = chunks
+ // Don't apply TTL to remote entries - they're managed by remote storage
+ if newEntry.Remote != nil {
+ newEntry.TtlSec = 0
+ }
+
if filer.EqualEntry(entry, newEntry) {
return &filer_pb.UpdateEntryResponse{}, err
}
diff --git a/weed/shell/command_remote_meta_sync.go b/weed/shell/command_remote_meta_sync.go
index d71ba16084..dc9cb9c687 100644
--- a/weed/shell/command_remote_meta_sync.go
+++ b/weed/shell/command_remote_meta_sync.go
@@ -160,6 +160,7 @@ func pullMetadata(commandEnv *CommandEnv, writer io.Writer, localMountedDir util
FileSize: uint64(remoteEntry.RemoteSize),
Mtime: remoteEntry.RemoteMtime,
FileMode: uint32(0644),
+ TtlSec: 0, // Remote entries should not have TTL
},
RemoteEntry: remoteEntry,
},
diff --git a/weed/shell/command_remote_mount.go b/weed/shell/command_remote_mount.go
index 144aa079ae..e9237866c6 100644
--- a/weed/shell/command_remote_mount.go
+++ b/weed/shell/command_remote_mount.go
@@ -188,6 +188,7 @@ func doSaveRemoteEntry(client filer_pb.SeaweedFilerClient, localDir string, exis
existingEntry.Attributes.FileSize = uint64(remoteEntry.RemoteSize)
existingEntry.Attributes.Mtime = remoteEntry.RemoteMtime
existingEntry.Attributes.Md5 = nil
+ existingEntry.Attributes.TtlSec = 0 // Remote entries should not have TTL
existingEntry.Chunks = nil
existingEntry.Content = nil
_, updateErr := client.UpdateEntry(context.Background(), &filer_pb.UpdateEntryRequest{