From 434512868de9169246bf14dbf1eaec391d61fe57 Mon Sep 17 00:00:00 2001 From: MyonKeminta Date: Mon, 26 Aug 2024 11:31:11 +0800 Subject: [PATCH] Make ReplaceLockByKey batched Signed-off-by: MyonKeminta --- pkg/deadlock/deadlock.pb.go | 356 ++++++++++++++++++++++++++++-------- proto/deadlock.proto | 8 +- scripts/proto.lock | 17 +- 3 files changed, 295 insertions(+), 86 deletions(-) diff --git a/pkg/deadlock/deadlock.pb.go b/pkg/deadlock/deadlock.pb.go index f381f950e..76351eb49 100644 --- a/pkg/deadlock/deadlock.pb.go +++ b/pkg/deadlock/deadlock.pb.go @@ -241,7 +241,7 @@ func (m *WaitForEntry) GetWaitTime() uint64 { return 0 } -type ReplaceLockByKeyRequest struct { +type ReplaceLockByKeyItem struct { KeyHash uint64 `protobuf:"varint,1,opt,name=key_hash,json=keyHash,proto3" json:"key_hash,omitempty"` Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` OldLockTs uint64 `protobuf:"varint,3,opt,name=old_lock_ts,json=oldLockTs,proto3" json:"old_lock_ts,omitempty"` @@ -251,18 +251,18 @@ type ReplaceLockByKeyRequest struct { XXX_sizecache int32 `json:"-"` } -func (m *ReplaceLockByKeyRequest) Reset() { *m = ReplaceLockByKeyRequest{} } -func (m *ReplaceLockByKeyRequest) String() string { return proto.CompactTextString(m) } -func (*ReplaceLockByKeyRequest) ProtoMessage() {} -func (*ReplaceLockByKeyRequest) Descriptor() ([]byte, []int) { +func (m *ReplaceLockByKeyItem) Reset() { *m = ReplaceLockByKeyItem{} } +func (m *ReplaceLockByKeyItem) String() string { return proto.CompactTextString(m) } +func (*ReplaceLockByKeyItem) ProtoMessage() {} +func (*ReplaceLockByKeyItem) Descriptor() ([]byte, []int) { return fileDescriptor_1995e4345c820a37, []int{3} } -func (m *ReplaceLockByKeyRequest) XXX_Unmarshal(b []byte) error { +func (m *ReplaceLockByKeyItem) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ReplaceLockByKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ReplaceLockByKeyItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ReplaceLockByKeyRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_ReplaceLockByKeyItem.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -272,60 +272,107 @@ func (m *ReplaceLockByKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *ReplaceLockByKeyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReplaceLockByKeyRequest.Merge(m, src) +func (m *ReplaceLockByKeyItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReplaceLockByKeyItem.Merge(m, src) } -func (m *ReplaceLockByKeyRequest) XXX_Size() int { +func (m *ReplaceLockByKeyItem) XXX_Size() int { return m.Size() } -func (m *ReplaceLockByKeyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ReplaceLockByKeyRequest.DiscardUnknown(m) +func (m *ReplaceLockByKeyItem) XXX_DiscardUnknown() { + xxx_messageInfo_ReplaceLockByKeyItem.DiscardUnknown(m) } -var xxx_messageInfo_ReplaceLockByKeyRequest proto.InternalMessageInfo +var xxx_messageInfo_ReplaceLockByKeyItem proto.InternalMessageInfo -func (m *ReplaceLockByKeyRequest) GetKeyHash() uint64 { +func (m *ReplaceLockByKeyItem) GetKeyHash() uint64 { if m != nil { return m.KeyHash } return 0 } -func (m *ReplaceLockByKeyRequest) GetKey() []byte { +func (m *ReplaceLockByKeyItem) GetKey() []byte { if m != nil { return m.Key } return nil } -func (m *ReplaceLockByKeyRequest) GetOldLockTs() uint64 { +func (m *ReplaceLockByKeyItem) GetOldLockTs() uint64 { if m != nil { return m.OldLockTs } return 0 } -func (m *ReplaceLockByKeyRequest) GetNewLockTs() uint64 { +func (m *ReplaceLockByKeyItem) GetNewLockTs() uint64 { if m != nil { return m.NewLockTs } return 0 } +type ReplaceLocksByKeysRequest struct { + Items []*ReplaceLockByKeyItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReplaceLocksByKeysRequest) Reset() { *m = ReplaceLocksByKeysRequest{} } +func (m *ReplaceLocksByKeysRequest) String() string { return proto.CompactTextString(m) } +func (*ReplaceLocksByKeysRequest) ProtoMessage() {} +func (*ReplaceLocksByKeysRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1995e4345c820a37, []int{4} +} +func (m *ReplaceLocksByKeysRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ReplaceLocksByKeysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ReplaceLocksByKeysRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ReplaceLocksByKeysRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReplaceLocksByKeysRequest.Merge(m, src) +} +func (m *ReplaceLocksByKeysRequest) XXX_Size() int { + return m.Size() +} +func (m *ReplaceLocksByKeysRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ReplaceLocksByKeysRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ReplaceLocksByKeysRequest proto.InternalMessageInfo + +func (m *ReplaceLocksByKeysRequest) GetItems() []*ReplaceLockByKeyItem { + if m != nil { + return m.Items + } + return nil +} + type DeadlockRequest struct { - Tp DeadlockRequestType `protobuf:"varint,1,opt,name=tp,proto3,enum=deadlock.DeadlockRequestType" json:"tp,omitempty"` - Entry *WaitForEntry `protobuf:"bytes,2,opt,name=entry,proto3" json:"entry,omitempty"` - ReplaceLockByKey *ReplaceLockByKeyRequest `protobuf:"bytes,3,opt,name=replace_lock_by_key,json=replaceLockByKey,proto3" json:"replace_lock_by_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Tp DeadlockRequestType `protobuf:"varint,1,opt,name=tp,proto3,enum=deadlock.DeadlockRequestType" json:"tp,omitempty"` + Entry *WaitForEntry `protobuf:"bytes,2,opt,name=entry,proto3" json:"entry,omitempty"` + ReplaceLocksByKeys *ReplaceLocksByKeysRequest `protobuf:"bytes,3,opt,name=replace_locks_by_keys,json=replaceLocksByKeys,proto3" json:"replace_locks_by_keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeadlockRequest) Reset() { *m = DeadlockRequest{} } func (m *DeadlockRequest) String() string { return proto.CompactTextString(m) } func (*DeadlockRequest) ProtoMessage() {} func (*DeadlockRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1995e4345c820a37, []int{4} + return fileDescriptor_1995e4345c820a37, []int{5} } func (m *DeadlockRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -368,9 +415,9 @@ func (m *DeadlockRequest) GetEntry() *WaitForEntry { return nil } -func (m *DeadlockRequest) GetReplaceLockByKey() *ReplaceLockByKeyRequest { +func (m *DeadlockRequest) GetReplaceLocksByKeys() *ReplaceLocksByKeysRequest { if m != nil { - return m.ReplaceLockByKey + return m.ReplaceLocksByKeys } return nil } @@ -394,7 +441,7 @@ func (m *DeadlockResponse) Reset() { *m = DeadlockResponse{} } func (m *DeadlockResponse) String() string { return proto.CompactTextString(m) } func (*DeadlockResponse) ProtoMessage() {} func (*DeadlockResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1995e4345c820a37, []int{5} + return fileDescriptor_1995e4345c820a37, []int{6} } func (m *DeadlockResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -456,7 +503,8 @@ func init() { proto.RegisterType((*WaitForEntriesRequest)(nil), "deadlock.WaitForEntriesRequest") proto.RegisterType((*WaitForEntriesResponse)(nil), "deadlock.WaitForEntriesResponse") proto.RegisterType((*WaitForEntry)(nil), "deadlock.WaitForEntry") - proto.RegisterType((*ReplaceLockByKeyRequest)(nil), "deadlock.ReplaceLockByKeyRequest") + proto.RegisterType((*ReplaceLockByKeyItem)(nil), "deadlock.ReplaceLockByKeyItem") + proto.RegisterType((*ReplaceLocksByKeysRequest)(nil), "deadlock.ReplaceLocksByKeysRequest") proto.RegisterType((*DeadlockRequest)(nil), "deadlock.DeadlockRequest") proto.RegisterType((*DeadlockResponse)(nil), "deadlock.DeadlockResponse") } @@ -464,43 +512,45 @@ func init() { func init() { proto.RegisterFile("deadlock.proto", fileDescriptor_1995e4345c820a37) } var fileDescriptor_1995e4345c820a37 = []byte{ - // 572 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x4d, 0x6e, 0xda, 0x40, - 0x14, 0x66, 0x30, 0x01, 0xf2, 0x40, 0xc4, 0x99, 0xa4, 0x89, 0x43, 0x55, 0x42, 0xbc, 0x42, 0x51, - 0x9a, 0x56, 0x54, 0xed, 0x01, 0x48, 0xd2, 0x54, 0x4a, 0x17, 0x91, 0x45, 0xd5, 0xec, 0x2c, 0xc7, - 0xbc, 0x82, 0x05, 0xf1, 0xb8, 0xf6, 0x20, 0xe2, 0x0b, 0xf4, 0x0c, 0xbd, 0x43, 0x6f, 0xd0, 0x55, - 0x97, 0x59, 0x74, 0xd1, 0x13, 0x54, 0x15, 0xbd, 0x48, 0x34, 0x33, 0x36, 0x06, 0x04, 0xd9, 0x0d, - 0xef, 0x7b, 0x3f, 0xdf, 0xfb, 0xde, 0x67, 0xa0, 0xd6, 0x43, 0xa7, 0x37, 0x62, 0xee, 0xf0, 0x34, - 0x08, 0x19, 0x67, 0xb4, 0x9c, 0xfe, 0xae, 0xef, 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x52, 0xa8, 0x9d, 0x8d, 0xd0, 0xf1, 0x3f, 0x05, 0xc9, 0x1c, 0x9d, 0xd0, - 0x0a, 0x94, 0x92, 0x98, 0x9e, 0xa7, 0xbb, 0xa0, 0x2f, 0xeb, 0xa7, 0x6b, 0xed, 0x1f, 0x04, 0xca, - 0x69, 0x6b, 0x7a, 0x03, 0xdb, 0x97, 0xc8, 0x17, 0xbf, 0x49, 0x7a, 0xb8, 0x72, 0x83, 0xec, 0x33, - 0xae, 0x37, 0xd7, 0x27, 0x28, 0xe1, 0xcd, 0x1c, 0xbd, 0x48, 0x99, 0xd2, 0x83, 0xb5, 0xe6, 0xa9, - 0xd7, 0x57, 0x41, 0x69, 0x8b, 0x16, 0x79, 0x4d, 0x3a, 0xfa, 0xc3, 0xb4, 0x41, 0xfe, 0x4c, 0x1b, - 0xe4, 0xdf, 0xb4, 0x41, 0xbe, 0xff, 0x6f, 0xe4, 0x6e, 0x8b, 0xf2, 0x3f, 0xe6, 0xcd, 0x63, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x57, 0x8b, 0x17, 0x3a, 0x95, 0x04, 0x00, 0x00, + // 603 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x4d, 0x6e, 0xd3, 0x40, + 0x14, 0xce, 0x24, 0x69, 0x9b, 0xbe, 0x44, 0xad, 0x3b, 0xb4, 0xc5, 0x0d, 0xc2, 0x0d, 0x66, 0x13, + 0x55, 0xa5, 0xa0, 0xf0, 0x73, 0x80, 0xfe, 0x50, 0x50, 0x59, 0x80, 0x15, 0xa0, 0x3b, 0xcb, 0x75, + 0x1e, 0x89, 0xe5, 0xc4, 0x63, 0xec, 0xa9, 0x52, 0xaf, 0xb9, 0x04, 0x77, 0xe0, 0x06, 0x1c, 0x00, + 0x75, 0xc1, 0x82, 0x13, 0x20, 0x54, 0x2e, 0x82, 0x66, 0xc6, 0xd3, 0xa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dc, 0xe0, 0x0e, 0xac, 0x69, 0x96, 0x7b, 0xbd, + 0x5a, 0x95, 0xc4, 0x55, 0x0d, 0x9c, 0xe4, 0x2b, 0x7e, 0x0e, 0x32, 0x9c, 0xae, 0x3f, 0xf0, 0x82, + 0xc8, 0xac, 0xdc, 0xf6, 0x39, 0x38, 0x32, 0x5d, 0x07, 0x82, 0x48, 0x1f, 0x40, 0x63, 0xba, 0x44, + 0x9e, 0xd9, 0xfa, 0x94, 0xfa, 0xce, 0x29, 0xdc, 0x29, 0x98, 0x37, 0x05, 0x58, 0x3c, 0x44, 0x8e, + 0x3e, 0x37, 0x4a, 0x94, 0xc2, 0xca, 0xc1, 0x10, 0xbd, 0xe8, 0x7d, 0x9c, 0xd7, 0x31, 0x08, 0xad, + 0xc3, 0x52, 0x7e, 0x67, 0x94, 0xe9, 0x3a, 0x18, 0xb3, 0xab, 0x37, 0x2a, 0x9d, 0x6f, 0x04, 0x6a, + 0x5a, 0x9a, 0x9e, 0xc2, 0xda, 0x31, 0xf2, 0x9b, 0x5f, 0x3a, 0xdd, 0x2e, 0xec, 0x60, 0xf2, 0x73, + 0x68, 0xb6, 0xe6, 0x13, 0xd4, 0xe0, 0xed, 0x12, 0x3d, 0xd2, 0x4e, 0xe9, 0xd6, 0xdc, 0x08, 0x35, + 0x9b, 0x45, 0x90, 0x96, 0x68, 0x93, 0x27, 0x64, 0xdf, 0xb8, 0xbc, 0xb2, 0xc8, 0xaf, 0x2b, 0x8b, + 0xfc, 0xb9, 0xb2, 0xc8, 0xd7, 0xbf, 0x56, 0xe9, 0x6c, 0x51, 0xfe, 0xb9, 0x9e, 0xfe, 0x0b, 0x00, + 0x00, 0xff, 0xff, 0x04, 0x4c, 0xf9, 0x46, 0xeb, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -791,7 +841,7 @@ func (m *WaitForEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ReplaceLockByKeyRequest) Marshal() (dAtA []byte, err error) { +func (m *ReplaceLockByKeyItem) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -801,12 +851,12 @@ func (m *ReplaceLockByKeyRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ReplaceLockByKeyRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ReplaceLockByKeyItem) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ReplaceLockByKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ReplaceLockByKeyItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -840,6 +890,47 @@ func (m *ReplaceLockByKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *ReplaceLocksByKeysRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ReplaceLocksByKeysRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReplaceLocksByKeysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDeadlock(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *DeadlockRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -864,9 +955,9 @@ func (m *DeadlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.ReplaceLockByKey != nil { + if m.ReplaceLocksByKeys != nil { { - size, err := m.ReplaceLockByKey.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ReplaceLocksByKeys.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1032,7 +1123,7 @@ func (m *WaitForEntry) Size() (n int) { return n } -func (m *ReplaceLockByKeyRequest) Size() (n int) { +func (m *ReplaceLockByKeyItem) Size() (n int) { if m == nil { return 0 } @@ -1057,6 +1148,24 @@ func (m *ReplaceLockByKeyRequest) Size() (n int) { return n } +func (m *ReplaceLocksByKeysRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovDeadlock(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *DeadlockRequest) Size() (n int) { if m == nil { return 0 @@ -1070,8 +1179,8 @@ func (m *DeadlockRequest) Size() (n int) { l = m.Entry.Size() n += 1 + l + sovDeadlock(uint64(l)) } - if m.ReplaceLockByKey != nil { - l = m.ReplaceLockByKey.Size() + if m.ReplaceLocksByKeys != nil { + l = m.ReplaceLocksByKeys.Size() n += 1 + l + sovDeadlock(uint64(l)) } if m.XXX_unrecognized != nil { @@ -1444,7 +1553,7 @@ func (m *WaitForEntry) Unmarshal(dAtA []byte) error { } return nil } -func (m *ReplaceLockByKeyRequest) Unmarshal(dAtA []byte) error { +func (m *ReplaceLockByKeyItem) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1467,10 +1576,10 @@ func (m *ReplaceLockByKeyRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ReplaceLockByKeyRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ReplaceLockByKeyItem: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ReplaceLockByKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ReplaceLockByKeyItem: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1586,6 +1695,91 @@ func (m *ReplaceLockByKeyRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *ReplaceLocksByKeysRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeadlock + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ReplaceLocksByKeysRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReplaceLocksByKeysRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeadlock + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDeadlock + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDeadlock + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, &ReplaceLockByKeyItem{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDeadlock(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDeadlock + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *DeadlockRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1672,7 +1866,7 @@ func (m *DeadlockRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReplaceLockByKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ReplaceLocksByKeys", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1699,10 +1893,10 @@ func (m *DeadlockRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ReplaceLockByKey == nil { - m.ReplaceLockByKey = &ReplaceLockByKeyRequest{} + if m.ReplaceLocksByKeys == nil { + m.ReplaceLocksByKeys = &ReplaceLocksByKeysRequest{} } - if err := m.ReplaceLockByKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ReplaceLocksByKeys.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto/deadlock.proto b/proto/deadlock.proto index 0996d3902..a291e0f86 100644 --- a/proto/deadlock.proto +++ b/proto/deadlock.proto @@ -35,17 +35,21 @@ enum DeadlockRequestType { ReplaceLockByKey = 3; } -message ReplaceLockByKeyRequest { +message ReplaceLockByKeyItem { uint64 key_hash = 1; bytes key = 2; uint64 old_lock_ts = 3; uint64 new_lock_ts = 4; } +message ReplaceLocksByKeysRequest { + repeated ReplaceLockByKeyItem items = 1; +} + message DeadlockRequest { DeadlockRequestType tp = 1; WaitForEntry entry = 2; - ReplaceLockByKeyRequest replace_lock_by_key = 3; + ReplaceLocksByKeysRequest replace_locks_by_keys = 3; } message DeadlockResponse { diff --git a/scripts/proto.lock b/scripts/proto.lock index 652a414cc..3a2a5adb6 100644 --- a/scripts/proto.lock +++ b/scripts/proto.lock @@ -3266,7 +3266,7 @@ ] }, { - "name": "ReplaceLockByKeyRequest", + "name": "ReplaceLockByKeyItem", "fields": [ { "id": 1, @@ -3290,6 +3290,17 @@ } ] }, + { + "name": "ReplaceLocksByKeysRequest", + "fields": [ + { + "id": 1, + "name": "items", + "type": "ReplaceLockByKeyItem", + "is_repeated": true + } + ] + }, { "name": "DeadlockRequest", "fields": [ @@ -3305,8 +3316,8 @@ }, { "id": 3, - "name": "replace_lock_by_key", - "type": "ReplaceLockByKeyRequest" + "name": "replace_locks_by_keys", + "type": "ReplaceLocksByKeysRequest" } ] },