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.

Volume Server: Unexpected Deletion of Remote Tier Data (#7377)

Chris Lufa35efc07671
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go
index 471401c6f4..4f550a949b 100644
--- a/weed/storage/volume_loading.go
+++ b/weed/storage/volume_loading.go
@@ -55,6 +55,19 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
if err := v.LoadRemoteFile(); err != nil {
return fmt.Errorf("load remote file %v: %w", v.volumeInfo, err)
}
+ // Set lastModifiedTsSeconds from remote file to prevent premature expiry on startup
+ if len(v.volumeInfo.GetFiles()) > 0 {
+ remoteFileModifiedTime := v.volumeInfo.GetFiles()[0].GetModifiedTime()
+ if remoteFileModifiedTime > 0 {
+ v.lastModifiedTsSeconds = remoteFileModifiedTime
+ } else {
+ // Fallback: use .vif file's modification time
+ if exists, _, _, modifiedTime, _ := util.CheckFile(v.FileName(".vif")); exists {
+ v.lastModifiedTsSeconds = uint64(modifiedTime.Unix())
+ }
+ }
+ glog.V(1).Infof("volume %d remote file lastModifiedTsSeconds set to %d", v.Id, v.lastModifiedTsSeconds)
+ }
alreadyHasSuperBlock = true
} else if exists, canRead, canWrite, modifiedTime, fileSize := util.CheckFile(v.FileName(".dat")); exists {
// open dat file