From 550a4ff761212287024dc6497dce764b38b97390 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 29 Jan 2026 14:16:42 -0800 Subject: [PATCH] Fix inconsistent TTL reporting in volume.list #8158 (#8164) * fix inconsistent TTL reporting in volume.list #8158 * simplify volume.list output using vi.String() --- weed/shell/command_volume_list.go | 10 +++++++++- weed/storage/volume_info.go | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go index 956d372bb..a07861b9c 100644 --- a/weed/shell/command_volume_list.go +++ b/weed/shell/command_volume_list.go @@ -11,6 +11,7 @@ import ( "time" "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" + "github.com/seaweedfs/seaweedfs/weed/storage" "github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding" "github.com/seaweedfs/seaweedfs/weed/storage/types" "github.com/seaweedfs/seaweedfs/weed/util" @@ -257,7 +258,14 @@ func (c *commandVolumeList) writeDiskInfo(writer io.Writer, t *master_pb.DiskInf } func writeVolumeInformationMessage(writer io.Writer, t *master_pb.VolumeInformationMessage, verbosityLevel int) statistics { - output(verbosityLevel >= 5, writer, " volume %+v \n", t) + if verbosityLevel >= 5 { + vi, err := storage.NewVolumeInfo(t) + if err == nil { + output(true, writer, " volume %s \n", vi.String()) + } else { + output(true, writer, " volume %+v \n", t) + } + } return statistics{ Size: t.Size, FileCount: t.FileCount, diff --git a/weed/storage/volume_info.go b/weed/storage/volume_info.go index 4d0a30658..3a5bae56b 100644 --- a/weed/storage/volume_info.go +++ b/weed/storage/volume_info.go @@ -75,8 +75,8 @@ func (vi VolumeInfo) IsRemote() bool { } func (vi VolumeInfo) String() string { - return fmt.Sprintf("Id:%d, Size:%d, ReplicaPlacement:%s, Collection:%s, Version:%v, FileCount:%d, DeleteCount:%d, DeletedByteCount:%d, ReadOnly:%v", - vi.Id, vi.Size, vi.ReplicaPlacement, vi.Collection, vi.Version, vi.FileCount, vi.DeleteCount, vi.DeletedByteCount, vi.ReadOnly) + return fmt.Sprintf("Id:%d, Size:%d, ReplicaPlacement:%s, Collection:%s, Version:%v, Ttl:%s, FileCount:%d, DeleteCount:%d, DeletedByteCount:%d, ReadOnly:%v, ModifiedAtSecond:%d", + vi.Id, vi.Size, vi.ReplicaPlacement, vi.Collection, vi.Version, vi.Ttl.String(), vi.FileCount, vi.DeleteCount, vi.DeletedByteCount, vi.ReadOnly, vi.ModifiedAtSecond) } func (vi VolumeInfo) ToVolumeInformationMessage() *master_pb.VolumeInformationMessage {