From c697fc85ddebfd1d2f0aec4fe8a28724dd3dc977 Mon Sep 17 00:00:00 2001 From: xiejian Date: Fri, 6 Sep 2024 17:33:52 +0800 Subject: [PATCH] fix(shardnode): fix raft related problems with #22357426 Signed-off-by: xiejian --- blobstore/api/shardnode/shardnode.pb.go | 374 +++++++++++---------- blobstore/api/shardnode/shardnode.proto | 15 +- blobstore/shardnode/base/mock_transport.go | 53 +++ blobstore/shardnode/base/transport.go | 17 + blobstore/shardnode/catalog/space_test.go | 3 +- blobstore/shardnode/mock/mock_shard.go | 8 +- blobstore/shardnode/rpcservice_test.go | 6 +- blobstore/shardnode/shard.go | 9 +- blobstore/shardnode/startup.go | 1 + blobstore/shardnode/storage/disk.go | 5 +- blobstore/shardnode/storage/disk_mock.go | 13 +- blobstore/shardnode/storage/raft_impl.go | 10 +- blobstore/shardnode/storage/shard.go | 36 +- blobstore/shardnode/storage/shard_test.go | 9 +- blobstore/shardnode/svr.go | 8 + blobstore/shardnode/svr_test.go | 4 +- build/build.sh | 10 +- 17 files changed, 360 insertions(+), 221 deletions(-) diff --git a/blobstore/api/shardnode/shardnode.pb.go b/blobstore/api/shardnode/shardnode.pb.go index a16e79048..d24a610d2 100644 --- a/blobstore/api/shardnode/shardnode.pb.go +++ b/blobstore/api/shardnode/shardnode.pb.go @@ -1823,13 +1823,14 @@ var xxx_messageInfo_SealBlobRet proto.InternalMessageInfo type ShardStats struct { Suid github_com_cubefs_cubefs_blobstore_common_proto.Suid `protobuf:"varint,1,opt,name=suid,proto3,casttype=github.com/cubefs/cubefs/blobstore/common/proto.Suid" json:"suid,omitempty"` AppliedIndex uint64 `protobuf:"varint,2,opt,name=applied_index,json=appliedIndex,proto3" json:"applied_index,omitempty"` - LeaderDiskID github_com_cubefs_cubefs_blobstore_common_proto.DiskID `protobuf:"varint,3,opt,name=leader_disk_id,json=leaderDiskId,proto3,casttype=github.com/cubefs/cubefs/blobstore/common/proto.DiskID" json:"leader_disk_id,omitempty"` - LeaderHost string `protobuf:"bytes,4,opt,name=leader_host,json=leaderHost,proto3" json:"leader_host,omitempty"` - RouteVersion github_com_cubefs_cubefs_blobstore_common_proto.RouteVersion `protobuf:"varint,5,opt,name=route_version,json=routeVersion,proto3,casttype=github.com/cubefs/cubefs/blobstore/common/proto.RouteVersion" json:"route_version,omitempty"` - Range sharding.Range `protobuf:"bytes,6,opt,name=range,proto3" json:"range"` - Units []clustermgr.ShardUnit `protobuf:"bytes,7,rep,name=units,proto3" json:"units"` - Learner bool `protobuf:"varint,8,opt,name=learner,proto3" json:"learner,omitempty"` - RaftStat raft.Stat `protobuf:"bytes,9,opt,name=raftStat,proto3" json:"raftStat"` + LeaderHost string `protobuf:"bytes,3,opt,name=leader_host,json=leaderHost,proto3" json:"leader_host,omitempty"` + LeaderDiskID github_com_cubefs_cubefs_blobstore_common_proto.DiskID `protobuf:"varint,4,opt,name=leader_disk_id,json=leaderDiskId,proto3,casttype=github.com/cubefs/cubefs/blobstore/common/proto.DiskID" json:"leader_disk_id,omitempty"` + LeaderSuid github_com_cubefs_cubefs_blobstore_common_proto.Suid `protobuf:"varint,5,opt,name=leader_suid,json=leaderSuid,proto3,casttype=github.com/cubefs/cubefs/blobstore/common/proto.Suid" json:"leader_suid,omitempty"` + Learner bool `protobuf:"varint,6,opt,name=learner,proto3" json:"learner,omitempty"` + RouteVersion github_com_cubefs_cubefs_blobstore_common_proto.RouteVersion `protobuf:"varint,7,opt,name=route_version,json=routeVersion,proto3,casttype=github.com/cubefs/cubefs/blobstore/common/proto.RouteVersion" json:"route_version,omitempty"` + Range sharding.Range `protobuf:"bytes,8,opt,name=range,proto3" json:"range"` + Units []clustermgr.ShardUnit `protobuf:"bytes,9,rep,name=units,proto3" json:"units"` + RaftStat raft.Stat `protobuf:"bytes,10,opt,name=raftStat,proto3" json:"raftStat"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1882,6 +1883,13 @@ func (m *ShardStats) GetAppliedIndex() uint64 { return 0 } +func (m *ShardStats) GetLeaderHost() string { + if m != nil { + return m.LeaderHost + } + return "" +} + func (m *ShardStats) GetLeaderDiskID() github_com_cubefs_cubefs_blobstore_common_proto.DiskID { if m != nil { return m.LeaderDiskID @@ -1889,11 +1897,18 @@ func (m *ShardStats) GetLeaderDiskID() github_com_cubefs_cubefs_blobstore_common return 0 } -func (m *ShardStats) GetLeaderHost() string { +func (m *ShardStats) GetLeaderSuid() github_com_cubefs_cubefs_blobstore_common_proto.Suid { if m != nil { - return m.LeaderHost + return m.LeaderSuid } - return "" + return 0 +} + +func (m *ShardStats) GetLearner() bool { + if m != nil { + return m.Learner + } + return false } func (m *ShardStats) GetRouteVersion() github_com_cubefs_cubefs_blobstore_common_proto.RouteVersion { @@ -1917,13 +1932,6 @@ func (m *ShardStats) GetUnits() []clustermgr.ShardUnit { return nil } -func (m *ShardStats) GetLearner() bool { - if m != nil { - return m.Learner - } - return false -} - func (m *ShardStats) GetRaftStat() raft.Stat { if m != nil { return m.RaftStat @@ -2171,91 +2179,92 @@ func init() { func init() { proto.RegisterFile("shardnode.proto", fileDescriptor_9d3815ca0e5f30f0) } var fileDescriptor_9d3815ca0e5f30f0 = []byte{ - // 1334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0x66, 0xed, 0xb5, 0x93, 0x1c, 0xaf, 0x13, 0xb4, 0xaa, 0x8a, 0x15, 0x89, 0x6c, 0xb4, 0x05, - 0x35, 0xe2, 0xc7, 0x96, 0x52, 0x04, 0x17, 0x05, 0xda, 0x3a, 0x56, 0x5b, 0x37, 0x29, 0x88, 0x75, - 0x1b, 0x09, 0x04, 0x8a, 0x36, 0x9e, 0xb1, 0x33, 0x64, 0xbd, 0x6b, 0x76, 0x66, 0xab, 0xa6, 0x57, - 0x48, 0x20, 0x71, 0x85, 0x78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0, 0x3c, 0x7d, 0x92, 0x1c, 0xd9, 0x8d, 0x92, 0x50, 0xe8, 0xe6, 0x56, 0x07, - 0x37, 0x82, 0x4a, 0x06, 0x51, 0x3e, 0xf9, 0x3a, 0x94, 0x24, 0x74, 0x5e, 0x33, 0x90, 0xe8, 0xa7, - 0x79, 0xb3, 0x52, 0xb4, 0x57, 0x00, 0x42, 0xfa, 0x50, 0xdc, 0x55, 0x10, 0x14, 0xb4, 0x89, 0x1b, - 0xf7, 0xf7, 0x22, 0x58, 0x37, 0x08, 0xc1, 0x97, 0x61, 0x50, 0x26, 0x08, 0xd3, 0x38, 0x43, 0xc2, - 0x2c, 0x28, 0xb6, 0x3a, 0x25, 0xc2, 0xdc, 0x80, 0x12, 0x0e, 0x70, 0x8c, 0x71, 0x65, 0xfd, 0xf2, - 0xd3, 0x71, 0x52, 0x9a, 0xf5, 0x6c, 0xde, 0xd7, 0x3d, 0x29, 0x9e, 0x85, 0x0a, 0x75, 0xed, 0x9b, - 0x50, 0x4a, 0x42, 0x26, 0x78, 0xcd, 0xc4, 0x60, 0xbf, 0xf3, 0xec, 0x60, 0x8f, 0xd7, 0x00, 0x55, - 0x0e, 0xf7, 0x43, 0x26, 0x32, 0x3b, 0xa8, 0x3e, 0x23, 0x66, 0x76, 0xab, 0x50, 0xc9, 0x12, 0x27, - 0xfb, 0xf3, 0x97, 0x22, 0x2c, 0x29, 0xe6, 0x38, 0xe7, 0xb9, 0xfc, 0xde, 0x80, 0x25, 0x15, 0x59, - 0x7c, 0xcd, 0xbd, 0x83, 0x21, 0xd5, 0xe3, 0x75, 0x7b, 0x94, 0x3a, 0x47, 0xff, 0x75, 0x98, 0x3a, - 0xd7, 0xa6, 0x76, 0xf6, 0xa4, 0x09, 0xef, 0xa8, 0x4d, 0xbb, 0x05, 0xa6, 0x4c, 0x25, 0xb6, 0xe6, - 0x49, 0x0a, 0x01, 0xb5, 0xdd, 0xd7, 0xb3, 0x49, 0x93, 0xe7, 0xe8, 0x8f, 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, 0x62, 0x56, 0xbf, 0x16, 0xe4, 0x7b, 0x78, 0xf9, - 0x34, 0xf6, 0xf0, 0xb9, 0x57, 0xdb, 0xc3, 0x6b, 0x30, 0x17, 0x50, 0x3f, 0x0e, 0x69, 0x5c, 0x9b, - 0x5f, 0x35, 0xd6, 0xe6, 0xbd, 0xec, 0x68, 0xb7, 0x60, 0x3e, 0xf6, 0x7b, 0x42, 0x16, 0x4a, 0x6d, - 0x01, 0x91, 0xba, 0xc7, 0x22, 0xc5, 0xdf, 0xe5, 0xa4, 0xa4, 0x36, 0x9e, 0x6b, 0xba, 0x07, 0xb0, - 0x28, 0x49, 0x69, 0x3b, 0x0a, 0x92, 0x01, 0xc5, 0x36, 0x98, 0x9c, 0x79, 0xc6, 0x19, 0xce, 0x3c, - 0x97, 0x40, 0x75, 0xec, 0x5a, 0x32, 0x62, 0x07, 0xcc, 0x07, 0x8c, 0x28, 0x42, 0xac, 0x36, 0xaf, - 0xc9, 0x6a, 0xdf, 0x66, 0x84, 0x1f, 0xa6, 0xce, 0x95, 0x69, 0xd3, 0xbb, 0x2d, 0x8b, 0x5d, 0x1a, - 0x73, 0x7f, 0x34, 0x94, 0x9b, 0x99, 0x2d, 0x56, 0x39, 0xf9, 0x17, 0x26, 0xc9, 0xff, 0x6b, 0x35, - 0x9f, 0xf2, 0xcd, 0x68, 0x0b, 0xca, 0x58, 0x3e, 0x19, 0xfd, 0x9f, 0x6c, 0x35, 0xd2, 0x36, 0x9a, - 0xcb, 0x8f, 0x47, 0x2b, 0xc6, 0x5f, 0xa3, 0x15, 0xe3, 0x9f, 0xd1, 0x8a, 0xf1, 0x95, 0x55, 0x6f, - 0x5c, 0xcd, 0x59, 0x6a, 0xb7, 0x8c, 0x28, 0xaf, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xa9, - 0x14, 0xa2, 0x86, 0x16, 0x00, 0x00, + // 1357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x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, + 0x36, 0x88, 0xbb, 0xb2, 0xaa, 0xa4, 0x30, 0xf7, 0x47, 0x43, 0xa9, 0x99, 0xdb, 0x06, 0x97, 0x4d, + 0x99, 0xdc, 0xe4, 0x94, 0xf9, 0x5a, 0x0d, 0xc2, 0x6c, 0x05, 0xdb, 0x81, 0x22, 0x26, 0x49, 0x3a, + 0x67, 0x4e, 0xb6, 0x83, 0x69, 0x19, 0xf5, 0xd5, 0xc7, 0xa3, 0x35, 0xe3, 0xaf, 0xd1, 0x9a, 0xf1, + 0xef, 0x68, 0xcd, 0xf8, 0xca, 0xaa, 0xd6, 0xae, 0x66, 0xed, 0x70, 0xaf, 0x88, 0x28, 0xaf, 0xfc, + 0x17, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x7b, 0xe2, 0xa0, 0xef, 0x16, 0x00, 0x00, } func (m *Item) Marshal() (dAtA []byte, err error) { @@ -3662,17 +3671,7 @@ func (m *ShardStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintShardnode(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a - if m.Learner { - i-- - if m.Learner { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } + dAtA[i] = 0x52 if len(m.Units) > 0 { for iNdEx := len(m.Units) - 1; iNdEx >= 0; iNdEx-- { { @@ -3684,7 +3683,7 @@ func (m *ShardStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintShardnode(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x4a } } { @@ -3696,23 +3695,38 @@ func (m *ShardStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintShardnode(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x42 if m.RouteVersion != 0 { i = encodeVarintShardnode(dAtA, i, uint64(m.RouteVersion)) i-- + dAtA[i] = 0x38 + } + if m.Learner { + i-- + if m.Learner { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.LeaderSuid != 0 { + i = encodeVarintShardnode(dAtA, i, uint64(m.LeaderSuid)) + i-- dAtA[i] = 0x28 } + if m.LeaderDiskID != 0 { + i = encodeVarintShardnode(dAtA, i, uint64(m.LeaderDiskID)) + i-- + dAtA[i] = 0x20 + } if len(m.LeaderHost) > 0 { i -= len(m.LeaderHost) copy(dAtA[i:], m.LeaderHost) i = encodeVarintShardnode(dAtA, i, uint64(len(m.LeaderHost))) i-- - dAtA[i] = 0x22 - } - if m.LeaderDiskID != 0 { - i = encodeVarintShardnode(dAtA, i, uint64(m.LeaderDiskID)) - i-- - dAtA[i] = 0x18 + dAtA[i] = 0x1a } if m.AppliedIndex != 0 { i = encodeVarintShardnode(dAtA, i, uint64(m.AppliedIndex)) @@ -4501,13 +4515,19 @@ func (m *ShardStats) Size() (n int) { if m.AppliedIndex != 0 { n += 1 + sovShardnode(uint64(m.AppliedIndex)) } - if m.LeaderDiskID != 0 { - n += 1 + sovShardnode(uint64(m.LeaderDiskID)) - } l = len(m.LeaderHost) if l > 0 { n += 1 + l + sovShardnode(uint64(l)) } + if m.LeaderDiskID != 0 { + n += 1 + sovShardnode(uint64(m.LeaderDiskID)) + } + if m.LeaderSuid != 0 { + n += 1 + sovShardnode(uint64(m.LeaderSuid)) + } + if m.Learner { + n += 2 + } if m.RouteVersion != 0 { n += 1 + sovShardnode(uint64(m.RouteVersion)) } @@ -4519,9 +4539,6 @@ func (m *ShardStats) Size() (n int) { n += 1 + l + sovShardnode(uint64(l)) } } - if m.Learner { - n += 2 - } l = m.RaftStat.Size() n += 1 + l + sovShardnode(uint64(l)) if m.XXX_unrecognized != nil { @@ -8118,25 +8135,6 @@ func (m *ShardStats) Unmarshal(dAtA []byte) error { } } case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LeaderDiskID", wireType) - } - m.LeaderDiskID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShardnode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LeaderDiskID |= github_com_cubefs_cubefs_blobstore_common_proto.DiskID(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LeaderHost", wireType) } @@ -8168,7 +8166,65 @@ func (m *ShardStats) Unmarshal(dAtA []byte) error { } m.LeaderHost = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LeaderDiskID", wireType) + } + m.LeaderDiskID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShardnode + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LeaderDiskID |= github_com_cubefs_cubefs_blobstore_common_proto.DiskID(b&0x7F) << shift + if b < 0x80 { + break + } + } case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LeaderSuid", wireType) + } + m.LeaderSuid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShardnode + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LeaderSuid |= github_com_cubefs_cubefs_blobstore_common_proto.Suid(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Learner", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowShardnode + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Learner = bool(v != 0) + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RouteVersion", wireType) } @@ -8187,7 +8243,7 @@ func (m *ShardStats) Unmarshal(dAtA []byte) error { break } } - case 6: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) } @@ -8220,7 +8276,7 @@ func (m *ShardStats) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Units", wireType) } @@ -8254,27 +8310,7 @@ func (m *ShardStats) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Learner", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowShardnode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Learner = bool(v != 0) - case 9: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RaftStat", wireType) } diff --git a/blobstore/api/shardnode/shardnode.proto b/blobstore/api/shardnode/shardnode.proto index 97474d66a..9a4095c7f 100644 --- a/blobstore/api/shardnode/shardnode.proto +++ b/blobstore/api/shardnode/shardnode.proto @@ -184,13 +184,14 @@ message SealBlobRet {} message ShardStats { uint64 suid = 1 [(gogoproto.customname) = "Suid", (gogoproto.casttype) = "github.com/cubefs/cubefs/blobstore/common/proto.Suid"]; uint64 applied_index = 2; - uint32 leader_disk_id = 3 [(gogoproto.customname) = "LeaderDiskID", (gogoproto.casttype) = "github.com/cubefs/cubefs/blobstore/common/proto.DiskID"]; - string leader_host = 4; - uint64 route_version = 5 [(gogoproto.casttype) = "github.com/cubefs/cubefs/blobstore/common/proto.RouteVersion"]; - cubefs.blobstore.common.sharding.Range range = 6 [(gogoproto.nullable) = false]; - repeated cubefs.blobstore.api.clustermgr.ShardUnit units = 7 [(gogoproto.nullable) = false]; - bool learner = 8; - cubefs.blobstore.common.raft.Stat raftStat = 9 [(gogoproto.nullable) = false]; + string leader_host = 3; + uint32 leader_disk_id = 4 [(gogoproto.customname) = "LeaderDiskID", (gogoproto.casttype) = "github.com/cubefs/cubefs/blobstore/common/proto.DiskID"]; + uint64 leader_suid = 5 [(gogoproto.customname) = "LeaderSuid", (gogoproto.casttype) = "github.com/cubefs/cubefs/blobstore/common/proto.Suid"]; + bool learner = 6; + uint64 route_version = 7 [(gogoproto.casttype) = "github.com/cubefs/cubefs/blobstore/common/proto.RouteVersion"]; + cubefs.blobstore.common.sharding.Range range = 8 [(gogoproto.nullable) = false]; + repeated cubefs.blobstore.api.clustermgr.ShardUnit units = 9 [(gogoproto.nullable) = false]; + cubefs.blobstore.common.raft.Stat raftStat = 10 [(gogoproto.nullable) = false]; } message ListVolumeArgs { diff --git a/blobstore/shardnode/base/mock_transport.go b/blobstore/shardnode/base/mock_transport.go index 2b8ff260c..a38cfe03c 100644 --- a/blobstore/shardnode/base/mock_transport.go +++ b/blobstore/shardnode/base/mock_transport.go @@ -258,6 +258,21 @@ func (mr *MockTransportMockRecorder) RegisterDisk(ctx, disk interface{}) *gomock return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterDisk", reflect.TypeOf((*MockTransport)(nil).RegisterDisk), ctx, disk) } +// ResolveAddr mocks base method. +func (m *MockTransport) ResolveAddr(ctx context.Context, diskID proto.DiskID) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResolveAddr", ctx, diskID) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResolveAddr indicates an expected call of ResolveAddr. +func (mr *MockTransportMockRecorder) ResolveAddr(ctx, diskID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResolveAddr", reflect.TypeOf((*MockTransport)(nil).ResolveAddr), ctx, diskID) +} + // RetainVolume mocks base method. func (m *MockTransport) RetainVolume(ctx context.Context, tokens []string) (clustermgr.RetainVolumes, error) { m.ctrl.T.Helper() @@ -589,3 +604,41 @@ func (mr *MockAllocVolTransportMockRecorder) RetainVolume(ctx, tokens interface{ mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RetainVolume", reflect.TypeOf((*MockAllocVolTransport)(nil).RetainVolume), ctx, tokens) } + +// MockShardTransport is a mock of ShardTransport interface. +type MockShardTransport struct { + ctrl *gomock.Controller + recorder *MockShardTransportMockRecorder +} + +// MockShardTransportMockRecorder is the mock recorder for MockShardTransport. +type MockShardTransportMockRecorder struct { + mock *MockShardTransport +} + +// NewMockShardTransport creates a new mock instance. +func NewMockShardTransport(ctrl *gomock.Controller) *MockShardTransport { + mock := &MockShardTransport{ctrl: ctrl} + mock.recorder = &MockShardTransportMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockShardTransport) EXPECT() *MockShardTransportMockRecorder { + return m.recorder +} + +// ResolveAddr mocks base method. +func (m *MockShardTransport) ResolveAddr(ctx context.Context, diskID proto.DiskID) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResolveAddr", ctx, diskID) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResolveAddr indicates an expected call of ResolveAddr. +func (mr *MockShardTransportMockRecorder) ResolveAddr(ctx, diskID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResolveAddr", reflect.TypeOf((*MockShardTransport)(nil).ResolveAddr), ctx, diskID) +} diff --git a/blobstore/shardnode/base/transport.go b/blobstore/shardnode/base/transport.go index 51312e9ff..38b1ee0af 100644 --- a/blobstore/shardnode/base/transport.go +++ b/blobstore/shardnode/base/transport.go @@ -34,6 +34,7 @@ type ( NodeTransport SpaceTransport AllocVolTransport + ShardTransport } NodeTransport interface { @@ -60,6 +61,10 @@ type ( AllocVolume(ctx context.Context, isInit bool, mode codemode.CodeMode, count int) (clustermgr.AllocatedVolumeInfos, error) RetainVolume(ctx context.Context, tokens []string) (clustermgr.RetainVolumes, error) } + + ShardTransport interface { + ResolveAddr(ctx context.Context, diskID proto.DiskID) (string, error) + } ) func NewTransport(cmClient *clustermgr.Client, myself *clustermgr.ShardNodeInfo) Transport { @@ -259,3 +264,15 @@ func (t *transport) AllocVolume(ctx context.Context, isInit bool, mode codemode. func (t *transport) RetainVolume(ctx context.Context, tokens []string) (clustermgr.RetainVolumes, error) { return t.cmClient.RetainVolume(ctx, &clustermgr.RetainVolumeArgs{Tokens: tokens}) } + +func (t *transport) ResolveAddr(ctx context.Context, diskID proto.DiskID) (string, error) { + disk, err := t.GetDisk(ctx, diskID) + if err != nil { + return "", err + } + node, err := t.GetNode(ctx, disk.NodeID) + if err != nil { + return "", err + } + return node.RaftHost, nil +} diff --git a/blobstore/shardnode/catalog/space_test.go b/blobstore/shardnode/catalog/space_test.go index 10ab51751..e682f4f2b 100644 --- a/blobstore/shardnode/catalog/space_test.go +++ b/blobstore/shardnode/catalog/space_test.go @@ -21,8 +21,6 @@ import ( "testing" "time" - "github.com/cubefs/cubefs/blobstore/shardnode/mock" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -33,6 +31,7 @@ import ( "github.com/cubefs/cubefs/blobstore/common/proto" "github.com/cubefs/cubefs/blobstore/common/rpc2" "github.com/cubefs/cubefs/blobstore/shardnode/catalog/allocator" + "github.com/cubefs/cubefs/blobstore/shardnode/mock" proto2 "github.com/cubefs/cubefs/blobstore/shardnode/proto" "github.com/cubefs/cubefs/blobstore/shardnode/storage" "github.com/cubefs/cubefs/blobstore/util/errors" diff --git a/blobstore/shardnode/mock/mock_shard.go b/blobstore/shardnode/mock/mock_shard.go index dd7477eda..23f27597e 100644 --- a/blobstore/shardnode/mock/mock_shard.go +++ b/blobstore/shardnode/mock/mock_shard.go @@ -396,18 +396,18 @@ func (mr *MockSpaceShardHandlerMockRecorder) ListItem(ctx, h, prefix, id, count } // Stats mocks base method. -func (m *MockSpaceShardHandler) Stats() (shardnode.ShardStats, error) { +func (m *MockSpaceShardHandler) Stats(ctx context.Context) (shardnode.ShardStats, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Stats") + ret := m.ctrl.Call(m, "Stats", ctx) ret0, _ := ret[0].(shardnode.ShardStats) ret1, _ := ret[1].(error) return ret0, ret1 } // Stats indicates an expected call of Stats. -func (mr *MockSpaceShardHandlerMockRecorder) Stats() *gomock.Call { +func (mr *MockSpaceShardHandlerMockRecorder) Stats(ctx interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stats", reflect.TypeOf((*MockSpaceShardHandler)(nil).Stats)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stats", reflect.TypeOf((*MockSpaceShardHandler)(nil).Stats), ctx) } // TransferLeader mocks base method. diff --git a/blobstore/shardnode/rpcservice_test.go b/blobstore/shardnode/rpcservice_test.go index 6c5f06703..6e0bd9d55 100644 --- a/blobstore/shardnode/rpcservice_test.go +++ b/blobstore/shardnode/rpcservice_test.go @@ -18,10 +18,6 @@ import ( "context" "testing" - "github.com/cubefs/cubefs/blobstore/shardnode/mock" - - "github.com/cubefs/cubefs/blobstore/util/taskpool" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -35,8 +31,10 @@ import ( "github.com/cubefs/cubefs/blobstore/shardnode/base" "github.com/cubefs/cubefs/blobstore/shardnode/catalog" "github.com/cubefs/cubefs/blobstore/shardnode/catalog/allocator" + "github.com/cubefs/cubefs/blobstore/shardnode/mock" snproto "github.com/cubefs/cubefs/blobstore/shardnode/proto" "github.com/cubefs/cubefs/blobstore/shardnode/storage" + "github.com/cubefs/cubefs/blobstore/util/taskpool" ) var ( diff --git a/blobstore/shardnode/shard.go b/blobstore/shardnode/shard.go index 273993f2b..1a9fb8d33 100644 --- a/blobstore/shardnode/shard.go +++ b/blobstore/shardnode/shard.go @@ -65,7 +65,7 @@ func (s *service) getShardUintInfo(ctx context.Context, diskID proto.DiskID, sui return } - shardStat, err := shard.Stats() + shardStat, err := shard.Stats(ctx) if err != nil { return } @@ -86,7 +86,7 @@ func (s *service) getShardStats(ctx context.Context, diskID proto.DiskID, suid p return } - shardStat, err := shard.Stats() + shardStat, err := shard.Stats(ctx) if err != nil { return } @@ -109,7 +109,7 @@ func (s *service) listShards(ctx context.Context, diskID proto.DiskID, count uin if count == 0 { return false } - stats, err := shard.Stats() + stats, err := shard.Stats(ctx) if err != nil { span.Errorf("get shard stats failed, err:%s", err.Error()) return false @@ -180,7 +180,7 @@ func (s *service) loop(ctx context.Context) { disks := s.getAllDisks() for _, disk := range disks { disk.RangeShard(func(shard storage.ShardHandler) bool { - stats, err := shard.Stats() + stats, err := shard.Stats(ctx) if err != nil { span.Errorf("get shard stat err: %s", err) return false @@ -192,7 +192,6 @@ func (s *service) loop(ctx context.Context) { LeaderDiskID: stats.LeaderDiskID, Range: stats.Range, RouteVersion: stats.RouteVersion, - Learner: stats.Learner, }) return true }) diff --git a/blobstore/shardnode/startup.go b/blobstore/shardnode/startup.go index 0adb46f9d..fff6a72d5 100644 --- a/blobstore/shardnode/startup.go +++ b/blobstore/shardnode/startup.go @@ -338,6 +338,7 @@ func initServiceConfig(cfg *Config) { log.Panicf("invalid node[%+v] config port", cfg) } + cfg.RaftConfig.TransportConfig.Addr = cfg.NodeConfig.RaftHost cfg.StoreConfig.KVOption.CreateIfMissing = true cfg.StoreConfig.RaftOption.CreateIfMissing = true diff --git a/blobstore/shardnode/storage/disk.go b/blobstore/shardnode/storage/disk.go index e6e364800..c40d13a1d 100644 --- a/blobstore/shardnode/storage/disk.go +++ b/blobstore/shardnode/storage/disk.go @@ -192,7 +192,6 @@ func (d *Disk) Load(ctx context.Context) error { raftConfig.NodeID = uint64(d.diskInfo.DiskID) raftConfig.Storage = &raftStorage{kvStore: d.store.RaftStore()} raftConfig.Logger = log.DefaultLogger - raftConfig.Resolver = &addressResolver{t: d.cfg.Transport} raftManager, err := raft.NewManager(raftConfig) if err != nil { return err @@ -229,7 +228,8 @@ func (d *Disk) Load(ctx context.Context) error { shardInfo: *shardInfo, store: d.store, raftManager: d.raftManager, - addrResolver: raftConfig.Resolver.(*addressResolver), + addrResolver: raftConfig.Resolver.(*AddressResolver), + disk: d, }) if err != nil { return errors.Info(err, "new shard failed") @@ -265,6 +265,7 @@ func (d *Disk) AddShard(ctx context.Context, suid proto.Suid, shardUnits := make([]clustermgr.ShardUnit, len(nodes)) for i := range nodes { shardUnits[i] = clustermgr.ShardUnit{ + Suid: nodes[i].Suid, DiskID: nodes[i].DiskID, Learner: nodes[i].Learner, } diff --git a/blobstore/shardnode/storage/disk_mock.go b/blobstore/shardnode/storage/disk_mock.go index e78eefbc2..9dd2cba62 100644 --- a/blobstore/shardnode/storage/disk_mock.go +++ b/blobstore/shardnode/storage/disk_mock.go @@ -24,14 +24,13 @@ import ( "testing" "time" - "github.com/cubefs/cubefs/blobstore/common/proto" - - "github.com/cubefs/cubefs/blobstore/common/trace" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" "github.com/cubefs/cubefs/blobstore/api/clustermgr" + "github.com/cubefs/cubefs/blobstore/common/proto" + "github.com/cubefs/cubefs/blobstore/common/trace" "github.com/cubefs/cubefs/blobstore/shardnode/base" - "github.com/stretchr/testify/require" ) var ( @@ -68,6 +67,12 @@ func NewMockDisk(tb testing.TB) (*MockDisk, func()) { }, nil).AnyTimes() tp.EXPECT().GetDisk(A, A).Return(&clustermgr.ShardNodeDiskInfo{}, nil).AnyTimes() + cfg.RaftConfig.Resolver = &AddressResolver{Transport: tp} + + shardTp := base.NewMockShardTransport(C(tb)) + shardTp.EXPECT().ResolveAddr(A, A).Return("", nil).AnyTimes() + cfg.ShardBaseConfig.Transport = shardTp + disk, err := OpenDisk(ctx, cfg) require.NoError(tb, err) diff --git a/blobstore/shardnode/storage/raft_impl.go b/blobstore/shardnode/storage/raft_impl.go index 756466764..3fc3c975a 100644 --- a/blobstore/shardnode/storage/raft_impl.go +++ b/blobstore/shardnode/storage/raft_impl.go @@ -161,16 +161,16 @@ func (t raftBatch) From(data []byte) { t.batch.From(data) } func (t raftBatch) Close() { t.batch.Close() } -type addressResolver struct { - t base.Transport +type AddressResolver struct { + base.Transport } -func (a *addressResolver) Resolve(ctx context.Context, diskID uint64) (raft.Addr, error) { - disk, err := a.t.GetDisk(ctx, proto.DiskID(diskID)) +func (a *AddressResolver) Resolve(ctx context.Context, diskID uint64) (raft.Addr, error) { + disk, err := a.GetDisk(ctx, proto.DiskID(diskID)) if err != nil { return nil, err } - node, err := a.t.GetNode(ctx, disk.NodeID) + node, err := a.GetNode(ctx, disk.NodeID) if err != nil { return nil, err } diff --git a/blobstore/shardnode/storage/shard.go b/blobstore/shardnode/storage/shard.go index f8cf7f1cb..7533e2192 100644 --- a/blobstore/shardnode/storage/shard.go +++ b/blobstore/shardnode/storage/shard.go @@ -27,6 +27,7 @@ import ( "github.com/cubefs/cubefs/blobstore/common/raft" "github.com/cubefs/cubefs/blobstore/common/sharding" "github.com/cubefs/cubefs/blobstore/common/trace" + "github.com/cubefs/cubefs/blobstore/shardnode/base" shardnodeproto "github.com/cubefs/cubefs/blobstore/shardnode/proto" "github.com/cubefs/cubefs/blobstore/shardnode/storage/store" "github.com/cubefs/cubefs/blobstore/util/errors" @@ -65,7 +66,7 @@ type ( GetRouteVersion() proto.RouteVersion TransferLeader(ctx context.Context, diskID proto.DiskID) error Checkpoint(ctx context.Context) error - Stats() (shardnode.ShardStats, error) + Stats(ctx context.Context) (shardnode.ShardStats, error) } OpHeader struct { @@ -76,6 +77,7 @@ type ( ShardBaseConfig struct { RaftSnapTransmitConfig RaftSnapshotTransmitConfig `json:"raft_snap_transmit_config"` TruncateWalLogInterval uint64 `json:"truncate_wal_log_interval"` + Transport base.ShardTransport } shardConfig struct { @@ -199,9 +201,6 @@ func (s *shard) UpdateItem(ctx context.Context, h OpHeader, i shardnode.Item) er } func (s *shard) GetItem(ctx context.Context, h OpHeader, id []byte) (protoItem shardnode.Item, err error) { - if err = s.checkShardOptHeader(h); err != nil { - return - } vg, err := s.Get(ctx, h, id) if err != nil { return @@ -241,6 +240,9 @@ func (s *shard) GetItems(ctx context.Context, h OpHeader, keys [][]byte) (ret [] err = item.Unmarshal(vgs[i].Value()) vgs[i].Close() if err != nil { + for j := i + 1; j < len(vgs); j++ { + vgs[j].Close() + } return } ret[i] = shardnode.Item{ @@ -420,7 +422,7 @@ func (s *shard) UpdateShardRouteVersion(version proto.RouteVersion) { s.shardInfoMu.Unlock() } -func (s *shard) Stats() (shardnode.ShardStats, error) { +func (s *shard) Stats(ctx context.Context) (shardnode.ShardStats, error) { if err := s.shardState.prepRWCheck(); err != nil { return shardnode.ShardStats{}, err } @@ -430,32 +432,40 @@ func (s *shard) Stats() (shardnode.ShardStats, error) { units := s.shardInfoMu.Units routeVersion := s.shardInfoMu.RouteVersion leaderDiskID := s.shardInfoMu.leader + leaderSuid := proto.Suid(0) appliedIndex := s.shardInfoMu.AppliedIndex rg := s.shardInfoMu.Range - learner := !(s.shardInfoMu.leader == s.diskID) + learner := false + for i := range units { + if units[i].DiskID == leaderDiskID { + leaderSuid = units[i].GetSuid() + } + if units[i].DiskID == s.diskID { + learner = units[i].Learner + } + } s.shardInfoMu.RUnlock() raftStat, err := s.raftGroup.Stat() if err != nil { return shardnode.ShardStats{}, err } - var leaderHost string - for _, pr := range raftStat.Peers { - if pr.IsLearner { - leaderHost = pr.Host - break - } + + leaderHost, err := s.cfg.Transport.ResolveAddr(ctx, leaderDiskID) + if err != nil { + return shardnode.ShardStats{}, err } return shardnode.ShardStats{ Suid: s.suid, AppliedIndex: appliedIndex, LeaderDiskID: leaderDiskID, + LeaderSuid: leaderSuid, LeaderHost: leaderHost, + Learner: learner, RouteVersion: routeVersion, Range: rg, Units: units, - Learner: learner, RaftStat: *raftStat, }, nil } diff --git a/blobstore/shardnode/storage/shard_test.go b/blobstore/shardnode/storage/shard_test.go index d650a7f29..a6a905954 100644 --- a/blobstore/shardnode/storage/shard_test.go +++ b/blobstore/shardnode/storage/shard_test.go @@ -15,6 +15,7 @@ package storage import ( + "context" "fmt" "io" "math/rand" @@ -33,6 +34,7 @@ import ( "github.com/cubefs/cubefs/blobstore/common/raft" "github.com/cubefs/cubefs/blobstore/common/rpc2" "github.com/cubefs/cubefs/blobstore/common/sharding" + "github.com/cubefs/cubefs/blobstore/shardnode/base" "github.com/cubefs/cubefs/blobstore/shardnode/storage/store" ) @@ -66,6 +68,10 @@ func newMockShard(tb testing.TB) (*mockShard, func()) { }, }) require.Nil(tb, err) + + mockShardTp := base.NewMockShardTransport(C(tb)) + mockShardTp.EXPECT().ResolveAddr(A, A).Return("", nil).AnyTimes() + shardID := proto.Suid(1) shard := &shard{ suid: shardID, @@ -78,6 +84,7 @@ func newMockShard(tb testing.TB) (*mockShard, func()) { BatchInflightNum: 64, BatchInflightSize: 1 << 20, }, + Transport: mockShardTp, }, shardInfoMu: struct { sync.RWMutex @@ -189,7 +196,7 @@ func TestServerShard_Stats(t *testing.T) { mockShard.mockRaftGroup.EXPECT().Stat().Return(&raft.Stat{}, nil) - _, err := mockShard.shard.Stats() + _, err := mockShard.shard.Stats(context.Background()) require.Nil(t, err) index := mockShard.shard.GetAppliedIndex() diff --git a/blobstore/shardnode/svr.go b/blobstore/shardnode/svr.go index 9029e59dc..496ce12ec 100644 --- a/blobstore/shardnode/svr.go +++ b/blobstore/shardnode/svr.go @@ -69,6 +69,14 @@ func newService(cfg *Config) *service { initServiceConfig(cfg) cmClient := cmapi.New(&cfg.CmConfig) transport := base.NewTransport(cmClient, &cfg.NodeConfig) + shardTransport := base.NewTransport(cmClient, &cfg.NodeConfig) + cfg.ShardBaseConfig.Transport = shardTransport + + // set raft config + resolver := &storage.AddressResolver{Transport: transport} + cfg.RaftConfig.Resolver = resolver + cfg.RaftConfig.TransportConfig.Resolver = resolver + cfg.RaftConfig.Transport = raft.NewTransport(&cfg.RaftConfig.TransportConfig) // register node if err := transport.Register(ctx); err != nil { diff --git a/blobstore/shardnode/svr_test.go b/blobstore/shardnode/svr_test.go index 41d5db14e..e96b1793c 100644 --- a/blobstore/shardnode/svr_test.go +++ b/blobstore/shardnode/svr_test.go @@ -71,11 +71,9 @@ func TestSvr(t *testing.T) { CmConfig: cc, } diskPath1 := tempPath("disk1") - diskPath2 := tempPath("disk2") - disks := []string{diskPath1, diskPath2} + disks := []string{diskPath1} defer func() { os.RemoveAll(diskPath1) - os.RemoveAll(diskPath2) }() cfg.DisksConfig.Disks = disks cfg.AllocVolConfig.BidAllocNums = 1000 diff --git a/build/build.sh b/build/build.sh index a8a412d6a..ba7331128 100755 --- a/build/build.sh +++ b/build/build.sh @@ -315,14 +315,20 @@ build_blobstore_cli() { popd >/dev/null } +build_shardnode() { + pushd $SrcPath/blobstore/cmd/shardnode >/dev/null + CGO_ENABLED=1 go build ${MODFLAGS} -gcflags=all=-trimpath=${BlobPath} -asmflags=all=-trimpath=${BlobPath} -ldflags="${LDFlags}" -o ${BuildBinPath}/blobstore . + popd >/dev/null +} + build_blobstore_dialtest_bin() { - CGO_ENABLED=0 go build ${MODFLAGS} -gcflags=all=-trimpath=${SrcPath} -asmflags=all=-trimpath=${SrcPath} -ldflags="${LDFlags}" -o ${BuildBinPath}/blobstore/blobstore-dialtest ${SrcPath}/blobstore/testing/dial/main + CGO_ENABLED=0 go build ${MODFLAGS} -gcflags=all=-trimpath=${BlobPath} -asmflags=all=-trimpath=${BlobPath} -ldflags="${LDFlags}" -o ${BuildBinPath}/blobstore/blobstore-dialtest ${SrcPath}/blobstore/testing/dial/main } build_blobstore() { pushd $SrcPath >/dev/null echo -n "build blobstore " - build_clustermgr && build_blobnode && build_access && build_scheduler && build_proxy && build_blobstore_cli && echo "success" || echo "failed" + build_clustermgr && build_blobnode && build_access && build_scheduler && build_proxy && build_blobstore_cli && build_shardnode && echo "success" || echo "failed" popd >/dev/null }