Merge branch 'master' into messaging

This commit is contained in:
chrislu
2022-07-04 13:48:00 -07:00
8 changed files with 44 additions and 39 deletions

View File

@@ -45,7 +45,7 @@ func (c *commandFsDu) Do(args []string, commandEnv *CommandEnv, writer io.Writer
blockCount, byteCount, err = duTraverseDirectory(writer, commandEnv, dir, name)
if name == "" && err == nil {
fmt.Fprintf(writer, "block:%4d\tbyte:%10d\t%s\n", blockCount, byteCount, dir)
fmt.Fprintf(writer, "block:%4d\tlogical size:%10d\t%s\n", blockCount, byteCount, dir)
}
return
@@ -76,7 +76,7 @@ func duTraverseDirectory(writer io.Writer, filerClient filer_pb.FilerClient, dir
}
if name != "" && !entry.IsDirectory {
fmt.Fprintf(writer, "block:%4d\tbyte:%10d\t%s/%s\n", fileBlockCount, fileByteCount, dir, entry.Name)
fmt.Fprintf(writer, "block:%4d\tlogical size:%10d\t%s/%s\n", fileBlockCount, fileByteCount, dir, entry.Name)
}
return nil
})

View File

@@ -4,8 +4,9 @@ import (
"context"
"flag"
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"io"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
)
func init() {
@@ -23,7 +24,7 @@ func (c *commandS3BucketQuota) Help() string {
return `set/remove/enable/disable quota for a bucket
Example:
s3.bucket.quota -name=<bucket_name> -operation=set -sizeMB=1024
s3.bucket.quota -name=<bucket_name> -op=set -sizeMB=1024
`
}
@@ -31,7 +32,7 @@ func (c *commandS3BucketQuota) Do(args []string, commandEnv *CommandEnv, writer
bucketCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
bucketName := bucketCommand.String("name", "", "bucket name")
operationName := bucketCommand.String("op", "set", "operation name [set|remove|enable|disable]")
operationName := bucketCommand.String("op", "set", "operation name [set|get|remove|enable|disable]")
sizeMB := bucketCommand.Int64("sizeMB", 0, "bucket quota size in MiB")
if err = bucketCommand.Parse(args); err != nil {
return nil
@@ -63,6 +64,9 @@ func (c *commandS3BucketQuota) Do(args []string, commandEnv *CommandEnv, writer
switch *operationName {
case "set":
bucketEntry.Quota = *sizeMB * 1024 * 1024
case "get":
fmt.Fprintf(writer, "bucket quota: %dMiB \n", bucketEntry.Quota/1024/1024)
return nil
case "remove":
bucketEntry.Quota = 0
case "enable":

View File

@@ -82,12 +82,13 @@ func (dnll *VolumeLocationList) Refresh(freshThreshHold int64) {
}
}
// Stats returns logic size and count
func (dnll *VolumeLocationList) Stats(vid needle.VolumeId, freshThreshHold int64) (size uint64, fileCount int) {
for _, dnl := range dnll.list {
if dnl.LastSeen < freshThreshHold {
vinfo, err := dnl.GetVolumesById(vid)
if err == nil {
return (vinfo.Size - vinfo.DeletedByteCount) * uint64(len(dnll.list)), vinfo.FileCount - vinfo.DeleteCount
return (vinfo.Size - vinfo.DeletedByteCount), vinfo.FileCount - vinfo.DeleteCount
}
}
}

View File

@@ -5,7 +5,7 @@ import (
)
var (
VERSION_NUMBER = fmt.Sprintf("%.02f", 3.13)
VERSION_NUMBER = fmt.Sprintf("%.02f", 3.14)
VERSION = sizeLimit + " " + VERSION_NUMBER
COMMIT = ""
)