aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_loading.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-10-24 18:05:35 -0700
committerGitHub <noreply@github.com>2025-10-24 18:05:35 -0700
commitfa35efc07671b26bb2fdf21f9f55e378ce92ffd1 (patch)
tree426d86705f734752e51f058d10461f2a9853b3d2 /weed/storage/volume_loading.go
parent263e891da0d9aae1618e48b4da5df6bfd9802f80 (diff)
downloadseaweedfs-fa35efc07671b26bb2fdf21f9f55e378ce92ffd1.tar.xz
seaweedfs-fa35efc07671b26bb2fdf21f9f55e378ce92ffd1.zip
Volume Server: Unexpected Deletion of Remote Tier Data (#7377)
* [Admin UI] Login not possible due to securecookie error * avoid 404 favicon * Update weed/admin/dash/auth_middleware.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * address comments * avoid variable over shadowing * log session save error * When jwt.signing.read.key is enabled in security.toml, the volume server requires JWT tokens for all read operations. * reuse fileId * refactor * fix deleting remote tier * simplify the fix * Update weed/storage/volume_loading.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/storage/volume_loading.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/storage/volume_loading.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Diffstat (limited to 'weed/storage/volume_loading.go')
-rw-r--r--weed/storage/volume_loading.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go
index 471401c6f..4f550a949 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