diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-05-03 17:22:39 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-05-03 17:22:39 -0700 |
| commit | b335f81a4fb51e57b0da37b2b662e823369459f6 (patch) | |
| tree | 7eeb6af906d81bf1a67aae1b9f627464f355908c /weed/server/volume_server.go | |
| parent | f0f981e7c8bd74f3df277539407bcb6b6a483050 (diff) | |
| download | seaweedfs-b335f81a4fb51e57b0da37b2b662e823369459f6.tar.xz seaweedfs-b335f81a4fb51e57b0da37b2b662e823369459f6.zip | |
volume: add option to limit compaction speed
Diffstat (limited to 'weed/server/volume_server.go')
| -rw-r--r-- | weed/server/volume_server.go | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/weed/server/volume_server.go b/weed/server/volume_server.go index 8e77ec570..be1b433f7 100644 --- a/weed/server/volume_server.go +++ b/weed/server/volume_server.go @@ -20,9 +20,10 @@ type VolumeServer struct { guard *security.Guard grpcDialOption grpc.DialOption - needleMapKind storage.NeedleMapType - FixJpgOrientation bool - ReadRedirect bool + needleMapKind storage.NeedleMapType + FixJpgOrientation bool + ReadRedirect bool + compactionBytePerSecond int64 } func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string, @@ -33,20 +34,23 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string, dataCenter string, rack string, whiteList []string, fixJpgOrientation bool, - readRedirect bool) *VolumeServer { + readRedirect bool, + compactionMBPerSecond int, +) *VolumeServer { v := viper.GetViper() signingKey := v.GetString("jwt.signing.key") enableUiAccess := v.GetBool("access.ui") vs := &VolumeServer{ - pulseSeconds: pulseSeconds, - dataCenter: dataCenter, - rack: rack, - needleMapKind: needleMapKind, - FixJpgOrientation: fixJpgOrientation, - ReadRedirect: readRedirect, - grpcDialOption: security.LoadClientTLS(viper.Sub("grpc"), "volume"), + pulseSeconds: pulseSeconds, + dataCenter: dataCenter, + rack: rack, + needleMapKind: needleMapKind, + FixJpgOrientation: fixJpgOrientation, + ReadRedirect: readRedirect, + grpcDialOption: security.LoadClientTLS(viper.Sub("grpc"), "volume"), + compactionBytePerSecond: int64(compactionMBPerSecond) * 1024 * 1024, } vs.MasterNodes = masterNodes vs.store = storage.NewStore(port, ip, publicUrl, folders, maxCounts, vs.needleMapKind) |
