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 inconsistent TTL reporting in volume.list #8158 (#8164)

Chris Lu550a4ff76121
diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go
index 956d372bbb..a07861b9cb 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 4d0a30658c..3a5bae56b6 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 {