From 5209ebbeef3ccd040419f3c00444de0159a3856c Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Mon, 1 Aug 2022 20:40:38 +0500 Subject: [PATCH] remove percent --- weed/pb/volume_server.proto | 2 +- weed/pb/volume_server_pb/volume_server.pb.go | 8 ++++---- weed/server/volume_grpc_vacuum.go | 3 +-- weed/topology/topology_vacuum.go | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/weed/pb/volume_server.proto b/weed/pb/volume_server.proto index 28dabd083..393819dab 100644 --- a/weed/pb/volume_server.proto +++ b/weed/pb/volume_server.proto @@ -147,7 +147,7 @@ message VacuumVolumeCompactRequest { } message VacuumVolumeCompactResponse { int64 processed_bytes = 1; - uint32 percent_load_avg_1m = 2; + float percent_load_avg_1m = 2; } message VacuumVolumeCommitRequest { diff --git a/weed/pb/volume_server_pb/volume_server.pb.go b/weed/pb/volume_server_pb/volume_server.pb.go index 8489e87f9..031314166 100644 --- a/weed/pb/volume_server_pb/volume_server.pb.go +++ b/weed/pb/volume_server_pb/volume_server.pb.go @@ -394,8 +394,8 @@ type VacuumVolumeCompactResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ProcessedBytes int64 `protobuf:"varint,1,opt,name=processed_bytes,json=processedBytes,proto3" json:"processed_bytes,omitempty"` - PercentLoadAvg_1M uint32 `protobuf:"varint,2,opt,name=percent_load_avg_1m,json=percentLoadAvg1m,proto3" json:"percent_load_avg_1m,omitempty"` + ProcessedBytes int64 `protobuf:"varint,1,opt,name=processed_bytes,json=processedBytes,proto3" json:"processed_bytes,omitempty"` + PercentLoadAvg_1M float32 `protobuf:"fixed32,2,opt,name=percent_load_avg_1m,json=percentLoadAvg1m,proto3" json:"percent_load_avg_1m,omitempty"` } func (x *VacuumVolumeCompactResponse) Reset() { @@ -437,7 +437,7 @@ func (x *VacuumVolumeCompactResponse) GetProcessedBytes() int64 { return 0 } -func (x *VacuumVolumeCompactResponse) GetPercentLoadAvg_1M() uint32 { +func (x *VacuumVolumeCompactResponse) GetPercentLoadAvg_1M() float32 { if x != nil { return x.PercentLoadAvg_1M } @@ -5625,7 +5625,7 @@ var file_volume_server_proto_rawDesc = []byte{ 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x13, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, - 0x61, 0x64, 0x5f, 0x61, 0x76, 0x67, 0x5f, 0x31, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x61, 0x64, 0x5f, 0x61, 0x76, 0x67, 0x5f, 0x31, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x10, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x41, 0x76, 0x67, 0x31, 0x6d, 0x22, 0x38, 0x0a, 0x19, 0x56, 0x61, 0x63, 0x75, 0x75, 0x6d, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, diff --git a/weed/server/volume_grpc_vacuum.go b/weed/server/volume_grpc_vacuum.go index 40ff1eabd..7d9846808 100644 --- a/weed/server/volume_grpc_vacuum.go +++ b/weed/server/volume_grpc_vacuum.go @@ -7,7 +7,6 @@ import ( "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb" "github.com/seaweedfs/seaweedfs/weed/storage/needle" - "math" "runtime" ) @@ -41,7 +40,7 @@ func (vs *VolumeServer) VacuumVolumeCompact(req *volume_server_pb.VacuumVolumeCo resp.ProcessedBytes = processed if fsErr == nil && numCPU > 0 { if fsLa, err := fs.LoadAvg(); err == nil { - resp.PercentLoadAvg_1M = uint32(math.Round(fsLa.Load1 * 100 / float64(numCPU))) + resp.PercentLoadAvg_1M = float32(fsLa.Load1 / float64(numCPU)) } } if sendErr = stream.Send(resp); sendErr != nil { diff --git a/weed/topology/topology_vacuum.go b/weed/topology/topology_vacuum.go index ad466b208..5b5483f6d 100644 --- a/weed/topology/topology_vacuum.go +++ b/weed/topology/topology_vacuum.go @@ -89,7 +89,7 @@ func (t *Topology) batchVacuumVolumeCompact(grpcDialOption grpc.DialOption, vl * return recvErr } } - glog.V(0).Infof("%d vacuum %d on %s processed %d bytes, loadAvg %v%%", + glog.V(0).Infof("%d vacuum %d on %s processed %d bytes, loadAvg %.0f%%", index, vid, url, resp.ProcessedBytes, resp.PercentLoadAvg_1M) } return nil