From 71f0a71d7c441394f95ba9771f7c33fb39662775 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Mon, 3 Jun 2024 11:12:49 +0800 Subject: [PATCH] persist region leader Signed-off-by: Ryan Leung --- pkg/configpb/configpb.pb.gw.go | 22 +--- pkg/metapb/metapb.pb.go | 186 ++++++++++++++++++++++----------- proto/metapb.proto | 1 + scripts/proto.lock | 5 + 4 files changed, 131 insertions(+), 83 deletions(-) diff --git a/pkg/configpb/configpb.pb.gw.go b/pkg/configpb/configpb.pb.gw.go index 9b4675b32..c0385b0e4 100644 --- a/pkg/configpb/configpb.pb.gw.go +++ b/pkg/configpb/configpb.pb.gw.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -31,7 +30,6 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join var ( filter_Config_Get_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} @@ -57,10 +55,7 @@ func local_request_Config_Get_0(ctx context.Context, marshaler runtime.Marshaler var protoReq GetRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Config_Get_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Config_Get_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -127,10 +122,7 @@ func local_request_Config_Delete_0(ctx context.Context, marshaler runtime.Marsha var protoReq DeleteRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Config_Delete_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Config_Delete_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -142,14 +134,11 @@ func local_request_Config_Delete_0(ctx context.Context, marshaler runtime.Marsha // RegisterConfigHandlerServer registers the http handlers for service Config to "mux". // UnaryRPC :call ConfigServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterConfigHandlerFromEndpoint instead. func RegisterConfigHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigServer) error { mux.Handle("GET", pattern_Config_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -157,7 +146,6 @@ func RegisterConfigHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser return } resp, md, err := local_request_Config_Get_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -171,8 +159,6 @@ func RegisterConfigHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser mux.Handle("POST", pattern_Config_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -180,7 +166,6 @@ func RegisterConfigHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser return } resp, md, err := local_request_Config_Update_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -194,8 +179,6 @@ func RegisterConfigHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser mux.Handle("DELETE", pattern_Config_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -203,7 +186,6 @@ func RegisterConfigHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser return } resp, md, err := local_request_Config_Delete_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/pkg/metapb/metapb.pb.go b/pkg/metapb/metapb.pb.go index 7a962f0e8..293d72560 100644 --- a/pkg/metapb/metapb.pb.go +++ b/pkg/metapb/metapb.pb.go @@ -637,6 +637,7 @@ type Region struct { IsInFlashback bool `protobuf:"varint,7,opt,name=is_in_flashback,json=isInFlashback,proto3" json:"is_in_flashback,omitempty"` // The start_ts that the current flashback progress is using. FlashbackStartTs uint64 `protobuf:"varint,8,opt,name=flashback_start_ts,json=flashbackStartTs,proto3" json:"flashback_start_ts,omitempty"` + Leader *Peer `protobuf:"bytes,9,opt,name=leader,proto3" json:"leader,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -731,6 +732,13 @@ func (m *Region) GetFlashbackStartTs() uint64 { return 0 } +func (m *Region) GetLeader() *Peer { + if m != nil { + return m.Leader + } + return nil +} + type Peer struct { Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` StoreId uint64 `protobuf:"varint,2,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"` @@ -819,69 +827,69 @@ func init() { func init() { proto.RegisterFile("metapb.proto", fileDescriptor_77b4d575d5a68dda) } var fileDescriptor_77b4d575d5a68dda = []byte{ - // 977 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x55, 0x4f, 0x73, 0x1b, 0xc5, - 0x13, 0xcd, 0xea, 0xef, 0xaa, 0x57, 0x92, 0x95, 0x89, 0xab, 0x7e, 0xeb, 0xe4, 0x87, 0x11, 0x2a, - 0x08, 0xc2, 0x45, 0x99, 0x60, 0x28, 0xae, 0x14, 0x4e, 0x4c, 0xd9, 0x95, 0x04, 0xcc, 0x3a, 0x84, - 0xe3, 0xd6, 0x48, 0xdb, 0x96, 0xb6, 0xb4, 0xda, 0x59, 0x66, 0x46, 0x4a, 0xf4, 0x4d, 0xb8, 0x72, - 0xe3, 0x6b, 0x70, 0x82, 0x23, 0x47, 0x0e, 0x1c, 0x28, 0xf3, 0x45, 0xa8, 0xee, 0xd9, 0x55, 0xec, - 0xb8, 0x38, 0x69, 0xfa, 0xbd, 0xee, 0xd9, 0x37, 0x6f, 0xa6, 0x5b, 0xd0, 0x5d, 0xa2, 0x95, 0xc5, - 0xe4, 0xb0, 0xd0, 0xca, 0x2a, 0xd1, 0x72, 0xd1, 0x7d, 0x81, 0xf9, 0x54, 0x6f, 0x0a, 0x9b, 0xaa, - 0xbc, 0xe2, 0xee, 0xef, 0xce, 0xd4, 0x4c, 0xf1, 0xf2, 0x13, 0x5a, 0x95, 0xe8,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1, 0x31, 0x74, 0xb6, 0x7d, 0x4b, 0xdc, 0xb9, 0xc6, 0x42, 0xea, 0x34, 0x9f, - 0xb9, 0xba, 0x0b, 0xd4, 0x6b, 0x0a, 0x3c, 0xd1, 0x05, 0x3f, 0xc2, 0xa5, 0xe2, 0xa8, 0x46, 0x14, - 0x47, 0x98, 0x0c, 0xea, 0x07, 0xa7, 0xe0, 0x57, 0x32, 0x45, 0x07, 0x9a, 0x2f, 0x95, 0x45, 0xed, - 0xca, 0x9f, 0xa1, 0xd4, 0x39, 0xea, 0x81, 0x27, 0xee, 0x42, 0xef, 0x2c, 0x9f, 0xaa, 0x65, 0x9a, - 0xcf, 0x1c, 0x5f, 0x23, 0xe8, 0x09, 0x2e, 0x95, 0xdd, 0x42, 0xf5, 0xe3, 0x87, 0x7f, 0xfe, 0xe2, - 0x7b, 0xbf, 0x5f, 0xed, 0x7b, 0x7f, 0x5c, 0xed, 0x7b, 0x7f, 0x5f, 0xed, 0x7b, 0x3f, 0xfd, 0xb3, - 0x7f, 0x07, 0x06, 0x4a, 0xcf, 0x0e, 0x6d, 0xba, 0x58, 0x1f, 0x2e, 0xd6, 0xfc, 0x5f, 0x35, 0x69, - 0xf1, 0xcf, 0x67, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x27, 0xfc, 0x6d, 0x8c, 0x05, 0x07, 0x00, - 0x00, + // 989 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x55, 0xcd, 0x72, 0x1b, 0x45, + 0x10, 0xce, 0xea, 0x77, 0xb7, 0x57, 0x92, 0x95, 0x89, 0xab, 0x58, 0x27, 0x60, 0x84, 0x2a, 0x04, + 0xe1, 0xa2, 0x4c, 0x30, 0x14, 0x57, 0x0a, 0x27, 0xa6, 0xac, 0x4a, 0x02, 0x66, 0x1d, 0xc2, 0x71, + 0x6b, 0xa4, 0x6d, 0x4b, 0x53, 0x5a, 0x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5, 0x9a, 0xfe, 0xd1, 0x26, 0x2d, 0xfa, 0xf9, 0xfc, 0xbf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xbc, 0xf9, 0x64, 0x2b, 0x07, 0x00, 0x00, } func (m *Cluster) Marshal() (dAtA []byte, err error) { @@ -1339,6 +1347,18 @@ func (m *Region) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.Leader != nil { + { + size, err := m.Leader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMetapb(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } if m.FlashbackStartTs != 0 { i = encodeVarintMetapb(dAtA, i, uint64(m.FlashbackStartTs)) i-- @@ -1715,6 +1735,10 @@ func (m *Region) Size() (n int) { if m.FlashbackStartTs != 0 { n += 1 + sovMetapb(uint64(m.FlashbackStartTs)) } + if m.Leader != nil { + l = m.Leader.Size() + n += 1 + l + sovMetapb(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3380,6 +3404,42 @@ func (m *Region) Unmarshal(dAtA []byte) error { break } } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetapb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMetapb + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetapb + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Leader == nil { + m.Leader = &Peer{} + } + if err := m.Leader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMetapb(dAtA[iNdEx:]) diff --git a/proto/metapb.proto b/proto/metapb.proto index ef3c8d45b..38d72865f 100644 --- a/proto/metapb.proto +++ b/proto/metapb.proto @@ -127,6 +127,7 @@ message Region { bool is_in_flashback = 7; // The start_ts that the current flashback progress is using. uint64 flashback_start_ts = 8; + Peer leader = 9; } enum PeerRole { diff --git a/scripts/proto.lock b/scripts/proto.lock index fd59f9c7f..d3d571f6b 100644 --- a/scripts/proto.lock +++ b/scripts/proto.lock @@ -12566,6 +12566,11 @@ "id": 8, "name": "flashback_start_ts", "type": "uint64" + }, + { + "id": 9, + "name": "leader", + "type": "Peer" } ] },