aboutsummaryrefslogtreecommitdiff
path: root/weed/command/volume.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-01-03 00:37:24 -0800
committerChris Lu <chris.lu@gmail.com>2020-01-03 00:37:26 -0800
commit3eafec4b29b9a5090eb6dd5f0ddee6ee1f713792 (patch)
tree9614ba54b9e746bb05d3559aeee63d64f241da75 /weed/command/volume.go
parenta3a2e69900290256646f24d9bbd2f204c188af2f (diff)
downloadseaweedfs-3eafec4b29b9a5090eb6dd5f0ddee6ee1f713792.tar.xz
seaweedfs-3eafec4b29b9a5090eb6dd5f0ddee6ee1f713792.zip
volume: add option to limit file size
Diffstat (limited to 'weed/command/volume.go')
-rw-r--r--weed/command/volume.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/weed/command/volume.go b/weed/command/volume.go
index 3e8341ef8..b0f46bbf3 100644
--- a/weed/command/volume.go
+++ b/weed/command/volume.go
@@ -10,17 +10,19 @@ import (
"strings"
"time"
- "github.com/chrislusf/seaweedfs/weed/security"
- "github.com/chrislusf/seaweedfs/weed/util/httpdown"
"github.com/spf13/viper"
"google.golang.org/grpc"
+ "github.com/chrislusf/seaweedfs/weed/security"
+ "github.com/chrislusf/seaweedfs/weed/util/httpdown"
+
+ "google.golang.org/grpc/reflection"
+
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
"github.com/chrislusf/seaweedfs/weed/server"
"github.com/chrislusf/seaweedfs/weed/storage"
"github.com/chrislusf/seaweedfs/weed/util"
- "google.golang.org/grpc/reflection"
)
var (
@@ -47,6 +49,7 @@ type VolumeServerOptions struct {
cpuProfile *string
memProfile *string
compactionMBPerSecond *int
+ fileSizeLimitMB *int
}
func init() {
@@ -67,6 +70,7 @@ func init() {
v.cpuProfile = cmdVolume.Flag.String("cpuprofile", "", "cpu profile output file")
v.memProfile = cmdVolume.Flag.String("memprofile", "", "memory profile output file")
v.compactionMBPerSecond = cmdVolume.Flag.Int("compactionMBps", 0, "limit background compaction or copying speed in mega bytes per second")
+ v.fileSizeLimitMB = cmdVolume.Flag.Int("fileSizeLimitMB", 256, "limit file size to avoid out of memory")
}
var cmdVolume = &Command{
@@ -158,6 +162,7 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
v.whiteList,
*v.fixJpgOrientation, *v.readRedirect,
*v.compactionMBPerSecond,
+ *v.fileSizeLimitMB,
)
// starting grpc server