From c589d7f01de3081c36916ba1520bb17601f9c0b7 Mon Sep 17 00:00:00 2001 From: "y_static_y@sina.com" Date: Fri, 25 Aug 2023 11:37:11 +0800 Subject: [PATCH] auto id req check ks Signed-off-by: y_static_y@sina.com --- pkg/autoid/autoid.pb.go | 82 ++++++++++++++++++++++++++++----------- pkg/kvrpcpb/kvrpcpb.pb.go | 8 ++-- pkg/tracepb/tracepb.pb.go | 1 + 3 files changed, 65 insertions(+), 26 deletions(-) diff --git a/pkg/autoid/autoid.pb.go b/pkg/autoid/autoid.pb.go index 145cef7e8..a4b5e1b8d 100644 --- a/pkg/autoid/autoid.pb.go +++ b/pkg/autoid/autoid.pb.go @@ -35,6 +35,7 @@ type AutoIDRequest struct { N uint64 `protobuf:"varint,4,opt,name=n,proto3" json:"n,omitempty"` Increment int64 `protobuf:"varint,5,opt,name=increment,proto3" json:"increment,omitempty"` Offset int64 `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty"` + KeyspaceID uint32 `protobuf:"varint,7,opt,name=keyspaceID,proto3" json:"keyspaceID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -115,6 +116,13 @@ func (m *AutoIDRequest) GetOffset() int64 { return 0 } +func (m *AutoIDRequest) GetKeyspaceID() uint32 { + if m != nil { + return m.KeyspaceID + } + return 0 +} + type AutoIDResponse struct { Min int64 `protobuf:"varint,1,opt,name=min,proto3" json:"min,omitempty"` Max int64 `protobuf:"varint,2,opt,name=max,proto3" json:"max,omitempty"` @@ -314,30 +322,31 @@ func init() { func init() { proto.RegisterFile("autoid.proto", fileDescriptor_d81e5bb779eac45f) } var fileDescriptor_d81e5bb779eac45f = []byte{ - // 365 bytes of a gzipped FileDescriptorProto + // 384 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xbf, 0x4e, 0xf3, 0x30, - 0x14, 0xc5, 0xeb, 0x2f, 0x69, 0xd4, 0xef, 0xf6, 0x0f, 0x95, 0x55, 0xaa, 0xa8, 0x42, 0x51, 0x95, - 0x01, 0x65, 0x0a, 0x12, 0x4c, 0x2c, 0x48, 0x45, 0x5d, 0x2a, 0x31, 0x59, 0xe2, 0x01, 0x9a, 0xd6, - 0x8d, 0xa2, 0xb6, 0x76, 0xb1, 0x9d, 0x8a, 0x9d, 0x85, 0x47, 0x60, 0x61, 0xe7, 0x51, 0x18, 0x19, - 0x19, 0x51, 0x79, 0x11, 0x94, 0xeb, 0x54, 0x69, 0x99, 0x99, 0x72, 0xce, 0xb1, 0x7c, 0xfd, 0x3b, - 0xb1, 0xa1, 0x35, 0xcd, 0x8d, 0xcc, 0xe6, 0xf1, 0x46, 0x49, 0x23, 0xa9, 0x67, 0xdd, 0xa0, 0x97, - 0xca, 0x54, 0x62, 0x74, 0x51, 0x28, 0xbb, 0x3a, 0x38, 0x51, 0xb9, 0x36, 0x28, 0x6d, 0x10, 0xbe, - 0x12, 0x68, 0x8f, 0x72, 0x23, 0x27, 0x63, 0xc6, 0x1f, 0x72, 0xae, 0x0d, 0xa5, 0xe0, 0xce, 0x93, - 0xc9, 0xd8, 0x27, 0x43, 0x12, 0x39, 0x0c, 0x35, 0xed, 0x41, 0xdd, 0x24, 0xab, 0xc9, 0xd8, 0xff, - 0x87, 0xa1, 0x35, 0x34, 0x00, 0xc8, 0xf4, 0xbd, 0xd0, 0x59, 0x2a, 0xf8, 0xdc, 0x77, 0x86, 0x24, - 0x6a, 0xb0, 0x83, 0x84, 0xb6, 0x80, 0x08, 0xdf, 0x1d, 0x92, 0xc8, 0x65, 0x44, 0xd0, 0x33, 0xf8, - 0x9f, 0x89, 0x99, 0xe2, 0x6b, 0x2e, 0x8c, 0x5f, 0xc7, 0x39, 0x55, 0x40, 0xfb, 0xe0, 0xc9, 0xc5, - 0x42, 0x73, 0xe3, 0x7b, 0xb8, 0x54, 0xba, 0xf0, 0x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0x85, 0xc1, 0x2e, 0xbe, 0x58, 0x73, 0x26, + 0x28, 0x1e, 0x82, 0xb1, 0xca, 0x59, 0x1d, 0xbf, 0x92, 0x8a, 0xc4, 0x0f, 0x75, 0xf6, 0x4a, 0x56, + 0xdd, 0x68, 0x51, 0xac, 0x44, 0xa6, 0x52, 0xf7, 0x48, 0xed, 0xbc, 0x27, 0x04, 0x7d, 0x42, 0x93, + 0x58, 0xd0, 0xbf, 0x9f, 0x06, 0x06, 0xb3, 0x2a, 0xac, 0x06, 0x62, 0x10, 0xa5, 0xab, 0x4a, 0x73, + 0x5e, 0xa4, 0x54, 0xcd, 0xa3, 0x43, 0xb4, 0xf1, 0x7c, 0x18, 0xec, 0x42, 0xd4, 0x6f, 0x6a, 0xf2, + 0xa2, 0xfd, 0xbc, 0x17, 0xcf, 0x08, 0xba, 0xfa, 0xf9, 0xd3, 0xe5, 0x92, 0xa7, 0xf8, 0x1a, 0xba, + 0x4a, 0x68, 0x86, 0x4f, 0x82, 0x7a, 0x35, 0x0e, 0xfe, 0xf0, 0x64, 0xfc, 0x1b, 0xeb, 0x2e, 0x5e, + 0x0b, 0x5f, 0x81, 0xa5, 0x3b, 0x37, 0x57, 0x0f, 0xc6, 0xd1, 0x5c, 0x3d, 0x0c, 0xe8, 0xb5, 0x6e, + 0xce, 0x3e, 0x5f, 0x3b, 0xe8, 0x7d, 0xeb, 0xa0, 0x8f, 0xad, 0x83, 0xbe, 0xb6, 0x0e, 0x7a, 0xf9, + 0x76, 0x5a, 0x30, 0xe4, 0x45, 0x16, 0xc8, 0x7c, 0xb1, 0x09, 0x16, 0x1b, 0xb5, 0x70, 0x89, 0xa5, + 0x3e, 0x97, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x86, 0xe8, 0x66, 0x90, 0xb6, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -480,6 +489,11 @@ func (m *AutoIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.KeyspaceID != 0 { + i = encodeVarintAutoid(dAtA, i, uint64(m.KeyspaceID)) + i-- + dAtA[i] = 0x38 + } if m.Offset != 0 { i = encodeVarintAutoid(dAtA, i, uint64(m.Offset)) i-- @@ -693,6 +707,9 @@ func (m *AutoIDRequest) Size() (n int) { if m.Offset != 0 { n += 1 + sovAutoid(uint64(m.Offset)) } + if m.KeyspaceID != 0 { + n += 1 + sovAutoid(uint64(m.KeyspaceID)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -914,6 +931,25 @@ func (m *AutoIDRequest) Unmarshal(dAtA []byte) error { break } } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyspaceID", wireType) + } + m.KeyspaceID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAutoid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KeyspaceID |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipAutoid(dAtA[iNdEx:]) diff --git a/pkg/kvrpcpb/kvrpcpb.pb.go b/pkg/kvrpcpb/kvrpcpb.pb.go index 3cf9d2dc9..9271855b1 100644 --- a/pkg/kvrpcpb/kvrpcpb.pb.go +++ b/pkg/kvrpcpb/kvrpcpb.pb.go @@ -1971,9 +1971,10 @@ type CheckTxnStatusResponse struct { RegionError *errorpb.Error `protobuf:"bytes,1,opt,name=region_error,json=regionError,proto3" json:"region_error,omitempty"` Error *KeyError `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // Three kinds of transaction status: - // locked: lock_ttl > 0 - // committed: commit_version > 0 - // rollbacked: lock_ttl = 0 && commit_version = 0 + // + // locked: lock_ttl > 0 + // committed: commit_version > 0 + // rollbacked: lock_ttl = 0 && commit_version = 0 LockTtl uint64 `protobuf:"varint,3,opt,name=lock_ttl,json=lockTtl,proto3" json:"lock_ttl,omitempty"` CommitVersion uint64 `protobuf:"varint,4,opt,name=commit_version,json=commitVersion,proto3" json:"commit_version,omitempty"` // The action performed by TiKV (and why if the action is to rollback). @@ -9700,6 +9701,7 @@ func (m *RawChecksumResponse) GetTotalBytes() uint64 { type CompactError struct { // Types that are valid to be assigned to Error: + // // *CompactError_ErrInvalidStartKey // *CompactError_ErrPhysicalTableNotExist // *CompactError_ErrCompactInProgress diff --git a/pkg/tracepb/tracepb.pb.go b/pkg/tracepb/tracepb.pb.go index e5b4919fe..55cf091a7 100644 --- a/pkg/tracepb/tracepb.pb.go +++ b/pkg/tracepb/tracepb.pb.go @@ -68,6 +68,7 @@ var xxx_messageInfo_TraceRecordRequest proto.InternalMessageInfo type TraceRecord struct { // Types that are valid to be assigned to RecordOneof: + // // *TraceRecord_Report // *TraceRecord_NotifyCollect RecordOneof isTraceRecord_RecordOneof `protobuf_oneof:"record_oneof"`