aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-08 15:19:39 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-08 15:19:39 -0700
commit4370a4db634f2268526911842a804d9dee97aadc (patch)
tree006fb8f2cb92cadebc45c81d971b98a8f7ef729d
parent26c222f59684d438b13042398f69952b006dafe9 (diff)
downloadseaweedfs-4370a4db634f2268526911842a804d9dee97aadc.tar.xz
seaweedfs-4370a4db634f2268526911842a804d9dee97aadc.zip
use int64 for volume count in case of negative overflow
-rw-r--r--weed/pb/master.proto10
-rw-r--r--weed/pb/master_pb/master.pb.go30
-rw-r--r--weed/topology/disk.go20
3 files changed, 30 insertions, 30 deletions
diff --git a/weed/pb/master.proto b/weed/pb/master.proto
index cdb49d1e3..6ef27fb4d 100644
--- a/weed/pb/master.proto
+++ b/weed/pb/master.proto
@@ -215,13 +215,13 @@ message CollectionDeleteResponse {
//
message DiskInfo {
string type = 1;
- uint64 volume_count = 2;
- uint64 max_volume_count = 3;
- uint64 free_volume_count = 4;
- uint64 active_volume_count = 5;
+ int64 volume_count = 2;
+ int64 max_volume_count = 3;
+ int64 free_volume_count = 4;
+ int64 active_volume_count = 5;
repeated VolumeInformationMessage volume_infos = 6;
repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
- uint64 remote_volume_count = 8;
+ int64 remote_volume_count = 8;
}
message DataNodeInfo {
string id = 1;
diff --git a/weed/pb/master_pb/master.pb.go b/weed/pb/master_pb/master.pb.go
index 29d8499f8..75e165ed6 100644
--- a/weed/pb/master_pb/master.pb.go
+++ b/weed/pb/master_pb/master.pb.go
@@ -1628,13 +1628,13 @@ type DiskInfo struct {
unknownFields protoimpl.UnknownFields
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
- VolumeCount uint64 `protobuf:"varint,2,opt,name=volume_count,json=volumeCount,proto3" json:"volume_count,omitempty"`
- MaxVolumeCount uint64 `protobuf:"varint,3,opt,name=max_volume_count,json=maxVolumeCount,proto3" json:"max_volume_count,omitempty"`
- FreeVolumeCount uint64 `protobuf:"varint,4,opt,name=free_volume_count,json=freeVolumeCount,proto3" json:"free_volume_count,omitempty"`
- ActiveVolumeCount uint64 `protobuf:"varint,5,opt,name=active_volume_count,json=activeVolumeCount,proto3" json:"active_volume_count,omitempty"`
+ VolumeCount int64 `protobuf:"varint,2,opt,name=volume_count,json=volumeCount,proto3" json:"volume_count,omitempty"`
+ MaxVolumeCount int64 `protobuf:"varint,3,opt,name=max_volume_count,json=maxVolumeCount,proto3" json:"max_volume_count,omitempty"`
+ FreeVolumeCount int64 `protobuf:"varint,4,opt,name=free_volume_count,json=freeVolumeCount,proto3" json:"free_volume_count,omitempty"`
+ ActiveVolumeCount int64 `protobuf:"varint,5,opt,name=active_volume_count,json=activeVolumeCount,proto3" json:"active_volume_count,omitempty"`
VolumeInfos []*VolumeInformationMessage `protobuf:"bytes,6,rep,name=volume_infos,json=volumeInfos,proto3" json:"volume_infos,omitempty"`
EcShardInfos []*VolumeEcShardInformationMessage `protobuf:"bytes,7,rep,name=ec_shard_infos,json=ecShardInfos,proto3" json:"ec_shard_infos,omitempty"`
- RemoteVolumeCount uint64 `protobuf:"varint,8,opt,name=remote_volume_count,json=remoteVolumeCount,proto3" json:"remote_volume_count,omitempty"`
+ RemoteVolumeCount int64 `protobuf:"varint,8,opt,name=remote_volume_count,json=remoteVolumeCount,proto3" json:"remote_volume_count,omitempty"`
}
func (x *DiskInfo) Reset() {
@@ -1676,28 +1676,28 @@ func (x *DiskInfo) GetType() string {
return ""
}
-func (x *DiskInfo) GetVolumeCount() uint64 {
+func (x *DiskInfo) GetVolumeCount() int64 {
if x != nil {
return x.VolumeCount
}
return 0
}
-func (x *DiskInfo) GetMaxVolumeCount() uint64 {
+func (x *DiskInfo) GetMaxVolumeCount() int64 {
if x != nil {
return x.MaxVolumeCount
}
return 0
}
-func (x *DiskInfo) GetFreeVolumeCount() uint64 {
+func (x *DiskInfo) GetFreeVolumeCount() int64 {
if x != nil {
return x.FreeVolumeCount
}
return 0
}
-func (x *DiskInfo) GetActiveVolumeCount() uint64 {
+func (x *DiskInfo) GetActiveVolumeCount() int64 {
if x != nil {
return x.ActiveVolumeCount
}
@@ -1718,7 +1718,7 @@ func (x *DiskInfo) GetEcShardInfos() []*VolumeEcShardInformationMessage {
return nil
}
-func (x *DiskInfo) GetRemoteVolumeCount() uint64 {
+func (x *DiskInfo) GetRemoteVolumeCount() int64 {
if x != nil {
return x.RemoteVolumeCount
}
@@ -3134,15 +3134,15 @@ var file_master_proto_rawDesc = []byte{
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x91, 0x03, 0x0a, 0x08, 0x44, 0x69, 0x73,
0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x76, 0x6f, 0x6c,
- 0x75, 0x6d, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52,
+ 0x75, 0x6d, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0b, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x10,
0x6d, 0x61, 0x78, 0x5f, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74,
- 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x56, 0x6f, 0x6c, 0x75, 0x6d,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x56, 0x6f, 0x6c, 0x75, 0x6d,
0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x66, 0x72, 0x65, 0x65, 0x5f, 0x76,
0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
- 0x04, 0x52, 0x0f, 0x66, 0x72, 0x65, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x43, 0x6f, 0x75,
+ 0x03, 0x52, 0x0f, 0x66, 0x72, 0x65, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x76, 0x6f, 0x6c,
- 0x75, 0x6d, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52,
+ 0x75, 0x6d, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52,
0x11, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0c, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x66,
0x6f, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65,
@@ -3155,7 +3155,7 @@ var file_master_proto_rawDesc = []byte{
0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0c,
0x65, 0x63, 0x53, 0x68, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x12, 0x2e, 0x0a, 0x13,
0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x5f, 0x63, 0x6f,
- 0x75, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x74,
+ 0x75, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x74,
0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xb7, 0x01, 0x0a,
0x0c, 0x44, 0x61, 0x74, 0x61, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x44, 0x0a,
diff --git a/weed/topology/disk.go b/weed/topology/disk.go
index a085f8dff..4e7d18f08 100644
--- a/weed/topology/disk.go
+++ b/weed/topology/disk.go
@@ -62,11 +62,11 @@ func (d *DiskUsages) ToDiskInfo() map[string]*master_pb.DiskInfo {
ret := make(map[string]*master_pb.DiskInfo)
for diskType, diskUsageCounts := range d.usages {
m := &master_pb.DiskInfo{
- VolumeCount: uint64(diskUsageCounts.volumeCount),
- MaxVolumeCount: uint64(diskUsageCounts.maxVolumeCount),
- FreeVolumeCount: uint64(diskUsageCounts.maxVolumeCount - diskUsageCounts.volumeCount),
- ActiveVolumeCount: uint64(diskUsageCounts.activeVolumeCount),
- RemoteVolumeCount: uint64(diskUsageCounts.remoteVolumeCount),
+ VolumeCount: diskUsageCounts.volumeCount,
+ MaxVolumeCount: diskUsageCounts.maxVolumeCount,
+ FreeVolumeCount: diskUsageCounts.maxVolumeCount - diskUsageCounts.volumeCount,
+ ActiveVolumeCount: diskUsageCounts.activeVolumeCount,
+ RemoteVolumeCount: diskUsageCounts.remoteVolumeCount,
}
ret[string(diskType)] = m
}
@@ -241,11 +241,11 @@ func (d *Disk) ToDiskInfo() *master_pb.DiskInfo {
diskUsage := d.diskUsages.getOrCreateDisk(types.ToDiskType(string(d.Id())))
m := &master_pb.DiskInfo{
Type: string(d.Id()),
- VolumeCount: uint64(diskUsage.volumeCount),
- MaxVolumeCount: uint64(diskUsage.maxVolumeCount),
- FreeVolumeCount: uint64(diskUsage.maxVolumeCount - diskUsage.volumeCount),
- ActiveVolumeCount: uint64(diskUsage.activeVolumeCount),
- RemoteVolumeCount: uint64(diskUsage.remoteVolumeCount),
+ VolumeCount: diskUsage.volumeCount,
+ MaxVolumeCount: diskUsage.maxVolumeCount,
+ FreeVolumeCount: diskUsage.maxVolumeCount - diskUsage.volumeCount,
+ ActiveVolumeCount: diskUsage.activeVolumeCount,
+ RemoteVolumeCount: diskUsage.remoteVolumeCount,
}
for _, v := range d.GetVolumes() {
m.VolumeInfos = append(m.VolumeInfos, v.ToVolumeInformationMessage())