diff options
| author | chrislu <chris.lu@gmail.com> | 2022-03-04 18:47:44 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-03-04 18:47:44 -0800 |
| commit | 6e49e75a5b70389d16026b52ba5001d09cea2c7f (patch) | |
| tree | 62af19cb1ded88e128c92fce452da4cac143fd83 /weed/shell/command_collection_list.go | |
| parent | f51e20028a381390bf1356e2ccd181838059cde9 (diff) | |
| download | seaweedfs-6e49e75a5b70389d16026b52ba5001d09cea2c7f.tar.xz seaweedfs-6e49e75a5b70389d16026b52ba5001d09cea2c7f.zip | |
use logical number of files and sizes for statistics and quota
Diffstat (limited to 'weed/shell/command_collection_list.go')
| -rw-r--r-- | weed/shell/command_collection_list.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/weed/shell/command_collection_list.go b/weed/shell/command_collection_list.go index 55fd6d9b9..47a4da553 100644 --- a/weed/shell/command_collection_list.go +++ b/weed/shell/command_collection_list.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/chrislusf/seaweedfs/weed/pb/master_pb" + "github.com/chrislusf/seaweedfs/weed/storage/super_block" "io" ) @@ -23,10 +24,10 @@ func (c *commandCollectionList) Help() string { } type CollectionInfo struct { - FileCount uint64 - DeleteCount uint64 - DeletedByteCount uint64 - Size uint64 + FileCount float64 + DeleteCount float64 + DeletedByteCount float64 + Size float64 VolumeCount int } @@ -52,7 +53,7 @@ func (c *commandCollectionList) Do(args []string, commandEnv *CommandEnv, writer if !found { continue } - fmt.Fprintf(writer, "collection:\"%s\"\tvolumeCount:%d\tsize:%d\tfileCount:%d\tdeletedBytes:%d\tdeletion:%d\n", c, cif.VolumeCount, cif.Size, cif.FileCount, cif.DeletedByteCount, cif.DeleteCount) + fmt.Fprintf(writer, "collection:\"%s\"\tvolumeCount:%d\tsize:%.0f\tfileCount:%.0f\tdeletedBytes:%.0f\tdeletion:%.0f\n", c, cif.VolumeCount, cif.Size, cif.FileCount, cif.DeletedByteCount, cif.DeleteCount) } fmt.Fprintf(writer, "Total %d collections.\n", len(collections)) @@ -85,10 +86,12 @@ func addToCollection(collectionInfos map[string]*CollectionInfo, vif *master_pb. cif = &CollectionInfo{} collectionInfos[c] = cif } - cif.Size += vif.Size - cif.DeleteCount += vif.DeleteCount - cif.FileCount += vif.FileCount - cif.DeletedByteCount += vif.DeletedByteCount + replicaPlacement, _ := super_block.NewReplicaPlacementFromByte(byte(vif.ReplicaPlacement)) + copyCount := float64(replicaPlacement.GetCopyCount()) + cif.Size += float64(vif.Size) / copyCount + cif.DeleteCount += float64(vif.DeleteCount) / copyCount + cif.FileCount += float64(vif.FileCount) / copyCount + cif.DeletedByteCount += float64(vif.DeletedByteCount) / copyCount cif.VolumeCount++ } |
