remove percent

This commit is contained in:
Konstantin Lebedev 2022-08-01 20:40:38 +05:00
parent 78cbd8002f
commit 5209ebbeef
4 changed files with 7 additions and 8 deletions

View file

@ -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 {

View file

@ -395,7 +395,7 @@ type VacuumVolumeCompactResponse struct {
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"`
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,

View file

@ -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 {

View file

@ -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