aboutsummaryrefslogtreecommitdiff
path: root/weed/command
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-05-03 17:22:39 -0700
committerChris Lu <chris.lu@gmail.com>2019-05-03 17:22:39 -0700
commitb335f81a4fb51e57b0da37b2b662e823369459f6 (patch)
tree7eeb6af906d81bf1a67aae1b9f627464f355908c /weed/command
parentf0f981e7c8bd74f3df277539407bcb6b6a483050 (diff)
downloadseaweedfs-b335f81a4fb51e57b0da37b2b662e823369459f6.tar.xz
seaweedfs-b335f81a4fb51e57b0da37b2b662e823369459f6.zip
volume: add option to limit compaction speed
Diffstat (limited to 'weed/command')
-rw-r--r--weed/command/backup.go2
-rw-r--r--weed/command/compact.go2
-rw-r--r--weed/command/server.go1
-rw-r--r--weed/command/volume.go3
4 files changed, 6 insertions, 2 deletions
diff --git a/weed/command/backup.go b/weed/command/backup.go
index 51a89a5af..022e784c7 100644
--- a/weed/command/backup.go
+++ b/weed/command/backup.go
@@ -91,7 +91,7 @@ func runBackup(cmd *Command, args []string) bool {
}
if v.SuperBlock.CompactionRevision < uint16(stats.CompactRevision) {
- if err = v.Compact(0); err != nil {
+ if err = v.Compact(0, 0); err != nil {
fmt.Printf("Compact Volume before synchronizing %v\n", err)
return true
}
diff --git a/weed/command/compact.go b/weed/command/compact.go
index 3ac09259e..79d50c095 100644
--- a/weed/command/compact.go
+++ b/weed/command/compact.go
@@ -43,7 +43,7 @@ func runCompact(cmd *Command, args []string) bool {
glog.Fatalf("Load Volume [ERROR] %s\n", err)
}
if *compactMethod == 0 {
- if err = v.Compact(preallocate); err != nil {
+ if err = v.Compact(preallocate, 0); err != nil {
glog.Fatalf("Compact Volume [ERROR] %s\n", err)
}
} else {
diff --git a/weed/command/server.go b/weed/command/server.go
index 228594ad0..ce402f1cd 100644
--- a/weed/command/server.go
+++ b/weed/command/server.go
@@ -94,6 +94,7 @@ func init() {
serverOptions.v.indexType = cmdServer.Flag.String("volume.index", "memory", "Choose [memory|leveldb|leveldbMedium|leveldbLarge] mode for memory~performance balance.")
serverOptions.v.fixJpgOrientation = cmdServer.Flag.Bool("volume.images.fix.orientation", false, "Adjust jpg orientation when uploading.")
serverOptions.v.readRedirect = cmdServer.Flag.Bool("volume.read.redirect", true, "Redirect moved or non-local volumes.")
+ serverOptions.v.compactionMBPerSecond = cmdServer.Flag.Int("volume.compactionMBps", 0, "limit compaction speed in mega bytes per second")
serverOptions.v.publicUrl = cmdServer.Flag.String("volume.publicUrl", "", "publicly accessible address")
s3Options.filerBucketsPath = cmdServer.Flag.String("s3.filer.dir.buckets", "/buckets", "folder on filer to store all buckets")
diff --git a/weed/command/volume.go b/weed/command/volume.go
index b87555456..4d34fbc1e 100644
--- a/weed/command/volume.go
+++ b/weed/command/volume.go
@@ -43,6 +43,7 @@ type VolumeServerOptions struct {
readRedirect *bool
cpuProfile *string
memProfile *string
+ compactionMBPerSecond *int
}
func init() {
@@ -63,6 +64,7 @@ func init() {
v.readRedirect = cmdVolume.Flag.Bool("read.redirect", true, "Redirect moved or non-local volumes.")
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 compaction speed in mega bytes per second")
}
var cmdVolume = &Command{
@@ -157,6 +159,7 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
strings.Split(masters, ","), *v.pulseSeconds, *v.dataCenter, *v.rack,
v.whiteList,
*v.fixJpgOrientation, *v.readRedirect,
+ *v.compactionMBPerSecond,
)
listeningAddress := *v.bindIp + ":" + strconv.Itoa(*v.port)