diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go index c4220e61e3ef8..a9e6307cd737c 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/coprocessor/coprocessor.pb.go @@ -21,10 +21,11 @@ import ( "math" proto "github.com/golang/protobuf/proto" -) -import errorpb "github.com/pingcap/kvproto/pkg/errorpb" -import kvrpcpb "github.com/pingcap/kvproto/pkg/kvrpcpb" + errorpb "github.com/pingcap/kvproto/pkg/errorpb" + + kvrpcpb "github.com/pingcap/kvproto/pkg/kvrpcpb" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -106,9 +107,9 @@ func (m *Request) GetRanges() []*KeyRange { type Response struct { Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` - RegionError *errorpb.Error `protobuf:"bytes,2,opt,name=region_error" json:"region_error,omitempty"` + RegionError *errorpb.Error `protobuf:"bytes,2,opt,name=region_error,json=regionError" json:"region_error,omitempty"` Locked *kvrpcpb.LockInfo `protobuf:"bytes,3,opt,name=locked" json:"locked,omitempty"` - OtherError string `protobuf:"bytes,4,opt,name=other_error" json:"other_error"` + OtherError string `protobuf:"bytes,4,opt,name=other_error,json=otherError" json:"other_error"` XXX_unrecognized []byte `json:"-"` } @@ -953,24 +954,25 @@ var ( func init() { proto.RegisterFile("coprocessor.proto", fileDescriptorCoprocessor) } var fileDescriptorCoprocessor = []byte{ - // 291 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x90, 0x41, 0x4e, 0xf3, 0x30, - 0x10, 0x85, 0xeb, 0x26, 0x7f, 0xdb, 0x7f, 0xdc, 0xa2, 0xd6, 0x02, 0x29, 0x74, 0x11, 0xda, 0x0a, - 0x50, 0x57, 0x41, 0xca, 0x11, 0x8a, 0x58, 0x20, 0x58, 0xf5, 0x02, 0x28, 0xb8, 0x43, 0x40, 0x45, - 0x1e, 0x63, 0x1b, 0x04, 0x12, 0x07, 0xe1, 0x48, 0x5d, 0x72, 0x02, 0x84, 0xca, 0x45, 0x50, 0x6c, - 0x12, 0x75, 0xe5, 0x99, 0x67, 0xfb, 0xbd, 0x6f, 0x06, 0x46, 0x92, 0xb4, 0x21, 0x89, 0xd6, 0x92, - 0xc9, 0xb4, 0x21, 0x47, 0x82, 0xef, 0x48, 0xe3, 0x01, 0x1a, 0x43, 0x46, 0xdf, 0x86, 0xbb, 0xf1, - 0x60, 0xfd, 0x62, 0xb4, 0x6c, 0xda, 0xfd, 0x92, 0x4a, 0xf2, 0xe5, 0x59, 0x55, 0x05, 0x75, 0x76, - 0x0a, 0xbd, 0x2b, 0x7c, 0x5b, 0x16, 0xaa, 0x44, 0x31, 0x80, 0x7f, 0xd6, 0x15, 0xc6, 0x25, 0x6c, - 0xc2, 0xe6, 0x7d, 0xc1, 0x21, 0x42, 0xb5, 0x4a, 0xda, 0x55, 0x33, 0xb3, 0xd0, 0x5d, 0xe2, 0xd3, - 0x33, 0x5a, 0x27, 0xa6, 0xd0, 0x95, 0xa4, 0x1c, 0xbe, 0x86, 0x87, 0x3c, 0x1f, 0x66, 0x75, 0xd2, - 0x79, 0xd0, 0xc5, 0x10, 0xda, 0x4e, 0xfb, 0x9f, 0xd1, 0x22, 0xde, 0x7c, 0x1d, 0xb5, 0x44, 0x1f, - 0xe2, 0x55, 0xe1, 0x8a, 0x24, 0xf2, 0xd6, 0x27, 0xd0, 0x31, 0x55, 0xa4, 0x4d, 0xe2, 0x49, 0x34, - 0xe7, 0xf9, 0x41, 0xb6, 0x3b, 0x5a, 0x0d, 0x34, 0x7b, 0x87, 0xde, 0x12, 0xad, 0x26, 0x65, 0xb1, - 0x31, 0x08, 0x6c, 0xc7, 0xd0, 0x37, 0x58, 0x3e, 0x90, 0xba, 0xf1, 0x33, 0xfb, 0x28, 0x9e, 0xef, - 0x65, 0xf5, 0x06, 0x2e, 0xaa, 0x53, 0x4c, 0xa1, 0xf3, 0x48, 0x72, 0x8d, 0x2b, 0x1f, 0xcb, 0xf3, - 0x51, 0x03, 0x7a, 0x4d, 0x72, 0x7d, 0xa9, 0xee, 0x48, 0x1c, 0x02, 0x27, 0x77, 0x8f, 0xe6, 0xcf, - 0x27, 0x9e, 0xb0, 0xf9, 0xff, 0x80, 0xbc, 0x18, 0x6e, 0xb6, 0x29, 0xfb, 0xdc, 0xa6, 0xec, 0x7b, - 0x9b, 0xb2, 0x8f, 0x9f, 0xb4, 0xf5, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xbb, 0x85, 0x68, 0x81, - 0x01, 0x00, 0x00, + // 320 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x50, 0x41, 0x4e, 0xeb, 0x30, + 0x10, 0xad, 0x9b, 0xfc, 0xb6, 0x7f, 0xdc, 0xa2, 0xd6, 0x2a, 0x52, 0xd4, 0x45, 0xa8, 0x2a, 0x21, + 0x15, 0x24, 0x82, 0xc8, 0x11, 0x8a, 0x58, 0x20, 0x58, 0xf9, 0x02, 0x28, 0xa4, 0x43, 0x40, 0x45, + 0x19, 0x63, 0x1b, 0x04, 0x97, 0x60, 0xcd, 0x9e, 0xcb, 0x74, 0xc9, 0x09, 0x10, 0x2a, 0x17, 0x41, + 0xb1, 0x93, 0xaa, 0x2b, 0xbf, 0x79, 0xf3, 0xfc, 0xe6, 0xcd, 0xc0, 0x28, 0x27, 0xa5, 0x29, 0x47, + 0x63, 0x48, 0x27, 0x4a, 0x93, 0x25, 0xc1, 0x77, 0xa8, 0xc9, 0x00, 0xb5, 0x26, 0xad, 0x6e, 0x7d, + 0x6f, 0x32, 0x58, 0xbd, 0x68, 0x95, 0x6f, 0xcb, 0x71, 0x41, 0x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, 0x38, 0xc7, 0xc5, 0x70, 0xbd, 0x89, 0xd9, 0xd7, 0x26, 0x66, 0x3f, 0x9b, 0x98, 0x7d, 0xfc, + 0xc6, 0xad, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x81, 0x24, 0x1b, 0xad, 0xd1, 0x01, 0x00, 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go index 83afbaaafa003..e5fa7bfbedd5a 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/eraftpb/eraftpb.pb.go @@ -186,7 +186,7 @@ func (x *ConfChangeType) UnmarshalJSON(data []byte) error { func (ConfChangeType) EnumDescriptor() ([]byte, []int) { return fileDescriptorEraftpb, []int{2} } type Entry struct { - EntryType *EntryType `protobuf:"varint,1,opt,name=entry_type,enum=eraftpb.EntryType" json:"entry_type,omitempty"` + EntryType *EntryType `protobuf:"varint,1,opt,name=entry_type,json=entryType,enum=eraftpb.EntryType" json:"entry_type,omitempty"` Term *uint64 `protobuf:"varint,2,opt,name=term" json:"term,omitempty"` Index *uint64 `protobuf:"varint,3,opt,name=index" json:"index,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data" json:"data,omitempty"` @@ -227,7 +227,7 @@ func (m *Entry) GetData() []byte { } type SnapshotMetadata struct { - ConfState *ConfState `protobuf:"bytes,1,opt,name=conf_state" json:"conf_state,omitempty"` + ConfState *ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState" json:"conf_state,omitempty"` Index *uint64 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` Term *uint64 `protobuf:"varint,3,opt,name=term" json:"term,omitempty"` XXX_unrecognized []byte `json:"-"` @@ -285,17 +285,17 @@ func (m *Snapshot) GetMetadata() *SnapshotMetadata { } type Message struct { - MsgType *MessageType `protobuf:"varint,1,opt,name=msg_type,enum=eraftpb.MessageType" json:"msg_type,omitempty"` + MsgType *MessageType `protobuf:"varint,1,opt,name=msg_type,json=msgType,enum=eraftpb.MessageType" json:"msg_type,omitempty"` To *uint64 `protobuf:"varint,2,opt,name=to" json:"to,omitempty"` From *uint64 `protobuf:"varint,3,opt,name=from" json:"from,omitempty"` Term *uint64 `protobuf:"varint,4,opt,name=term" json:"term,omitempty"` - LogTerm *uint64 `protobuf:"varint,5,opt,name=log_term" json:"log_term,omitempty"` + LogTerm *uint64 `protobuf:"varint,5,opt,name=log_term,json=logTerm" json:"log_term,omitempty"` Index *uint64 `protobuf:"varint,6,opt,name=index" json:"index,omitempty"` Entries []*Entry `protobuf:"bytes,7,rep,name=entries" json:"entries,omitempty"` Commit *uint64 `protobuf:"varint,8,opt,name=commit" json:"commit,omitempty"` Snapshot *Snapshot `protobuf:"bytes,9,opt,name=snapshot" json:"snapshot,omitempty"` Reject *bool `protobuf:"varint,10,opt,name=reject" json:"reject,omitempty"` - RejectHint *uint64 `protobuf:"varint,11,opt,name=reject_hint" json:"reject_hint,omitempty"` + RejectHint *uint64 `protobuf:"varint,11,opt,name=reject_hint,json=rejectHint" json:"reject_hint,omitempty"` Context []byte `protobuf:"bytes,12,opt,name=context" json:"context,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -441,8 +441,8 @@ func (m *ConfState) GetNodes() []uint64 { type ConfChange struct { Id *uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` - ChangeType *ConfChangeType `protobuf:"varint,2,opt,name=change_type,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` - NodeId *uint64 `protobuf:"varint,3,opt,name=node_id" json:"node_id,omitempty"` + ChangeType *ConfChangeType `protobuf:"varint,2,opt,name=change_type,json=changeType,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` + NodeId *uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId" json:"node_id,omitempty"` Context []byte `protobuf:"bytes,4,opt,name=context" json:"context,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -2159,47 +2159,52 @@ var ( func init() { proto.RegisterFile("eraftpb.proto", fileDescriptorEraftpb) } var fileDescriptorEraftpb = []byte{ - // 667 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x52, 0xcf, 0x6e, 0xd3, 0x4c, - 0x10, 0x8f, 0x13, 0x27, 0x76, 0xc6, 0x8e, 0xb3, 0xdd, 0xf6, 0xfb, 0x3e, 0x7f, 0x3d, 0x84, 0x28, - 0x48, 0x55, 0x54, 0xa0, 0x12, 0xbd, 0x70, 0x6e, 0xab, 0x4a, 0x45, 0xc2, 0x15, 0xa4, 0x05, 0x24, - 0x2e, 0xd1, 0xd6, 0x9e, 0x38, 0x86, 0xda, 0x6b, 0x76, 0x37, 0xa5, 0x7d, 0x01, 0x9e, 0x81, 0x47, - 0xe2, 0xc8, 0x89, 0x33, 0x2a, 0x2f, 0x82, 0x76, 0xe3, 0xfc, 0x2b, 0x37, 0xcf, 0x78, 0xe7, 0xf7, - 0x6f, 0x06, 0x3a, 0x28, 0xd8, 0x44, 0x95, 0x57, 0x07, 0xa5, 0xe0, 0x8a, 0x53, 0xa7, 0x2a, 0x07, - 0x1f, 0xa0, 0x79, 0x5a, 0x28, 0x71, 0x47, 0xf7, 0x00, 0x50, 0x7f, 0x8c, 0xd5, 0x5d, 0x89, 0xa1, - 0xd5, 0xb7, 0x86, 0xc1, 0x21, 0x3d, 0x58, 0x4c, 0x99, 0x37, 0x97, 0x77, 0x25, 0x52, 0x1f, 0x6c, - 0x85, 0x22, 0x0f, 0xeb, 0x7d, 0x6b, 0x68, 0xd3, 0x0e, 0x34, 0xb3, 0x22, 0xc1, 0xdb, 0xb0, 0x61, - 0x4a, 0x1f, 0xec, 0x84, 0x29, 0x16, 0xda, 0x7d, 0x6b, 0xe8, 0x0f, 0xde, 0x03, 0xb9, 0x28, 0x58, - 0x29, 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84, 0xba, - 0xd2, 0x42, 0x5c, 0x1a, 0xc2, 0xce, 0x7a, 0x67, 0x39, 0xdc, 0xae, 0xc8, 0xde, 0x16, 0x02, 0x59, - 0x3c, 0x65, 0x57, 0xd7, 0x48, 0x80, 0x6e, 0x41, 0xa7, 0x02, 0xd4, 0xbb, 0x99, 0x49, 0xe2, 0x55, - 0xcf, 0x4e, 0xa6, 0x18, 0x7f, 0x7a, 0x33, 0xe3, 0x62, 0x96, 0x13, 0xbf, 0x92, 0x7f, 0x29, 0x58, - 0x21, 0x27, 0x28, 0x5e, 0x21, 0x4b, 0x50, 0x90, 0x4e, 0x35, 0x7d, 0x99, 0xe5, 0xc8, 0x67, 0xea, - 0x9c, 0x7f, 0x21, 0x41, 0x25, 0x68, 0x84, 0x2c, 0x79, 0xa9, 0x8f, 0x98, 0x74, 0xe9, 0x0e, 0x90, - 0xf5, 0x8e, 0x16, 0x44, 0xc8, 0xfe, 0x33, 0x08, 0x1e, 0xec, 0xcf, 0x03, 0xe7, 0x28, 0x49, 0xce, - 0x79, 0x82, 0xa4, 0xa6, 0xe3, 0x1c, 0x61, 0xce, 0x6f, 0xd0, 0xd4, 0xd6, 0x31, 0xf9, 0x7e, 0xdf, - 0xb3, 0x7e, 0xdc, 0xf7, 0xac, 0x5f, 0xf7, 0x3d, 0xeb, 0xdb, 0xef, 0x5e, 0xed, 0x4f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x38, 0x66, 0xcf, 0x27, 0xa9, 0x04, 0x00, 0x00, + // 743 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x53, 0xcd, 0x6e, 0xc3, 0x44, + 0x10, 0x8e, 0x9d, 0x1f, 0xdb, 0xe3, 0x24, 0xdd, 0x2e, 0xa1, 0x75, 0x39, 0x84, 0x90, 0x53, 0x54, + 0xa9, 0x45, 0xad, 0x84, 0xc4, 0xb5, 0x8d, 0x90, 0x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 0x7d, 0x4f, 0x91, 0xf6, 0x45, + 0x5c, 0x5d, 0x0a, 0xb1, 0x28, 0x81, 0xbe, 0xe2, 0x83, 0xac, 0x90, 0xcf, 0x8a, 0x88, 0x4d, 0x3d, + 0x18, 0x35, 0x33, 0xf5, 0x63, 0xa7, 0x1c, 0xf6, 0x94, 0x15, 0xc8, 0xc2, 0x35, 0x7b, 0xde, 0x20, + 0x01, 0x7a, 0x0c, 0x83, 0xb2, 0xa1, 0x32, 0x71, 0x2b, 0x88, 0x5b, 0x96, 0xcd, 0xd7, 0x18, 0xfe, + 0xfc, 0xc3, 0x96, 0x17, 0xdb, 0x94, 0xf4, 0x4b, 0xfa, 0x8b, 0x82, 0x65, 0x62, 0x85, 0xc5, 0x77, + 0xc8, 0x22, 0x2c, 0xc8, 0xa0, 0x7c, 0xbd, 0x48, 0x52, 0xe4, 0x5b, 0xf9, 0xc0, 0x7f, 0x25, 0xc3, + 0x92, 0x50, 0x80, 0x2c, 0xba, 0x57, 0xff, 0x0c, 0x39, 0xa2, 0x23, 0x20, 0xcd, 0x8c, 0x22, 0x44, + 0xc8, 0xf9, 0x05, 0x0c, 0x0f, 0xcd, 0x55, 0x72, 0xde, 0x44, 0xd1, 0x03, 0x8f, 0x90, 0xb4, 0x94, + 0x9c, 0x01, 0xa6, 0xfc, 0x05, 0x35, 0x36, 0x6e, 0xc9, 0x1f, 0xef, 0x63, 0xe3, 0xcf, 0xf7, 0xb1, + 0xf1, 0xf7, 0xfb, 0xd8, 0xf8, 0xfd, 0x9f, 0x71, 0xeb, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd8, + 0x67, 0x57, 0x8a, 0x8d, 0x05, 0x00, 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go index 1fcd3c8977a04..9630bbeb93a0b 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/errorpb/errorpb.pb.go @@ -24,9 +24,9 @@ import ( "math" proto "github.com/golang/protobuf/proto" -) -import metapb "github.com/pingcap/kvproto/pkg/metapb" + metapb "github.com/pingcap/kvproto/pkg/metapb" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -40,7 +40,7 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type NotLeader struct { - RegionId *uint64 `protobuf:"varint,1,opt,name=region_id" json:"region_id,omitempty"` + RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` Leader *metapb.Peer `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -65,7 +65,7 @@ func (m *NotLeader) GetLeader() *metapb.Peer { } type RegionNotFound struct { - RegionId *uint64 `protobuf:"varint,1,opt,name=region_id" json:"region_id,omitempty"` + RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -83,9 +83,9 @@ func (m *RegionNotFound) GetRegionId() uint64 { type KeyNotInRegion struct { Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` - RegionId *uint64 `protobuf:"varint,2,opt,name=region_id" json:"region_id,omitempty"` - StartKey []byte `protobuf:"bytes,3,opt,name=start_key" json:"start_key,omitempty"` - EndKey []byte `protobuf:"bytes,4,opt,name=end_key" json:"end_key,omitempty"` + RegionId *uint64 `protobuf:"varint,2,opt,name=region_id,json=regionId" json:"region_id,omitempty"` + StartKey []byte `protobuf:"bytes,3,opt,name=start_key,json=startKey" json:"start_key,omitempty"` + EndKey []byte `protobuf:"bytes,4,opt,name=end_key,json=endKey" json:"end_key,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -123,7 +123,7 @@ func (m *KeyNotInRegion) GetEndKey() []byte { } type StaleEpoch struct { - NewRegions []*metapb.Region `protobuf:"bytes,1,rep,name=new_regions" json:"new_regions,omitempty"` + NewRegions []*metapb.Region `protobuf:"bytes,1,rep,name=new_regions,json=newRegions" json:"new_regions,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -150,11 +150,11 @@ func (*ServerIsBusy) Descriptor() ([]byte, []int) { return fileDescriptorErrorpb type Error struct { Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` - NotLeader *NotLeader `protobuf:"bytes,2,opt,name=not_leader" json:"not_leader,omitempty"` - RegionNotFound *RegionNotFound `protobuf:"bytes,3,opt,name=region_not_found" json:"region_not_found,omitempty"` - KeyNotInRegion *KeyNotInRegion `protobuf:"bytes,4,opt,name=key_not_in_region" json:"key_not_in_region,omitempty"` - StaleEpoch *StaleEpoch `protobuf:"bytes,5,opt,name=stale_epoch" json:"stale_epoch,omitempty"` - ServerIsBusy *ServerIsBusy `protobuf:"bytes,6,opt,name=server_is_busy" json:"server_is_busy,omitempty"` + NotLeader *NotLeader `protobuf:"bytes,2,opt,name=not_leader,json=notLeader" json:"not_leader,omitempty"` + RegionNotFound *RegionNotFound `protobuf:"bytes,3,opt,name=region_not_found,json=regionNotFound" json:"region_not_found,omitempty"` + KeyNotInRegion *KeyNotInRegion `protobuf:"bytes,4,opt,name=key_not_in_region,json=keyNotInRegion" json:"key_not_in_region,omitempty"` + StaleEpoch *StaleEpoch `protobuf:"bytes,5,opt,name=stale_epoch,json=staleEpoch" json:"stale_epoch,omitempty"` + ServerIsBusy *ServerIsBusy `protobuf:"bytes,6,opt,name=server_is_busy,json=serverIsBusy" json:"server_is_busy,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -1425,28 +1425,32 @@ var ( func init() { proto.RegisterFile("errorpb.proto", fileDescriptorErrorpb) } var fileDescriptorErrorpb = []byte{ - // 363 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0xcd, 0x4a, 0xfb, 0x40, - 0x14, 0xc5, 0xff, 0xe9, 0x27, 0xb9, 0xc9, 0x3f, 0xb6, 0x51, 0x31, 0x14, 0x09, 0x25, 0x05, 0xc9, - 0xc6, 0x4a, 0xb3, 0x76, 0x55, 0xa8, 0x50, 0x94, 0x22, 0xd6, 0x7d, 0x48, 0xcd, 0x35, 0x86, 0xb6, - 0x33, 0x65, 0x66, 0xaa, 0x64, 0xe7, 0x63, 0xf8, 0x48, 0x2e, 0x7d, 0x04, 0xa9, 0x2f, 0x22, 0x33, - 0x49, 0x3f, 0x71, 0x37, 0x73, 0xe7, 0x77, 0xcf, 0x9c, 0x73, 0xe0, 0x3f, 0x32, 0x46, 0xd9, 0x62, - 0xd2, 0x5d, 0x30, 0x2a, 0xa8, 0x5d, 0x2f, 0xae, 0x2d, 0x73, 0x8e, 0x22, 0x5a, 0x8f, 0x5b, 0x27, - 0x09, 0x4d, 0xa8, 0x3a, 0x5e, 0xc9, 0x53, 0x3e, 0xf5, 0xae, 0x41, 0x1f, 0x51, 0x71, 0x87, 0x51, - 0x8c, 0xcc, 0x6e, 0x82, 0xce, 0x30, 0x49, 0x29, 0x09, 0xd3, 0xd8, 0xd1, 0xda, 0x9a, 0x5f, 0xb1, - 0xcf, 0xa1, 0x36, 0x53, 0x8f, 0x4e, 0xa9, 0xad, 0xf9, 0x46, 0x60, 0x76, 0x0b, 0xd1, 0x7b, 0x44, - 0xe6, 0x75, 0xc0, 0x7a, 0x50, 0x0b, 0x23, 0x2a, 0x6e, 0xe8, 0x92, 0xc4, 0x7f, 0x48, 0x78, 0x8f, - 0x60, 0xdd, 0x62, 0x36, 0xa2, 0x62, 0x48, 0x72, 0xd8, 0x36, 0xa0, 0x3c, 0xc5, 0x4c, 0x3d, 0x9b, - 0xfb, 0x1b, 0x25, 0xf5, 0x69, 0x13, 0x74, 0x2e, 0x22, 0x26, 0x42, 0x49, 0x95, 0x15, 0x75, 0x04, - 0x75, 0x24, 0xb1, 0x1a, 0x54, 0xe4, 0xc0, 0xeb, 0x01, 0x8c, 0x45, 0x34, 0xc3, 0xc1, 0x82, 0x3e, - 0xbd, 0xd8, 0x1d, 0x30, 0x08, 0xbe, 0x85, 0xb9, 0x10, 0x77, 0xb4, 0x76, 0xd9, 0x37, 0x02, 0x6b, - 0xed, 0x35, 0xff, 0xd6, 0xb3, 0xc0, 0x1c, 0x23, 0x7b, 0x45, 0x36, 0xe4, 0xfd, 0x25, 0xcf, 0xbc, - 0xf7, 0x12, 0x54, 0x07, 0xb2, 0x2b, 0xa9, 0x3e, 0x47, 0xce, 0xa3, 0x04, 0x95, 0x29, 0xdd, 0xbe, - 0x00, 0x20, 0x54, 0x84, 0x7b, 0xd1, 0xed, 0xee, 0xba, 0xe7, 0x6d, 0x63, 0x3d, 0x68, 0x14, 0xe6, - 0x25, 0xfe, 0x2c, 0x2b, 0x50, 0x86, 0x8d, 0xe0, 0x6c, 0x43, 0x1f, 0x34, 0x14, 0x40, 0x73, 0x8a, - 0x99, 0xe2, 0x53, 0x52, 0x38, 0x56, 0x99, 0x76, 0x77, 0x0e, 0x0a, 0xf3, 0xc1, 0xe0, 0x32, 0x6c, - 0x88, 0x32, 0xad, 0x53, 0x55, 0xf4, 0xf1, 0x86, 0xde, 0x29, 0xe2, 0x12, 0x2c, 0xae, 0x32, 0x86, - 0x29, 0x0f, 0x27, 0x4b, 0x9e, 0x39, 0x35, 0x05, 0x9f, 0x6e, 0xe1, 0x9d, 0x0a, 0xfa, 0x8d, 0xcf, - 0x95, 0xab, 0x7d, 0xad, 0x5c, 0xed, 0x7b, 0xe5, 0x6a, 0x1f, 0x3f, 0xee, 0xbf, 0xdf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xd5, 0x44, 0x97, 0x65, 0x4d, 0x02, 0x00, 0x00, + // 418 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x91, 0xdd, 0x8a, 0xd3, 0x40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 0x06, 0x7c, 0x79, 0x06, 0x2f, 0x14, + 0x52, 0x57, 0x5e, 0x64, 0xf3, 0xd1, 0xcf, 0x53, 0x60, 0xfd, 0x3e, 0x05, 0xd6, 0x9f, 0x53, 0x60, + 0xfd, 0xf8, 0x1b, 0x3c, 0xf9, 0x17, 0x00, 0x00, 0xff, 0xff, 0x84, 0x38, 0x69, 0x79, 0xe4, 0x02, + 0x00, 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go index 89b7ff5d82b26..6e179832c7541 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/kvrpcpb/kvrpcpb.pb.go @@ -45,10 +45,11 @@ import ( "math" proto "github.com/golang/protobuf/proto" -) -import metapb "github.com/pingcap/kvproto/pkg/metapb" -import errorpb "github.com/pingcap/kvproto/pkg/errorpb" + metapb "github.com/pingcap/kvproto/pkg/metapb" + + errorpb "github.com/pingcap/kvproto/pkg/errorpb" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -157,9 +158,10 @@ func (x *Op) UnmarshalJSON(data []byte) error { func (Op) EnumDescriptor() ([]byte, []int) { return fileDescriptorKvrpcpb, []int{1} } type LockInfo struct { - PrimaryLock []byte `protobuf:"bytes,1,opt,name=primary_lock" json:"primary_lock,omitempty"` - LockVersion uint64 `protobuf:"varint,2,opt,name=lock_version" json:"lock_version"` + PrimaryLock []byte `protobuf:"bytes,1,opt,name=primary_lock,json=primaryLock" json:"primary_lock,omitempty"` + LockVersion uint64 `protobuf:"varint,2,opt,name=lock_version,json=lockVersion" json:"lock_version"` Key []byte `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` + LockTtl uint64 `protobuf:"varint,4,opt,name=lock_ttl,json=lockTtl" json:"lock_ttl"` XXX_unrecognized []byte `json:"-"` } @@ -189,6 +191,13 @@ func (m *LockInfo) GetKey() []byte { return nil } +func (m *LockInfo) GetLockTtl() uint64 { + if m != nil { + return m.LockTtl + } + return 0 +} + type KeyError struct { Locked *LockInfo `protobuf:"bytes,1,opt,name=locked" json:"locked,omitempty"` Retryable string `protobuf:"bytes,2,opt,name=retryable" json:"retryable"` @@ -223,10 +232,10 @@ func (m *KeyError) GetAbort() string { } type Context struct { - RegionId uint64 `protobuf:"varint,1,opt,name=region_id" json:"region_id"` - RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,2,opt,name=region_epoch" json:"region_epoch,omitempty"` + RegionId uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id"` + RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,2,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` Peer *metapb.Peer `protobuf:"bytes,3,opt,name=peer" json:"peer,omitempty"` - ReadQuorum bool `protobuf:"varint,4,opt,name=read_quorum" json:"read_quorum"` + ReadQuorum bool `protobuf:"varint,4,opt,name=read_quorum,json=readQuorum" json:"read_quorum"` XXX_unrecognized []byte `json:"-"` } @@ -314,9 +323,10 @@ func (m *CmdGetResponse) GetValue() []byte { } type CmdScanRequest struct { - StartKey []byte `protobuf:"bytes,1,opt,name=start_key" json:"start_key,omitempty"` + StartKey []byte `protobuf:"bytes,1,opt,name=start_key,json=startKey" json:"start_key,omitempty"` Limit uint32 `protobuf:"varint,2,opt,name=limit" json:"limit"` Version uint64 `protobuf:"varint,3,opt,name=version" json:"version"` + KeyOnly bool `protobuf:"varint,4,opt,name=key_only,json=keyOnly" json:"key_only"` XXX_unrecognized []byte `json:"-"` } @@ -346,6 +356,13 @@ func (m *CmdScanRequest) GetVersion() uint64 { return 0 } +func (m *CmdScanRequest) GetKeyOnly() bool { + if m != nil { + return m.KeyOnly + } + return false +} + type KvPair struct { Error *KeyError `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` @@ -432,8 +449,9 @@ func (m *Mutation) GetValue() []byte { type CmdPrewriteRequest struct { Mutations []*Mutation `protobuf:"bytes,1,rep,name=mutations" json:"mutations,omitempty"` // primary_lock_key - PrimaryLock []byte `protobuf:"bytes,2,opt,name=primary_lock" json:"primary_lock,omitempty"` - StartVersion uint64 `protobuf:"varint,3,opt,name=start_version" json:"start_version"` + PrimaryLock []byte `protobuf:"bytes,2,opt,name=primary_lock,json=primaryLock" json:"primary_lock,omitempty"` + StartVersion uint64 `protobuf:"varint,3,opt,name=start_version,json=startVersion" json:"start_version"` + LockTtl uint64 `protobuf:"varint,4,opt,name=lock_ttl,json=lockTtl" json:"lock_ttl"` XXX_unrecognized []byte `json:"-"` } @@ -463,6 +481,13 @@ func (m *CmdPrewriteRequest) GetStartVersion() uint64 { return 0 } +func (m *CmdPrewriteRequest) GetLockTtl() uint64 { + if m != nil { + return m.LockTtl + } + return 0 +} + type CmdPrewriteResponse struct { Errors []*KeyError `protobuf:"bytes,1,rep,name=errors" json:"errors,omitempty"` XXX_unrecognized []byte `json:"-"` @@ -481,9 +506,9 @@ func (m *CmdPrewriteResponse) GetErrors() []*KeyError { } type CmdCommitRequest struct { - StartVersion uint64 `protobuf:"varint,1,opt,name=start_version" json:"start_version"` + StartVersion uint64 `protobuf:"varint,1,opt,name=start_version,json=startVersion" json:"start_version"` Keys [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"` - CommitVersion uint64 `protobuf:"varint,3,opt,name=commit_version" json:"commit_version"` + CommitVersion uint64 `protobuf:"varint,3,opt,name=commit_version,json=commitVersion" json:"commit_version"` Binlog []byte `protobuf:"bytes,4,opt,name=binlog" json:"binlog,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -539,7 +564,7 @@ func (m *CmdCommitResponse) GetError() *KeyError { } type CmdBatchRollbackRequest struct { - StartVersion uint64 `protobuf:"varint,1,opt,name=start_version" json:"start_version"` + StartVersion uint64 `protobuf:"varint,1,opt,name=start_version,json=startVersion" json:"start_version"` Keys [][]byte `protobuf:"bytes,2,rep,name=keys" json:"keys,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -582,7 +607,7 @@ func (m *CmdBatchRollbackResponse) GetError() *KeyError { type CmdCleanupRequest struct { Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` - StartVersion uint64 `protobuf:"varint,2,opt,name=start_version" json:"start_version"` + StartVersion uint64 `protobuf:"varint,2,opt,name=start_version,json=startVersion" json:"start_version"` XXX_unrecognized []byte `json:"-"` } @@ -607,7 +632,7 @@ func (m *CmdCleanupRequest) GetStartVersion() uint64 { type CmdCleanupResponse struct { Error *KeyError `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` - CommitVersion uint64 `protobuf:"varint,2,opt,name=commit_version" json:"commit_version"` + CommitVersion uint64 `protobuf:"varint,2,opt,name=commit_version,json=commitVersion" json:"commit_version"` XXX_unrecognized []byte `json:"-"` } @@ -673,7 +698,7 @@ func (m *CmdBatchGetResponse) GetPairs() []*KvPair { } type CmdScanLockRequest struct { - MaxVersion uint64 `protobuf:"varint,1,opt,name=max_version" json:"max_version"` + MaxVersion uint64 `protobuf:"varint,1,opt,name=max_version,json=maxVersion" json:"max_version"` XXX_unrecognized []byte `json:"-"` } @@ -715,9 +740,9 @@ func (m *CmdScanLockResponse) GetLocks() []*LockInfo { } type CmdResolveLockRequest struct { - StartVersion uint64 `protobuf:"varint,1,opt,name=start_version" json:"start_version"` + StartVersion uint64 `protobuf:"varint,1,opt,name=start_version,json=startVersion" json:"start_version"` // If the txn is rolled back, do not set it. - CommitVersion uint64 `protobuf:"varint,2,opt,name=commit_version" json:"commit_version"` + CommitVersion uint64 `protobuf:"varint,2,opt,name=commit_version,json=commitVersion" json:"commit_version"` XXX_unrecognized []byte `json:"-"` } @@ -758,7 +783,7 @@ func (m *CmdResolveLockResponse) GetError() *KeyError { } type CmdGCRequest struct { - SafePoint uint64 `protobuf:"varint,1,opt,name=safe_point" json:"safe_point"` + SafePoint uint64 `protobuf:"varint,1,opt,name=safe_point,json=safePoint" json:"safe_point"` XXX_unrecognized []byte `json:"-"` } @@ -794,16 +819,16 @@ func (m *CmdGCResponse) GetError() *KeyError { type Request struct { Type MessageType `protobuf:"varint,1,opt,name=type,enum=kvrpcpb.MessageType" json:"type"` Context *Context `protobuf:"bytes,2,opt,name=context" json:"context,omitempty"` - CmdGetReq *CmdGetRequest `protobuf:"bytes,3,opt,name=cmd_get_req" json:"cmd_get_req,omitempty"` - CmdScanReq *CmdScanRequest `protobuf:"bytes,4,opt,name=cmd_scan_req" json:"cmd_scan_req,omitempty"` - CmdPrewriteReq *CmdPrewriteRequest `protobuf:"bytes,5,opt,name=cmd_prewrite_req" json:"cmd_prewrite_req,omitempty"` - CmdCommitReq *CmdCommitRequest `protobuf:"bytes,6,opt,name=cmd_commit_req" json:"cmd_commit_req,omitempty"` - CmdCleanupReq *CmdCleanupRequest `protobuf:"bytes,7,opt,name=cmd_cleanup_req" json:"cmd_cleanup_req,omitempty"` - CmdBatchGetReq *CmdBatchGetRequest `protobuf:"bytes,10,opt,name=cmd_batch_get_req" json:"cmd_batch_get_req,omitempty"` - CmdBatchRollbackReq *CmdBatchRollbackRequest `protobuf:"bytes,11,opt,name=cmd_batch_rollback_req" json:"cmd_batch_rollback_req,omitempty"` - CmdScanLockReq *CmdScanLockRequest `protobuf:"bytes,12,opt,name=cmd_scan_lock_req" json:"cmd_scan_lock_req,omitempty"` - CmdResolveLockReq *CmdResolveLockRequest `protobuf:"bytes,13,opt,name=cmd_resolve_lock_req" json:"cmd_resolve_lock_req,omitempty"` - CmdGcReq *CmdGCRequest `protobuf:"bytes,14,opt,name=cmd_gc_req" json:"cmd_gc_req,omitempty"` + CmdGetReq *CmdGetRequest `protobuf:"bytes,3,opt,name=cmd_get_req,json=cmdGetReq" json:"cmd_get_req,omitempty"` + CmdScanReq *CmdScanRequest `protobuf:"bytes,4,opt,name=cmd_scan_req,json=cmdScanReq" json:"cmd_scan_req,omitempty"` + CmdPrewriteReq *CmdPrewriteRequest `protobuf:"bytes,5,opt,name=cmd_prewrite_req,json=cmdPrewriteReq" json:"cmd_prewrite_req,omitempty"` + CmdCommitReq *CmdCommitRequest `protobuf:"bytes,6,opt,name=cmd_commit_req,json=cmdCommitReq" json:"cmd_commit_req,omitempty"` + CmdCleanupReq *CmdCleanupRequest `protobuf:"bytes,7,opt,name=cmd_cleanup_req,json=cmdCleanupReq" json:"cmd_cleanup_req,omitempty"` + CmdBatchGetReq *CmdBatchGetRequest `protobuf:"bytes,10,opt,name=cmd_batch_get_req,json=cmdBatchGetReq" json:"cmd_batch_get_req,omitempty"` + CmdBatchRollbackReq *CmdBatchRollbackRequest `protobuf:"bytes,11,opt,name=cmd_batch_rollback_req,json=cmdBatchRollbackReq" json:"cmd_batch_rollback_req,omitempty"` + CmdScanLockReq *CmdScanLockRequest `protobuf:"bytes,12,opt,name=cmd_scan_lock_req,json=cmdScanLockReq" json:"cmd_scan_lock_req,omitempty"` + CmdResolveLockReq *CmdResolveLockRequest `protobuf:"bytes,13,opt,name=cmd_resolve_lock_req,json=cmdResolveLockReq" json:"cmd_resolve_lock_req,omitempty"` + CmdGcReq *CmdGCRequest `protobuf:"bytes,14,opt,name=cmd_gc_req,json=cmdGcReq" json:"cmd_gc_req,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -898,17 +923,17 @@ func (m *Request) GetCmdGcReq() *CmdGCRequest { type Response struct { Type MessageType `protobuf:"varint,1,opt,name=type,enum=kvrpcpb.MessageType" json:"type"` - RegionError *errorpb.Error `protobuf:"bytes,2,opt,name=region_error" json:"region_error,omitempty"` - CmdGetResp *CmdGetResponse `protobuf:"bytes,3,opt,name=cmd_get_resp" json:"cmd_get_resp,omitempty"` - CmdScanResp *CmdScanResponse `protobuf:"bytes,4,opt,name=cmd_scan_resp" json:"cmd_scan_resp,omitempty"` - CmdPrewriteResp *CmdPrewriteResponse `protobuf:"bytes,5,opt,name=cmd_prewrite_resp" json:"cmd_prewrite_resp,omitempty"` - CmdCommitResp *CmdCommitResponse `protobuf:"bytes,6,opt,name=cmd_commit_resp" json:"cmd_commit_resp,omitempty"` - CmdCleanupResp *CmdCleanupResponse `protobuf:"bytes,7,opt,name=cmd_cleanup_resp" json:"cmd_cleanup_resp,omitempty"` - CmdBatchGetResp *CmdBatchGetResponse `protobuf:"bytes,10,opt,name=cmd_batch_get_resp" json:"cmd_batch_get_resp,omitempty"` - CmdBatchRollbackResp *CmdBatchRollbackResponse `protobuf:"bytes,11,opt,name=cmd_batch_rollback_resp" json:"cmd_batch_rollback_resp,omitempty"` - CmdScanLockResp *CmdScanLockResponse `protobuf:"bytes,12,opt,name=cmd_scan_lock_resp" json:"cmd_scan_lock_resp,omitempty"` - CmdResolveLockResp *CmdResolveLockResponse `protobuf:"bytes,13,opt,name=cmd_resolve_lock_resp" json:"cmd_resolve_lock_resp,omitempty"` - CmdGcResp *CmdGCResponse `protobuf:"bytes,14,opt,name=cmd_gc_resp" json:"cmd_gc_resp,omitempty"` + RegionError *errorpb.Error `protobuf:"bytes,2,opt,name=region_error,json=regionError" json:"region_error,omitempty"` + CmdGetResp *CmdGetResponse `protobuf:"bytes,3,opt,name=cmd_get_resp,json=cmdGetResp" json:"cmd_get_resp,omitempty"` + CmdScanResp *CmdScanResponse `protobuf:"bytes,4,opt,name=cmd_scan_resp,json=cmdScanResp" json:"cmd_scan_resp,omitempty"` + CmdPrewriteResp *CmdPrewriteResponse `protobuf:"bytes,5,opt,name=cmd_prewrite_resp,json=cmdPrewriteResp" json:"cmd_prewrite_resp,omitempty"` + CmdCommitResp *CmdCommitResponse `protobuf:"bytes,6,opt,name=cmd_commit_resp,json=cmdCommitResp" json:"cmd_commit_resp,omitempty"` + CmdCleanupResp *CmdCleanupResponse `protobuf:"bytes,7,opt,name=cmd_cleanup_resp,json=cmdCleanupResp" json:"cmd_cleanup_resp,omitempty"` + CmdBatchGetResp *CmdBatchGetResponse `protobuf:"bytes,10,opt,name=cmd_batch_get_resp,json=cmdBatchGetResp" json:"cmd_batch_get_resp,omitempty"` + CmdBatchRollbackResp *CmdBatchRollbackResponse `protobuf:"bytes,11,opt,name=cmd_batch_rollback_resp,json=cmdBatchRollbackResp" json:"cmd_batch_rollback_resp,omitempty"` + CmdScanLockResp *CmdScanLockResponse `protobuf:"bytes,12,opt,name=cmd_scan_lock_resp,json=cmdScanLockResp" json:"cmd_scan_lock_resp,omitempty"` + CmdResolveLockResp *CmdResolveLockResponse `protobuf:"bytes,13,opt,name=cmd_resolve_lock_resp,json=cmdResolveLockResp" json:"cmd_resolve_lock_resp,omitempty"` + CmdGcResp *CmdGCResponse `protobuf:"bytes,14,opt,name=cmd_gc_resp,json=cmdGcResp" json:"cmd_gc_resp,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -1062,6 +1087,9 @@ func (m *LockInfo) MarshalTo(data []byte) (int, error) { i = encodeVarintKvrpcpb(data, i, uint64(len(m.Key))) i += copy(data[i:], m.Key) } + data[i] = 0x20 + i++ + i = encodeVarintKvrpcpb(data, i, uint64(m.LockTtl)) if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } @@ -1253,6 +1281,14 @@ func (m *CmdScanRequest) MarshalTo(data []byte) (int, error) { data[i] = 0x18 i++ i = encodeVarintKvrpcpb(data, i, uint64(m.Version)) + data[i] = 0x20 + i++ + if m.KeyOnly { + data[i] = 1 + } else { + data[i] = 0 + } + i++ if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } @@ -1407,6 +1443,9 @@ func (m *CmdPrewriteRequest) MarshalTo(data []byte) (int, error) { data[i] = 0x18 i++ i = encodeVarintKvrpcpb(data, i, uint64(m.StartVersion)) + data[i] = 0x20 + i++ + i = encodeVarintKvrpcpb(data, i, uint64(m.LockTtl)) if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } @@ -2197,6 +2236,7 @@ func (m *LockInfo) Size() (n int) { l = len(m.Key) n += 1 + l + sovKvrpcpb(uint64(l)) } + n += 1 + sovKvrpcpb(uint64(m.LockTtl)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2279,6 +2319,7 @@ func (m *CmdScanRequest) Size() (n int) { } n += 1 + sovKvrpcpb(uint64(m.Limit)) n += 1 + sovKvrpcpb(uint64(m.Version)) + n += 2 if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2353,6 +2394,7 @@ func (m *CmdPrewriteRequest) Size() (n int) { n += 1 + l + sovKvrpcpb(uint64(l)) } n += 1 + sovKvrpcpb(uint64(m.StartVersion)) + n += 1 + sovKvrpcpb(uint64(m.LockTtl)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2803,6 +2845,25 @@ func (m *LockInfo) Unmarshal(data []byte) error { m.Key = []byte{} } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LockTtl", wireType) + } + m.LockTtl = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + m.LockTtl |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipKvrpcpb(data[iNdEx:]) @@ -3437,6 +3498,26 @@ func (m *CmdScanRequest) Unmarshal(data []byte) error { break } } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyOnly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.KeyOnly = bool(v != 0) default: iNdEx = preIndex skippy, err := skipKvrpcpb(data[iNdEx:]) @@ -3929,6 +4010,25 @@ func (m *CmdPrewriteRequest) Unmarshal(data []byte) error { break } } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LockTtl", wireType) + } + m.LockTtl = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowKvrpcpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + m.LockTtl |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipKvrpcpb(data[iNdEx:]) @@ -6320,80 +6420,95 @@ var ( func init() { proto.RegisterFile("kvrpcpb.proto", fileDescriptorKvrpcpb) } var fileDescriptorKvrpcpb = []byte{ - // 1186 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x96, 0xcf, 0x6e, 0xdb, 0xc6, - 0x13, 0xc7, 0x43, 0xfd, 0xd7, 0x90, 0x92, 0xe9, 0xb5, 0x1d, 0x2b, 0xb2, 0x7f, 0x8a, 0x4c, 0xe4, - 0xa0, 0xe4, 0x87, 0xda, 0xb0, 0x03, 0xb7, 0x69, 0x91, 0x16, 0xad, 0x15, 0xb7, 0x08, 0xd2, 0xc2, - 0x86, 0x9b, 0x4b, 0xd1, 0x83, 0x40, 0x51, 0x1b, 0x85, 0x90, 0xa8, 0x5d, 0x2f, 0x29, 0x37, 0xba, - 0xe7, 0x21, 0xfa, 0x12, 0x7d, 0x8f, 0x1c, 0xfb, 0x04, 0x45, 0xe1, 0x5e, 0xfb, 0x10, 0x05, 0x87, - 0xbb, 0x24, 0x25, 0x32, 0x86, 0x72, 0xd3, 0x9f, 0xf9, 0xce, 0xcc, 0x7e, 0xf7, 0x33, 0x43, 0x42, - 0x63, 0x72, 0x23, 0xb8, 0xc3, 0x87, 0x87, 0x5c, 0xb0, 0x80, 0x91, 0xaa, 0xfc, 0xda, 0x36, 0x3c, - 0x1a, 0xd8, 0xea, 0xe7, 0x76, 0x83, 0x0a, 0xc1, 0x44, 0xfc, 0x75,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 0xfd, 0x7c, 0x02, 0xa5, 0xf2, 0x1b, 0xd8, 0xc9, - 0x41, 0xd0, 0xe7, 0x92, 0xc1, 0x87, 0x1f, 0x65, 0x50, 0xea, 0xd5, 0xbe, 0x71, 0x22, 0x55, 0x33, - 0x67, 0xdf, 0xc4, 0x7b, 0xf1, 0xc9, 0x1f, 0x1a, 0xe8, 0x29, 0xca, 0x08, 0x40, 0x25, 0x82, 0xc3, - 0x0c, 0x5f, 0xbf, 0xaa, 0xb2, 0x3f, 0x53, 0x23, 0x1b, 0xa0, 0xa7, 0x2e, 0xd4, 0x2c, 0x90, 0x06, - 0xd4, 0xe3, 0xab, 0x32, 0x8b, 0xa4, 0x09, 0x90, 0xdc, 0x81, 0x59, 0x92, 0xf1, 0xca, 0x5a, 0xb3, - 0x4a, 0xb6, 0xf1, 0x3d, 0x68, 0xc9, 0x2c, 0xb3, 0x26, 0xc3, 0x94, 0x07, 0x66, 0x9d, 0x10, 0x7c, - 0xd5, 0x4d, 0x9d, 0xcb, 0x04, 0x52, 0x87, 0x32, 0x76, 0x6d, 0xea, 0x4f, 0xba, 0x50, 0xb8, 0xe0, - 0xa4, 0x0a, 0xc5, 0xcb, 0x79, 0xd8, 0x62, 0x15, 0x8a, 0x2f, 0xe8, 0xd4, 0xd4, 0x48, 0x0d, 0x4a, - 0x18, 0x5c, 0x38, 0x33, 0x3f, 0xdc, 0x76, 0xb4, 0x3f, 0x6f, 0x3b, 0xda, 0xdf, 0xb7, 0x1d, 0xed, - 0xf7, 0x7f, 0x3a, 0xf7, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x38, 0x18, 0x61, 0x64, 0x30, 0x0d, - 0x00, 0x00, + // 1434 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x57, 0xdf, 0x8e, 0xd3, 0x46, + 0x17, 0xc7, 0xf9, 0x9f, 0x63, 0x27, 0x6b, 0x86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 0x86, 0x66, 0x59, 0x81, 0x94, 0xd1, 0x39, 0x84, 0xae, 0x82, 0x48, 0x58, 0x34, + 0x4b, 0x28, 0xb9, 0x01, 0x75, 0x6c, 0x97, 0x42, 0xba, 0x55, 0x45, 0x5c, 0xe1, 0x27, 0xeb, 0x50, + 0x3f, 0xf5, 0x82, 0xb9, 0xc8, 0xb4, 0xe5, 0x8a, 0x85, 0xf3, 0xa3, 0x81, 0x88, 0xdf, 0xf8, 0xde, + 0x4c, 0xb1, 0xba, 0x02, 0xed, 0x24, 0xf5, 0xe2, 0x74, 0x98, 0x73, 0x6b, 0xa1, 0xe1, 0x09, 0x5d, + 0xf0, 0x7a, 0x04, 0x93, 0x70, 0x92, 0x22, 0x4a, 0x47, 0xd5, 0x03, 0x4d, 0x3a, 0xf9, 0x6a, 0x09, + 0x79, 0xde, 0x47, 0x53, 0xba, 0x18, 0x46, 0xb3, 0x60, 0xb1, 0x94, 0xa3, 0xe6, 0x94, 0x2e, 0x0e, + 0x67, 0xc1, 0xc2, 0xf9, 0x16, 0x1a, 0x4f, 0x4e, 0x8f, 0xbc, 0x49, 0xfc, 0xe1, 0x51, 0xc9, 0x14, + 0x56, 0xf2, 0x14, 0x66, 0x71, 0x56, 0xf5, 0x38, 0xef, 0xc1, 0x5a, 0x16, 0xa6, 0xcc, 0xdc, 0x75, + 0xa8, 0x33, 0x6f, 0x12, 0x27, 0x3d, 0xa3, 0x5f, 0xdd, 0x35, 0xf7, 0xd7, 0xf2, 0x3b, 0x90, 0x83, + 0x2b, 0xbc, 0xce, 0x33, 0x68, 0x7d, 0x35, 0x4f, 0xbd, 0x94, 0x47, 0xb0, 0x03, 0x95, 0x88, 0x21, + 0xa7, 0xee, 0xbe, 0x99, 0xed, 0x3f, 0x64, 0x32, 0x90, 0x4a, 0xc4, 0x3e, 0x98, 0xd0, 0xaf, 0x06, + 0x90, 0x41, 0x38, 0x3a, 0x8a, 0xe9, 0xf7, 0xf1, 0x24, 0xa5, 0x2a, 0xf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 0xad, + 0x4c, 0x49, 0xab, 0x8a, 0xe2, 0xff, 0xf9, 0xe3, 0x1a, 0x05, 0x28, 0x94, 0xd1, 0xdd, 0x53, 0x7f, + 0x65, 0x84, 0xfa, 0xd4, 0xbb, 0x1a, 0xe7, 0x99, 0xec, 0x71, 0x51, 0xd6, 0x84, 0x49, 0x71, 0x6c, + 0x16, 0xc4, 0x21, 0x18, 0x61, 0x8f, 0xcb, 0x35, 0xb9, 0x0f, 0x1d, 0x4d, 0x1e, 0x09, 0x93, 0xfa, + 0xe8, 0x15, 0xf5, 0x21, 0x0f, 0x9b, 0x7e, 0x6e, 0x20, 0x8f, 0x44, 0xd9, 0x34, 0x85, 0x24, 0x4c, + 0x4a, 0xe4, 0x6a, 0xb9, 0x44, 0x24, 0xca, 0x9a, 0xbf, 0x6c, 0xcc, 0x7a, 0x5c, 0x89, 0x24, 0x61, + 0x52, 0x25, 0x5b, 0x65, 0x2a, 0x91, 0x28, 0x1d, 0x5f, 0x37, 0x29, 0xbd, 0xe6, 0x3a, 0x49, 0x98, + 0x14, 0xca, 0x95, 0x52, 0xa1, 0x48, 0x94, 0xae, 0xbf, 0x64, 0x23, 0x8f, 0x81, 0x9c, 0x95, 0x4a, + 0xc2, 0xa4, 0x56, 0xae, 0x96, 0x6b, 0x45, 0x8b, 0x4a, 0x37, 0x92, 0x17, 0xb0, 0x59, 0xaa, 0x96, + 0x84, 0x49, 0xb9, 0xec, 0xbc, 0x47, 0x2e, 0x12, 0x74, 0xdd, 0x2f, 0xf1, 0x28, 0x92, 0xba, 0x60, + 0x12, 0x26, 0x15, 0x73, 0xb5, 0x5c, 0x31, 0x1a, 0x49, 0xdd, 0x48, 0x5c, 0xb8, 0x5c, 0xa2, 0x99, + 0x84, 0x49, 0xd1, 0x5c, 0x3b, 0x57, 0x34, 0x12, 0x90, 0xf8, 0x05, 0x7b, 0x36, 0xad, 0x7d, 0x81, + 0xd4, 0x2d, 0x99, 0xd6, 0xd9, 0xb7, 0x46, 0x4c, 0x6b, 0x9f, 0x2f, 0x6f, 0xbd, 0x31, 0xc0, 0xd4, + 0x84, 0x41, 0x00, 0x1a, 0xa2, 0x79, 0xed, 0x0b, 0xc4, 0x84, 0xa6, 0x8c, 0xc7, 0x36, 0xc8, 0x1a, + 0x98, 0x5a, 0x5f, 0xd9, 0x15, 0xd2, 0x81, 0x76, 0xd6, 0x20, 0x76, 0x95, 0x74, 0x01, 0xf2, 0x52, + 0xdb, 0x35, 0xb9, 0x5f, 0x15, 0xc7, 0x6e, 0x92, 0x75, 0x7c, 0x3b, 0x2f, 0x25, 0xd6, 0x6e, 0xc9, + 0x6d, 0x2a, 0x3d, 0x76, 0x9b, 0x10, 0xfc, 0x53, 0xa7, 0x85, 0x67, 0x03, 0x69, 0x43, 0x1d, 0x03, + 0xb0, 0xcd, 0x5b, 0x7d, 0xa8, 0x1c, 0x32, 0xd2, 0x84, 0xea, 0xd1, 0x9c, 0x53, 0x6c, 0x42, 0xf5, + 0x33, 0x1a, 0xd8, 0x06, 0x69, 0x41, 0x0d, 0x37, 0x57, 0x0e, 0xec, 0xb7, 0xef, 0xb6, 0x8d, 0xdf, + 0xdf, 0x6d, 0x1b, 0x7f, 0xbe, 0xdb, 0x36, 0x7e, 0xf9, 0x6b, 0xfb, 0xc2, 0xdf, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x51, 0x95, 0x46, 0xac, 0xbb, 0x10, 0x00, 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go index 2b3d04318bfaf..d8fd60b6343e6 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/metapb/metapb.pb.go @@ -77,7 +77,7 @@ type Cluster struct { Id uint64 `protobuf:"varint,1,opt,name=id" json:"id"` // max peer count for a region. // pd will do the auto-balance if region peer count mismatches. - MaxPeerCount uint32 `protobuf:"varint,2,opt,name=max_peer_count" json:"max_peer_count"` + MaxPeerCount uint32 `protobuf:"varint,2,opt,name=max_peer_count,json=maxPeerCount" json:"max_peer_count"` XXX_unrecognized []byte `json:"-"` } @@ -101,10 +101,12 @@ func (m *Cluster) GetMaxPeerCount() uint32 { } type Store struct { - Id uint64 `protobuf:"varint,1,opt,name=id" json:"id"` - Address string `protobuf:"bytes,2,opt,name=address" json:"address"` - State StoreState `protobuf:"varint,3,opt,name=state,enum=metapb.StoreState" json:"state"` - XXX_unrecognized []byte `json:"-"` + Id uint64 `protobuf:"varint,1,opt,name=id" json:"id"` + Address string `protobuf:"bytes,2,opt,name=address" json:"address"` + State StoreState `protobuf:"varint,3,opt,name=state,enum=metapb.StoreState" json:"state"` + // Case insensitive tags for replica constraints. + Tags []string `protobuf:"bytes,4,rep,name=tags" json:"tags,omitempty"` + XXX_unrecognized []byte `json:"-"` } func (m *Store) Reset() { *m = Store{} } @@ -133,9 +135,16 @@ func (m *Store) GetState() StoreState { return StoreState_Up } +func (m *Store) GetTags() []string { + if m != nil { + return m.Tags + } + return nil +} + type RegionEpoch struct { // Conf change version, auto increment when add or remove peer - ConfVer uint64 `protobuf:"varint,1,opt,name=conf_ver" json:"conf_ver"` + ConfVer uint64 `protobuf:"varint,1,opt,name=conf_ver,json=confVer" json:"conf_ver"` // Region version, auto increment when split or merge Version uint64 `protobuf:"varint,2,opt,name=version" json:"version"` XXX_unrecognized []byte `json:"-"` @@ -163,9 +172,9 @@ func (m *RegionEpoch) GetVersion() uint64 { type Region struct { Id uint64 `protobuf:"varint,1,opt,name=id" json:"id"` // Region key range [start_key, end_key). - StartKey []byte `protobuf:"bytes,2,opt,name=start_key" json:"start_key,omitempty"` - EndKey []byte `protobuf:"bytes,3,opt,name=end_key" json:"end_key,omitempty"` - RegionEpoch *RegionEpoch `protobuf:"bytes,4,opt,name=region_epoch" json:"region_epoch,omitempty"` + StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey" json:"start_key,omitempty"` + EndKey []byte `protobuf:"bytes,3,opt,name=end_key,json=endKey" json:"end_key,omitempty"` + RegionEpoch *RegionEpoch `protobuf:"bytes,4,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` Peers []*Peer `protobuf:"bytes,5,rep,name=peers" json:"peers,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -212,7 +221,7 @@ func (m *Region) GetPeers() []*Peer { type Peer struct { Id uint64 `protobuf:"varint,1,opt,name=id" json:"id"` - StoreId uint64 `protobuf:"varint,2,opt,name=store_id" json:"store_id"` + StoreId uint64 `protobuf:"varint,2,opt,name=store_id,json=storeId" json:"store_id"` XXX_unrecognized []byte `json:"-"` } @@ -295,6 +304,21 @@ func (m *Store) MarshalTo(data []byte) (int, error) { data[i] = 0x18 i++ i = encodeVarintMetapb(data, i, uint64(m.State)) + if len(m.Tags) > 0 { + for _, s := range m.Tags { + data[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + data[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + data[i] = uint8(l) + i++ + i += copy(data[i:], s) + } + } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } @@ -458,6 +482,12 @@ func (m *Store) Size() (n int) { l = len(m.Address) n += 1 + l + sovMetapb(uint64(l)) n += 1 + sovMetapb(uint64(m.State)) + if len(m.Tags) > 0 { + for _, s := range m.Tags { + l = len(s) + n += 1 + l + sovMetapb(uint64(l)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -712,6 +742,35 @@ func (m *Store) Unmarshal(data []byte) error { break } } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetapb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetapb + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tags = append(m.Tags, string(data[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMetapb(data[iNdEx:]) @@ -1216,27 +1275,31 @@ var ( func init() { proto.RegisterFile("metapb.proto", fileDescriptorMetapb) } var fileDescriptorMetapb = []byte{ - // 350 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4e, 0xea, 0x40, - 0x14, 0x86, 0x99, 0xd2, 0x52, 0x38, 0x2d, 0xdc, 0xde, 0xb9, 0xf7, 0x92, 0xe6, 0xde, 0x9b, 0xda, - 0x74, 0x63, 0x75, 0x81, 0x84, 0x9d, 0x89, 0x2b, 0x8c, 0x6b, 0x8d, 0xe8, 0xc2, 0x55, 0x53, 0xe8, - 0x01, 0x1b, 0xa1, 0xd3, 0xcc, 0x0c, 0x44, 0x5f, 0xc0, 0x67, 0xf0, 0x91, 0x58, 0xfa, 0x04, 0xc6, - 0xe0, 0x8b, 0x98, 0x4e, 0x4b, 0x24, 0x86, 0x55, 0x3b, 0xff, 0x3f, 0xff, 0xf9, 0xbf, 0x39, 0x60, - 0x2f, 0x50, 0xc6, 0xf9, 0xb8, 0x97, 0x73, 0x26, 0x19, 0x6d, 0x94, 0xa7, 0xbf, 0xbf, 0x67, 0x6c, - 0xc6, 0x94, 0x74, 0x52, 0xfc, 0x95, 0x6e, 0x70, 0x0a, 0xe6, 0xf9, 0x7c, 0x29, 0x24, 0x72, 0xea, - 0x80, 0x96, 0x26, 0x2e, 0xf1, 0x49, 0xa8, 0x0f, 0xf5, 0xf5, 0xdb, 0x41, 0x8d, 0xfe, 0x87, 0xce, - 0x22, 0x7e, 0x8c, 0x72, 0x44, 0x1e, 0x4d, 0xd8, 0x32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x3a, 0xda, 0xd0, 0x59, 0x6f, 0x3c, 0xf2, 0xba, 0xf1, 0xc8, 0xfb, 0xc6, 0x23, 0x2f, 0x1f, 0x5e, - 0xed, 0x33, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x03, 0xd0, 0xd5, 0xff, 0x01, 0x00, 0x00, + // 411 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0x41, 0x6e, 0xd4, 0x30, + 0x14, 0x86, 0xc7, 0x99, 0x4c, 0x32, 0x79, 0x49, 0xab, 0xc8, 0x54, 0x22, 0x02, 0x29, 0x13, 0x65, + 0x15, 0x75, 0x31, 0xa0, 0x59, 0xb0, 0x63, 0xd3, 0x8a, 0x05, 0xaa, 0x04, 0x28, 0x05, 0xb6, 0x51, + 0x3a, 0x7e, 0x13, 0x22, 0x1a, 0x3b, 0xb2, 0xdd, 0xaa, 0x5d, 0x72, 0x0b, 0x8e, 0xc1, 0x31, 0xba, + 0xe4, 0x04, 0x08, 0x0d, 0x17, 0x41, 0x76, 0x32, 0xd0, 0x59, 0xcc, 0xce, 0xfe, 0x3f, 0xfb, 0xd7, + 0xff, 0xbf, 0x07, 0x51, 0x87, 0xba, 0xee, 0xaf, 0x96, 0xbd, 0x14, 0x5a, 0x50, 0x6f, 0xb8, 0x3d, + 0x3b, 0x69, 0x44, 0x23, 0xac, 0xf4, 0xc2, 0x9c, 0x06, 0x9a, 0x5f, 0x80, 0x7f, 0x7e, 0x7d, 0xa3, + 0x34, 0x4a, 0x7a, 0x02, 0x4e, 0xcb, 0x12, 0x92, 0x91, 0xc2, 0x3d, 0x73, 0x1f, 0x7e, 0x2d, 0x26, + 0xa5, 0xd3, 0x32, 0x7a, 0x0a, 0xc7, 0x5d, 0x7d, 0x57, 0xf5, 0x88, 0xb2, 0x5a, 0x8b, 0x1b, 0xae, + 0x13, 0x27, 0x23, 0xc5, 0xd1, 0xf8, 0x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7, 0x5c, 0x0f, 0xe4, + 0x5d, 0xc0, 0x5c, 0x99, 0x79, 0x56, 0x2d, 0xdb, 0x6f, 0x6c, 0xd5, 0xb7, 0xec, 0xf4, 0x25, 0xc0, + 0xff, 0x81, 0x53, 0x0f, 0x9c, 0x4f, 0x7d, 0x3c, 0xa1, 0x21, 0xf8, 0xef, 0x37, 0x9b, 0xeb, 0x96, + 0x63, 0x4c, 0xe8, 0x11, 0x04, 0x1f, 0x45, 0x77, 0xa5, 0xb4, 0xe0, 0x18, 0x3b, 0x67, 0xf1, 0xc3, + 0x36, 0x25, 0x3f, 0xb7, 0x29, 0xf9, 0xbd, 0x4d, 0xc9, 0xf7, 0x3f, 0xe9, 0xe4, 0x6f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x9d, 0x2c, 0x2b, 0x71, 0x83, 0x02, 0x00, 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/msgpb/msgpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/msgpb/msgpb.pb.go index d26adf6b2aa63..5d5e7a344bb86 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/msgpb/msgpb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/msgpb/msgpb.pb.go @@ -19,13 +19,17 @@ import ( "math" proto "github.com/golang/protobuf/proto" -) -import raft_cmdpb "github.com/pingcap/kvproto/pkg/raft_cmdpb" -import raft_serverpb "github.com/pingcap/kvproto/pkg/raft_serverpb" -import kvrpcpb "github.com/pingcap/kvproto/pkg/kvrpcpb" -import coprocessor "github.com/pingcap/kvproto/pkg/coprocessor" -import pdpb "github.com/pingcap/kvproto/pkg/pdpb" + raft_cmdpb "github.com/pingcap/kvproto/pkg/raft_cmdpb" + + raft_serverpb "github.com/pingcap/kvproto/pkg/raft_serverpb" + + kvrpcpb "github.com/pingcap/kvproto/pkg/kvrpcpb" + + coprocessor "github.com/pingcap/kvproto/pkg/coprocessor" + + pdpb "github.com/pingcap/kvproto/pkg/pdpb" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -98,16 +102,16 @@ func (MessageType) EnumDescriptor() ([]byte, []int) { return fileDescriptorMsgpb // Message holds all messages communicating with TiKV. type Message struct { - MsgType MessageType `protobuf:"varint,1,opt,name=msg_type,enum=msgpb.MessageType" json:"msg_type"` - CmdReq *raft_cmdpb.RaftCmdRequest `protobuf:"bytes,2,opt,name=cmd_req" json:"cmd_req,omitempty"` - CmdResp *raft_cmdpb.RaftCmdResponse `protobuf:"bytes,3,opt,name=cmd_resp" json:"cmd_resp,omitempty"` + MsgType MessageType `protobuf:"varint,1,opt,name=msg_type,json=msgType,enum=msgpb.MessageType" json:"msg_type"` + CmdReq *raft_cmdpb.RaftCmdRequest `protobuf:"bytes,2,opt,name=cmd_req,json=cmdReq" json:"cmd_req,omitempty"` + CmdResp *raft_cmdpb.RaftCmdResponse `protobuf:"bytes,3,opt,name=cmd_resp,json=cmdResp" json:"cmd_resp,omitempty"` Raft *raft_serverpb.RaftMessage `protobuf:"bytes,4,opt,name=raft" json:"raft,omitempty"` - KvReq *kvrpcpb.Request `protobuf:"bytes,5,opt,name=kv_req" json:"kv_req,omitempty"` - KvResp *kvrpcpb.Response `protobuf:"bytes,6,opt,name=kv_resp" json:"kv_resp,omitempty"` - CopReq *coprocessor.Request `protobuf:"bytes,7,opt,name=cop_req" json:"cop_req,omitempty"` - CopResp *coprocessor.Response `protobuf:"bytes,8,opt,name=cop_resp" json:"cop_resp,omitempty"` - PdReq *pdpb.Request `protobuf:"bytes,9,opt,name=pd_req" json:"pd_req,omitempty"` - PdResp *pdpb.Response `protobuf:"bytes,10,opt,name=pd_resp" json:"pd_resp,omitempty"` + KvReq *kvrpcpb.Request `protobuf:"bytes,5,opt,name=kv_req,json=kvReq" json:"kv_req,omitempty"` + KvResp *kvrpcpb.Response `protobuf:"bytes,6,opt,name=kv_resp,json=kvResp" json:"kv_resp,omitempty"` + CopReq *coprocessor.Request `protobuf:"bytes,7,opt,name=cop_req,json=copReq" json:"cop_req,omitempty"` + CopResp *coprocessor.Response `protobuf:"bytes,8,opt,name=cop_resp,json=copResp" json:"cop_resp,omitempty"` + PdReq *pdpb.Request `protobuf:"bytes,9,opt,name=pd_req,json=pdReq" json:"pd_req,omitempty"` + PdResp *pdpb.Response `protobuf:"bytes,10,opt,name=pd_resp,json=pdResp" json:"pd_resp,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -865,30 +869,33 @@ var ( func init() { proto.RegisterFile("msgpb.proto", fileDescriptorMsgpb) } var fileDescriptorMsgpb = []byte{ - // 399 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x91, 0xcf, 0xaa, 0xda, 0x40, - 0x14, 0xc6, 0x8d, 0xf9, 0x33, 0xf1, 0x04, 0x65, 0x9c, 0x5a, 0x08, 0x96, 0x46, 0x11, 0x4a, 0xc5, - 0xd2, 0x14, 0x7c, 0x04, 0x5d, 0x96, 0x16, 0x91, 0xee, 0xc5, 0x26, 0x63, 0x16, 0x12, 0xe7, 0x38, - 0x93, 0x06, 0xdc, 0xf4, 0x1d, 0xba, 0xeb, 0x23, 0xb9, 0xec, 0x13, 0x94, 0x8b, 0xf7, 0x45, 0x2e, - 0x33, 0x49, 0xbc, 0xe1, 0x72, 0x77, 0x27, 0xdf, 0xf7, 0x9b, 0x6f, 0x4e, 0xbe, 0x81, 0x20, 0x57, - 0x19, 0xfe, 0x8c, 0x51, 0x8a, 0x42, 0x30, 0xd7, 0x7c, 0x8c, 0xa9, 0xdc, 0x1f, 0x8a, 0x5d, 0x92, - 0xa7, 0x8d, 0x31, 0x7e, 0x63, 0x14, 0xc5, 0x65, 0xc9, 0xe5, 0x5d, 0xec, 0x1f, 0x4b, 0x89, 0xc9, - 0xfd, 0x73, 0x98, 0x08, 0x94, 0x22, 0xe1, 0x4a, 0x09, 0x59, 0x4b, 0x80, 0xcf, 0x11, 0xa3, 0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0x70, 0xe6, 0x83, 0xf3, 0x5d, 0x9c, 0x38, 0xed, 0x30, 0x02, 0xf6, 0x3a, - 0x4f, 0xa9, 0xc5, 0x02, 0x20, 0x75, 0x61, 0xb4, 0xab, 0x7d, 0xdd, 0x09, 0xb5, 0x59, 0x0f, 0xdc, - 0xaf, 0xe5, 0x96, 0x9f, 0xa9, 0xc3, 0x00, 0x3c, 0x3d, 0x2a, 0xa4, 0xae, 0x9e, 0xd7, 0x02, 0xb5, - 0xee, 0x99, 0x93, 0x7a, 0x56, 0x48, 0x89, 0xe6, 0x37, 0xfa, 0x91, 0xa8, 0xaf, 0x99, 0x4d, 0x15, - 0xd8, 0x5b, 0xd1, 0xeb, 0x2d, 0xb2, 0xfe, 0xdd, 0x22, 0xeb, 0xe1, 0x16, 0x59, 0x7f, 0x1f, 0xa3, - 0xce, 0x53, 0x00, 0x00, 0x00, 0xff, 0xff, 0x62, 0x73, 0xa8, 0x29, 0xa5, 0x02, 0x00, 0x00, + // 433 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x6a, 0xdb, 0x40, + 0x10, 0x86, 0xad, 0x58, 0xd2, 0xca, 0x63, 0x12, 0x36, 0xdb, 0x14, 0x84, 0x0b, 0x6e, 0x28, 0x85, + 0x84, 0x40, 0xd5, 0x92, 0x40, 0x1f, 0x20, 0x3e, 0x86, 0x96, 0x20, 0x7a, 0x37, 0xee, 0x7a, 0xa3, + 0x83, 0x51, 0x76, 0xb2, 0xa3, 0x1a, 0x72, 0xe9, 0x73, 0xf4, 0x91, 0x72, 0xec, 0x13, 0x94, 0xe0, + 0xbe, 0x48, 0xd9, 0x59, 0x49, 0x16, 0x25, 0xb7, 0x99, 0xd1, 0xf7, 0x8f, 0xfe, 0xf9, 0x17, 0xa6, + 0x35, 0x55, 0xf8, 0xbd, 0x40, 0x67, 0x1b, 0xab, 0x12, 0x6e, 0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+ 0x64, 0xeb, 0x22, 0xf5, 0x28, 0xa1, 0xfa, 0x00, 0x42, 0x5b, 0xe4, 0xad, 0x82, 0xd9, 0x93, 0x62, + 0x98, 0xfc, 0xfe, 0x56, 0x8b, 0x7e, 0xf5, 0x27, 0xc8, 0x02, 0x4e, 0x98, 0x67, 0xcc, 0xbf, 0xfe, + 0x8f, 0xef, 0xaf, 0xf4, 0x02, 0x42, 0xf5, 0x1e, 0x52, 0x0c, 0x89, 0x4e, 0x98, 0x3f, 0x2c, 0xf8, + 0x19, 0x7b, 0xcb, 0xc8, 0x19, 0x9e, 0x81, 0xc0, 0x36, 0x42, 0x60, 0xec, 0xa8, 0xc3, 0x3a, 0xbf, + 0xc8, 0xa1, 0x5d, 0xfc, 0x84, 0xe9, 0xe0, 0xfd, 0x54, 0x06, 0xf1, 0x57, 0x7b, 0x6f, 0xe4, 0x48, + 0x09, 0x18, 0x2f, 0xea, 0xb5, 0x8c, 0xd4, 0x14, 0x44, 0x1b, 0xb7, 0x3c, 0xf0, 0xdf, 0x7d, 0x90, + 0x72, 0xac, 0x26, 0x90, 0xdc, 0xf8, 0x74, 0x64, 0xac, 0x00, 0xd2, 0x1b, 0xbe, 0x5e, 0x26, 0xbe, + 0x5e, 0xf0, 0x69, 0x32, 0x65, 0x65, 0x70, 0x2d, 0x85, 0xe7, 0x6f, 0xbd, 0x35, 0x99, 0x79, 0xe6, + 0x36, 0x2c, 0x9c, 0x5c, 0xcb, 0xa7, 0xdd, 0x3c, 0xfa, 0xbd, 0x9b, 0x47, 0xcf, 0xbb, 0x79, 0xf4, + 0xeb, 0xef, 0x7c, 0xf4, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xfa, 0xfa, 0x65, 0xe4, 0xf4, 0x02, 0x00, + 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/pdpb/pdpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/pdpb/pdpb.pb.go index e22a1838f8212..3c4c449a5fe03 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/pdpb/pdpb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/pdpb/pdpb.pb.go @@ -61,10 +61,11 @@ import ( "math" proto "github.com/golang/protobuf/proto" -) -import metapb "github.com/pingcap/kvproto/pkg/metapb" -import eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" + metapb "github.com/pingcap/kvproto/pkg/metapb" + + eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -332,7 +333,7 @@ func (m *AllocIdResponse) GetId() uint64 { } type GetStoreRequest struct { - StoreId uint64 `protobuf:"varint,1,opt,name=store_id" json:"store_id"` + StoreId uint64 `protobuf:"varint,1,opt,name=store_id,json=storeId" json:"store_id"` XXX_unrecognized []byte `json:"-"` } @@ -366,7 +367,7 @@ func (m *GetStoreResponse) GetStore() *metapb.Store { } type GetRegionRequest struct { - RegionKey []byte `protobuf:"bytes,1,opt,name=region_key" json:"region_key,omitempty"` + RegionKey []byte `protobuf:"bytes,1,opt,name=region_key,json=regionKey" json:"region_key,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -408,7 +409,7 @@ func (m *GetRegionResponse) GetLeader() *metapb.Peer { } type GetRegionByIDRequest struct { - RegionId uint64 `protobuf:"varint,1,opt,name=region_id" json:"region_id"` + RegionId uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id"` XXX_unrecognized []byte `json:"-"` } @@ -478,8 +479,8 @@ func (*PutStoreResponse) Descriptor() ([]byte, []int) { return fileDescriptorPdp type PDMember struct { Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - ClientUrls []string `protobuf:"bytes,2,rep,name=client_urls" json:"client_urls,omitempty"` - PeerUrls []string `protobuf:"bytes,3,rep,name=peer_urls" json:"peer_urls,omitempty"` + ClientUrls []string `protobuf:"bytes,2,rep,name=client_urls,json=clientUrls" json:"client_urls,omitempty"` + PeerUrls []string `protobuf:"bytes,3,rep,name=peer_urls,json=peerUrls" json:"peer_urls,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -537,7 +538,7 @@ func (m *GetPDMembersResponse) GetMembers() []*PDMember { type PeerStats struct { Peer *metapb.Peer `protobuf:"bytes,1,opt,name=peer" json:"peer,omitempty"` - DownSeconds *uint64 `protobuf:"varint,2,opt,name=down_seconds" json:"down_seconds,omitempty"` + DownSeconds *uint64 `protobuf:"varint,2,opt,name=down_seconds,json=downSeconds" json:"down_seconds,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -565,7 +566,7 @@ type RegionHeartbeatRequest struct { // Leader Peer sending the heartbeat. Leader *metapb.Peer `protobuf:"bytes,2,opt,name=leader" json:"leader,omitempty"` // Leader considers that these peers are down. - DownPeers []*PeerStats `protobuf:"bytes,3,rep,name=down_peers" json:"down_peers,omitempty"` + DownPeers []*PeerStats `protobuf:"bytes,3,rep,name=down_peers,json=downPeers" json:"down_peers,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -596,7 +597,7 @@ func (m *RegionHeartbeatRequest) GetDownPeers() []*PeerStats { } type ChangePeer struct { - ChangeType *eraftpb.ConfChangeType `protobuf:"varint,1,opt,name=change_type,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` + ChangeType *eraftpb.ConfChangeType `protobuf:"varint,1,opt,name=change_type,json=changeType,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` Peer *metapb.Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -652,9 +653,9 @@ type RegionHeartbeatResponse struct { // 4. Leader may report old Peers (1), ConfVer (1) to pd before ConfChange // finished, pd stills responses ChangePeer Adding 2, of course, we must // guarantee the second ChangePeer can't be applied in TiKV. - ChangePeer *ChangePeer `protobuf:"bytes,1,opt,name=change_peer" json:"change_peer,omitempty"` + ChangePeer *ChangePeer `protobuf:"bytes,1,opt,name=change_peer,json=changePeer" json:"change_peer,omitempty"` // Pd can return transfer_leader to let TiKV does leader transfer itself. - TransferLeader *TransferLeader `protobuf:"bytes,2,opt,name=transfer_leader" json:"transfer_leader,omitempty"` + TransferLeader *TransferLeader `protobuf:"bytes,2,opt,name=transfer_leader,json=transferLeader" json:"transfer_leader,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -724,9 +725,9 @@ type AskSplitResponse struct { // We split the region into two, first uses the origin // parent region id, and the second uses the new_region_id. // We must guarantee that the new_region_id is global unique. - NewRegionId uint64 `protobuf:"varint,1,opt,name=new_region_id" json:"new_region_id"` + NewRegionId uint64 `protobuf:"varint,1,opt,name=new_region_id,json=newRegionId" json:"new_region_id"` // The peer ids for the new split region. - NewPeerIds []uint64 `protobuf:"varint,2,rep,name=new_peer_ids" json:"new_peer_ids,omitempty"` + NewPeerIds []uint64 `protobuf:"varint,2,rep,name=new_peer_ids,json=newPeerIds" json:"new_peer_ids,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -750,18 +751,22 @@ func (m *AskSplitResponse) GetNewPeerIds() []uint64 { } type StoreStats struct { - StoreId uint64 `protobuf:"varint,1,opt,name=store_id" json:"store_id"` + StoreId uint64 `protobuf:"varint,1,opt,name=store_id,json=storeId" json:"store_id"` // Capacity for the store. Capacity uint64 `protobuf:"varint,2,opt,name=capacity" json:"capacity"` // Available size for the store. Available uint64 `protobuf:"varint,3,opt,name=available" json:"available"` // Total region count in this store. - RegionCount uint32 `protobuf:"varint,4,opt,name=region_count" json:"region_count"` + RegionCount uint32 `protobuf:"varint,4,opt,name=region_count,json=regionCount" json:"region_count"` // Current sending snapshot count. - SendingSnapCount uint32 `protobuf:"varint,5,opt,name=sending_snap_count" json:"sending_snap_count"` + SendingSnapCount uint32 `protobuf:"varint,5,opt,name=sending_snap_count,json=sendingSnapCount" json:"sending_snap_count"` // Current receiving snapshot count. - ReceivingSnapCount uint32 `protobuf:"varint,6,opt,name=receiving_snap_count" json:"receiving_snap_count"` - XXX_unrecognized []byte `json:"-"` + ReceivingSnapCount uint32 `protobuf:"varint,6,opt,name=receiving_snap_count,json=receivingSnapCount" json:"receiving_snap_count"` + // When the store is started (unix timestamp in seconds). + StartTime uint32 `protobuf:"varint,7,opt,name=start_time,json=startTime" json:"start_time"` + // How many region is applying snapshot. + ApplyingSnapCount uint32 `protobuf:"varint,8,opt,name=applying_snap_count,json=applyingSnapCount" json:"applying_snap_count"` + XXX_unrecognized []byte `json:"-"` } func (m *StoreStats) Reset() { *m = StoreStats{} } @@ -811,6 +816,20 @@ func (m *StoreStats) GetReceivingSnapCount() uint32 { return 0 } +func (m *StoreStats) GetStartTime() uint32 { + if m != nil { + return m.StartTime + } + return 0 +} + +func (m *StoreStats) GetApplyingSnapCount() uint32 { + if m != nil { + return m.ApplyingSnapCount + } + return 0 +} + type StoreHeartbeatRequest struct { Stats *StoreStats `protobuf:"bytes,1,opt,name=stats" json:"stats,omitempty"` XXX_unrecognized []byte `json:"-"` @@ -874,7 +893,7 @@ func (*ReportSplitResponse) Descriptor() ([]byte, []int) { return fileDescriptor type RequestHeader struct { // 16 bytes, to distinguish request. Uuid []byte `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` - ClusterId uint64 `protobuf:"varint,2,opt,name=cluster_id" json:"cluster_id"` + ClusterId uint64 `protobuf:"varint,2,opt,name=cluster_id,json=clusterId" json:"cluster_id"` XXX_unrecognized []byte `json:"-"` } @@ -900,7 +919,7 @@ func (m *RequestHeader) GetClusterId() uint64 { type ResponseHeader struct { // 16 bytes, to distinguish request. Uuid []byte `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` - ClusterId uint64 `protobuf:"varint,2,opt,name=cluster_id" json:"cluster_id"` + ClusterId uint64 `protobuf:"varint,2,opt,name=cluster_id,json=clusterId" json:"cluster_id"` Error *Error `protobuf:"bytes,3,opt,name=error" json:"error,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -933,22 +952,22 @@ func (m *ResponseHeader) GetError() *Error { type Request struct { Header *RequestHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - CmdType CommandType `protobuf:"varint,2,opt,name=cmd_type,enum=pdpb.CommandType" json:"cmd_type"` + CmdType CommandType `protobuf:"varint,2,opt,name=cmd_type,json=cmdType,enum=pdpb.CommandType" json:"cmd_type"` Tso *TsoRequest `protobuf:"bytes,3,opt,name=tso" json:"tso,omitempty"` Bootstrap *BootstrapRequest `protobuf:"bytes,4,opt,name=bootstrap" json:"bootstrap,omitempty"` - IsBootstrapped *IsBootstrappedRequest `protobuf:"bytes,5,opt,name=is_bootstrapped" json:"is_bootstrapped,omitempty"` - AllocId *AllocIdRequest `protobuf:"bytes,6,opt,name=alloc_id" json:"alloc_id,omitempty"` - GetStore *GetStoreRequest `protobuf:"bytes,7,opt,name=get_store" json:"get_store,omitempty"` - PutStore *PutStoreRequest `protobuf:"bytes,8,opt,name=put_store" json:"put_store,omitempty"` - AskSplit *AskSplitRequest `protobuf:"bytes,9,opt,name=ask_split" json:"ask_split,omitempty"` - GetRegion *GetRegionRequest `protobuf:"bytes,10,opt,name=get_region" json:"get_region,omitempty"` - RegionHeartbeat *RegionHeartbeatRequest `protobuf:"bytes,11,opt,name=region_heartbeat" json:"region_heartbeat,omitempty"` - GetClusterConfig *GetClusterConfigRequest `protobuf:"bytes,12,opt,name=get_cluster_config" json:"get_cluster_config,omitempty"` - PutClusterConfig *PutClusterConfigRequest `protobuf:"bytes,13,opt,name=put_cluster_config" json:"put_cluster_config,omitempty"` - StoreHeartbeat *StoreHeartbeatRequest `protobuf:"bytes,14,opt,name=store_heartbeat" json:"store_heartbeat,omitempty"` - ReportSplit *ReportSplitRequest `protobuf:"bytes,15,opt,name=report_split" json:"report_split,omitempty"` - GetRegionById *GetRegionByIDRequest `protobuf:"bytes,16,opt,name=get_region_by_id" json:"get_region_by_id,omitempty"` - GetPdMembers *GetPDMembersRequest `protobuf:"bytes,17,opt,name=get_pd_members" json:"get_pd_members,omitempty"` + IsBootstrapped *IsBootstrappedRequest `protobuf:"bytes,5,opt,name=is_bootstrapped,json=isBootstrapped" json:"is_bootstrapped,omitempty"` + AllocId *AllocIdRequest `protobuf:"bytes,6,opt,name=alloc_id,json=allocId" json:"alloc_id,omitempty"` + GetStore *GetStoreRequest `protobuf:"bytes,7,opt,name=get_store,json=getStore" json:"get_store,omitempty"` + PutStore *PutStoreRequest `protobuf:"bytes,8,opt,name=put_store,json=putStore" json:"put_store,omitempty"` + AskSplit *AskSplitRequest `protobuf:"bytes,9,opt,name=ask_split,json=askSplit" json:"ask_split,omitempty"` + GetRegion *GetRegionRequest `protobuf:"bytes,10,opt,name=get_region,json=getRegion" json:"get_region,omitempty"` + RegionHeartbeat *RegionHeartbeatRequest `protobuf:"bytes,11,opt,name=region_heartbeat,json=regionHeartbeat" json:"region_heartbeat,omitempty"` + GetClusterConfig *GetClusterConfigRequest `protobuf:"bytes,12,opt,name=get_cluster_config,json=getClusterConfig" json:"get_cluster_config,omitempty"` + PutClusterConfig *PutClusterConfigRequest `protobuf:"bytes,13,opt,name=put_cluster_config,json=putClusterConfig" json:"put_cluster_config,omitempty"` + StoreHeartbeat *StoreHeartbeatRequest `protobuf:"bytes,14,opt,name=store_heartbeat,json=storeHeartbeat" json:"store_heartbeat,omitempty"` + ReportSplit *ReportSplitRequest `protobuf:"bytes,15,opt,name=report_split,json=reportSplit" json:"report_split,omitempty"` + GetRegionById *GetRegionByIDRequest `protobuf:"bytes,16,opt,name=get_region_by_id,json=getRegionById" json:"get_region_by_id,omitempty"` + GetPdMembers *GetPDMembersRequest `protobuf:"bytes,17,opt,name=get_pd_members,json=getPdMembers" json:"get_pd_members,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -1078,22 +1097,22 @@ func (m *Request) GetGetPdMembers() *GetPDMembersRequest { type Response struct { Header *ResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - CmdType CommandType `protobuf:"varint,2,opt,name=cmd_type,enum=pdpb.CommandType" json:"cmd_type"` + CmdType CommandType `protobuf:"varint,2,opt,name=cmd_type,json=cmdType,enum=pdpb.CommandType" json:"cmd_type"` Tso *TsoResponse `protobuf:"bytes,3,opt,name=tso" json:"tso,omitempty"` Bootstrap *BootstrapResponse `protobuf:"bytes,4,opt,name=bootstrap" json:"bootstrap,omitempty"` - IsBootstrapped *IsBootstrappedResponse `protobuf:"bytes,5,opt,name=is_bootstrapped" json:"is_bootstrapped,omitempty"` - AllocId *AllocIdResponse `protobuf:"bytes,6,opt,name=alloc_id" json:"alloc_id,omitempty"` - GetStore *GetStoreResponse `protobuf:"bytes,7,opt,name=get_store" json:"get_store,omitempty"` - PutStore *PutStoreResponse `protobuf:"bytes,8,opt,name=put_store" json:"put_store,omitempty"` - AskSplit *AskSplitResponse `protobuf:"bytes,9,opt,name=ask_split" json:"ask_split,omitempty"` - GetRegion *GetRegionResponse `protobuf:"bytes,10,opt,name=get_region" json:"get_region,omitempty"` - RegionHeartbeat *RegionHeartbeatResponse `protobuf:"bytes,11,opt,name=region_heartbeat" json:"region_heartbeat,omitempty"` - GetClusterConfig *GetClusterConfigResponse `protobuf:"bytes,12,opt,name=get_cluster_config" json:"get_cluster_config,omitempty"` - PutClusterConfig *PutClusterConfigResponse `protobuf:"bytes,13,opt,name=put_cluster_config" json:"put_cluster_config,omitempty"` - StoreHeartbeat *StoreHeartbeatResponse `protobuf:"bytes,14,opt,name=store_heartbeat" json:"store_heartbeat,omitempty"` - ReportSplit *ReportSplitResponse `protobuf:"bytes,15,opt,name=report_split" json:"report_split,omitempty"` - GetRegionById *GetRegionResponse `protobuf:"bytes,16,opt,name=get_region_by_id" json:"get_region_by_id,omitempty"` - GetPdMembers *GetPDMembersResponse `protobuf:"bytes,17,opt,name=get_pd_members" json:"get_pd_members,omitempty"` + IsBootstrapped *IsBootstrappedResponse `protobuf:"bytes,5,opt,name=is_bootstrapped,json=isBootstrapped" json:"is_bootstrapped,omitempty"` + AllocId *AllocIdResponse `protobuf:"bytes,6,opt,name=alloc_id,json=allocId" json:"alloc_id,omitempty"` + GetStore *GetStoreResponse `protobuf:"bytes,7,opt,name=get_store,json=getStore" json:"get_store,omitempty"` + PutStore *PutStoreResponse `protobuf:"bytes,8,opt,name=put_store,json=putStore" json:"put_store,omitempty"` + AskSplit *AskSplitResponse `protobuf:"bytes,9,opt,name=ask_split,json=askSplit" json:"ask_split,omitempty"` + GetRegion *GetRegionResponse `protobuf:"bytes,10,opt,name=get_region,json=getRegion" json:"get_region,omitempty"` + RegionHeartbeat *RegionHeartbeatResponse `protobuf:"bytes,11,opt,name=region_heartbeat,json=regionHeartbeat" json:"region_heartbeat,omitempty"` + GetClusterConfig *GetClusterConfigResponse `protobuf:"bytes,12,opt,name=get_cluster_config,json=getClusterConfig" json:"get_cluster_config,omitempty"` + PutClusterConfig *PutClusterConfigResponse `protobuf:"bytes,13,opt,name=put_cluster_config,json=putClusterConfig" json:"put_cluster_config,omitempty"` + StoreHeartbeat *StoreHeartbeatResponse `protobuf:"bytes,14,opt,name=store_heartbeat,json=storeHeartbeat" json:"store_heartbeat,omitempty"` + ReportSplit *ReportSplitResponse `protobuf:"bytes,15,opt,name=report_split,json=reportSplit" json:"report_split,omitempty"` + GetRegionById *GetRegionResponse `protobuf:"bytes,16,opt,name=get_region_by_id,json=getRegionById" json:"get_region_by_id,omitempty"` + GetPdMembers *GetPDMembersResponse `protobuf:"bytes,17,opt,name=get_pd_members,json=getPdMembers" json:"get_pd_members,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -1242,7 +1261,7 @@ func (*StoreIsTombstoneError) Descriptor() ([]byte, []int) { return fileDescript type Error struct { Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` Bootstrapped *BootstrappedError `protobuf:"bytes,2,opt,name=bootstrapped" json:"bootstrapped,omitempty"` - IsTombstone *StoreIsTombstoneError `protobuf:"bytes,3,opt,name=is_tombstone" json:"is_tombstone,omitempty"` + IsTombstone *StoreIsTombstoneError `protobuf:"bytes,3,opt,name=is_tombstone,json=isTombstone" json:"is_tombstone,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -2294,6 +2313,12 @@ func (m *StoreStats) MarshalTo(data []byte) (int, error) { data[i] = 0x30 i++ i = encodeVarintPdpb(data, i, uint64(m.ReceivingSnapCount)) + data[i] = 0x38 + i++ + i = encodeVarintPdpb(data, i, uint64(m.StartTime)) + data[i] = 0x40 + i++ + i = encodeVarintPdpb(data, i, uint64(m.ApplyingSnapCount)) if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } @@ -3387,6 +3412,8 @@ func (m *StoreStats) Size() (n int) { n += 1 + sovPdpb(uint64(m.RegionCount)) n += 1 + sovPdpb(uint64(m.SendingSnapCount)) n += 1 + sovPdpb(uint64(m.ReceivingSnapCount)) + n += 1 + sovPdpb(uint64(m.StartTime)) + n += 1 + sovPdpb(uint64(m.ApplyingSnapCount)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -6417,6 +6444,44 @@ func (m *StoreStats) Unmarshal(data []byte) error { break } } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + m.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + m.StartTime |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ApplyingSnapCount", wireType) + } + m.ApplyingSnapCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPdpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + m.ApplyingSnapCount |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipPdpb(data[iNdEx:]) @@ -8530,100 +8595,120 @@ var ( func init() { proto.RegisterFile("pdpb.proto", fileDescriptorPdpb) } var fileDescriptorPdpb = []byte{ - // 1509 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x57, 0xeb, 0x6e, 0x13, 0xc7, - 0x17, 0xc7, 0xf1, 0x75, 0x8f, 0x2f, 0x3b, 0x9e, 0x24, 0xb6, 0x31, 0x89, 0xc9, 0x7f, 0xf9, 0x97, - 0x26, 0x14, 0x92, 0x26, 0xa2, 0xa5, 0xd0, 0x56, 0x2a, 0x01, 0x04, 0x91, 0xa8, 0x14, 0x20, 0xea, - 0xd7, 0xd5, 0xda, 0x3b, 0x71, 0x56, 0xd8, 0xbb, 0xdb, 0x9d, 0x31, 0xc8, 0xed, 0x83, 0xb4, 0x8f, - 0xd0, 0x17, 0xa8, 0xfa, 0x0a, 0x7c, 0xec, 0x13, 0x54, 0x15, 0x7d, 0x91, 0x6a, 0x6e, 0xeb, 0xdd, - 0xf5, 0x3a, 0x02, 0xf5, 0x9b, 0xf7, 0xcc, 0xf9, 0x9d, 0xfb, 0x6f, 0xce, 0x18, 0x20, 0x74, 0xc3, - 0xe1, 0x7e, 0x18, 0x05, 0x2c, 0xc0, 0x25, 0xfe, 0xbb, 0xdf, 0x98, 0x12, 0xe6, 0x68, 0x59, 0xbf, - 0x49, 0x22, 0xe7, 0x9c, 0xc5, 0x9f, 0x1b, 0xe3, 0x60, 0x1c, 0x88, 0x9f, 0x07, 0xfc, 0x97, 0x94, - 0x5a, 0x07, 0x50, 0x79, 0x4e, 0x1c, 0x97, 0x44, 0x18, 0x43, 0xc9, 0x71, 0xdd, 0xa8, 0x57, 0xd8, - 0x29, 0xec, 0x1a, 0xc7, 0xa5, 0x77, 0x7f, 0x5d, 0xbf, 0x82, 0xdb, 0x50, 0x0c, 0x3d, 0xb7, 0xb7, - 0xb6, 0x53, 0xd8, 0x2d, 0x4a, 0x91, 0xf5, 0x3f, 0x80, 0x33, 0x1a, 0xbc, 0x24, 0x3f, 0xce, 0x08, - 0x65, 0x78, 0x1d, 0xca, 0xa3, 0x60, 0xe6, 0x33, 0x81, 0x6a, 0x2a, 0x95, 0x07, 0x60, 0x9c, 0x79, - 0x53, 0x42, 0x99, 0x33, 0x0d, 0x71, 0x07, 0x6a, 0xe1, 0xc5, 0x9c, 0x7a, 0x23, 0x67, 0x22, 0x94, - 0x94, 0x1d, 0xbc, 0x09, 0xd5, 0x49, 0x30, 0x16, 0xe2, 0xa4, 0xf9, 0xe7, 0x50, 0x17, 0xe6, 0x69, - 0x18, 0xf8, 0x94, 0xe4, 0xda, 0xc7, 0xbb, 0x60, 0x30, 0x6d, 0x5f, 0x80, 0xeb, 0x47, 0xe6, 0xbe, - 0x28, 0x46, 0xec, 0x56, 0x59, 0x3b, 0x05, 0x74, 0x1c, 0x04, 0x8c, 0xb2, 0xc8, 0x09, 0x75, 0xc8, - 0x5b, 0x50, 0xa6, 0x2c, 0x88, 0x88, 0x30, 0x59, 0x3f, 0x6a, 0xee, 0xab, 0xa2, 0xbd, 0xe2, 0x42, - 0x3c, 0x80, 0x4a, 0x44, 0xc6, 0x5e, 0xe0, 0x2b, 0xc3, 0x2d, 0x7d, 0xfc, 0x52, 0x48, 0xad, 0x75, - 0x68, 0x27, 0x2c, 0xca, 0x28, 0xad, 0x2e, 0x6c, 0x9e, 0xd0, 0x58, 0x1c, 0x12, 0x57, 0xf9, 0xb2, - 0xf6, 0xa1, 0x93, 0x3d, 0x50, 0x89, 0x6d, 0x40, 0x63, 0x98, 0x90, 0x8b, 0x60, 0x6a, 0x16, 0x82, - 0xd6, 0xc3, 0xc9, 0x24, 0x18, 0x9d, 0xc4, 0x16, 0x6e, 0x80, 0x19, 0x4b, 0x14, 0x14, 0xc1, 0x9a, - 0x27, 0x01, 0x25, 0x95, 0xe6, 0x1e, 0x98, 0x4f, 0x09, 0x13, 0x09, 0xe8, 0x2c, 0x3b, 0x50, 0x13, - 0x59, 0xda, 0x19, 0xd5, 0xcf, 0x01, 0x2d, 0x54, 0x95, 0xc1, 0x4b, 0x2b, 0x62, 0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0x6c, 0x42, 0x3d, 0x31, 0x0b, 0xa8, 0x89, 0xdb, 0xd0, 0x4c, 0xdd, 0x90, 0xa8, 0x85, 0x11, - 0x34, 0x92, 0x9d, 0x44, 0xe6, 0x31, 0x7a, 0xf7, 0x7e, 0x50, 0xf8, 0xf3, 0xfd, 0xa0, 0xf0, 0xf7, - 0xfb, 0x41, 0xe1, 0xd7, 0x7f, 0x06, 0x57, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x61, 0x46, 0x22, - 0x55, 0x09, 0x11, 0x00, 0x00, + // 1825 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x58, 0xdb, 0x8e, 0xdb, 0xc6, + 0x19, 0xb6, 0x4e, 0x2b, 0xf2, 0xa7, 0x0e, 0xdc, 0xd9, 0x93, 0xbc, 0xb1, 0xd7, 0xeb, 0x71, 0xd0, + 0x6c, 0x0f, 0xd8, 0x34, 0x72, 0xe2, 0x36, 0x6d, 0xda, 0x38, 0x5e, 0x1b, 0xb6, 0x10, 0x07, 0x58, + 0xcc, 0x6e, 0xef, 0x0a, 0x13, 0x5c, 0x71, 0xac, 0x25, 0x4c, 0x91, 0x2c, 0x67, 0x64, 0x43, 0x4f, + 0xd0, 0x8b, 0xde, 0xb7, 0xbd, 0xea, 0xf3, 0xe4, 0xb2, 0x4f, 0x50, 0x14, 0xce, 0x5b, 0xf4, 0xaa, + 0x98, 0x13, 0x4f, 0x92, 0x9c, 0x04, 0xce, 0x1d, 0xe7, 0xfb, 0x0f, 0x33, 0xf3, 0x1f, 0xbe, 0xf9, + 0x25, 0x80, 0x34, 0x48, 0xaf, 0x4e, 0xd3, 0x2c, 0xe1, 0x09, 0x6a, 0x8b, 0xef, 0xc3, 0xde, 0x9c, + 0x72, 0xdf, 0x60, 0x87, 0x7d, 0x9a, 0xf9, 0x2f, 0x79, 0xbe, 0xdc, 0x9d, 0x25, 0xb3,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x3b, 0xb0, 0x5d, 0xda, 0x40, 0x5d, 0x03, 0x1f, 0xc0, 0xde, 0x84, 0xe5, + 0x70, 0x4a, 0x03, 0xbd, 0x35, 0xfe, 0x02, 0xf6, 0xeb, 0x02, 0x7d, 0x73, 0x0c, 0xbd, 0xab, 0x12, + 0x2e, 0xcf, 0x66, 0x91, 0x0a, 0x86, 0x5d, 0x18, 0x7c, 0x15, 0x45, 0xc9, 0x74, 0x92, 0xfb, 0xfb, + 0x08, 0x86, 0x39, 0xa2, 0x1d, 0xed, 0x42, 0x33, 0x54, 0xe6, 0x6d, 0x1d, 0x8e, 0x66, 0x18, 0xe0, + 0x31, 0x0c, 0x9f, 0x52, 0xae, 0x6e, 0xa8, 0xc3, 0x70, 0x07, 0x2c, 0x79, 0x55, 0xaf, 0xa6, 0xde, + 0x95, 0xe8, 0x24, 0xc0, 0xbf, 0x01, 0xb7, 0xb0, 0xd1, 0xde, 0x7f, 0x48, 0xec, 0xf0, 0x27, 0xd2, + 0x50, 0x07, 0x4a, 0xef, 0x76, 0x1b, 0x40, 0x45, 0xcc, 0x7b, 0x45, 0x97, 0xd2, 0xba, 0x47, 0x6c, + 0x85, 0x7c, 0x4d, 0x97, 0xd8, 0x87, 0xed, 0x92, 0x89, 0xde, 0xac, 0xc8, 0x41, 0xe3, 0x5d, 0x39, + 0x40, 0x1f, 0xc2, 0x56, 0x24, 0x2b, 0x5f, 0xe7, 0xaa, 0x67, 0xf4, 0xce, 0x29, 0xcd, 0x88, 0x96, + 0xe1, 0xcf, 0x61, 0x37, 0xdf, 0xe2, 0xd1, 0x72, 0xf2, 0xd8, 0x9c, 0xec, 0x2e, 0xe8, 0x73, 0xd4, + 0x03, 0x61, 0x29, 0x78, 0x12, 0xe0, 0x9b, 0x70, 0xf0, 0x94, 0xf2, 0xb3, 0x68, 0xc1, 0x38, 0xcd, + 0xce, 0x92, 0xf8, 0x65, 0x38, 0x33, 0x19, 0x78, 0x02, 0xa3, 0x55, 0x91, 0x3e, 0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xbf, 0xde, 0xf6, 0x19, 0xf4, 0xf5, 0x5e, 0xcf, 0x54, 0xd7, 0x23, 0x68, 0x2f, 0x16, 0xba, 0x6a, + 0x7a, 0x44, 0x7e, 0x8b, 0x88, 0xea, 0xf6, 0xf0, 0xf4, 0x4c, 0x98, 0xd7, 0x82, 0xc6, 0x27, 0x01, + 0x8e, 0x60, 0x60, 0xbc, 0xbe, 0xa7, 0x2b, 0x74, 0x17, 0x3a, 0x34, 0xcb, 0x92, 0x4c, 0x96, 0x9d, + 0x33, 0x76, 0x54, 0x34, 0x9f, 0x08, 0x88, 0x28, 0x09, 0xfe, 0x5f, 0x17, 0xba, 0x26, 0x48, 0xbf, + 0x84, 0xad, 0x6b, 0x45, 0x17, 0x2a, 0x4c, 0x3b, 0x4a, 0xbf, 0x72, 0x2f, 0xa2, 0x55, 0xd0, 0x18, + 0xac, 0xe9, 0x3c, 0x50, 0x04, 0xda, 0x94, 0x04, 0xba, 0xad, 0x49, 0x29, 0x99, 0xcf, 0xfd, 0x38, + 0x10, 0x74, 0x69, 0x9a, 0x65, 0x3a, 0x97, 0x4b, 0x84, 0xa1, 0xc5, 0x59, 0xa2, 0x4f, 0xa3, 0x73, + 0x5b, 0x4c, 0xc1, 0x44, 0x08, 0xd1, 0xa7, 0x60, 0xe7, 0x23, 0x98, 0xec, 0x03, 0x67, 0xbc, 0xaf, + 0x34, 0xeb, 0x63, 0x25, 0x29, 0x14, 0xd1, 0x63, 0x18, 0x86, 0xcc, 0xab, 0xcc, 0x73, 0x1d, 0x69, + 0xfb, 0x81, 0xb2, 0x5d, 0x3b, 0x1c, 0x92, 0x41, 0x58, 0x81, 0xd1, 0xc7, 0x60, 0xf9, 0x62, 0xb8, + 0x13, 0x21, 0xdd, 0x2a, 0x33, 0x66, 0x75, 0x08, 0x24, 0x5d, 0x5f, 0xad, 0xd1, 0x18, 0xec, 0x19, + 0xe5, 0x9e, 0x9a, 0x1a, 0xba, 0xd2, 0x62, 0x4f, 0x59, 0xd4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1, 0x29, 0x95, 0x96, + 0xdb, 0x47, 0xdb, 0xd0, 0xaf, 0xbc, 0x1a, 0xee, 0x00, 0xb9, 0xd0, 0x2b, 0x27, 0xdf, 0x1d, 0x3e, + 0x72, 0xbf, 0x7d, 0x7b, 0xd4, 0xf8, 0xf7, 0xdb, 0xa3, 0xc6, 0x7f, 0xdf, 0x1e, 0x35, 0xfe, 0xf9, + 0xdd, 0xd1, 0x8d, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x20, 0x52, 0xe7, 0x15, 0x0b, 0x15, 0x00, + 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go index 18d7deb7adb87..4c4a89cef73ff 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_cmdpb/raft_cmdpb.pb.go @@ -48,11 +48,13 @@ import ( "math" proto "github.com/golang/protobuf/proto" -) -import metapb "github.com/pingcap/kvproto/pkg/metapb" -import errorpb "github.com/pingcap/kvproto/pkg/errorpb" -import eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" + metapb "github.com/pingcap/kvproto/pkg/metapb" + + errorpb "github.com/pingcap/kvproto/pkg/errorpb" + + eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -333,7 +335,7 @@ func (m *SnapResponse) GetRegion() *metapb.Region { } type Request struct { - CmdType *CmdType `protobuf:"varint,1,opt,name=cmd_type,enum=raft_cmdpb.CmdType" json:"cmd_type,omitempty"` + CmdType *CmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.CmdType" json:"cmd_type,omitempty"` Get *GetRequest `protobuf:"bytes,2,opt,name=get" json:"get,omitempty"` Put *PutRequest `protobuf:"bytes,4,opt,name=put" json:"put,omitempty"` Delete *DeleteRequest `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"` @@ -382,7 +384,7 @@ func (m *Request) GetSnap() *SnapRequest { } type Response struct { - CmdType *CmdType `protobuf:"varint,1,opt,name=cmd_type,enum=raft_cmdpb.CmdType" json:"cmd_type,omitempty"` + CmdType *CmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.CmdType" json:"cmd_type,omitempty"` Get *GetResponse `protobuf:"bytes,2,opt,name=get" json:"get,omitempty"` Put *PutResponse `protobuf:"bytes,4,opt,name=put" json:"put,omitempty"` Delete *DeleteResponse `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"` @@ -432,7 +434,7 @@ func (m *Response) GetSnap() *SnapResponse { type ChangePeerRequest struct { // This can be only called in internal RaftStore now. - ChangeType *eraftpb.ConfChangeType `protobuf:"varint,1,opt,name=change_type,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` + ChangeType *eraftpb.ConfChangeType `protobuf:"varint,1,opt,name=change_type,json=changeType,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` Peer *metapb.Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -476,13 +478,13 @@ func (m *ChangePeerResponse) GetRegion() *metapb.Region { type SplitRequest struct { // This can be only called in internal RaftStore now. // The split_key must be in the been splitting region. - SplitKey []byte `protobuf:"bytes,1,opt,name=split_key" json:"split_key,omitempty"` + SplitKey []byte `protobuf:"bytes,1,opt,name=split_key,json=splitKey" json:"split_key,omitempty"` // We split the region into two, first uses the origin // parent region id, and the second uses the new_region_id. // We must guarantee that the new_region_id is global unique. - NewRegionId *uint64 `protobuf:"varint,2,opt,name=new_region_id" json:"new_region_id,omitempty"` + NewRegionId *uint64 `protobuf:"varint,2,opt,name=new_region_id,json=newRegionId" json:"new_region_id,omitempty"` // The peer ids for the new split region. - NewPeerIds []uint64 `protobuf:"varint,3,rep,name=new_peer_ids" json:"new_peer_ids,omitempty"` + NewPeerIds []uint64 `protobuf:"varint,3,rep,name=new_peer_ids,json=newPeerIds" json:"new_peer_ids,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -538,7 +540,7 @@ func (m *SplitResponse) GetRight() *metapb.Region { } type CompactLogRequest struct { - CompactIndex *uint64 `protobuf:"varint,1,opt,name=compact_index" json:"compact_index,omitempty"` + CompactIndex *uint64 `protobuf:"varint,1,opt,name=compact_index,json=compactIndex" json:"compact_index,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -590,11 +592,11 @@ func (*TransferLeaderResponse) ProtoMessage() {} func (*TransferLeaderResponse) Descriptor() ([]byte, []int) { return fileDescriptorRaftCmdpb, []int{17} } type AdminRequest struct { - CmdType *AdminCmdType `protobuf:"varint,1,opt,name=cmd_type,enum=raft_cmdpb.AdminCmdType" json:"cmd_type,omitempty"` - ChangePeer *ChangePeerRequest `protobuf:"bytes,2,opt,name=change_peer" json:"change_peer,omitempty"` + CmdType *AdminCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.AdminCmdType" json:"cmd_type,omitempty"` + ChangePeer *ChangePeerRequest `protobuf:"bytes,2,opt,name=change_peer,json=changePeer" json:"change_peer,omitempty"` Split *SplitRequest `protobuf:"bytes,3,opt,name=split" json:"split,omitempty"` - CompactLog *CompactLogRequest `protobuf:"bytes,4,opt,name=compact_log" json:"compact_log,omitempty"` - TransferLeader *TransferLeaderRequest `protobuf:"bytes,5,opt,name=transfer_leader" json:"transfer_leader,omitempty"` + CompactLog *CompactLogRequest `protobuf:"bytes,4,opt,name=compact_log,json=compactLog" json:"compact_log,omitempty"` + TransferLeader *TransferLeaderRequest `protobuf:"bytes,5,opt,name=transfer_leader,json=transferLeader" json:"transfer_leader,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -639,11 +641,11 @@ func (m *AdminRequest) GetTransferLeader() *TransferLeaderRequest { } type AdminResponse struct { - CmdType *AdminCmdType `protobuf:"varint,1,opt,name=cmd_type,enum=raft_cmdpb.AdminCmdType" json:"cmd_type,omitempty"` - ChangePeer *ChangePeerResponse `protobuf:"bytes,2,opt,name=change_peer" json:"change_peer,omitempty"` + CmdType *AdminCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.AdminCmdType" json:"cmd_type,omitempty"` + ChangePeer *ChangePeerResponse `protobuf:"bytes,2,opt,name=change_peer,json=changePeer" json:"change_peer,omitempty"` Split *SplitResponse `protobuf:"bytes,3,opt,name=split" json:"split,omitempty"` - CompactLog *CompactLogResponse `protobuf:"bytes,4,opt,name=compact_log" json:"compact_log,omitempty"` - TransferLeader *TransferLeaderResponse `protobuf:"bytes,5,opt,name=transfer_leader" json:"transfer_leader,omitempty"` + CompactLog *CompactLogResponse `protobuf:"bytes,4,opt,name=compact_log,json=compactLog" json:"compact_log,omitempty"` + TransferLeader *TransferLeaderResponse `protobuf:"bytes,5,opt,name=transfer_leader,json=transferLeader" json:"transfer_leader,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -758,9 +760,9 @@ func (m *RegionDetailResponse) GetLeader() *metapb.Peer { } type StatusRequest struct { - CmdType *StatusCmdType `protobuf:"varint,1,opt,name=cmd_type,enum=raft_cmdpb.StatusCmdType" json:"cmd_type,omitempty"` - RegionLeader *RegionLeaderRequest `protobuf:"bytes,2,opt,name=region_leader" json:"region_leader,omitempty"` - RegionDetail *RegionDetailRequest `protobuf:"bytes,3,opt,name=region_detail" json:"region_detail,omitempty"` + CmdType *StatusCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.StatusCmdType" json:"cmd_type,omitempty"` + RegionLeader *RegionLeaderRequest `protobuf:"bytes,2,opt,name=region_leader,json=regionLeader" json:"region_leader,omitempty"` + RegionDetail *RegionDetailRequest `protobuf:"bytes,3,opt,name=region_detail,json=regionDetail" json:"region_detail,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -791,9 +793,9 @@ func (m *StatusRequest) GetRegionDetail() *RegionDetailRequest { } type StatusResponse struct { - CmdType *StatusCmdType `protobuf:"varint,1,opt,name=cmd_type,enum=raft_cmdpb.StatusCmdType" json:"cmd_type,omitempty"` - RegionLeader *RegionLeaderResponse `protobuf:"bytes,2,opt,name=region_leader" json:"region_leader,omitempty"` - RegionDetail *RegionDetailResponse `protobuf:"bytes,3,opt,name=region_detail" json:"region_detail,omitempty"` + CmdType *StatusCmdType `protobuf:"varint,1,opt,name=cmd_type,json=cmdType,enum=raft_cmdpb.StatusCmdType" json:"cmd_type,omitempty"` + RegionLeader *RegionLeaderResponse `protobuf:"bytes,2,opt,name=region_leader,json=regionLeader" json:"region_leader,omitempty"` + RegionDetail *RegionDetailResponse `protobuf:"bytes,3,opt,name=region_detail,json=regionDetail" json:"region_detail,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -824,13 +826,13 @@ func (m *StatusResponse) GetRegionDetail() *RegionDetailResponse { } type RaftRequestHeader struct { - RegionId *uint64 `protobuf:"varint,1,opt,name=region_id" json:"region_id,omitempty"` + RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` Peer *metapb.Peer `protobuf:"bytes,2,opt,name=peer" json:"peer,omitempty"` // true for read linearization - ReadQuorum *bool `protobuf:"varint,3,opt,name=read_quorum" json:"read_quorum,omitempty"` + ReadQuorum *bool `protobuf:"varint,3,opt,name=read_quorum,json=readQuorum" json:"read_quorum,omitempty"` // 16 bytes, to distinguish request. Uuid []byte `protobuf:"bytes,4,opt,name=uuid" json:"uuid,omitempty"` - RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch" json:"region_epoch,omitempty"` + RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -877,7 +879,7 @@ func (m *RaftRequestHeader) GetRegionEpoch() *metapb.RegionEpoch { type RaftResponseHeader struct { Error *errorpb.Error `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` Uuid []byte `protobuf:"bytes,2,opt,name=uuid" json:"uuid,omitempty"` - CurrentTerm *uint64 `protobuf:"varint,3,opt,name=current_term" json:"current_term,omitempty"` + CurrentTerm *uint64 `protobuf:"varint,3,opt,name=current_term,json=currentTerm" json:"current_term,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -912,8 +914,8 @@ type RaftCmdRequest struct { // We can't enclose normal requests and administrator request // at same time. Requests []*Request `protobuf:"bytes,2,rep,name=requests" json:"requests,omitempty"` - AdminRequest *AdminRequest `protobuf:"bytes,3,opt,name=admin_request" json:"admin_request,omitempty"` - StatusRequest *StatusRequest `protobuf:"bytes,4,opt,name=status_request" json:"status_request,omitempty"` + AdminRequest *AdminRequest `protobuf:"bytes,3,opt,name=admin_request,json=adminRequest" json:"admin_request,omitempty"` + StatusRequest *StatusRequest `protobuf:"bytes,4,opt,name=status_request,json=statusRequest" json:"status_request,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -953,8 +955,8 @@ func (m *RaftCmdRequest) GetStatusRequest() *StatusRequest { type RaftCmdResponse struct { Header *RaftResponseHeader `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` Responses []*Response `protobuf:"bytes,2,rep,name=responses" json:"responses,omitempty"` - AdminResponse *AdminResponse `protobuf:"bytes,3,opt,name=admin_response" json:"admin_response,omitempty"` - StatusResponse *StatusResponse `protobuf:"bytes,4,opt,name=status_response" json:"status_response,omitempty"` + AdminResponse *AdminResponse `protobuf:"bytes,3,opt,name=admin_response,json=adminResponse" json:"admin_response,omitempty"` + StatusResponse *StatusResponse `protobuf:"bytes,4,opt,name=status_response,json=statusResponse" json:"status_response,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -6310,74 +6312,85 @@ var ( func init() { proto.RegisterFile("raft_cmdpb.proto", fileDescriptorRaftCmdpb) } var fileDescriptorRaftCmdpb = []byte{ - // 1100 bytes of a gzipped FileDescriptor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ff, 0x16, 0xed, 0xf5, 0xa8, 0x73, 0x0c, 0x00, 0x00, + // 1269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x73, 0xdb, 0x44, + 0x14, 0x8f, 0x6c, 0xd9, 0x71, 0x9e, 0x25, 0x57, 0xd9, 0xa6, 0x8d, 0xdb, 0x0e, 0xae, 0xab, 0x66, + 0x98, 0x34, 0x30, 0xee, 0x34, 0x40, 0xa6, 0xcc, 0x94, 0x16, 0x70, 0x42, 0x09, 0xed, 0x21, 0x6c, + 0x72, 0xe1, 0xa4, 0x11, 0xd2, 0xda, 0xf1, 0x60, 0x4b, 0x8a, 0x24, 0x37, 0xe4, 0xce, 0x87, 0xe0, + 0xdb, 0xf4, 0xc2, 0x81, 0x23, 0xcc, 0xf0, 0x01, 0x98, 0x70, 0xe6, 0xc2, 0x8d, 0x1b, 0xa3, 0xfd, + 0x23, 0xed, 0x5a, 0x72, 0x69, 0x7a, 0xb2, 0xf7, 0xed, 0xdb, 0xdf, 0x7b, 0xbf, 0xdf, 0xbe, 0xb7, + 0x4f, 0x60, 0xc5, 0xee, 0x28, 0x75, 0xbc, 0x99, 0x1f, 0x7d, 0x3f, 0x88, 0xe2, 0x30, 0x0d, 0x11, + 0x14, 0x96, 0xdb, 0xc6, 0x8c, 0xa4, 0xae, 0xd8, 0xb9, 0x6d, 0x92, 0x38, 0x0e, 0x63, 0x79, 0xe9, + 0x8e, 0x52, 0xb1, 0xb4, 0x07, 0x00, 0xcf, 0x49, 0x8a, 0xc9, 0xd9, 0x9c, 0x24, 0x29, 0xea, 0x40, + 0xcd, 0x1b, 0x75, 0xb5, 0xbe, 0xb6, 0xbd, 0x86, 0x6b, 0xde, 0x08, 0x59, 0x50, 0xff, 0x81, 0x5c, + 0x74, 0x6b, 0x7d, 0x6d, 0xdb, 0xc0, 0xd9, 0x5f, 0xfb, 0x3e, 0xb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0xc0, 0x0e, 0x00, 0x00, } diff --git a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go index ac9a1c434b328..74469f54d4763 100644 --- a/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go +++ b/_vendor/src/github.com/pingcap/kvproto/pkg/raft_serverpb/raft_serverpb.pb.go @@ -26,10 +26,11 @@ import ( "math" proto "github.com/golang/protobuf/proto" -) -import eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" -import metapb "github.com/pingcap/kvproto/pkg/metapb" + eraftpb "github.com/pingcap/kvproto/pkg/eraftpb" + + metapb "github.com/pingcap/kvproto/pkg/metapb" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -80,13 +81,16 @@ func (x *PeerState) UnmarshalJSON(data []byte) error { func (PeerState) EnumDescriptor() ([]byte, []int) { return fileDescriptorRaftServerpb, []int{0} } type RaftMessage struct { - RegionId *uint64 `protobuf:"varint,1,opt,name=region_id" json:"region_id,omitempty"` - FromPeer *metapb.Peer `protobuf:"bytes,2,opt,name=from_peer" json:"from_peer,omitempty"` - ToPeer *metapb.Peer `protobuf:"bytes,3,opt,name=to_peer" json:"to_peer,omitempty"` + RegionId *uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId" json:"region_id,omitempty"` + FromPeer *metapb.Peer `protobuf:"bytes,2,opt,name=from_peer,json=fromPeer" json:"from_peer,omitempty"` + ToPeer *metapb.Peer `protobuf:"bytes,3,opt,name=to_peer,json=toPeer" json:"to_peer,omitempty"` Message *eraftpb.Message `protobuf:"bytes,4,opt,name=message" json:"message,omitempty"` - RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch" json:"region_epoch,omitempty"` + RegionEpoch *metapb.RegionEpoch `protobuf:"bytes,5,opt,name=region_epoch,json=regionEpoch" json:"region_epoch,omitempty"` // true means to_peer is a tombstone peer and it should remove itself. - IsTombstone *bool `protobuf:"varint,6,opt,name=is_tombstone" json:"is_tombstone,omitempty"` + IsTombstone *bool `protobuf:"varint,6,opt,name=is_tombstone,json=isTombstone" json:"is_tombstone,omitempty"` + // Region key range [start_key, end_key). + StartKey []byte `protobuf:"bytes,7,opt,name=start_key,json=startKey" json:"start_key,omitempty"` + EndKey []byte `protobuf:"bytes,8,opt,name=end_key,json=endKey" json:"end_key,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -137,6 +141,20 @@ func (m *RaftMessage) GetIsTombstone() bool { return false } +func (m *RaftMessage) GetStartKey() []byte { + if m != nil { + return m.StartKey + } + return nil +} + +func (m *RaftMessage) GetEndKey() []byte { + if m != nil { + return m.EndKey + } + return nil +} + type RaftTruncatedState struct { Index *uint64 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` Term *uint64 `protobuf:"varint,2,opt,name=term" json:"term,omitempty"` @@ -189,7 +207,7 @@ func (m *KeyValue) GetValue() []byte { type RaftSnapshotData struct { Region *metapb.Region `protobuf:"bytes,1,opt,name=region" json:"region,omitempty"` - FileSize *uint64 `protobuf:"varint,2,opt,name=file_size" json:"file_size,omitempty"` + FileSize *uint64 `protobuf:"varint,2,opt,name=file_size,json=fileSize" json:"file_size,omitempty"` Data []*KeyValue `protobuf:"bytes,3,rep,name=data" json:"data,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -221,8 +239,8 @@ func (m *RaftSnapshotData) GetData() []*KeyValue { } type StoreIdent struct { - ClusterId *uint64 `protobuf:"varint,1,opt,name=cluster_id" json:"cluster_id,omitempty"` - StoreId *uint64 `protobuf:"varint,2,opt,name=store_id" json:"store_id,omitempty"` + ClusterId *uint64 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId" json:"cluster_id,omitempty"` + StoreId *uint64 `protobuf:"varint,2,opt,name=store_id,json=storeId" json:"store_id,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -246,8 +264,8 @@ func (m *StoreIdent) GetStoreId() uint64 { } type RaftLocalState struct { - HardState *eraftpb.HardState `protobuf:"bytes,1,opt,name=hard_state" json:"hard_state,omitempty"` - LastIndex *uint64 `protobuf:"varint,2,opt,name=last_index" json:"last_index,omitempty"` + HardState *eraftpb.HardState `protobuf:"bytes,1,opt,name=hard_state,json=hardState" json:"hard_state,omitempty"` + LastIndex *uint64 `protobuf:"varint,2,opt,name=last_index,json=lastIndex" json:"last_index,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -271,8 +289,8 @@ func (m *RaftLocalState) GetLastIndex() uint64 { } type RaftApplyState struct { - AppliedIndex *uint64 `protobuf:"varint,1,opt,name=applied_index" json:"applied_index,omitempty"` - TruncatedState *RaftTruncatedState `protobuf:"bytes,2,opt,name=truncated_state" json:"truncated_state,omitempty"` + AppliedIndex *uint64 `protobuf:"varint,1,opt,name=applied_index,json=appliedIndex" json:"applied_index,omitempty"` + TruncatedState *RaftTruncatedState `protobuf:"bytes,2,opt,name=truncated_state,json=truncatedState" json:"truncated_state,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -401,6 +419,18 @@ func (m *RaftMessage) MarshalTo(data []byte) (int, error) { } i++ } + if m.StartKey != nil { + data[i] = 0x3a + i++ + i = encodeVarintRaftServerpb(data, i, uint64(len(m.StartKey))) + i += copy(data[i:], m.StartKey) + } + if m.EndKey != nil { + data[i] = 0x42 + i++ + i = encodeVarintRaftServerpb(data, i, uint64(len(m.EndKey))) + i += copy(data[i:], m.EndKey) + } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } @@ -710,6 +740,14 @@ func (m *RaftMessage) Size() (n int) { if m.IsTombstone != nil { n += 2 } + if m.StartKey != nil { + l = len(m.StartKey) + n += 1 + l + sovRaftServerpb(uint64(l)) + } + if m.EndKey != nil { + l = len(m.EndKey) + n += 1 + l + sovRaftServerpb(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1048,6 +1086,68 @@ func (m *RaftMessage) Unmarshal(data []byte) error { } b := bool(v != 0) m.IsTombstone = &b + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = append(m.StartKey[:0], data[iNdEx:postIndex]...) + if m.StartKey == nil { + m.StartKey = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRaftServerpb + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := data[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthRaftServerpb + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndKey = append(m.EndKey[:0], data[iNdEx:postIndex]...) + if m.EndKey == nil { + m.EndKey = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRaftServerpb(data[iNdEx:]) @@ -1920,37 +2020,44 @@ var ( func init() { proto.RegisterFile("raft_serverpb.proto", fileDescriptorRaftServerpb) } var fileDescriptorRaftServerpb = []byte{ - // 499 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x52, 0xc1, 0x6e, 0xd3, 0x40, - 0x14, 0xac, 0x1b, 0x27, 0x4d, 0x5e, 0xec, 0x60, 0xb6, 0x20, 0xac, 0x4a, 0x98, 0xd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, 0x6a, 0x9d, 0xcf, 0xe1, - 0x16, 0xb5, 0x7d, 0x37, 0x3f, 0x99, 0xed, 0x38, 0xbe, 0x16, 0xee, 0xff, 0xc9, 0x84, 0x9f, 0xc1, - 0x33, 0x55, 0x5d, 0x31, 0xfd, 0x08, 0xba, 0x5b, 0xbf, 0xa3, 0xc8, 0xbf, 0xa6, 0xa2, 0x77, 0xc9, - 0x10, 0xb7, 0xed, 0xef, 0xdf, 0xd4, 0xfe, 0x93, 0x67, 0x30, 0xd8, 0x92, 0x01, 0x7a, 0x1f, 0x84, - 0x2c, 0x78, 0xee, 0xed, 0x31, 0x07, 0xfa, 0x75, 0xac, 0xac, 0x5c, 0x78, 0x16, 0x73, 0x61, 0x70, - 0xde, 0xae, 0x91, 0xb7, 0xff, 0xd2, 0xfb, 0xb9, 0x09, 0xac, 0x5f, 0x9b, 0xc0, 0xfa, 0xbd, 0x09, - 0xac, 0xef, 0x7f, 0x82, 0xbd, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x8d, 0xfd, 0xb6, 0x5d, - 0x03, 0x00, 0x00, + // 615 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x53, 0xdf, 0x6a, 0x13, 0x4f, + 0x14, 0xee, 0x26, 0x69, 0xb2, 0x7b, 0xb2, 0xc9, 0x6f, 0x99, 0xfe, 0xa0, 0x6b, 0xc5, 0x90, 0xae, + 0x28, 0xb1, 0x42, 0xc0, 0x20, 0x5e, 0x0a, 0x8a, 0x8a, 0xb1, 0x2a, 0x32, 0x29, 0xde, 0x2e, 0xd3, + 0xec, 0x49, 0xb3, 0xba, 0xbb, 0xb3, 0xcc, 0x4c, 0x8b, 0xe9, 0x9d, 0xe0, 0x43, 0xf8, 0x2a, 0xbe, + 0x81, 0x97, 0x3e, 0x82, 0xd4, 0x17, 0x91, 0x99, 0xd9, 0x6d, 0x93, 0x2a, 0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, 0xd7, 0x7c, 0xce, 0x32, 0x2b, 0xdf, 0x03, + 0x80, 0x25, 0x13, 0x49, 0x2c, 0xb5, 0x55, 0xcd, 0x43, 0x2e, 0x8f, 0xe2, 0x25, 0x13, 0x56, 0x66, + 0xea, 0x2d, 0xeb, 0xa7, 0x2e, 0x9f, 0x31, 0xa9, 0x62, 0x2b, 0xbb, 0xad, 0xe0, 0x69, 0x64, 0xaa, + 0x81, 0xe8, 0xb3, 0x63, 0x8b, 0x3c, 0x29, 0xcb, 0x6c, 0x65, 0x23, 0x6e, 0x43, 0x8f, 0x95, 0x65, + 0x96, 0x62, 0x12, 0xaf, 0xef, 0xca, 0xaf, 0x40, 0x13, 0x47, 0x5e, 0xc1, 0x7f, 0xaa, 0x5e, 0x6d, + 0xd5, 0x8e, 0xbd, 0xf9, 0xfd, 0x6b, 0xda, 0xfc, 0x79, 0x04, 0xb4, 0xaf, 0x36, 0xec, 0xe8, 0x03, + 0x04, 0x76, 0x17, 0x6b, 0x93, 0x8e, 0x61, 0xfb, 0x6a, 0xc8, 0xfe, 0x24, 0xbc, 0x96, 0x55, 0xff, + 0x0f, 0x9b, 0xcc, 0xba, 0xad, 0x6d, 0xb9, 0xf1, 0xaf, 0x2d, 0x1f, 0x3c, 0x04, 0xef, 0x32, 0x96, + 0x00, 0xb4, 0xdf, 0x72, 0x91, 0xb3, 0x2c, 0xd8, 0x22, 0x3e, 0xb8, 0x46, 0x83, 0xb4, 0x38, 0x09, + 0x1c, 0xd2, 0x03, 0xef, 0xf2, 0x03, 0x04, 0x8d, 0xa7, 0xc1, 0xf7, 0x8b, 0x81, 0xf3, 0xe3, 0x62, + 0xe0, 0xfc, 0xbc, 0x18, 0x38, 0x5f, 0x7f, 0x0d, 0xb6, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xd8, + 0xfb, 0xf7, 0xdf, 0x5c, 0x04, 0x00, 0x00, } diff --git a/bootstrap_test.go b/bootstrap_test.go index 53bcf06aea043..1a87b957fe8c8 100644 --- a/bootstrap_test.go +++ b/bootstrap_test.go @@ -189,7 +189,7 @@ func (s *testSessionSuite) TestUpgrade(c *C) { c.Assert(err, IsNil) c.Assert(ver, Equals, int64(0)) - // Create a new session then upgrade() will run automaticly. + // Create a new session then upgrade() will run automatically. se2 := newSession(c, store, s.dbName) r = mustExecSQL(c, se2, `SELECT VARIABLE_VALUE from mysql.TiDB where VARIABLE_NAME="tidb_server_version";`) row, err = r.Next() diff --git a/ddl/ddl.go b/ddl/ddl.go index c87399afcfe65..298efd6838a64 100644 --- a/ddl/ddl.go +++ b/ddl/ddl.go @@ -595,7 +595,10 @@ func getDefaultValue(ctx context.Context, c *ast.ColumnOption, tp byte, fsp int) if err != nil { return nil, errors.Trace(err) } - return v.GetValue(), nil + if v.IsNull() { + return nil, nil + } + return v.ToString() } func removeOnUpdateNowFlag(c *table.Column) { diff --git a/ddl/ddl_test.go b/ddl/ddl_test.go index 993897c5cecab..6fc096208574a 100644 --- a/ddl/ddl_test.go +++ b/ddl/ddl_test.go @@ -42,7 +42,7 @@ func testCreateStore(c *C, name string) kv.Storage { } func testNewContext(c *C, d *ddl) context.Context { - ctx := d.newReorgContext() + ctx := d.newMockContext() variable.BindSessionVars(ctx) return ctx } diff --git a/ddl/reorg.go b/ddl/reorg.go index aa6a655f8cb89..e718527a358d0 100644 --- a/ddl/reorg.go +++ b/ddl/reorg.go @@ -15,6 +15,7 @@ package ddl import ( "fmt" + "sync" "time" "github.com/juju/errors" @@ -26,16 +27,19 @@ import ( "github.com/pingcap/tidb/terror" ) -var _ context.Context = &reorgContext{} +var _ context.Context = &mockContext{} -// reorgContext implements context.Context interface for reorganization use. -type reorgContext struct { +// mockContext implements context.Context interface for testing. +type mockContext struct { store kv.Storage + mux sync.Mutex m map[fmt.Stringer]interface{} txn kv.Transaction } -func (c *reorgContext) GetTxn(forceNew bool) (kv.Transaction, error) { +func (c *mockContext) GetTxn(forceNew bool) (kv.Transaction, error) { + c.mux.Lock() + defer c.mux.Unlock() if forceNew { if c.txn != nil { if err := c.txn.Commit(); err != nil { @@ -44,7 +48,6 @@ func (c *reorgContext) GetTxn(forceNew bool) (kv.Transaction, error) { c.txn = nil } } - if c.txn != nil { return c.txn, nil } @@ -58,7 +61,7 @@ func (c *reorgContext) GetTxn(forceNew bool) (kv.Transaction, error) { return c.txn, nil } -func (c *reorgContext) finishTxn(rollback bool) error { +func (c *mockContext) finishTxn(rollback bool) error { if c.txn == nil { return nil } @@ -75,32 +78,32 @@ func (c *reorgContext) finishTxn(rollback bool) error { return errors.Trace(err) } -func (c *reorgContext) RollbackTxn() error { +func (c *mockContext) RollbackTxn() error { return c.finishTxn(true) } -func (c *reorgContext) CommitTxn() error { +func (c *mockContext) CommitTxn() error { return c.finishTxn(false) } -func (c *reorgContext) GetClient() kv.Client { +func (c *mockContext) GetClient() kv.Client { return c.store.GetClient() } -func (c *reorgContext) SetValue(key fmt.Stringer, value interface{}) { +func (c *mockContext) SetValue(key fmt.Stringer, value interface{}) { c.m[key] = value } -func (c *reorgContext) Value(key fmt.Stringer) interface{} { +func (c *mockContext) Value(key fmt.Stringer) interface{} { return c.m[key] } -func (c *reorgContext) ClearValue(key fmt.Stringer) { +func (c *mockContext) ClearValue(key fmt.Stringer) { delete(c.m, key) } -func (d *ddl) newReorgContext() context.Context { - c := &reorgContext{ +func (d *ddl) newMockContext() context.Context { + c := &mockContext{ store: d.store, m: make(map[fmt.Stringer]interface{}), } diff --git a/domain/domain.go b/domain/domain.go index e7049c862864a..4807fec1495b1 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -84,7 +84,8 @@ func (do *Domain) loadInfoSchema(handle *infoschema.Handle, usedSchemaVersion in } log.Infof("[ddl] full load InfoSchema from version %d to %d, in %v", usedSchemaVersion, latestSchemaVersion, time.Since(startTime)) - return newISBuilder.Build() + newISBuilder.Build() + return nil } func (do *Domain) fetchAllSchemasWithTables(m *meta.Meta) ([]*model.DBInfo, error) { @@ -183,10 +184,7 @@ func (do *Domain) tryLoadSchemaDiffs(m *meta.Meta, usedVersion, newVersion int64 return false, errors.Trace(err) } } - err := builder.Build() - if err != nil { - return false, errors.Trace(err) - } + builder.Build() return true, nil } diff --git a/evaluator/builtin_time.go b/evaluator/builtin_time.go index 4d7c46641ec02..d40b9b069e117 100644 --- a/evaluator/builtin_time.go +++ b/evaluator/builtin_time.go @@ -160,6 +160,9 @@ func convertDateFormat(arg types.Datum, b byte) (types.Datum, error) { } case 'H', 'k': d, err = builtinHour([]types.Datum{arg}, nil) + if err == nil && b == 'H' && !d.IsNull() { + d.SetString(fmt.Sprintf("%02d", d.GetInt64())) + } case 'h', 'I', 'l': d, err = builtinHour([]types.Datum{arg}, nil) if err == nil && !d.IsNull() { @@ -196,11 +199,14 @@ func convertDateFormat(arg types.Datum, b byte) (types.Datum, error) { } case 'S', 's': d, err = builtinSecond([]types.Datum{arg}, nil) - if err == nil { + if err == nil && !d.IsNull() { d.SetString(fmt.Sprintf("%02d", d.GetInt64())) } case 'f': d, err = builtinMicroSecond([]types.Datum{arg}, nil) + if err == nil && !d.IsNull() { + d.SetString(fmt.Sprintf("%06d", d.GetInt64())) + } case 'U': d, err = builtinWeek([]types.Datum{arg, types.NewIntDatum(0)}, nil) if err == nil && !d.IsNull() { @@ -304,7 +310,6 @@ func builtinDateFormat(args []types.Datum, _ context.Context) (types.Datum, erro ret = append(ret, b) } } - d.SetString(string(ret)) return d, nil } diff --git a/evaluator/builtin_time_test.go b/evaluator/builtin_time_test.go index 92fab9a1b4212..fe39c1ea3f423 100644 --- a/evaluator/builtin_time_test.go +++ b/evaluator/builtin_time_test.go @@ -207,6 +207,9 @@ func (s *testEvaluatorSuite) TestDateFormat(c *C) { {[]string{"2016-09-3 00:59:59.123456", "abc%b %M %m %c %D %d %e %j %k %h %i %p %r %T %s %f %U %u %V %v %a %W %w %X %x %Y %y!123 %%xyz %z"}, "abcSep September 09 9 3rd 03 3 247 0 12 59 AM 12:59:59 AM 00:59:59 59 123456 35 35 35 35 Sat Saturday 6 2016 2016 2016 16!123 %xyz z"}, + {[]string{"2012-10-01 00:00:00", + "%b %M %m %c %D %d %e %j %k %H %i %p %r %T %s %f %v %x %Y %y %%"}, + "Oct October 10 10 1st 01 1 275 0 00 00 AM 12:00:00 AM 00:00:00 00 000000 40 2012 2012 12 %"}, } dtblDate := tblToDtbl(tblDate) diff --git a/executor/aggregate_test.go b/executor/aggregate_test.go index fba5a5d79dc14..f271c5dbe427d 100644 --- a/executor/aggregate_test.go +++ b/executor/aggregate_test.go @@ -59,7 +59,10 @@ func (m *MockExec) Close() error { } func (s *testSuite) TestAggregation(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") diff --git a/executor/builder.go b/executor/builder.go index 918b648ec03de..ebbb45a2e5580 100644 --- a/executor/builder.go +++ b/executor/builder.go @@ -15,6 +15,7 @@ package executor import ( "math" + "strings" "github.com/juju/errors" "github.com/pingcap/tidb/ast" @@ -490,11 +491,7 @@ func (b *executorBuilder) buildTableScan(v *plan.PhysicalTableScan) Executor { } table, _ := b.is.TableByID(v.Table.ID) client := b.ctx.GetClient() - var memDB bool - switch v.DBName.L { - case "information_schema", "performance_schema": - memDB = true - } + memDB := infoschema.IsMemoryDB(v.DBName.L) supportDesc := client.SupportRequestType(kv.ReqTypeSelect, kv.ReqSubTypeDesc) if !memDB && client.SupportRequestType(kv.ReqTypeSelect, 0) { st := &XSelectTableExec{ @@ -522,13 +519,14 @@ func (b *executorBuilder) buildTableScan(v *plan.PhysicalTableScan) Executor { } ts := &TableScanExec{ - t: table, - asName: v.TableAsName, - ctx: b.ctx, - columns: v.Columns, - schema: v.GetSchema(), - seekHandle: math.MinInt64, - ranges: v.Ranges, + t: table, + asName: v.TableAsName, + ctx: b.ctx, + columns: v.Columns, + schema: v.GetSchema(), + seekHandle: math.MinInt64, + ranges: v.Ranges, + isInfoSchema: strings.EqualFold(v.DBName.L, infoschema.Name), } if v.Desc { return &ReverseExec{Src: ts} @@ -543,11 +541,7 @@ func (b *executorBuilder) buildIndexScan(v *plan.PhysicalIndexScan) Executor { } table, _ := b.is.TableByID(v.Table.ID) client := b.ctx.GetClient() - var memDB bool - switch v.DBName.L { - case "information_schema", "performance_schema": - memDB = true - } + memDB := infoschema.IsMemoryDB(v.DBName.L) supportDesc := client.SupportRequestType(kv.ReqTypeIndex, kv.ReqSubTypeDesc) if !memDB && client.SupportRequestType(kv.ReqTypeIndex, 0) { st := &XSelectIndexExec{ diff --git a/executor/executor.go b/executor/executor.go index eb47355579d4d..edca8d94387df 100644 --- a/executor/executor.go +++ b/executor/executor.go @@ -21,7 +21,6 @@ import ( "github.com/juju/errors" "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/context" - "github.com/pingcap/tidb/evaluator" "github.com/pingcap/tidb/expression" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/inspectkv" @@ -46,7 +45,6 @@ var ( _ Executor = &DistinctExec{} _ Executor = &DummyScanExec{} _ Executor = &ExistsExec{} - _ Executor = &FilterExec{} _ Executor = &HashAggExec{} _ Executor = &HashJoinExec{} _ Executor = &HashSemiJoinExec{} @@ -231,45 +229,6 @@ func (e *CheckTableExec) Close() error { return nil } -// FilterExec represents a filter executor. -// It evaluates the condition for every source row, returns the source row only if -// the condition evaluates to true. -type FilterExec struct { - Src Executor - Condition ast.ExprNode - ctx context.Context -} - -// Schema implements the Executor Schema interface. -func (e *FilterExec) Schema() expression.Schema { - return e.Src.Schema() -} - -// Next implements the Executor Next interface. -func (e *FilterExec) Next() (*Row, error) { - for { - srcRow, err := e.Src.Next() - if err != nil { - return nil, errors.Trace(err) - } - if srcRow == nil { - return nil, nil - } - match, err := evaluator.EvalBool(e.ctx, e.Condition) - if err != nil { - return nil, errors.Trace(err) - } - if match { - return srcRow, nil - } - } -} - -// Close implements the Executor Close interface. -func (e *FilterExec) Close() error { - return e.Src.Close() -} - // SelectLockExec represents a select lock executor. // It is built from the "SELECT .. FOR UPDATE" or the "SELECT .. LOCK IN SHARE MODE" statement. // For "SELECT .. FOR UPDATE" statement, it locks every row key from source Executor. @@ -1369,6 +1328,10 @@ type TableScanExec struct { cursor int schema expression.Schema columns []*model.ColumnInfo + + isInfoSchema bool + infoSchemaRows [][]types.Datum + infoSchemaCursor int } // Schema implements the Executor Schema interface. @@ -1378,6 +1341,9 @@ func (e *TableScanExec) Schema() expression.Schema { // Next implements the Executor interface. func (e *TableScanExec) Next() (*Row, error) { + if e.isInfoSchema { + return e.nextForInfoSchema() + } for { if e.cursor >= len(e.ranges) { return nil, nil @@ -1417,6 +1383,28 @@ func (e *TableScanExec) Next() (*Row, error) { } } +func (e *TableScanExec) nextForInfoSchema() (*Row, error) { + if e.infoSchemaRows == nil { + columns := make([]*table.Column, len(e.schema)) + for i, v := range e.columns { + columns[i] = table.ToColumn(v) + } + err := e.t.IterRecords(e.ctx, nil, columns, func(h int64, rec []types.Datum, cols []*table.Column) (bool, error) { + e.infoSchemaRows = append(e.infoSchemaRows, rec) + return true, nil + }) + if err != nil { + return nil, errors.Trace(err) + } + } + if e.infoSchemaCursor >= len(e.infoSchemaRows) { + return nil, nil + } + row := &Row{Data: e.infoSchemaRows[e.infoSchemaCursor]} + e.infoSchemaCursor++ + return row, nil +} + // seekRange increments the range cursor to the range // with high value greater or equal to handle. func (e *TableScanExec) seekRange(handle int64) (inRange bool) { diff --git a/executor/executor_ddl_test.go b/executor/executor_ddl_test.go index 1441fd37a144f..512e571b47413 100644 --- a/executor/executor_ddl_test.go +++ b/executor/executor_ddl_test.go @@ -22,7 +22,10 @@ import ( ) func (s *testSuite) TestTruncateTable(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec(`drop table if exists truncate_test;`) @@ -36,7 +39,10 @@ func (s *testSuite) TestTruncateTable(c *C) { } func (s *testSuite) TestCreateTable(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") // Test create an exist database diff --git a/executor/executor_test.go b/executor/executor_test.go index 107770988d58d..46195cd1854d1 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -77,8 +77,21 @@ func (s *testSuite) TearDownSuite(c *C) { s.store.Close() } +func (s *testSuite) cleanEnv(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("use test") + r := tk.MustQuery("show tables") + for _, tb := range r.Rows() { + tableName := tb[0] + tk.MustExec(fmt.Sprintf("drop table %v", tableName)) + } +} + func (s *testSuite) TestAdmin(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists admin_test") @@ -189,8 +202,11 @@ func (s *testSuite) TestSelectWithoutFrom(c *C) { } func (s *testSuite) TestSelectLimit(c *C) { - defer testleak.AfterTest(c)() tk := testkit.NewTestKit(c, s.store) + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk.MustExec("use test") s.fillData(tk, "select_limit") @@ -233,7 +249,10 @@ func (s *testSuite) TestSelectLimit(c *C) { } func (s *testSuite) TestSelectOrderBy(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") s.fillData(tk, "select_order_test") @@ -314,7 +333,10 @@ func (s *testSuite) TestSelectOrderBy(c *C) { } func (s *testSuite) TestSelectDistinct(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") s.fillData(tk, "select_distinct_test") @@ -325,11 +347,13 @@ func (s *testSuite) TestSelectDistinct(c *C) { r.Check(testkit.Rows(rowStr)) tk.MustExec("commit") - tk.MustExec("drop table select_distinct_test") } func (s *testSuite) TestSelectErrorRow(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") @@ -363,7 +387,10 @@ func (s *testSuite) TestSelectErrorRow(c *C) { // For https://github.com/pingcap/tidb/issues/345 func (s *testSuite) TestIssue345(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec(`drop table if exists t1, t2`) @@ -404,7 +431,10 @@ func (s *testSuite) TestIssue345(c *C) { } func (s *testSuite) TestUnion(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") testSQL := `select 1 union select 0;` @@ -459,7 +489,10 @@ func (s *testSuite) TestUnion(c *C) { } func (s *testSuite) TestIn(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec(`drop table if exists t`) @@ -476,7 +509,10 @@ func (s *testSuite) TestIn(c *C) { } func (s *testSuite) TestTablePKisHandleScan(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -539,7 +575,10 @@ func (s *testSuite) TestTablePKisHandleScan(c *C) { } func (s *testSuite) TestJoin(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -632,10 +671,12 @@ func (s *testSuite) TestJoin(c *C) { } func (s *testSuite) TestMultiJoin(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") - tk.MustExec("drop table if exists t") tk.MustExec("create table t35(a35 int primary key, b35 int, x35 int)") tk.MustExec("create table t40(a40 int primary key, b40 int, x40 int)") tk.MustExec("create table t14(a14 int primary key, b14 int, x14 int)") @@ -726,7 +767,10 @@ AND b44=a42`) } func (s *testSuite) TestIndexScan(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -772,7 +816,10 @@ func (s *testSuite) TestIndexScan(c *C) { } func (s *testSuite) TestSubquerySameTable(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -785,7 +832,10 @@ func (s *testSuite) TestSubquerySameTable(c *C) { } func (s *testSuite) TestIndexReverseOrder(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -804,7 +854,10 @@ func (s *testSuite) TestIndexReverseOrder(c *C) { } func (s *testSuite) TestTableReverseOrder(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -817,7 +870,10 @@ func (s *testSuite) TestTableReverseOrder(c *C) { } func (s *testSuite) TestInSubquery(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -847,7 +903,10 @@ func (s *testSuite) TestInSubquery(c *C) { } func (s *testSuite) TestDefaultNull(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -864,7 +923,10 @@ func (s *testSuite) TestDefaultNull(c *C) { } func (s *testSuite) TestUnsignedPKColumn(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -878,7 +940,10 @@ func (s *testSuite) TestUnsignedPKColumn(c *C) { } func (s *testSuite) TestBuiltin(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") @@ -1022,7 +1087,10 @@ func (s *testSuite) TestBuiltin(c *C) { } func (s *testSuite) TestToPBExpr(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -1041,9 +1109,8 @@ func (s *testSuite) TestToPBExpr(c *C) { result.Check(testkit.Rows("3.300000 3")) result = tk.MustQuery("select * from t where not (b = 1)") result.Check(testkit.Rows("2.400000 2", "3.300000 3")) - // TODO: This test cannot pass temporarily, because local store doesn't support decimal correctly. - //result = tk.MustQuery("select * from t where b&1 = a|1") - //result.Check(testkit.Rows("1.100000 1")) + result = tk.MustQuery("select * from t where b&1 = a|1") + result.Check(testkit.Rows("1.100000 1")) result = tk.MustQuery("select * from t where b != 2 and b <=> 3") result.Check(testkit.Rows("3.300000 3")) result = tk.MustQuery("select * from t where b in (3)") @@ -1074,7 +1141,10 @@ func (s *testSuite) TestToPBExpr(c *C) { } func (s *testSuite) TestDatumXAPI(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -1100,7 +1170,10 @@ func (s *testSuite) TestDatumXAPI(c *C) { } func (s *testSuite) TestJoinPanic(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists events") @@ -1109,7 +1182,10 @@ func (s *testSuite) TestJoinPanic(c *C) { } func (s *testSuite) TestSQLMode(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -1143,7 +1219,10 @@ func (s *testSuite) TestSQLMode(c *C) { } func (s *testSuite) TestNewSubquery(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -1254,7 +1333,10 @@ func (s *testSuite) TestAdapterStatement(c *C) { } func (s *testSuite) TestRow(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -1276,6 +1358,10 @@ func (s *testSuite) TestRow(c *C) { } func (s *testSuite) TestColumnName(c *C) { + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -1305,6 +1391,10 @@ func (s *testSuite) TestColumnName(c *C) { } func (s *testSuite) TestSelectVar(c *C) { + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") @@ -1314,11 +1404,13 @@ func (s *testSuite) TestSelectVar(c *C) { result.Check(testkit.Rows(" 2", " 3", " 2")) result = tk.MustQuery("select @a, @a := d+1 from t") result.Check(testkit.Rows("2 2", "2 3", "3 2")) - } func (s *testSuite) TestHistoryRead(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists history_read") diff --git a/executor/executor_write_test.go b/executor/executor_write_test.go index 6d3c6811e8ab5..0270502ba3c00 100644 --- a/executor/executor_write_test.go +++ b/executor/executor_write_test.go @@ -28,7 +28,10 @@ import ( ) func (s *testSuite) TestInsert(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") testSQL := `drop table if exists insert_test;create table insert_test (id int PRIMARY KEY AUTO_INCREMENT, c1 int, c2 int, c3 int default 1);` @@ -108,7 +111,10 @@ func (s *testSuite) TestInsert(c *C) { } func (s *testSuite) TestInsertAutoInc(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") createSQL := `drop table if exists insert_autoinc_test; create table insert_autoinc_test (id int primary key auto_increment, c1 int);` @@ -192,7 +198,10 @@ func (s *testSuite) TestInsertAutoInc(c *C) { } func (s *testSuite) TestInsertIgnore(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") testSQL := `drop table if exists t; @@ -214,7 +223,10 @@ func (s *testSuite) TestInsertIgnore(c *C) { } func (s *testSuite) TestReplace(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") testSQL := `drop table if exists replace_test; @@ -336,7 +348,10 @@ func (s *testSuite) TestReplace(c *C) { } func (s *testSuite) TestUpdate(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") s.fillData(tk, "update_test") @@ -391,7 +406,6 @@ func (s *testSuite) TestUpdate(c *C) { r = tk.MustQuery("select * from update_test;") r.Check(testkit.Rows("2")) tk.MustExec("commit") - tk.MustExec("drop table update_test") } func (s *testSuite) fillMultiTableForUpdate(tk *testkit.TestKit) { @@ -406,7 +420,10 @@ func (s *testSuite) fillMultiTableForUpdate(tk *testkit.TestKit) { } func (s *testSuite) TestMultipleTableUpdate(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") s.fillMultiTableForUpdate(tk) @@ -464,7 +481,10 @@ func (s *testSuite) TestMultipleTableUpdate(c *C) { } func (s *testSuite) TestDelete(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) s.fillData(tk, "delete_test") @@ -511,7 +531,10 @@ func (s *testSuite) fillDataMultiTable(tk *testkit.TestKit) { } func (s *testSuite) TestMultiTableDelete(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) s.fillDataMultiTable(tk) @@ -524,7 +547,10 @@ func (s *testSuite) TestMultiTableDelete(c *C) { } func (s *testSuite) TestQualifiedDelete(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t1") @@ -558,12 +584,13 @@ func (s *testSuite) TestQualifiedDelete(c *C) { _, err = tk.Exec("delete t1, t2 from t1 as a join t2 as b where a.c2 = b.c1") c.Assert(err, NotNil) - - tk.MustExec("drop table t1, t2") } func (s *testSuite) TestLoadData(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") createSQL := `drop table if exists load_data_test; @@ -742,7 +769,10 @@ func (s *testSuite) TestLoadData(c *C) { } func (s *testSuite) TestLoadDataEscape(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test; drop table if exists load_data_test;") tk.MustExec("CREATE TABLE load_data_test (id INT NOT NULL PRIMARY KEY, value TEXT NOT NULL) CHARACTER SET utf8") diff --git a/executor/explain_test.go b/executor/explain_test.go index 8d516b12ea33f..7725f52c1f561 100644 --- a/executor/explain_test.go +++ b/executor/explain_test.go @@ -20,7 +20,10 @@ import ( ) func (s *testSuite) TestExplain(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t1, t2") @@ -39,9 +42,11 @@ func (s *testSuite) TestExplain(c *C) { "table": "t1", "desc": false, "keep order": false, - "access condition": null, - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": null, + "filter conditions": null + } }`, }, { @@ -55,9 +60,11 @@ func (s *testSuite) TestExplain(c *C) { "desc": false, "out of order": false, "double read": false, - "access condition": null, - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": null, + "filter conditions": null + } }`, }, { @@ -77,9 +84,11 @@ func (s *testSuite) TestExplain(c *C) { "table": "t2", "desc": false, "keep order": false, - "access condition": null, - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": null, + "filter conditions": null + } } }`, }, @@ -91,11 +100,13 @@ func (s *testSuite) TestExplain(c *C) { "table": "t1", "desc": false, "keep order": false, - "access condition": [ - "gt(test.t1.c1, 0)" - ], - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": [ + "gt(test.t1.c1, 0)" + ], + "filter conditions": null + } }`, }, { @@ -109,11 +120,13 @@ func (s *testSuite) TestExplain(c *C) { "desc": false, "out of order": true, "double read": false, - "access condition": [ - "eq(test.t1.c2, 1)" - ], - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": [ + "eq(test.t1.c2, 1)" + ], + "filter conditions": null + } }`, }, { @@ -132,11 +145,13 @@ func (s *testSuite) TestExplain(c *C) { "table": "t1", "desc": false, "keep order": false, - "access condition": [ - "gt(test.t1.c1, 1)" - ], - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": [ + "gt(test.t1.c1, 1)" + ], + "filter conditions": null + } }, "rightPlan": { "type": "TableScan", @@ -144,9 +159,11 @@ func (s *testSuite) TestExplain(c *C) { "table": "t2", "desc": false, "keep order": false, - "access condition": null, - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": null, + "filter conditions": null + } } }`, }, @@ -161,11 +178,13 @@ func (s *testSuite) TestExplain(c *C) { "table": "t1", "desc": false, "keep order": false, - "access condition": [ - "eq(test.t1.c1, 1)" - ], - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": [ + "eq(test.t1.c1, 1)" + ], + "filter conditions": null + } } ] }`, @@ -184,29 +203,31 @@ func (s *testSuite) TestExplain(c *C) { "desc": false, "out of order": true, "double read": false, - "access condition": [ - "eq(test.t1.c2, 1)" - ], - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": [ + "eq(test.t1.c2, 1)" + ], + "filter conditions": null + } } ] }`, }, { - "select count(b.b) from t a, t b where a.a = b.a group by a.b", + "select count(b.c2) from t1 a, t2 b where a.c1 = b.c2 group by a.c1", `{ "type": "CompleteAgg", "AggFuncs": [ "count(join_agg_0)" ], "GroupByItems": [ - "a.b" + "a.c1" ], "child": { "type": "InnerJoin", "eqCond": [ - "eq(a.a, b.a)" + "eq(a.c1, b.c2)" ], "leftCond": null, "rightCond": null, @@ -214,31 +235,43 @@ func (s *testSuite) TestExplain(c *C) { "leftPlan": { "type": "TableScan", "db": "test", - "table": "t", + "table": "t1", "desc": false, "keep order": false, - "access condition": null, - "count of pushed aggregate functions": 0, - "limit": 0 + "push down info": { + "limit": 0, + "access conditions": null, + "filter conditions": null + } }, "rightPlan": { "type": "FinalAgg", "AggFuncs": [ - "count([b.b])", - "firstrow([b.a])" + "count([b.c2])", + "firstrow([b.c2])" ], "GroupByItems": [ - "[b.a]" + "[b.c2]" ], "child": { "type": "TableScan", "db": "test", - "table": "t", + "table": "t2", "desc": false, "keep order": false, - "access condition": null, - "count of pushed aggregate functions": 2, - "limit": 0 + "push down info": { + "limit": 0, + "aggregated push down": true, + "gby items": [ + "b.c2" + ], + "agg funcs": [ + "count(b.c2)", + "firstrow(b.c2)" + ], + "access conditions": null, + "filter conditions": null + } } } } diff --git a/executor/prepared_test.go b/executor/prepared_test.go index 0b61424c33629..1463309169c6d 100644 --- a/executor/prepared_test.go +++ b/executor/prepared_test.go @@ -21,7 +21,10 @@ import ( ) func (s *testSuite) TestPrepared(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists prepare_test") diff --git a/executor/show.go b/executor/show.go index d4ff40898733f..6fc01fcdf315e 100644 --- a/executor/show.go +++ b/executor/show.go @@ -167,16 +167,13 @@ func (e *ShowExec) fetchShowTableStatus() error { } // sort for tables - var tableNames []string - for _, v := range e.is.SchemaTables(e.DBName) { - tableNames = append(tableNames, v.Meta().Name.O) - } - sort.Strings(tableNames) + tables := e.is.SchemaTables(e.DBName) + sort.Sort(table.Slice(tables)) - for _, v := range tableNames { + for _, t := range tables { now := mysql.CurrentTime(mysql.TypeDatetime) - data := types.MakeDatums(v, "InnoDB", "10", "Compact", 100, 100, 100, 100, 100, 100, 100, - now, now, now, "utf8_general_ci", "", "", "") + data := types.MakeDatums(t.Meta().Name.O, "InnoDB", "10", "Compact", 100, 100, 100, 100, 100, 100, 100, + now, now, now, "utf8_general_ci", "", "", t.Meta().Comment) e.rows = append(e.rows, &Row{Data: data}) } return nil diff --git a/executor/show_test.go b/executor/show_test.go index d3ea43e1c4ac7..e0b9dcaab0ed6 100644 --- a/executor/show_test.go +++ b/executor/show_test.go @@ -21,7 +21,10 @@ import ( ) func (s *testSuite) TestShow(c *C) { - defer testleak.AfterTest(c)() + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c)() + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") testSQL := `drop table if exists show_test` @@ -58,7 +61,7 @@ func (s *testSuite) TestShow(c *C) { c.Check(result.Rows(), HasLen, 1) row = result.Rows()[0] expectedRow = []interface{}{ - "ptest", "CREATE TABLE `ptest` (\n `a` int(11) NOT NULL,\n `b` double NOT NULL DEFAULT '2',\n `c` varchar(10) NOT NULL,\n `d` time DEFAULT NULL,\n `e` timestamp NULL DEFAULT NULL,\n PRIMARY KEY (`a`),\n UNIQUE KEY `d` (`d`)\n) ENGINE=InnoDB"} + "ptest", "CREATE TABLE `ptest` (\n `a` int(11) NOT NULL,\n `b` double NOT NULL DEFAULT '2.0',\n `c` varchar(10) NOT NULL,\n `d` time DEFAULT NULL,\n `e` timestamp NULL DEFAULT NULL,\n PRIMARY KEY (`a`),\n UNIQUE KEY `d` (`d`)\n) ENGINE=InnoDB"} for i, r := range row { c.Check(r, Equals, expectedRow[i]) } diff --git a/executor/union_scan_test.go b/executor/union_scan_test.go index a546a57e5fdce..503ddb12b95f9 100644 --- a/executor/union_scan_test.go +++ b/executor/union_scan_test.go @@ -20,7 +20,10 @@ import ( ) func (s *testSuite) TestDirtyTransaction(c *C) { - defer testleak.AfterTest(c) + defer func() { + s.cleanEnv(c) + testleak.AfterTest(c) + }() tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") tk.MustExec("drop table if exists t") diff --git a/glide.lock b/glide.lock index 9aa323259815c..ac31b24418921 100644 --- a/glide.lock +++ b/glide.lock @@ -99,7 +99,7 @@ imports: - leveldb/table - leveldb/util - name: github.com/pingcap/kvproto - version: 3ef22759515076bd169f08e96c4760b05cd0f1a6 + version: f5305cef0defaec3307623b7f7394d9fb3fd99b5 subpackages: - pkg/coprocessor - pkg/eraftpb diff --git a/glide.yaml b/glide.yaml index 61586cfec247a..05056ca290bb4 100644 --- a/glide.yaml +++ b/glide.yaml @@ -147,7 +147,7 @@ import: - go-binlog - go-tipb - package: github.com/pingcap/kvproto - version: 3ef22759515076bd169f08e96c4760b05cd0f1a6 + version: f5305cef0defaec3307623b7f7394d9fb3fd99b5 - package: github.com/gogo/protobuf version: ^0.3.0 subpackages: diff --git a/infoschema/builder.go b/infoschema/builder.go index 7f44095629c19..f972053bdb0a0 100644 --- a/infoschema/builder.go +++ b/infoschema/builder.go @@ -14,6 +14,8 @@ package infoschema import ( + "sort" + "github.com/juju/errors" "github.com/pingcap/tidb/meta" "github.com/pingcap/tidb/meta/autoid" @@ -37,7 +39,7 @@ func (b *Builder) ApplyDiff(m *meta.Meta, diff *model.SchemaDiff) error { b.applyDropSchema(diff.SchemaID) return nil } - roDBInfo, ok := b.is.schemas[diff.SchemaID] + roDBInfo, ok := b.is.SchemaByID(diff.SchemaID) if !ok { return ErrDatabaseNotExists } @@ -54,15 +56,18 @@ func (b *Builder) ApplyDiff(m *meta.Meta, diff *model.SchemaDiff) error { oldTableID = diff.TableID newTableID = diff.TableID } + b.copySchemaTables(roDBInfo.Name.L) + b.copySortedTables(oldTableID, newTableID) + // We try to reuse the old allocator, so the cached auto ID can be reused. var alloc autoid.Allocator - if oldTableID != 0 { + if tableIDIsValid(oldTableID) { if oldTableID == newTableID { alloc, _ = b.is.AllocByID(oldTableID) } - b.applyDropTable(roDBInfo.Name.L, oldTableID) + b.applyDropTable(roDBInfo, oldTableID) } - if newTableID != 0 { + if tableIDIsValid(newTableID) { // All types except DropTable. err := b.applyCreateTable(m, roDBInfo, newTableID, alloc) if err != nil { @@ -74,22 +79,40 @@ func (b *Builder) ApplyDiff(m *meta.Meta, diff *model.SchemaDiff) error { return nil } +// CopySortedTables copies sortedTables for old table and new table for later modification. +func (b *Builder) copySortedTables(oldTableID, newTableID int64) { + buckets := b.is.sortedTablesBuckets + if tableIDIsValid(oldTableID) { + bucketIdx := tableBucketIdx(oldTableID) + oldSortedTables := buckets[bucketIdx] + newSortedTables := make(sortedTables, len(oldSortedTables)) + copy(newSortedTables, oldSortedTables) + buckets[bucketIdx] = newSortedTables + } + if tableIDIsValid(newTableID) && newTableID != oldTableID { + oldSortedTables := buckets[tableBucketIdx(newTableID)] + newSortedTables := make(sortedTables, len(oldSortedTables), len(oldSortedTables)+1) + copy(newSortedTables, oldSortedTables) + buckets[tableBucketIdx(newTableID)] = newSortedTables + } +} + // updateDBInfo clones a new DBInfo from old DBInfo, and update on the new one. func (b *Builder) updateDBInfo(roDBInfo *model.DBInfo, oldTableID, newTableID int64) { - newDbInfo := new(model.DBInfo) - *newDbInfo = *roDBInfo + newDbInfo := *roDBInfo newDbInfo.Tables = make([]*model.TableInfo, 0, len(roDBInfo.Tables)) - if newTableID != 0 { + if tableIDIsValid(newTableID) { // All types except DropTable. - newTblInfo := b.is.tables[newTableID].Meta() - newDbInfo.Tables = append(newDbInfo.Tables, newTblInfo) + if newTbl, ok := b.is.TableByID(newTableID); ok { + newDbInfo.Tables = append(newDbInfo.Tables, newTbl.Meta()) + } } for _, tblInfo := range roDBInfo.Tables { if tblInfo.ID != oldTableID && tblInfo.ID != newTableID { newDbInfo.Tables = append(newDbInfo.Tables, tblInfo) } } - b.is.schemas[newDbInfo.ID] = newDbInfo + b.is.schemaMap[roDBInfo.Name.L].dbInfo = &newDbInfo } func (b *Builder) applyCreateSchema(m *meta.Meta, diff *model.SchemaDiff) error { @@ -102,20 +125,18 @@ func (b *Builder) applyCreateSchema(m *meta.Meta, diff *model.SchemaDiff) error // full load. return ErrDatabaseNotExists } - b.is.schemas[di.ID] = di - b.is.schemaNameToID[di.Name.L] = di.ID + b.is.schemaMap[di.Name.L] = &schemaTables{dbInfo: di, tables: make(map[string]table.Table)} return nil } func (b *Builder) applyDropSchema(schemaID int64) { - di, ok := b.is.schemas[schemaID] + di, ok := b.is.SchemaByID(schemaID) if !ok { return } - delete(b.is.schemas, di.ID) - delete(b.is.schemaNameToID, di.Name.L) + delete(b.is.schemaMap, di.Name.L) for _, tbl := range di.Tables { - b.applyDropTable(di.Name.L, tbl.ID) + b.applyDropTable(di, tbl.ID) } } @@ -136,122 +157,133 @@ func (b *Builder) applyCreateTable(m *meta.Meta, roDBInfo *model.DBInfo, tableID if err != nil { return errors.Trace(err) } - b.is.tables[tblInfo.ID] = tbl - tn := makeTableName(roDBInfo.Name.L, tblInfo.Name.L) - b.is.tableNameToID[string(tn)] = tblInfo.ID + tableNames := b.is.schemaMap[roDBInfo.Name.L] + tableNames.tables[tblInfo.Name.L] = tbl + bucketIdx := tableBucketIdx(tableID) + sortedTables := b.is.sortedTablesBuckets[bucketIdx] + sortedTables = append(sortedTables, tbl) + sort.Sort(sortedTables) + b.is.sortedTablesBuckets[bucketIdx] = sortedTables return nil } -func (b *Builder) applyDropTable(schemaName string, tableID int64) { - tbl, ok := b.is.tables[tableID] - if !ok { +func (b *Builder) applyDropTable(di *model.DBInfo, tableID int64) { + bucketIdx := tableBucketIdx(tableID) + sortedTables := b.is.sortedTablesBuckets[bucketIdx] + idx := sortedTables.searchTable(tableID) + if idx == -1 { return } - tblInfo := tbl.Meta() - delete(b.is.tables, tblInfo.ID) - tn := makeTableName(schemaName, tblInfo.Name.L) - delete(b.is.tableNameToID, string(tn)) + if tableNames, ok := b.is.schemaMap[di.Name.L]; ok { + delete(tableNames.tables, sortedTables[idx].Meta().Name.L) + } + // Remove the table in sorted table slice. + b.is.sortedTablesBuckets[bucketIdx] = append(sortedTables[0:idx], sortedTables[idx+1:]...) } // InitWithOldInfoSchema initializes an empty new InfoSchema by copies all the data from old InfoSchema. func (b *Builder) InitWithOldInfoSchema() *Builder { oldIS := b.handle.Get().(*infoSchema) b.is.schemaMetaVersion = oldIS.schemaMetaVersion - b.copySchemaNames(oldIS) - b.copyTableNames(oldIS) - b.copySchemas(oldIS) - b.copyTables(oldIS) + b.copySchemasMap(oldIS) + copy(b.is.sortedTablesBuckets, oldIS.sortedTablesBuckets) return b } -func (b *Builder) copySchemaNames(oldIS *infoSchema) { - for k, v := range oldIS.schemaNameToID { - b.is.schemaNameToID[k] = v +func (b *Builder) copySchemasMap(oldIS *infoSchema) { + for k, v := range oldIS.schemaMap { + b.is.schemaMap[k] = v } } -func (b *Builder) copyTableNames(oldIS *infoSchema) { - b.is.tableNameToID = make(map[string]int64, len(oldIS.tableNameToID)) - for k, v := range oldIS.tableNameToID { - b.is.tableNameToID[k] = v +// When a table in the database has changed, we should create a new schemaTables instance, then do modifications +// on the new one. Because old schemaTables must be read-only. +func (b *Builder) copySchemaTables(dbName string) { + oldSchemaTables := b.is.schemaMap[dbName] + newSchemaTables := &schemaTables{ + dbInfo: oldSchemaTables.dbInfo, + tables: make(map[string]table.Table, len(oldSchemaTables.tables)), } -} - -func (b *Builder) copySchemas(oldIS *infoSchema) { - for k, v := range oldIS.schemas { - b.is.schemas[k] = v - } -} - -func (b *Builder) copyTables(oldIS *infoSchema) { - b.is.tables = make(map[int64]table.Table, len(oldIS.tables)) - for k, v := range oldIS.tables { - b.is.tables[k] = v + for k, v := range oldSchemaTables.tables { + newSchemaTables.tables[k] = v } + b.is.schemaMap[dbName] = newSchemaTables } // InitWithDBInfos initializes an empty new InfoSchema with a slice of DBInfo and schema version. func (b *Builder) InitWithDBInfos(dbInfos []*model.DBInfo, schemaVersion int64) (*Builder, error) { - err := b.initMemorySchemas() - if err != nil { - return nil, errors.Trace(err) - } info := b.is info.schemaMetaVersion = schemaVersion for _, di := range dbInfos { - info.schemas[di.ID] = di - info.schemaNameToID[di.Name.L] = di.ID - for _, t := range di.Tables { - alloc := autoid.NewAllocator(b.handle.store, di.ID) - var tbl table.Table - tbl, err = table.TableFromMeta(alloc, t) - if err != nil { - return nil, errors.Trace(err) - } - info.tables[t.ID] = tbl - tname := makeTableName(di.Name.L, t.Name.L) - info.tableNameToID[string(tname)] = t.ID + err := b.createSchemaTablesForDB(di) + if err != nil { + return nil, errors.Trace(err) } } + b.createSchemaTablesForPerfSchemaDB() + b.createSchemaTablesForInfoSchemaDB() + for _, v := range info.sortedTablesBuckets { + sort.Sort(v) + } return b, nil } -func (b *Builder) initMemorySchemas() error { - info := b.is - info.schemaNameToID[infoSchemaDB.Name.L] = infoSchemaDB.ID - info.schemas[infoSchemaDB.ID] = infoSchemaDB - for _, t := range infoSchemaDB.Tables { - tbl := b.handle.memSchema.nameToTable[t.Name.L] - info.tables[t.ID] = tbl - tname := makeTableName(infoSchemaDB.Name.L, t.Name.L) - info.tableNameToID[string(tname)] = t.ID +func (b *Builder) createSchemaTablesForDB(di *model.DBInfo) error { + schTbls := &schemaTables{ + dbInfo: di, + tables: make(map[string]table.Table, len(di.Tables)), } + b.is.schemaMap[di.Name.L] = schTbls + for _, t := range di.Tables { + alloc := autoid.NewAllocator(b.handle.store, di.ID) + var tbl table.Table + tbl, err := tables.TableFromMeta(alloc, t) + if err != nil { + return errors.Trace(err) + } + schTbls.tables[t.Name.L] = tbl + sortedTables := b.is.sortedTablesBuckets[tableBucketIdx(t.ID)] + b.is.sortedTablesBuckets[tableBucketIdx(t.ID)] = append(sortedTables, tbl) + } + return nil +} - perfHandle := b.handle.memSchema.perfHandle - psDB := perfHandle.GetDBMeta() - - info.schemaNameToID[psDB.Name.L] = psDB.ID - info.schemas[psDB.ID] = psDB - for _, t := range psDB.Tables { +func (b *Builder) createSchemaTablesForPerfSchemaDB() { + perfHandle := b.handle.perfHandle + perfSchemaDB := perfHandle.GetDBMeta() + perfSchemaTblNames := &schemaTables{ + dbInfo: perfSchemaDB, + tables: make(map[string]table.Table, len(perfSchemaDB.Tables)), + } + b.is.schemaMap[perfSchemaDB.Name.L] = perfSchemaTblNames + for _, t := range perfSchemaDB.Tables { tbl, ok := perfHandle.GetTable(t.Name.O) if !ok { - return ErrTableNotExists.Gen("table `%s` is missing.", t.Name) + continue } - info.tables[t.ID] = tbl - tname := makeTableName(psDB.Name.L, t.Name.L) - info.tableNameToID[string(tname)] = t.ID + perfSchemaTblNames.tables[t.Name.L] = tbl + bucketIdx := tableBucketIdx(t.ID) + b.is.sortedTablesBuckets[bucketIdx] = append(b.is.sortedTablesBuckets[bucketIdx], tbl) } - return nil } -// Build sets new InfoSchema to the handle in the Builder. -func (b *Builder) Build() error { - err := b.handle.refillMemoryTables(b.is.AllSchemas()) - if err != nil { - return errors.Trace(err) +func (b *Builder) createSchemaTablesForInfoSchemaDB() { + infoSchemaSchemaTables := &schemaTables{ + dbInfo: infoSchemaDB, + tables: make(map[string]table.Table, len(infoSchemaDB.Tables)), } + b.is.schemaMap[infoSchemaDB.Name.L] = infoSchemaSchemaTables + for _, t := range infoSchemaDB.Tables { + tbl := createInfoSchemaTable(b.handle, t) + infoSchemaSchemaTables.tables[t.Name.L] = tbl + bucketIdx := tableBucketIdx(t.ID) + b.is.sortedTablesBuckets[bucketIdx] = append(b.is.sortedTablesBuckets[bucketIdx], tbl) + } +} + +// Build sets new InfoSchema to the handle in the Builder. +func (b *Builder) Build() { b.handle.value.Store(b.is) - return nil } // NewBuilder creates a new Builder with a Handle. @@ -259,10 +291,16 @@ func NewBuilder(handle *Handle) *Builder { b := new(Builder) b.handle = handle b.is = &infoSchema{ - schemaNameToID: map[string]int64{}, - tableNameToID: map[string]int64{}, - schemas: map[int64]*model.DBInfo{}, - tables: map[int64]table.Table{}, + schemaMap: map[string]*schemaTables{}, + sortedTablesBuckets: make([]sortedTables, bucketCount), } return b } + +func tableBucketIdx(tableID int64) int { + return int(tableID % bucketCount) +} + +func tableIDIsValid(tableID int64) bool { + return tableID != 0 +} diff --git a/infoschema/infoschema.go b/infoschema/infoschema.go index ac6ae186ab723..774a49b0b6c0b 100644 --- a/infoschema/infoschema.go +++ b/infoschema/infoschema.go @@ -14,7 +14,7 @@ package infoschema import ( - "strings" + "sort" "sync/atomic" "github.com/juju/errors" @@ -25,9 +25,6 @@ import ( "github.com/pingcap/tidb/perfschema" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/terror" - // import table implementation to init table.TableFromMeta - "github.com/pingcap/tidb/table/tables" - "github.com/pingcap/tidb/util/types" ) var ( @@ -81,34 +78,66 @@ const ( Name = "INFORMATION_SCHEMA" ) +type sortedTables []table.Table + +func (s sortedTables) Len() int { + return len(s) +} + +func (s sortedTables) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s sortedTables) Less(i, j int) bool { + return s[i].Meta().ID < s[j].Meta().ID +} + +func (s sortedTables) searchTable(id int64) int { + idx := sort.Search(len(s), func(i int) bool { + return s[i].Meta().ID >= id + }) + if idx == len(s) || s[idx].Meta().ID != id { + return -1 + } + return idx +} + +type schemaTables struct { + dbInfo *model.DBInfo + tables map[string]table.Table +} + +const bucketCount = 512 + type infoSchema struct { - schemaNameToID map[string]int64 - tableNameToID map[string]int64 - schemas map[int64]*model.DBInfo - tables map[int64]table.Table + schemaMap map[string]*schemaTables + + // sortedTablesBuckets is a slice of sortedTables, a table's bucket index is (tableID % bucketCount). + sortedTablesBuckets []sortedTables // We should check version when change schema. schemaMetaVersion int64 } -type schemaHandle struct { - tableNameToID map[string]int64 -} - // MockInfoSchema only serves for test. func MockInfoSchema(tbList []*model.TableInfo) InfoSchema { result := &infoSchema{} - result.schemaNameToID = make(map[string]int64) - result.tableNameToID = make(map[string]int64) - result.schemas = make(map[int64]*model.DBInfo) - result.tables = make(map[int64]table.Table) - - result.schemaNameToID["test"] = 0 - result.schemas[0] = &model.DBInfo{ID: 0, Name: model.NewCIStr("test"), Tables: tbList} - for i, tb := range tbList { - tn := makeTableName("test", tb.Name.L) - result.tableNameToID[string(tn)] = int64(i) - result.tables[int64(i)] = table.MockTableFromMeta(tb) + result.schemaMap = make(map[string]*schemaTables) + result.sortedTablesBuckets = make([]sortedTables, bucketCount) + dbInfo := &model.DBInfo{ID: 0, Name: model.NewCIStr("test"), Tables: tbList} + tableNames := &schemaTables{ + dbInfo: dbInfo, + tables: make(map[string]table.Table), + } + result.schemaMap["test"] = tableNames + for _, tb := range tbList { + tbl := table.MockTableFromMeta(tb) + tableNames.tables[tb.Name.L] = tbl + bucketIdx := tableBucketIdx(tb.ID) + result.sortedTablesBuckets[bucketIdx] = append(result.sortedTablesBuckets[bucketIdx], tbl) + } + for i := range result.sortedTablesBuckets { + sort.Sort(result.sortedTablesBuckets[i]) } return result } @@ -116,12 +145,11 @@ func MockInfoSchema(tbList []*model.TableInfo) InfoSchema { var _ InfoSchema = (*infoSchema)(nil) func (is *infoSchema) SchemaByName(schema model.CIStr) (val *model.DBInfo, ok bool) { - id, ok := is.schemaNameToID[schema.L] + tableNames, ok := is.schemaMap[schema.L] if !ok { return } - val, ok = is.schemas[id] - return + return tableNames.dbInfo, true } func (is *infoSchema) SchemaMetaVersion() int64 { @@ -129,46 +157,48 @@ func (is *infoSchema) SchemaMetaVersion() int64 { } func (is *infoSchema) SchemaExists(schema model.CIStr) bool { - _, ok := is.schemaNameToID[schema.L] + _, ok := is.schemaMap[schema.L] return ok } func (is *infoSchema) TableByName(schema, table model.CIStr) (t table.Table, err error) { - name := makeTableName(schema.L, table.L) - id, ok := is.tableNameToID[string(name)] - if !ok { - return nil, ErrTableNotExists.Gen("table %s.%s does not exist", schema, table) + if tbNames, ok := is.schemaMap[schema.L]; ok { + if t, ok = tbNames.tables[table.L]; ok { + return + } } - t = is.tables[id] - return + return nil, ErrTableNotExists.Gen("table %s.%s does not exist", schema, table) } func (is *infoSchema) TableExists(schema, table model.CIStr) bool { - name := makeTableName(schema.L, table.L) - _, ok := is.tableNameToID[string(name)] - return ok -} - -func makeTableName(schema, table string) []byte { - name := make([]byte, len(schema)+1+len(table)) - copy(name, schema) - name[len(schema)] = '.' - copy(name[len(schema)+1:], table) - return name + if tbNames, ok := is.schemaMap[schema.L]; ok { + if _, ok = tbNames.tables[table.L]; ok { + return true + } + } + return false } func (is *infoSchema) SchemaByID(id int64) (val *model.DBInfo, ok bool) { - val, ok = is.schemas[id] - return + for _, v := range is.schemaMap { + if v.dbInfo.ID == id { + return v.dbInfo, true + } + } + return nil, false } func (is *infoSchema) TableByID(id int64) (val table.Table, ok bool) { - val, ok = is.tables[id] - return + slice := is.sortedTablesBuckets[tableBucketIdx(id)] + idx := slice.searchTable(id) + if idx == -1 { + return nil, false + } + return slice[idx], true } func (is *infoSchema) AllocByID(id int64) (autoid.Allocator, bool) { - tbl, ok := is.tables[id] + tbl, ok := is.TableByID(id) if !ok { return nil, false } @@ -176,42 +206,42 @@ func (is *infoSchema) AllocByID(id int64) (autoid.Allocator, bool) { } func (is *infoSchema) AllSchemaNames() (names []string) { - for _, v := range is.schemas { - names = append(names, v.Name.O) + for _, v := range is.schemaMap { + names = append(names, v.dbInfo.Name.O) } return } func (is *infoSchema) AllSchemas() (schemas []*model.DBInfo) { - for _, v := range is.schemas { - schemas = append(schemas, v) + for _, v := range is.schemaMap { + schemas = append(schemas, v.dbInfo) } return } func (is *infoSchema) SchemaTables(schema model.CIStr) (tables []table.Table) { - di, ok := is.SchemaByName(schema) + schemaTables, ok := is.schemaMap[schema.L] if !ok { return } - for _, ti := range di.Tables { - tables = append(tables, is.tables[ti.ID]) + for _, tbl := range schemaTables.tables { + tables = append(tables, tbl) } return } func (is *infoSchema) Clone() (result []*model.DBInfo) { - for _, v := range is.schemas { - result = append(result, v.Clone()) + for _, v := range is.schemaMap { + result = append(result, v.dbInfo.Clone()) } return } // Handle handles information schema, including getting and setting. type Handle struct { - value atomic.Value - store kv.Storage - memSchema *memSchemaHandle + value atomic.Value + store kv.Storage + perfHandle perfschema.PerfSchema } // NewHandle creates a new Handle. @@ -221,116 +251,16 @@ func NewHandle(store kv.Storage) (*Handle, error) { } // init memory tables var err error - h.memSchema, err = newMemSchemaHandle() - if err != nil { - return nil, errors.Trace(err) - } - return h, nil -} - -// Init memory schemas including infoschema and perfshcema. -func newMemSchemaHandle() (*memSchemaHandle, error) { - h := &memSchemaHandle{ - nameToTable: make(map[string]table.Table), - } - err := initMemoryTables(h) + h.perfHandle, err = perfschema.NewPerfHandle() if err != nil { return nil, errors.Trace(err) } - h.perfHandle, err = perfschema.NewPerfHandle() if err != nil { return nil, errors.Trace(err) } return h, nil } -// memSchemaHandle is used to store memory schema information. -type memSchemaHandle struct { - // Information Schema - schemataTbl table.Table - tablesTbl table.Table - columnsTbl table.Table - statisticsTbl table.Table - charsetTbl table.Table - collationsTbl table.Table - filesTbl table.Table - defTbl table.Table - profilingTbl table.Table - partitionsTbl table.Table - nameToTable map[string]table.Table - // Performance Schema - perfHandle perfschema.PerfSchema -} - -func initMemoryTables(h *memSchemaHandle) error { - // Init Information_Schema - var ( - err error - tbl table.Table - ) - for _, tblInfo := range infoSchemaDB.Tables { - alloc := autoid.NewMemoryAllocator(infoSchemaDB.ID) - tbl, err = createMemoryTable(tblInfo, alloc) - if err != nil { - return errors.Trace(err) - } - h.nameToTable[tblInfo.Name.L] = tbl - } - h.schemataTbl = h.nameToTable[strings.ToLower(tableSchemata)] - h.tablesTbl = h.nameToTable[strings.ToLower(tableTables)] - h.columnsTbl = h.nameToTable[strings.ToLower(tableColumns)] - h.statisticsTbl = h.nameToTable[strings.ToLower(tableStatistics)] - h.charsetTbl = h.nameToTable[strings.ToLower(tableCharacterSets)] - h.collationsTbl = h.nameToTable[strings.ToLower(tableCollations)] - - // CharacterSets/Collations contain static data. Init them now. - err = insertData(h.charsetTbl, dataForCharacterSets()) - if err != nil { - return errors.Trace(err) - } - err = insertData(h.collationsTbl, dataForColltions()) - if err != nil { - return errors.Trace(err) - } - return nil -} - -func insertData(tbl table.Table, rows [][]types.Datum) error { - for _, r := range rows { - _, err := tbl.AddRecord(nil, r) - if err != nil { - return errors.Trace(err) - } - } - return nil -} - -func refillMemoryTable(tbl table.Table, rows [][]types.Datum) error { - tbl.(*tables.MemoryTable).Truncate() - return insertData(tbl, rows) -} - -func (h *Handle) refillMemoryTables(schemas []*model.DBInfo) error { - dbNames := make([]string, 0, len(schemas)) - for _, v := range schemas { - dbNames = append(dbNames, v.Name.L) - } - err := refillMemoryTable(h.memSchema.schemataTbl, dataForSchemata(dbNames)) - if err != nil { - return errors.Trace(err) - } - err = refillMemoryTable(h.memSchema.tablesTbl, dataForTables(schemas)) - if err != nil { - return errors.Trace(err) - } - err = refillMemoryTable(h.memSchema.columnsTbl, dataForColumns(schemas)) - if err != nil { - return errors.Trace(err) - } - err = refillMemoryTable(h.memSchema.statisticsTbl, dataForStatistics(schemas)) - return errors.Trace(err) -} - // Get gets information schema from Handle. func (h *Handle) Get() InfoSchema { v := h.value.Load() @@ -340,14 +270,14 @@ func (h *Handle) Get() InfoSchema { // GetPerfHandle gets performance schema from handle. func (h *Handle) GetPerfHandle() perfschema.PerfSchema { - return h.memSchema.perfHandle + return h.perfHandle } // EmptyClone creates a new Handle with the same store and memSchema, but the value is not set. func (h *Handle) EmptyClone() *Handle { newHandle := &Handle{ - store: h.store, - memSchema: h.memSchema, + store: h.store, + perfHandle: h.perfHandle, } return newHandle } @@ -410,3 +340,8 @@ func initInfoSchemaDB() { Tables: infoSchemaTables, } } + +// IsMemoryDB checks if the db is in memory. +func IsMemoryDB(dbName string) bool { + return dbName == "information_schema" || dbName == "performance_schema" +} diff --git a/infoschema/infoschema_test.go b/infoschema/infoschema_test.go index 8bd35e49e5580..cdb175e19ac92 100644 --- a/infoschema/infoschema_test.go +++ b/infoschema/infoschema_test.go @@ -118,8 +118,7 @@ func (*testSuite) TestT(c *C) { checkApplyCreateNonExistsTableDoesNotPanic(c, txn, builder, dbID) txn.Rollback() - err = builder.Build() - c.Assert(err, IsNil) + builder.Build() is := handle.Get() @@ -236,8 +235,7 @@ func (*testSuite) TestInfoTables(c *C) { c.Assert(err, IsNil) builder, err := infoschema.NewBuilder(handle).InitWithDBInfos(nil, 0) c.Assert(err, IsNil) - err = builder.Build() - c.Assert(err, IsNil) + builder.Build() is := handle.Get() c.Assert(is, NotNil) diff --git a/infoschema/tables.go b/infoschema/tables.go index c13f890939d0a..fe0442667eb1b 100644 --- a/infoschema/tables.go +++ b/infoschema/tables.go @@ -17,11 +17,13 @@ import ( "fmt" "sort" + "github.com/juju/errors" + "github.com/pingcap/tidb/context" + "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/meta/autoid" "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/table" - "github.com/pingcap/tidb/table/tables" "github.com/pingcap/tidb/util/charset" "github.com/pingcap/tidb/util/types" ) @@ -318,13 +320,12 @@ var filesCols = []columnInfo{ {"EXTRA", mysql.TypeVarchar, 255, 0, nil, nil}, } -func dataForSchemata(schemas []string) [][]types.Datum { - sort.Strings(schemas) +func dataForSchemata(schemas []*model.DBInfo) [][]types.Datum { rows := [][]types.Datum{} for _, schema := range schemas { record := types.MakeDatums( catalogVal, // CATALOG_NAME - schema, // SCHEMA_NAME + schema.Name.O, // SCHEMA_NAME mysql.DefaultCharset, // DEFAULT_CHARACTER_SET_NAME mysql.DefaultCollationName, // DEFAULT_COLLATION_NAME nil, @@ -517,7 +518,162 @@ var tableNameToColumns = map[string]([]columnInfo){ tableReferConst: referConstCols, } -func createMemoryTable(meta *model.TableInfo, alloc autoid.Allocator) (table.Table, error) { - tbl, _ := tables.MemoryTableFromMeta(alloc, meta) - return tbl, nil +func createInfoSchemaTable(handle *Handle, meta *model.TableInfo) *infoschemaTable { + columns := make([]*table.Column, len(meta.Columns)) + for i, col := range meta.Columns { + columns[i] = (*table.Column)(col) + } + return &infoschemaTable{ + handle: handle, + meta: meta, + cols: columns, + } +} + +type infoschemaTable struct { + handle *Handle + meta *model.TableInfo + cols []*table.Column + rows [][]types.Datum +} + +// schemasSorter implements the sort.Interface interface, sorts DBInfo by name. +type schemasSorter []*model.DBInfo + +func (s schemasSorter) Len() int { + return len(s) +} + +func (s schemasSorter) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s schemasSorter) Less(i, j int) bool { + return s[i].Name.L < s[j].Name.L +} + +func (it *infoschemaTable) getRows(ctx context.Context, cols []*table.Column) [][]types.Datum { + is := it.handle.Get() + dbs := is.AllSchemas() + sort.Sort(schemasSorter(dbs)) + var fullRows [][]types.Datum + switch it.meta.Name.O { + case tableSchemata: + fullRows = dataForSchemata(dbs) + case tableTables: + fullRows = dataForTables(dbs) + case tableColumns: + fullRows = dataForColumns(dbs) + case tableStatistics: + fullRows = dataForStatistics(dbs) + case tableCharacterSets: + fullRows = dataForCharacterSets() + case tableCollations: + fullRows = dataForColltions() + case tableFiles: + case tableProfiling: + case tablePartitions: + case tableKeyColumm: + case tableReferConst: + } + if len(cols) == len(it.cols) { + return fullRows + } + rows := make([][]types.Datum, len(fullRows)) + for i, fullRow := range fullRows { + row := make([]types.Datum, len(cols)) + for j, col := range cols { + row[j] = fullRow[col.Offset] + } + rows[i] = row + } + return rows +} + +func (it *infoschemaTable) IterRecords(ctx context.Context, startKey kv.Key, cols []*table.Column, + fn table.RecordIterFunc) error { + if len(startKey) != 0 { + return table.ErrUnsupportedOp + } + rows := it.getRows(ctx, cols) + for i, row := range rows { + more, err := fn(int64(i), row, cols) + if err != nil { + return errors.Trace(err) + } + if !more { + break + } + } + return nil +} + +func (it *infoschemaTable) RowWithCols(ctx context.Context, h int64, cols []*table.Column) ([]types.Datum, error) { + return nil, table.ErrUnsupportedOp +} + +// Row implements table.Table Row interface. +func (it *infoschemaTable) Row(ctx context.Context, h int64) ([]types.Datum, error) { + return nil, table.ErrUnsupportedOp +} + +func (it *infoschemaTable) Cols() []*table.Column { + return it.cols +} + +func (it *infoschemaTable) WritableCols() []*table.Column { + return it.cols +} + +func (it *infoschemaTable) Indices() []table.Index { + return nil +} + +func (it *infoschemaTable) RecordPrefix() kv.Key { + return nil +} + +func (it *infoschemaTable) IndexPrefix() kv.Key { + return nil +} + +func (it *infoschemaTable) FirstKey() kv.Key { + return nil +} + +func (it *infoschemaTable) RecordKey(h int64) kv.Key { + return nil +} + +func (it *infoschemaTable) AddRecord(ctx context.Context, r []types.Datum) (recordID int64, err error) { + return 0, table.ErrUnsupportedOp +} + +func (it *infoschemaTable) RemoveRecord(ctx context.Context, h int64, r []types.Datum) error { + return table.ErrUnsupportedOp +} + +func (it *infoschemaTable) UpdateRecord(ctx context.Context, h int64, oldData []types.Datum, newData []types.Datum, touched map[int]bool) error { + return table.ErrUnsupportedOp +} + +func (it *infoschemaTable) AllocAutoID() (int64, error) { + return 0, table.ErrUnsupportedOp +} + +func (it *infoschemaTable) Allocator() autoid.Allocator { + return nil +} + +func (it *infoschemaTable) RebaseAutoID(newBase int64, isSetStep bool) error { + return table.ErrUnsupportedOp +} + +func (it *infoschemaTable) Meta() *model.TableInfo { + return it.meta +} + +// Seek is the first method called for table scan, we lazy initialize it here. +func (it *infoschemaTable) Seek(ctx context.Context, h int64) (int64, bool, error) { + return 0, false, table.ErrUnsupportedOp } diff --git a/parser/lexer.go b/parser/lexer.go index 98d0d3b3d20d8..f7dcc41743e54 100644 --- a/parser/lexer.go +++ b/parser/lexer.go @@ -102,11 +102,13 @@ func (s *Scanner) Lex(v *yySymType) int { return toInt(s, v, lit) case floatLit: return toFloat(s, v, lit) + case decLit: + return toDecimal(s, v, lit) case hexLit: return toHex(s, v, lit) case bitLit: return toBit(s, v, lit) - case userVar, sysVar, database, currentUser, replace, cast, sysDate, currentTs, currentTime, currentDate, curDate, utcDate, extract, repeat, secondMicrosecond, minuteMicrosecond, minuteSecond, hourMicrosecond, hourMinute, hourSecond, dayMicrosecond, dayMinute, daySecond, dayHour, yearMonth, ifKwd, left, convert: + case userVar, sysVar, cast, sysDate, curDate, extract: v.item = lit return tok case null: @@ -137,6 +139,8 @@ func (s *Scanner) scan() (tok int, pos Pos, lit string) { tok, pos, lit = specialComment.scan() if tok != 0 { // return the specialComment scan result as the result + pos.Line += s.r.p.Line + pos.Offset += s.r.p.Col return } // leave specialComment scan mode after all stream consumed. @@ -518,9 +522,16 @@ func (s *Scanner) scanFloat(beg *Pos) (tok int, pos Pos, lit string) { } if ch0 == 'e' || ch0 == 'E' { s.r.inc() + ch0 = s.r.peek() + if ch0 == '-' || ch0 == '+' { + s.r.inc() + } s.scanDigits() + tok = floatLit + } else { + tok = decLit } - tok, pos, lit = floatLit, *beg, s.r.data(beg) + pos, lit = *beg, s.r.data(beg) return } diff --git a/parser/lexer_test.go b/parser/lexer_test.go index bb4b3f9a54967..3058cded35fb4 100644 --- a/parser/lexer_test.go +++ b/parser/lexer_test.go @@ -15,10 +15,10 @@ package parser import ( "fmt" + "unicode" . "github.com/pingcap/check" "github.com/pingcap/tidb/util/testleak" - "unicode" ) var _ = Suite(&testLexerSuite{}) @@ -92,8 +92,10 @@ func (s *testLexerSuite) TestLiteral(c *C) { {`""a""`, stringLit}, {`\'a\'`, int('\\')}, {`\"a\"`, int('\\')}, - {"0.2314", floatLit}, + {"0.2314", decLit}, + {"132.313", decLit}, {"132.3e231", floatLit}, + {"132.3e-231", floatLit}, {"23416", intLit}, {"123test", identifier}, {"123" + string(unicode.ReplacementChar) + "xxx", identifier}, diff --git a/parser/parser.y b/parser/parser.y index c174547a4c5f4..d8ddedf0754b4 100644 --- a/parser/parser.y +++ b/parser/parser.y @@ -48,8 +48,163 @@ import ( /*yy:token "%c" */ identifier "identifier" /*yy:token "\"%c\"" */ stringLit "string literal" invalid "a special token never used by parser, used by lexer to indicate error" + andand "&&" + oror "||" + /* the following tokens belong to ReservedKeyword*/ + add "ADD" + all "ALL" + alter "ALTER" + analyze "ANALYZE" + and "AND" + as "AS" + asc "ASC" + between "BETWEEN" + bigIntType "BIGINT" + binaryType "BINARY" + blobType "BLOB" + both "BOTH" + charType "CHAR" + by "BY" + cascade "CASCADE" + caseKwd "CASE" + character "CHARACTER" + check "CHECK" + collate "COLLATE" + column "COLUMN" + constraint "CONSTRAINT" + convert "CONVERT" + create "CREATE" + cross "CROSS" + currentDate "CURRENT_DATE" + currentTime "CURRENT_TIME" + currentTs "CURRENT_TIMESTAMP" + currentUser "CURRENT_USER" + database "DATABASE" + databases "DATABASES" + dayHour "DAY_HOUR" + dayMicrosecond "DAY_MICROSECOND" + dayMinute "DAY_MINUTE" + daySecond "DAY_SECOND" + decimalType "DECIMAL" + defaultKwd "DEFAULT" + delayed "DELAYED" + deleteKwd "DELETE" + desc "DESC" + describe "DESCRIBE" + distinct "DISTINCT" + div "DIV" + doubleType "DOUBLE" + drop "DROP" + dual "DUAL" + elseKwd "ELSE" + enclosed "ENCLOSED" + escaped "ESCAPED" + exists "EXISTS" + explain "EXPLAIN" + falseKwd "FALSE" + floatType "FLOAT" + forKwd "FOR" + force "FORCE" + foreign "FOREIGN" + from "FROM" + fulltext "FULLTEXT" + grants "GRANTS" + group "GROUP" + having "HAVING" + highPriority "HIGH_PRIORITY" + hourMicrosecond "HOUR_MICROSECOND" + hourMinute "HOUR_MINUTE" + hourSecond "HOUR_SECOND" + ifKwd "IF" + ignore "IGNORE" + in "IN" + index "INDEX" + infile "INFILE" + inner "INNER" + integerType "INTEGER" + interval "INTERVAL" + into "INTO" + is "IS" + insert "INSERT" + intType "INT" + join "JOIN" + key "KEY" + keys "KEYS" + leading "LEADING" + left "LEFT" + like "LIKE" + limit "LIMIT" + lines "LINES" + load "LOAD" + localTime "LOCALTIME" + localTs "LOCALTIMESTAMP" + lock "LOCK" + longblobType "LONGBLOB" + longtextType "LONGTEXT" + lowPriority "LOW_PRIORITY" + mediumblobType "MEDIUMBLOB" + mediumIntType "MEDIUMINT" + mediumtextType "MEDIUMTEXT" + minuteMicrosecond "MINUTE_MICROSECOND" + minuteSecond "MINUTE_SECOND" + mod "MOD" + not "NOT" + noWriteToBinLog "NO_WRITE_TO_BINLOG" + null "NULL" + numericType "NUMERIC" + on "ON" + option "OPTION" + or "OR" + order "ORDER" + outer "OUTER" + precisionType "PRECISION" + primary "PRIMARY" + procedure "PROCEDURE" + read "READ" + realType "REAL" + references "REFERENCES" + regexpKwd "REGEXP" + repeat "REPEAT" + replace "REPLACE" + restrict "RESTRICT" + right "RIGHT" + rlike "RLIKE" + schema "SCHEMA" + schemas "SCHEMAS" + secondMicrosecond "SECOND_MICROSECOND" + selectKwd "SELECT" + set "SET" + show "SHOW" + smallIntType "SMALLINT" + starting "STARTING" + tableKwd "TABLE" + terminated "TERMINATED" + then "THEN" + tinyblobType "TINYBLOB" + tinyIntType "TINYINT" + tinytextType "TINYTEXT" + to "TO" + trailing "TRAILING" + trueKwd "TRUE" + unique "UNIQUE" + union "UNION" + unlock "UNLOCK" + unsigned "UNSIGNED" + update "UPDATE" + use "USE" + using "USING" + utcDate "UTC_DATE" + values "VALUES" + varcharType "VARCHAR" + varbinaryType "VARBINARY" + when "WHEN" + where "WHERE" + write "WRITE" with "WITH" + xor "XOR" + yearMonth "YEAR_MONTH" + zerofill "ZEROFILL" /* the following tokens belong to NotKeywordToken*/ abs "ABS" @@ -73,6 +228,7 @@ import ( dayofyear "DAYOFYEAR" foundRows "FOUND_ROWS" fromUnixTime "FROM_UNIXTIME" + grant "GRANT" groupConcat "GROUP_CONCAT" greatest "GREATEST" hour "HOUR" @@ -122,6 +278,7 @@ import ( after "AFTER" any "ANY" ascii "ASCII" + at "AT" autoIncrement "AUTO_INCREMENT" avgRowLength "AVG_ROW_LENGTH" avg "AVG" @@ -131,6 +288,7 @@ import ( booleanType "BOOLEAN" boolType "BOOL" btree "BTREE" + byteType "BYTE" charsetKwd "CHARSET" checksum "CHECKSUM" collation "COLLATION" @@ -150,6 +308,7 @@ import ( delayKeyWrite "DELAY_KEY_WRITE" disable "DISABLE" do "DO" + duplicate "DUPLICATE" dynamic "DYNAMIC" enable "ENABLE" end "END" @@ -163,7 +322,6 @@ import ( flush "FLUSH" full "FULL" function "FUNCTION" - grants "GRANTS" hash "HASH" identified "IDENTIFIED" isolation "ISOLATION" @@ -175,7 +333,6 @@ import ( modify "MODIFY" maxRows "MAX_ROWS" minRows "MIN_ROWS" - noWriteToBinLog "NO_WRITE_TO_BINLOG" names "NAMES" national "NATIONAL" no "NO" @@ -195,6 +352,7 @@ import ( rowFormat "ROW_FORMAT" serializable "SERIALIZABLE" session "SESSION" + share "SHARE" signed "SIGNED" snapshot "SNAPSHOT" space "SPACE" @@ -224,196 +382,33 @@ import ( %token /*yy:token "1.%d" */ floatLit "floating-point literal" + /*yy:token "1.%d" */ decLit "decimal literal" /*yy:token "%d" */ intLit "integer literal" /*yy:token "%x" */ hexLit "hexadecimal literal" /*yy:token "%b" */ bitLit "bit literal" - add "ADD" - all "ALL" - alter "ALTER" - analyze "ANALYZE" - and "AND" - andand "&&" andnot "&^" - as "AS" - asc "ASC" assignmentEq ":=" - at "AT" - between "BETWEEN" - both "BOTH" - by "BY" - byteType "BYTE" - caseKwd "CASE" cast "CAST" - character "CHARACTER" - check "CHECK" - collate "COLLATE" - column "COLUMN" - constraint "CONSTRAINT" - convert "CONVERT" - create "CREATE" - cross "CROSS" curDate "CURDATE" - currentDate "CURRENT_DATE" - currentTime "CURRENT_TIME" - currentUser "CURRENT_USER" - database "DATABASE" - databases "DATABASES" ddl "DDL" - defaultKwd "DEFAULT" - delayed "DELAYED" - deleteKwd "DELETE" - desc "DESC" - describe "DESCRIBE" - distinct "DISTINCT" - div "DIV" - drop "DROP" - dual "DUAL" - duplicate "DUPLICATE" - elseKwd "ELSE" - enclosed "ENCLOSED" enum "ENUM" eq "=" - escaped "ESCAPED" - exists "EXISTS" - explain "EXPLAIN" extract "EXTRACT" - falseKwd "false" - foreign "FOREIGN" - forKwd "FOR" - force "FORCE" - from "FROM" - fulltext "FULLTEXT" + ge ">=" - grant "GRANT" - group "GROUP" - having "HAVING" - highPriority "HIGH_PRIORITY" - ignore "IGNORE" - ifKwd "IF" - in "IN" - index "INDEX" - infile "INFILE" - inner "INNER" - insert "INSERT" - interval "INTERVAL" - into "INTO" - is "IS" - join "JOIN" - key "KEY" - keys "KEYS" le "<=" - leading "LEADING" - left "LEFT" - like "LIKE" - limit "LIMIT" - lines "LINES" - load "LOAD" - lock "LOCK" - lowPriority "LOW_PRIORITY" lsh "<<" - mod "MOD" neq "!=" neqSynonym "<>" - not "NOT" - null "NULL" nulleq "<=>" - on "ON" - option "OPTION" - or "OR" - order "ORDER" - oror "||" - outer "OUTER" placeholder "PLACEHOLDER" - primary "PRIMARY" - procedure "PROCEDURE" - read "READ" - references "REFERENCES" - regexpKwd "REGEXP" - repeat "REPEAT" - replace "REPLACE" - right "RIGHT" - rlike "RLIKE" rsh ">>" - schema "SCHEMA" - schemas "SCHEMAS" - selectKwd "SELECT" - set "SET" - share "SHARE" - show "SHOW" - starting "STARTING" strcmp "STRCMP" sysVar "SYS_VAR" sysDate "SYSDATE" - tableKwd "TABLE" - terminated "TERMINATED" - then "THEN" - to "TO" - trailing "TRAILING" - trueKwd "true" underscoreCS "UNDERSCORE_CHARSET" - union "UNION" - unique "UNIQUE" - unlock "UNLOCK" - unsigned "UNSIGNED" - update "UPDATE" - use "USE" userVar "USER_VAR" - using "USING" - utcDate "UTC_DATE" - values "VALUES" - when "WHEN" - where "WHERE" - write "WRITE" - xor "XOR" - zerofill "ZEROFILL" - - - currentTs "CURRENT_TIMESTAMP" - localTime "LOCALTIME" - localTs "LOCALTIMESTAMP" - - tinyIntType "TINYINT" - smallIntType "SMALLINT" - mediumIntType "MEDIUMINT" - intType "INT" - integerType "INTEGER" - bigIntType "BIGINT" - - decimalType "DECIMAL" - numericType "NUMERIC" - floatType "float" - doubleType "DOUBLE" - precisionType "PRECISION" - realType "REAL" - - - charType "CHAR" - varcharType "VARCHAR" - binaryType "BINARY" - varbinaryType "VARBINARY" - tinyblobType "TINYBLOB" - blobType "BLOB" - mediumblobType "MEDIUMBLOB" - longblobType "LONGBLOB" - tinytextType "TINYTEXT" - mediumtextType "MEDIUMTEXT" - longtextType "LONGTEXT" - - secondMicrosecond "SECOND_MICROSECOND" - minuteMicrosecond "MINUTE_MICROSECOND" - minuteSecond "MINUTE_SECOND" - hourMicrosecond "HOUR_MICROSECOND" - hourSecond "HOUR_SECOND" - hourMinute "HOUR_MINUTE" - dayMicrosecond "DAY_MICROSECOND" - daySecond "DAY_SECOND" - dayMinute "DAY_MINUTE" - dayHour "DAY_HOUR" - yearMonth "YEAR_MONTH" - - restrict "RESTRICT" - cascade "CASCADE" %type AdminStmt "Check table statement or show ddl statement" @@ -435,10 +430,8 @@ import ( ColumnName "column name" ColumnNameList "column name list" ColumnNameListOpt "column name list opt" - ColumnKeywordOpt "Column keyword or empty" ColumnSetValue "insert statement set value by column name" ColumnSetValueList "insert statement set value by column name list" - CommaOpt "optional comma" CommitStmt "COMMIT statement" CompareOp "Compare opcode" ColumnOption "column definition option" @@ -455,17 +448,13 @@ import ( DatabaseOptionListOpt "CREATE Database specification list opt" CreateTableStmt "CREATE TABLE statement" CreateUserStmt "CREATE User statement" - CrossOpt "Cross join option" DateArithOpt "Date arith dateadd or datesub option" DateArithMultiFormsOpt "Date arith adddate or subdate option" DateArithInterval "Date arith interval part" - DatabaseSym "DATABASE or SCHEMA" DBName "Database Name" - DeallocateSym "Deallocate or drop" DeallocateStmt "Deallocate prepared statement" Default "DEFAULT clause" DefaultOpt "optional DEFAULT clause" - DefaultKwdOpt "optional DEFAULT keyword" DefaultValueExpr "DefaultValueExpr(Now or Signed Literal)" DeleteFromStmt "DELETE FROM statement" DistinctOpt "Distinct option" @@ -481,7 +470,6 @@ import ( EscapedTableRef "escaped table reference" Escaped "Escaped by" ExecuteStmt "Execute statement" - ExplainSym "EXPLAIN or DESCRIBE or DESC" ExplainStmt "EXPLAIN statement" Expression "expression" ExpressionList "expression list" @@ -496,16 +484,13 @@ import ( FieldAsName "Field alias name" FieldAsNameOpt "Field alias name opt" FieldList "field expression list" - FieldsOrColumns "Fields or columns" FlushStmt "Flush statement" - FromOrIn "From or In" TableRefsClause "Table references clause" Function "function expr" FunctionCallAgg "Function call on aggregate data" FunctionCallConflict "Function call with reserved keyword as function name" FunctionCallKeyword "Function call with keyword as function name" FunctionCallNonKeyword "Function call with nonkeyword as function name" - FunctionNameConflict "Built-in function call names which are conflict with keywords" FuncDatetimePrec "Function datetime precision" GlobalScope "The scope of variable" GrantStmt "Grant statement" @@ -529,11 +514,8 @@ import ( IndexTypeOpt "Optional index type" InsertIntoStmt "INSERT INTO statement" InsertValues "Rest part of INSERT/REPLACE INTO statement" - IntoOpt "INTO or EmptyString" - IsolationLevel "Isolation level" JoinTable "join table" JoinType "join type" - KeyOrIndex "{KEY|INDEX}" LikeEscapeOpt "like escape option" LimitClause "LIMIT clause" Lines "Lines clause" @@ -542,27 +524,19 @@ import ( LoadDataStmt "Load data statement" LocalOpt "Local opt" LockTablesStmt "Lock tables statement" - LockType "Table locks type" - logAnd "logical and operator" - logOr "logical or operator" LowPriorityOptional "LOW_PRIORITY or empty" - NationalOpt "National option" NotOpt "optional NOT" - NowSym "CURRENT_TIMESTAMP/LOCALTIME/LOCALTIMESTAMP/NOW" NumLiteral "Num/Int/Float/Decimal Literal" NoWriteToBinLogAliasOpt "NO_WRITE_TO_BINLOG alias LOCAL or empty" ObjectType "Grant statement object type" OnDuplicateKeyUpdate "ON DUPLICATE KEY UPDATE value list" Operand "operand" OptFull "Full or empty" - OptInteger "Optional Integer keyword" - OptTable "Optional table keyword" Order "ORDER BY clause optional collation specification" OrderBy "ORDER BY clause" ByItem "BY item" OrderByOptional "Optional ORDER BY clause optional" ByList "BY list" - OuterOpt "optional OUTER clause" QuickOptional "QUICK or empty" PasswordOpt "Password option" ColumnPosition "Column position [First|After ColumnName]" @@ -570,7 +544,6 @@ import ( PrepareSQL "Prepare statement sql string" PrimaryExpression "primary expression" PrimaryFactor "primary expression factor" - PrimaryOpt "Optional primary keyword" Priority "insert statement priority" PrivElem "Privilege element" PrivElemList "Privilege element list" @@ -580,7 +553,6 @@ import ( OnDeleteOpt "optional ON DELETE clause" OnUpdateOpt "optional ON UPDATE clause" ReferOpt "reference option" - RegexpSym "REGEXP or RLIKE" ReplaceIntoStmt "REPLACE INTO statement" ReplacePriority "replace statement priority" RollbackStmt "ROLLBACK statement" @@ -600,7 +572,6 @@ import ( ShowDatabaseNameOpt "Show tables/columns statement database name option" ShowTableAliasOpt "Show table alias option" ShowLikeOrWhereOpt "Show like or where clause option" - ShowIndexKwd "Show index/indexs/key keyword" SignedLiteral "Literal or NumLiteral with sign" Starting "Starting by" Statement "statement" @@ -627,9 +598,6 @@ import ( TableOptionListOpt "create table option list opt" TableRef "table reference" TableRefs "table references" - TimeUnit "Time unit" - TransactionChar "Transaction characteristic" - TransactionChars "Transaction characteristic list" TrimDirection "Trim string direction" TruncateTableStmt "TRANSACTION TABLE statement" UnionOpt "Union Option(empty/ALL/DISTINCT)" @@ -645,7 +613,6 @@ import ( UserVariable "User defined variable name" UserVariableList "User defined variable name list" UseStmt "USE statement" - ValueSym "Value or Values" VariableAssignment "set variable value" VariableAssignmentList "set variable value list" Variable "User or system variable" @@ -675,17 +642,50 @@ import ( FloatOpt "Floating-point type option" Precision "Floating-point precision option" OptBinary "Optional BINARY" - CharsetKw "charset or charater set" OptCharset "Optional Character setting" OptCollate "Optional Collate setting" NUM "numbers" LengthNum "Field length num(uint64)" %type - Identifier "identifier or unreserved keyword" - NotKeywordToken "Tokens not mysql keyword but treated specially" - UnReservedKeyword "MySQL unreserved keywords" + KeyOrIndex "{KEY|INDEX}" + ColumnKeywordOpt "Column keyword or empty" + PrimaryOpt "Optional primary keyword" + NowSym "CURRENT_TIMESTAMP/LOCALTIME/LOCALTIMESTAMP/NOW" + DefaultKwdOpt "optional DEFAULT keyword" + DatabaseSym "DATABASE or SCHEMA" + ExplainSym "EXPLAIN or DESCRIBE or DESC" + RegexpSym "REGEXP or RLIKE" + IntoOpt "INTO or EmptyString" + ValueSym "Value or Values" + TimeUnit "Time unit" + DeallocateSym "Deallocate or drop" + OuterOpt "optional OUTER clause" + CrossOpt "Cross join option" + TransactionChar "Transaction characteristic" + TransactionChars "Transaction characteristic list" + IsolationLevel "Isolation level" + ShowIndexKwd "Show index/indexs/key keyword" + FromOrIn "From or In" + OptTable "Optional table keyword" + OptInteger "Optional Integer keyword" + NationalOpt "National option" + CharsetKw "charset or charater set" + CommaOpt "optional comma" + LockType "Table locks type" + logAnd "logical and operator" + logOr "logical or operator" + FieldsOrColumns "Fields or columns" + +%type + Identifier "identifier or unreserved keyword" + IdentifierOrReservedKeyword "Identifier or ReservedKeyword" + NotKeywordToken "Tokens not mysql keyword but treated specially" + UnReservedKeyword "MySQL unreserved keywords" + ReservedKeyword "MySQL reserved keywords" + FunctionNameConflict "Built-in function call names which are conflict with keywords" +%precedence lowestOpt %token tableRefPriority %precedence lowerThanCalcFoundRows @@ -733,6 +733,15 @@ import ( %precedence escape %precedence lowerThanComma %precedence ',' +%precedence lowerThanWith +%precedence with +%precedence lowerThanInto +%precedence into +%precedence lowerThanIf +%precedence ifKwd +%precedence lowerThanIgnore +%precedence ignore +%precedence tableKwd %start Start @@ -819,8 +828,7 @@ AlterTableSpec: } } -KeyOrIndex: - "KEY"|"INDEX" +KeyOrIndex: "KEY" | "INDEX" ColumnKeywordOpt: {} @@ -934,11 +942,11 @@ ColumnName: { $$ = &ast.ColumnName{Name: model.NewCIStr($1)} } -| Identifier '.' Identifier +| Identifier '.' IdentifierOrReservedKeyword { $$ = &ast.ColumnName{Table: model.NewCIStr($1), Name: model.NewCIStr($3)} } -| Identifier '.' Identifier '.' Identifier +| Identifier '.' Identifier '.' IdentifierOrReservedKeyword { $$ = &ast.ColumnName{Schema: model.NewCIStr($1), Table: model.NewCIStr($3), Name: model.NewCIStr($5)} } @@ -970,7 +978,8 @@ CommitStmt: } PrimaryOpt: - {} | "PRIMARY" + {} +| "PRIMARY" ColumnOption: "NOT" "NULL" @@ -1248,13 +1257,7 @@ DefaultValueExpr: // TODO: Process other three keywords NowSym: - "CURRENT_TIMESTAMP" -| "LOCALTIME" -| "LOCALTIMESTAMP" -| "NOW" - { - $$ = $1 - } +"CURRENT_TIMESTAMP" | "LOCALTIME" | "LOCALTIMESTAMP" | "NOW" SignedLiteral: Literal @@ -1274,6 +1277,7 @@ SignedLiteral: NumLiteral: intLit | floatLit +| decLit CreateIndexStmt: @@ -1503,7 +1507,7 @@ DeleteFromStmt: } DatabaseSym: - "DATABASE" | "SCHEMA" +"DATABASE" | "SCHEMA" DropDatabaseStmt: "DROP" DatabaseSym IfExists DBName @@ -1548,11 +1552,8 @@ TableOrTables: | "TABLES" EqOpt: - { - } + {} | eq - { - } EmptyStmt: /* EMPTY */ @@ -1561,9 +1562,7 @@ EmptyStmt: } ExplainSym: - "EXPLAIN" -| "DESCRIBE" -| "DESC" +"EXPLAIN" | "DESCRIBE" | "DESC" ExplainStmt: ExplainSym TableName @@ -1649,20 +1648,10 @@ Expression: logOr: - "||" - { - } -| "OR" - { - } +"||" | "OR" logAnd: - "&&" - { - } -| "AND" - { - } +"&&" | "AND" ExpressionList: Expression @@ -1800,8 +1789,7 @@ PredicateExpr: | PrimaryFactor RegexpSym: - "REGEXP" -| "RLIKE" +"REGEXP" | "RLIKE" LikeEscapeOpt: %prec lowerThanEscape @@ -1909,6 +1897,7 @@ HavingClause: } IfExists: + %prec lowestOpt { $$ = false } @@ -1918,6 +1907,7 @@ IfExists: } IfNotExists: + %prec lowestOpt { $$ = false } @@ -1928,6 +1918,7 @@ IfNotExists: IgnoreOptional: + %prec lowerThanIgnore { $$ = false } @@ -1993,8 +1984,11 @@ IndexTypeOpt: Identifier: identifier | UnReservedKeyword | NotKeywordToken +IdentifierOrReservedKeyword: +Identifier | ReservedKeyword + UnReservedKeyword: - "ACTION" | "ASCII" | "AUTO_INCREMENT" | "AFTER" | "AVG" | "BEGIN" | "BIT" | "BOOL" | "BOOLEAN" | "BTREE" | "CHARSET" + "ACTION" | "ASCII" | "AUTO_INCREMENT" | "AFTER" | "AT" | "AVG" | "BEGIN" | "BIT" | "BOOL" | "BOOLEAN" | "BTREE" | "CHARSET" | "COLUMNS" | "COMMIT" | "COMPACT" | "COMPRESSED" | "CONSISTENT" | "DATA" | "DATE" | "DATETIME" | "DEALLOCATE" | "DO" | "DYNAMIC"| "END" | "ENGINE" | "ENGINES" | "ESCAPE" | "EXECUTE" | "FIELDS" | "FIRST" | "FIXED" | "FULL" |"GLOBAL" | "HASH" | "LOCAL" | "NAMES" | "OFFSET" | "PASSWORD" %prec lowerThanEq | "PREPARE" | "QUICK" | "REDUNDANT" | "ROLLBACK" @@ -2005,6 +1999,31 @@ UnReservedKeyword: | "REPEATABLE" | "COMMITTED" | "UNCOMMITTED" | "ONLY" | "SERIALIZABLE" | "LEVEL" | "VARIABLES" | "SQL_CACHE" | "INDEXES" | "PROCESSLIST" | "SQL_NO_CACHE" | "DISABLE" | "ENABLE" | "REVERSE" | "SPACE" | "PRIVILEGES" | "NO" | "BINLOG" | "FUNCTION" | "VIEW" | "MODIFY" +ReservedKeyword: +"ADD" | "ALL" | "ALTER" | "ANALYZE" | "AND" | "AS" | "ASC" | "BETWEEN" | "BIGINT" +| "BINARY" | "BLOB" | "BOTH" | "BY" | "CASCADE" | "CASE" | "CHARACTER" | "CHECK" | "COLLATE" +| "COLUMN" | "CONSTRAINT" | "CONVERT" | "CREATE" | "CROSS" | "CURRENT_DATE" | "CURRENT_TIME" +| "CURRENT_TIMESTAMP" | "CURRENT_USER" | "DATABASE" | "DATABASES" | "DAY_HOUR" | "DAY_MICROSECOND" +| "DAY_MINUTE" | "DAY_SECOND" | "DECIMAL" | "DEFAULT" | "DELETE" | "DESC" | "DESCRIBE" +| "DISTINCT" | "DIV" | "DOUBLE" | "DROP" | "DUAL" | "ELSE" | "ENCLOSED" | "ESCAPED" +| "EXISTS" | "EXPLAIN" | "FALSE" | "FLOAT" | "FOR" | "FORCE" | "FOREIGN" | "FROM" +| "FULLTEXT" | "GRANT" | "GROUP" | "HAVING" | "HOUR_MICROSECOND" | "HOUR_MINUTE" +| "HOUR_SECOND" | "IF" | "IGNORE" | "IN" | "INDEX" | "INFILE" | "INNER" | "INSERT" | "INT" | "INTO" | "INTEGER" +| "INTERVAL" | "IS" | "JOIN" | "KEY" | "KEYS" | "LEADING" | "LEFT" | "LIKE" | "LIMIT" | "LINES" | "LOAD" +| "LOCALTIME" | "LOCALTIMESTAMP" | "LOCK" | "LONGBLOB" | "LONGTEXT" | "MEDIUMBLOB" | "MEDIUMINT" | "MEDIUMTEXT" +| "MINUTE_MICROSECOND" | "MINUTE_SECOND" | "MOD" | "NOT" | "NO_WRITE_TO_BINLOG" | "NULL" | "NUMERIC" +| "ON" | "OPTION" | "OR" | "ORDER" | "OUTER" | "PRECISION" | "PRIMARY" | "PROCEDURE" | "READ" | "REAL" +| "REFERENCES" | "REGEXP" | "REPEAT" | "REPLACE" | "RESTRICT" | "RIGHT" | "RLIKE" +| "SCHEMA" | "SCHEMAS" | "SECOND_MICROSECOND" | "SELECT" | "SET" | "SHOW" | "SMALLINT" +| "STARTING" | "TABLE" | "TERMINATED" | "THEN" | "TINYBLOB" | "TINYINT" | "TINYTEXT" | "TO" +| "TRAILING" | "TRUE" | "UNION" | "UNIQUE" | "UNLOCK" | "UNSIGNED" +| "UPDATE" | "USE" | "USING" | "UTC_DATE" | "VALUES" | "VARBINARY" | "VARCHAR" +| "WHEN" | "WHERE" | "WRITE" | "XOR" | "YEAR_MONTH" | "ZEROFILL" + /* +| "DELAYED" | "HIGH_PRIORITY" | "LOW_PRIORITY"| "WITH" + */ + + NotKeywordToken: "ABS" | "ADDDATE" | "ADMIN" | "COALESCE" | "CONCAT" | "CONCAT_WS" | "CONNECTION_ID" | "CUR_TIME"| "COUNT" | "DAY" | "DATE_ADD" | "DATE_FORMAT" | "DATE_SUB" | "DAYNAME" | "DAYOFMONTH" | "DAYOFWEEK" | "DAYOFYEAR" | "FOUND_ROWS" @@ -2036,11 +2055,9 @@ InsertIntoStmt: } IntoOpt: - { - } + %prec lowerThanInto + {} | "INTO" - { - } InsertValues: '(' ColumnNameListOpt ')' ValueSym ExpressionListList @@ -2076,11 +2093,7 @@ InsertValues: } ValueSym: - "VALUE" - { - $$ = $1 - } -| "VALUES" +"VALUE" | "VALUES" ExpressionListList: ExpressionListListItem @@ -2168,16 +2181,20 @@ ReplacePriority: /***********************************Replace Statements END************************************/ Literal: - "false" + "FALSE" { $$ = int64(0) } | "NULL" -| "true" + { + $$ = nil + } +| "TRUE" { $$ = int64(1) } | floatLit +| decLit | intLit | stringLit { @@ -2355,29 +2372,33 @@ Function: | FunctionCallAgg FunctionNameConflict: - "DATABASE" | "SCHEMA" | "IF" | "LEFT" | "REPEAT" | "CURRENT_USER" | "CURRENT_DATE" | "UTC_DATE" -| "VERSION" - { - $$ = $1 - } + "DATABASE" +| "SCHEMA" +| "IF" +| "LEFT" +| "REPEAT" +| "CURRENT_USER" +| "UTC_DATE" +| "CURRENT_DATE" +| "VERSION" FunctionCallConflict: FunctionNameConflict '(' ExpressionListOpt ')' { - $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1.(string)), Args: $3.([]ast.ExprNode)} + $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1), Args: $3.([]ast.ExprNode)} } | "CURRENT_USER" { // See https://dev.mysql.com/doc/refman/5.7/en/information-functions.html#function_current-user - $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1.(string))} + $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1)} } | "CURRENT_DATE" { - $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1.(string))} + $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1)} } | "UTC_DATE" { - $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1.(string))} + $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1)} } | "MOD" '(' PrimaryFactor ',' PrimaryFactor ')' { @@ -2427,7 +2448,7 @@ FunctionCallKeyword: // See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert charset := ast.NewValueExpr($5) $$ = &ast.FuncCallExpr{ - FnName: model.NewCIStr($1.(string)), + FnName: model.NewCIStr($1), Args: []ast.ExprNode{$3.(ast.ExprNode), charset}, } } @@ -2489,7 +2510,7 @@ FunctionCallNonKeyword: if $2 != nil { args = append(args, $2.(ast.ExprNode)) } - $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1.(string)), Args: args} + $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1), Args: args} } | "CURRENT_TIMESTAMP" FuncDatetimePrec { @@ -2497,7 +2518,7 @@ FunctionCallNonKeyword: if $2 != nil { args = append(args, $2.(ast.ExprNode)) } - $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1.(string)), Args: args} + $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1), Args: args} } | "ABS" '(' Expression ')' { @@ -2544,7 +2565,7 @@ FunctionCallNonKeyword: op := ast.NewValueExpr($1) dateArithInterval := ast.NewValueExpr( ast.DateArithInterval{ - Unit: $7.(string), + Unit: $7, Interval: $6.(ast.ExprNode), }, ) @@ -2720,7 +2741,7 @@ FunctionCallNonKeyword: | "REPLACE" '(' Expression ',' Expression ',' Expression ')' { args := []ast.ExprNode{$3.(ast.ExprNode), $5.(ast.ExprNode), $7.(ast.ExprNode)} - $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1.(string)), Args: args} + $$ = &ast.FuncCallExpr{FnName: model.NewCIStr($1), Args: args} } | "REVERSE" '(' Expression ')' { @@ -2891,7 +2912,7 @@ DateArithInterval: } | "INTERVAL" Expression TimeUnit { - $$ = ast.DateArithInterval{Unit: $3.(string), Interval: $2.(ast.ExprNode)} + $$ = ast.DateArithInterval{Unit: $3, Interval: $2.(ast.ExprNode)} } TrimDirection: @@ -2954,44 +2975,25 @@ FuncDatetimePrec: TimeUnit: "MICROSECOND" - { - $$ = $1 - } -| "SECOND" - { - $$ = $1 - } -| "MINUTE" - { - $$ = $1 - } -| "HOUR" - { - $$ = $1 - } -| "DAY" - { - $$ = $1 - } -| "WEEK" - { - $$ = $1 - } -| "MONTH" - { - $$ = $1 - } -| "QUARTER" - { - $$ = $1 - } -| "YEAR" - { - $$ = $1 - } -| "SECOND_MICROSECOND" | "MINUTE_MICROSECOND" -| "MINUTE_SECOND" | "HOUR_MICROSECOND" | "HOUR_SECOND" | "HOUR_MINUTE" -| "DAY_MICROSECOND" | "DAY_SECOND" | "DAY_MINUTE" | "DAY_HOUR" | "YEAR_MONTH" +| "SECOND" +| "MINUTE" +| "HOUR" +| "DAY" +| "WEEK" +| "MONTH" +| "QUARTER" +| "YEAR" +| "SECOND_MICROSECOND" +| "MINUTE_MICROSECOND" +| "MINUTE_SECOND" +| "HOUR_MICROSECOND" +| "HOUR_SECOND" +| "HOUR_MINUTE" +| "DAY_MICROSECOND" +| "DAY_SECOND" +| "DAY_MINUTE" +| "DAY_HOUR" +| "YEAR_MONTH" ExpressionOpt: { @@ -3171,7 +3173,7 @@ TableName: { $$ = &ast.TableName{Name:model.NewCIStr($1)} } -| Identifier '.' Identifier +| IdentifierOrReservedKeyword '.' IdentifierOrReservedKeyword { $$ = &ast.TableName{Schema:model.NewCIStr($1), Name:model.NewCIStr($3)} } @@ -3273,11 +3275,7 @@ DeallocateStmt: } DeallocateSym: - "DEALLOCATE" - { - $$ = $1 - } -| "DROP" +"DEALLOCATE" | "DROP" /****************************Prepared Statement End*******************************/ @@ -3575,18 +3573,14 @@ JoinType: } OuterOpt: - { - $$ = nil - } + {} | "OUTER" - CrossOpt: "JOIN" | "CROSS" "JOIN" | "INNER" "JOIN" - LimitClause: { $$ = nil @@ -3809,15 +3803,15 @@ TransactionChars: | TransactionChars ',' TransactionChar TransactionChar: - "ISOLATION" "LEVEL" IsolationLevel {} + "ISOLATION" "LEVEL" IsolationLevel | "READ" "WRITE" -| "READ" "ONLY" {} +| "READ" "ONLY" IsolationLevel: - "REPEATABLE" "READ" {} -| "READ" "COMMITTED" {} -| "READ" "UNCOMMITTED" {} -| "SERIALIZABLE" {} + "REPEATABLE" "READ" +| "READ" "COMMITTED" +| "READ" "UNCOMMITTED" +| "SERIALIZABLE" VariableAssignment: Identifier eq Expression @@ -4042,11 +4036,11 @@ ShowStmt: ShowIndexKwd: "INDEX" -| "INDEXES" {} +| "INDEXES" | "KEYS" FromOrIn: - "FROM"|"IN" +"FROM" | "IN" ShowTargetFilterable: "ENGINES" @@ -4463,7 +4457,9 @@ TableOptionList: } OptTable: - {} | "TABLE" + %prec lowestOpt + {} +| "TABLE" TruncateTableStmt: "TRUNCATE" OptTable TableName @@ -4617,7 +4613,8 @@ IntegerType: } OptInteger: - {} | "INTEGER" + {} +| "INTEGER" FixedPointType: "DECIMAL" @@ -4630,7 +4627,7 @@ FixedPointType: } FloatingPointType: - "float" + "FLOAT" { $$ = mysql.TypeFloat } @@ -4730,13 +4727,8 @@ StringType: } NationalOpt: - { - - } + {} | "NATIONAL" - { - - } BlobType: "TINYBLOB" @@ -4900,9 +4892,6 @@ OptCharset: CharsetKw: "CHARACTER" "SET" | "CHARSET" - { - $$ = $1 - } OptCollate: { @@ -4997,11 +4986,9 @@ WhereClauseOptional: } CommaOpt: - { - } + {} | ',' - { - } + {} /************************************************************************************ * Account Management Statements @@ -5268,8 +5255,7 @@ Fields: } FieldsOrColumns: - "FIELDS"{} -| "COLUMNS"{} +"FIELDS" | "COLUMNS" FieldsTerminated: { @@ -5334,12 +5320,14 @@ LinesTerminated: UnlockTablesStmt: "UNLOCK" "TABLES" + {} LockTablesStmt: "LOCK" "TABLES" TableLockList + {} TableLock: - TableName LockType + TableName LockType LockType: "READ" diff --git a/parser/parser_test.go b/parser/parser_test.go index 7868a33615f14..5820dc26b5821 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -37,6 +37,44 @@ type testParserSuite struct { func (s *testParserSuite) TestSimple(c *C) { defer testleak.AfterTest(c)() parser := New() + + reservedKws := []string{ + "add", "all", "alter", "analyze", "and", "as", "asc", "between", "bigint", + "binary", "blob", "both", "by", "cascade", "case", "character", "check", "collate", + "column", "constraint", "convert", "create", "cross", "current_date", "current_time", + "current_timestamp", "current_user", "database", "databases", "day_hour", "day_microsecond", + "day_minute", "day_second", "decimal", "default", "delete", "desc", "describe", + "distinct", "div", "double", "drop", "dual", "else", "enclosed", "escaped", + "exists", "explain", "false", "float", "for", "force", "foreign", "from", + "fulltext", "grant", "group", "having", "hour_microsecond", "hour_minute", + "hour_second", "if", "ignore", "in", "index", "infile", "inner", "insert", "int", "into", "integer", + "interval", "is", "join", "key", "keys", "leading", "left", "like", "limit", "lines", "load", + "localtime", "localtimestamp", "lock", "longblob", "longtext", "mediumblob", "mediumint", "mediumtext", + "minute_microsecond", "minute_second", "mod", "not", "no_write_to_binlog", "null", "numeric", + "on", "option", "or", "order", "outer", "precision", "primary", "procedure", "read", "real", + "references", "regexp", "repeat", "replace", "restrict", "right", "rlike", + "schema", "schemas", "second_microsecond", "select", "set", "show", "smallint", + "starting", "table", "terminated", "then", "tinyblob", "tinyint", "tinytext", "to", + "trailing", "true", "union", "unique", "unlock", "unsigned", + "update", "use", "using", "utc_date", "values", "varbinary", "varchar", + "when", "where", "write", "xor", "year_month", "zerofill", + // TODO: support the following keywords + // "delayed" , "high_priority" , "low_priority", "with", + } + for _, kw := range reservedKws { + src := fmt.Sprintf("SELECT * FROM db.%s;", kw) + _, err := parser.ParseOneStmt(src, "", "") + c.Assert(err, IsNil, Commentf("source %s", src)) + + src = fmt.Sprintf("SELECT * FROM %s.desc", kw) + _, err = parser.ParseOneStmt(src, "", "") + c.Assert(err, IsNil, Commentf("source %s", src)) + + src = fmt.Sprintf("SELECT t.%s FROM t", kw) + _, err = parser.ParseOneStmt(src, "", "") + c.Assert(err, IsNil, Commentf("source %s", src)) + } + // Testcase for unreserved keywords unreservedKws := []string{ "auto_increment", "after", "begin", "bit", "bool", "boolean", "charset", "columns", "commit", @@ -727,6 +765,11 @@ func (s *testParserSuite) TestIdentifier(c *C) { {`select 1 a, 1 "a", 1 'a'`, true}, {`select * from t as "a"`, false}, {`select * from t a`, true}, + // reserved keyword can't be used as identifier directly, but A.B pattern is an exception + {`select COUNT from DESC`, false}, + {`select COUNT from SELECT.DESC`, true}, + {"use `select`", true}, + {"use select", false}, {`select * from t as a`, true}, {"select 1 full, 1 row, 1 abs", true}, {"select * from t full, t1 row, t2 abs", true}, diff --git a/parser/yy_parser.go b/parser/yy_parser.go index a600ec2fe0da2..7226528ffd4e3 100644 --- a/parser/yy_parser.go +++ b/parser/yy_parser.go @@ -23,6 +23,7 @@ import ( "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/terror" + "github.com/pingcap/tidb/util/hack" ) // Error instances. @@ -151,6 +152,16 @@ func toInt(l yyLexer, lval *yySymType, str string) int { return intLit } +func toDecimal(l yyLexer, lval *yySymType, str string) int { + dec := new(mysql.MyDecimal) + err := dec.FromString(hack.Slice(str)) + if err != nil { + l.Errorf("decimal literal: %v", err) + } + lval.item = dec + return decLit +} + func toFloat(l yyLexer, lval *yySymType, str string) int { n, err := strconv.ParseFloat(str, 64) if err != nil { diff --git a/plan/expression_rewriter.go b/plan/expression_rewriter.go index 587cae778f3fc..0e50d94e5a22e 100644 --- a/plan/expression_rewriter.go +++ b/plan/expression_rewriter.go @@ -43,7 +43,7 @@ func (b *planBuilder) rewrite(expr ast.ExprNode, p LogicalPlan, aggMapper map[*a return nil, nil, errors.Errorf("context len %v is invalid", len(er.ctxStack)) } if getRowLen(er.ctxStack[0]) != 1 { - return nil, nil, errors.New("Operand should contain 1 column(s)") + return nil, nil, ErrOneColumn } return er.ctxStack[0], er.p, nil } @@ -85,7 +85,7 @@ func constructBinaryOpFunction(l expression.Expression, r expression.Expression, if lLen == 1 && rLen == 1 { return expression.NewFunction(op, types.NewFieldType(mysql.TypeTiny), l, r) } else if rLen != lLen { - return nil, errors.Errorf("Operand should contain %d column(s)", lLen) + return nil, ErrSameColumns } funcs := make([]expression.Expression, lLen) for i := 0; i < lLen; i++ { @@ -164,11 +164,11 @@ func (er *expressionRewriter) handleCompareSubquery(v *ast.CompareSubqueryExpr) // Only (a,b,c) = all (...) and (a,b,c) != any () can use row expression. canMultiCol := (!v.All && v.Op == opcode.EQ) || (v.All && v.Op == opcode.NE) if !canMultiCol && (getRowLen(lexpr) != 1 || len(np.GetSchema()) != 1) { - er.err = errors.New("Operand should contain 1 column(s)") + er.err = ErrOneColumn return v, true } if getRowLen(lexpr) != len(np.GetSchema()) { - er.err = errors.Errorf("Operand should contain %d column(s)", getRowLen(lexpr)) + er.err = ErrSameColumns return v, true } var checkCondition expression.Expression @@ -276,7 +276,7 @@ func (er *expressionRewriter) handleInSubquery(v *ast.PatternInExpr) (ast.Node, return v, true } if getRowLen(lexpr) != len(np.GetSchema()) { - er.err = errors.Errorf("Operand should contain %d column(s)", getRowLen(lexpr)) + er.err = ErrSameColumns return v, true } var rexpr expression.Expression @@ -427,9 +427,9 @@ func (er *expressionRewriter) Leave(inNode ast.Node) (retNode ast.Node, ok bool) case *ast.PositionExpr: er.positionToScalarFunc(v) case *ast.IsNullExpr: - er.isnullToExpression(v) + er.isNullToExpression(v) case *ast.IsTruthExpr: - er.istrueToScalarFunc(v) + er.isTrueToScalarFunc(v) default: er.err = errors.Errorf("UnknownType: %T", v) return retNode, false @@ -520,9 +520,6 @@ func (er *expressionRewriter) rewriteVariable(v *ast.VariableExpr) { func (er *expressionRewriter) unaryOpToExpression(v *ast.UnaryOperationExpr) { stkLen := len(er.ctxStack) - if getRowLen(er.ctxStack[stkLen-1]) != 1 { - er.err = errors.New("Operand should contain 1 column(s)") - } var op string switch v.Op { case opcode.Plus: @@ -538,6 +535,10 @@ func (er *expressionRewriter) unaryOpToExpression(v *ast.UnaryOperationExpr) { er.err = errors.Errorf("Unknown Unary Op %T", v.Op) return } + if getRowLen(er.ctxStack[stkLen-1]) != 1 { + er.err = ErrOneColumn + return + } er.ctxStack[stkLen-1], er.err = expression.NewFunction(op, &v.Type, er.ctxStack[stkLen-1]) } @@ -549,6 +550,21 @@ func (er *expressionRewriter) binaryOpToExpression(v *ast.BinaryOperationExpr) { function, er.err = constructBinaryOpFunction(er.ctxStack[stkLen-2], er.ctxStack[stkLen-1], opcode.Ops[v.Op]) default: + lLen := getRowLen(er.ctxStack[stkLen-2]) + rLen := getRowLen(er.ctxStack[stkLen-1]) + switch v.Op { + case opcode.GT, opcode.GE, opcode.LT, opcode.LE: + if lLen != rLen { + er.err = ErrSameColumns + } + default: + if lLen != 1 || rLen != 1 { + er.err = ErrOneColumn + } + } + if er.err != nil { + return + } function, er.err = expression.NewFunction(opcode.Ops[v.Op], &v.Type, er.ctxStack[stkLen-2:]...) } if er.err != nil { @@ -578,10 +594,10 @@ func (er *expressionRewriter) notToExpression(hasNot bool, op string, tp *types. return opFunc } -func (er *expressionRewriter) isnullToExpression(v *ast.IsNullExpr) { +func (er *expressionRewriter) isNullToExpression(v *ast.IsNullExpr) { stkLen := len(er.ctxStack) if getRowLen(er.ctxStack[stkLen-1]) != 1 { - er.err = errors.New("Operand should contain 1 column(s)") + er.err = ErrOneColumn return } function := er.notToExpression(v.Not, ast.IsNull, &v.Type, er.ctxStack[stkLen-1]) @@ -597,12 +613,16 @@ func (er *expressionRewriter) positionToScalarFunc(v *ast.PositionExpr) { } } -func (er *expressionRewriter) istrueToScalarFunc(v *ast.IsTruthExpr) { +func (er *expressionRewriter) isTrueToScalarFunc(v *ast.IsTruthExpr) { stkLen := len(er.ctxStack) op := ast.IsTruth if v.True == 0 { op = ast.IsFalsity } + if getRowLen(er.ctxStack[stkLen-1]) != 1 { + er.err = ErrOneColumn + return + } function := er.notToExpression(v.Not, op, &v.Type, er.ctxStack[stkLen-1]) er.ctxStack = er.ctxStack[:stkLen-1] er.ctxStack = append(er.ctxStack, function) @@ -614,6 +634,12 @@ func (er *expressionRewriter) inToExpression(v *ast.PatternInExpr) { } stkLen := len(er.ctxStack) lLen := len(v.List) + for i := 0; i < lLen; i++ { + if getRowLen(er.ctxStack[stkLen-lLen-1]) != getRowLen(er.ctxStack[stkLen-lLen+i]) { + er.err = ErrSameColumns + return + } + } function := er.notToExpression(v.Not, ast.In, &v.Type, er.ctxStack[stkLen-lLen-1:stkLen]...) er.ctxStack = er.ctxStack[:stkLen-lLen-1] er.ctxStack = append(er.ctxStack, function) @@ -625,6 +651,10 @@ func (er *expressionRewriter) caseToExpression(v *ast.CaseExpr) { if v.ElseClause != nil { argsLen++ } + er.checkArgsOneColumn(er.ctxStack[stkLen-argsLen:]...) + if er.err != nil { + return + } // value -> ctxStack[stkLen-argsLen-1] // when clause(condition, result) -> ctxStack[stkLen-argsLen:stkLen-1]; @@ -655,7 +685,7 @@ func (er *expressionRewriter) caseToExpression(v *ast.CaseExpr) { // condition2, result2, // ... // else clause - args = er.ctxStack[stkLen-argsLen : stkLen] + args = er.ctxStack[stkLen-argsLen:] } function, err := expression.NewFunction(ast.Case, &v.Type, args...) if err != nil { @@ -668,6 +698,10 @@ func (er *expressionRewriter) caseToExpression(v *ast.CaseExpr) { func (er *expressionRewriter) likeToScalarFunc(v *ast.PatternLikeExpr) { l := len(er.ctxStack) + er.checkArgsOneColumn(er.ctxStack[l-2:]...) + if er.err != nil { + return + } function := er.notToExpression(v.Not, ast.Like, &v.Type, er.ctxStack[l-2], er.ctxStack[l-1], &expression.Constant{Value: types.NewIntDatum(int64(v.Escape))}) er.ctxStack = er.ctxStack[:l-2] @@ -676,6 +710,10 @@ func (er *expressionRewriter) likeToScalarFunc(v *ast.PatternLikeExpr) { func (er *expressionRewriter) regexpToScalarFunc(v *ast.PatternRegexpExpr) { l := len(er.ctxStack) + er.checkArgsOneColumn(er.ctxStack[l-2:]...) + if er.err != nil { + return + } function := er.notToExpression(v.Not, ast.Regexp, &v.Type, er.ctxStack[l-2], er.ctxStack[l-1]) er.ctxStack = er.ctxStack[:l-2] er.ctxStack = append(er.ctxStack, function) @@ -699,6 +737,10 @@ func (er *expressionRewriter) rowToScalarFunc(v *ast.RowExpr) { func (er *expressionRewriter) betweenToExpression(v *ast.BetweenExpr) { stkLen := len(er.ctxStack) + er.checkArgsOneColumn(er.ctxStack[stkLen-3:]...) + if er.err != nil { + return + } var op string var l, r expression.Expression if v.Not { @@ -727,10 +769,24 @@ func (er *expressionRewriter) betweenToExpression(v *ast.BetweenExpr) { er.ctxStack = append(er.ctxStack, function) } +func (er *expressionRewriter) checkArgsOneColumn(args ...expression.Expression) { + for _, arg := range args { + if getRowLen(arg) != 1 { + er.err = ErrOneColumn + return + } + } +} + func (er *expressionRewriter) funcCallToExpression(v *ast.FuncCallExpr) { stackLen := len(er.ctxStack) + args := er.ctxStack[stackLen-len(v.Args):] + er.checkArgsOneColumn(args...) + if er.err != nil { + return + } var function expression.Expression - function, er.err = expression.NewFunction(v.FnName.L, &v.Type, er.ctxStack[stackLen-len(v.Args):]...) + function, er.err = expression.NewFunction(v.FnName.L, &v.Type, args...) er.ctxStack = er.ctxStack[:stackLen-len(v.Args)] er.ctxStack = append(er.ctxStack, function) } @@ -767,6 +823,10 @@ func (er *expressionRewriter) castToScalarFunc(v *ast.FuncCastExpr) { er.err = errors.Trace(err) return } + er.checkArgsOneColumn(er.ctxStack[len(er.ctxStack)-1]) + if er.err != nil { + return + } function := &expression.ScalarFunction{ Args: []expression.Expression{er.ctxStack[len(er.ctxStack)-1]}, FuncName: model.NewCIStr("cast"), diff --git a/plan/plan_test.go b/plan/logcial_plan_test.go similarity index 73% rename from plan/plan_test.go rename to plan/logcial_plan_test.go index b16a60ead84cc..3f11bdc92dcc8 100644 --- a/plan/plan_test.go +++ b/plan/logcial_plan_test.go @@ -29,6 +29,7 @@ import ( "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/parser" "github.com/pingcap/tidb/sessionctx/variable" + "github.com/pingcap/tidb/terror" "github.com/pingcap/tidb/util/mock" "github.com/pingcap/tidb/util/testleak" "github.com/pingcap/tidb/util/types" @@ -402,208 +403,6 @@ func (s *testPlanSuite) TestPushDownAggregation(c *C) { } } -func (s *testPlanSuite) TestPushDownOrderbyAndLimit(c *C) { - defer testleak.AfterTest(c)() - cases := []struct { - sql string - best string - orderByItmes string - limit string - }{ - { - sql: "select * from t order by a limit 5", - best: "Table(t)->Limit->Projection", - orderByItmes: "[]", - limit: "5", - }, - { - sql: "select * from t limit 5", - best: "Table(t)->Limit->Projection", - orderByItmes: "[]", - limit: "5", - }, - { - sql: "select c from t order by c limit 5", - best: "Index(t.c_d_e)[[,+inf]]->Limit->Projection", - orderByItmes: "[]", - limit: "5", - }, - { - sql: "select * from t order by d limit 1", - best: "Table(t)->Sort + Limit(1) + Offset(0)->Projection", - orderByItmes: "[(test.t.d, false)]", - limit: "1", - }, - { - sql: "select * from t where c > 0 order by d limit 1", - best: "Index(t.c_d_e)[(0,+inf]]->Sort + Limit(1) + Offset(0)->Projection", - orderByItmes: "[(test.t.d, false)]", - limit: "1", - }, - { - sql: "select * from t a where a.c < 10000 and a.d in (1000, a.e) order by a.b limit 2", - best: "Index(t.c_d_e)[[-inf,10000)]->Selection->Sort + Limit(2) + Offset(0)->Projection", - orderByItmes: "[]", - limit: "nil", - }, - } - for _, ca := range cases { - comment := Commentf("for %s", ca.sql) - stmt, err := s.ParseOneStmt(ca.sql, "", "") - c.Assert(err, IsNil, comment) - ast.SetFlag(stmt) - - err = mockResolve(stmt) - c.Assert(err, IsNil) - builder := &planBuilder{ - allocator: new(idAllocator), - ctx: mockContext(), - colMapper: make(map[*ast.ColumnNameExpr]int), - } - p := builder.build(stmt) - c.Assert(builder.err, IsNil) - lp := p.(LogicalPlan) - - _, lp, err = lp.PredicatePushDown(nil) - c.Assert(err, IsNil) - _, err = lp.PruneColumnsAndResolveIndices(lp.GetSchema()) - c.Assert(err, IsNil) - info, err := lp.convert2PhysicalPlan(&requiredProperty{}) - c.Assert(err, IsNil) - c.Assert(ToString(info.p), Equals, ca.best, Commentf("for %s", ca.sql)) - p = info.p - for { - var ts *physicalTableSource - switch x := p.(type) { - case *PhysicalTableScan: - ts = &x.physicalTableSource - case *PhysicalIndexScan: - ts = &x.physicalTableSource - } - if ts != nil { - c.Assert(fmt.Sprintf("%s", ts.sortItems), Equals, ca.orderByItmes, Commentf("for %s", ca.sql)) - var limitStr string - if ts.LimitCount == nil { - limitStr = fmt.Sprint("nil") - } else { - limitStr = fmt.Sprintf("%d", *ts.LimitCount) - } - c.Assert(limitStr, Equals, ca.limit, Commentf("for %s", ca.sql)) - break - } - p = p.GetChildByIndex(0) - } - } -} - -// TestPushDownExpression tests whether expressions have been pushed down successfully. -func (s *testPlanSuite) TestPushDownExpression(c *C) { - defer testleak.AfterTest(c)() - cases := []struct { - sql string - cond string // readable expressions. - }{ - { - sql: "a and b", - cond: "test.t.b", - }, - { - sql: "a or (b and c)", - cond: "or(test.t.a, and(test.t.b, test.t.c))", - }, - { - sql: "c=1 and d =1 and e =1 and b=1", - cond: "eq(test.t.b, 1)", - }, - { - sql: "a or b", - cond: "or(test.t.a, test.t.b)", - }, - { - sql: "a and (b or c)", - cond: "or(test.t.b, test.t.c)", - }, - { - sql: "not a", - cond: "not(test.t.a)", - }, - { - sql: "a xor b", - cond: "xor(test.t.a, test.t.b)", - }, - { - sql: "a & b", - cond: "bitand(test.t.a, test.t.b)", - }, - { - sql: "a | b", - cond: "bitor(test.t.a, test.t.b)", - }, - { - sql: "a ^ b", - cond: "bitxor(test.t.a, test.t.b)", - }, - { - sql: "~a", - cond: "bitneg(test.t.a)", - }, - { - sql: "a = case a when b then 1 when a then 0 end", - cond: "eq(test.t.a, case(eq(test.t.a, test.t.b), 1, eq(test.t.a, test.t.a), 0))", - }, - // if - { - sql: "a = if(a, 1, 0)", - cond: "eq(test.t.a, if(test.t.a, 1, 0))", - }, - // coalesce - { - sql: "a = coalesce(null, null, a, b)", - cond: "eq(test.t.a, coalesce(, , test.t.a, test.t.b))", - }, - } - for _, ca := range cases { - sql := "select * from t where " + ca.sql - comment := Commentf("for %s", sql) - stmt, err := s.ParseOneStmt(sql, "", "") - c.Assert(err, IsNil, comment) - ast.SetFlag(stmt) - - err = mockResolve(stmt) - c.Assert(err, IsNil) - builder := &planBuilder{ - allocator: new(idAllocator), - ctx: mockContext(), - colMapper: make(map[*ast.ColumnNameExpr]int), - } - p := builder.build(stmt) - c.Assert(builder.err, IsNil) - lp := p.(LogicalPlan) - - _, lp, err = lp.PredicatePushDown(nil) - c.Assert(err, IsNil) - _, err = lp.PruneColumnsAndResolveIndices(lp.GetSchema()) - c.Assert(err, IsNil) - info, err := lp.convert2PhysicalPlan(&requiredProperty{}) - c.Assert(err, IsNil) - p = info.p - for { - var ts *physicalTableSource - switch x := p.(type) { - case *PhysicalTableScan: - ts = &x.physicalTableSource - case *PhysicalIndexScan: - ts = &x.physicalTableSource - } - if ts != nil { - c.Assert(fmt.Sprintf("%s", expression.ComposeCNFCondition(ts.conditions).String()), Equals, ca.cond, Commentf("for %s", sql)) - break - } - p = p.GetChildByIndex(0) - } - } -} - func (s *testPlanSuite) TestPredicatePushDown(c *C) { defer testleak.AfterTest(c)() cases := []struct { @@ -938,173 +737,6 @@ func (s *testPlanSuite) TestLogicalPlan(c *C) { } } -func (s *testPlanSuite) TestCBO(c *C) { - defer testleak.AfterTest(c)() - cases := []struct { - sql string - best string - }{ - { - sql: "select * from t t1 use index(e)", - best: "Table(t)", - }, - { - sql: "select * from t t1 use index(c_d_e)", - best: "Index(t.c_d_e)[[,+inf]]", - }, - { - sql: "select * from t where (t.c > 0 and t.c < 1) or (t.c > 2 and t.c < 3) or (t.c > 4 and t.c < 5) or (t.c > 6 and t.c < 7) or (t.c > 9 and t.c < 10)", - best: "Index(t.c_d_e)[(0,1) (2,3) (4,5) (6,7) (9,10)]", - }, - { - sql: "select sum(t.a) from t where t.c in (1,2) and t.d in (1,3) group by t.d order by t.d", - best: "Index(t.c_d_e)[[1 1,1 1] [1 3,1 3] [2 1,2 1] [2 3,2 3]]->HashAgg->Sort->Trim", - }, - { - sql: "select * from t t1 ignore index(e) where c < 0", - best: "Index(t.c_d_e)[[-inf,0)]", - }, - { - sql: "select * from t t1 ignore index(c_d_e) where c < 0", - best: "Table(t)->Selection", - }, - { - sql: "select * from t where f in (1,2) and g in(1,2,3,4,5)", - best: "Index(t.f_g)[[1 1,1 1] [1 2,1 2] [1 3,1 3] [1 4,1 4] [1 5,1 5] [2 1,2 1] [2 2,2 2] [2 3,2 3] [2 4,2 4] [2 5,2 5]]", - }, - { - sql: "select * from t t1 where 1 = 0", - best: "Dummy", - }, - { - sql: "select * from t t1 where c in (1,2,3,4,5,6,7,8,9,0)", - best: "Index(t.c_d_e)[[0,0] [1,1] [2,2] [3,3] [4,4] [5,5] [6,6] [7,7] [8,8] [9,9]]", - }, - { - sql: "select * from t t1 where a in (1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9)", - best: "Table(t)", - }, - { - sql: "select count(*) from t t1 having 1 = 0", - best: "Dummy->HashAgg->Selection", - }, - { - sql: "select sum(a.b), sum(b.b) from t a join t b on a.c = b.c group by a.d order by a.d", - best: "LeftHashJoin{Table(t)->Table(t)}(a.c,b.c)->HashAgg->Sort->Trim", - }, - { - sql: "select count(*) from t group by c", - best: "Index(t.c_d_e)[[,+inf]]->StreamAgg", - }, - { - sql: "select count(*) from t group by e order by d limit 1", - best: "Table(t)->HashAgg->Sort + Limit(1) + Offset(0)->Trim", - }, - { - sql: "select count(*) from t group by a", - best: "Table(t)->StreamAgg", - }, - { - sql: "select count(*) from t group by a order by a", - best: "Table(t)->StreamAgg->Trim", - }, - { - sql: "select count(distinct e) from t where c = 1 group by d", - best: "Index(t.c_d_e)[[1,1]]->StreamAgg", - }, - { - sql: "select count(distinct e) from t group by d", - best: "Table(t)->HashAgg", - }, - { - // Multi distinct column can't apply stream agg. - sql: "select count(distinct e), sum(distinct c) from t where c = 1 group by d", - best: "Index(t.c_d_e)[[1,1]]->StreamAgg", - }, - { - sql: "select * from t a where a.c = 1 order by a.d limit 2", - best: "Index(t.c_d_e)[[1,1]]", - }, - { - sql: "select * from t a order by a.c desc limit 2", - best: "Index(t.c_d_e)[[,+inf]]->Limit", - }, - { - sql: "select * from t t1, t t2 right join t t3 on t2.a = t3.b order by t1.a, t1.b, t2.a, t2.b, t3.a, t3.b", - best: "RightHashJoin{Table(t)->RightHashJoin{Table(t)->Table(t)}(t2.a,t3.b)}->Sort", - }, - { - sql: "select * from t a where 1 = a.c and a.d > 1 order by a.d desc limit 2", - best: "Index(t.c_d_e)[(1 1,1 +inf]]", - }, - { - sql: "select * from t a where a.c < 10000 order by a.a limit 2", - best: "Index(t.c_d_e)[[-inf,10000)]->Sort + Limit(2) + Offset(0)", - }, - { - sql: "select * from t a where a.c < 10000 and a.d in (1000, a.e) order by a.a limit 2", - best: "Index(t.c_d_e)[[-inf,10000)]->Selection->Sort + Limit(2) + Offset(0)", - }, - { - sql: "select * from (select * from t) a left outer join (select * from t) b on 1 order by a.c", - best: "LeftHashJoin{Index(t.c_d_e)[[,+inf]]->Table(t)}", - }, - { - sql: "select * from (select * from t) a left outer join (select * from t) b on 1 order by b.c", - best: "LeftHashJoin{Table(t)->Table(t)}->Sort", - }, - { - sql: "select * from (select * from t) a right outer join (select * from t) b on 1 order by a.c", - best: "RightHashJoin{Table(t)->Table(t)}->Sort", - }, - { - sql: "select * from (select * from t) a right outer join (select * from t) b on 1 order by b.c", - best: "RightHashJoin{Table(t)->Index(t.c_d_e)[[,+inf]]}", - }, - { - sql: "select * from t a where exists(select * from t b where a.a = b.a) and a.c = 1 order by a.d limit 3", - best: "SemiJoin{Index(t.c_d_e)[[1,1]]->Table(t)}->Limit", - }, - { - sql: "select exists(select * from t b where a.a = b.a and b.c = 1) from t a order by a.c limit 3", - best: "SemiJoinWithAux{Index(t.c_d_e)[[,+inf]]->Limit->Index(t.c_d_e)[[1,1]]}->Projection->Trim", - }, - { - sql: "select * from (select t.a from t union select t.d from t where t.c = 1 union select t.c from t) k order by a limit 1", - best: "UnionAll{Table(t)->Index(t.c_d_e)[[1,1]]->Projection->Index(t.c_d_e)[[,+inf]]}->Distinct->Limit", - }, - { - sql: "select * from (select t.a from t union select t.d from t union select t.c from t) k order by a limit 1", - best: "UnionAll{Table(t)->Table(t)->Table(t)}->Distinct->Sort + Limit(1) + Offset(0)", - }, - } - for _, ca := range cases { - comment := Commentf("for %s", ca.sql) - stmt, err := s.ParseOneStmt(ca.sql, "", "") - c.Assert(err, IsNil, comment) - - err = mockResolve(stmt) - c.Assert(err, IsNil) - - builder := &planBuilder{ - allocator: new(idAllocator), - ctx: mock.NewContext(), - colMapper: make(map[*ast.ColumnNameExpr]int), - } - p := builder.build(stmt) - c.Assert(builder.err, IsNil) - lp := p.(LogicalPlan) - - _, lp, err = lp.PredicatePushDown(nil) - c.Assert(err, IsNil) - _, err = lp.PruneColumnsAndResolveIndices(lp.GetSchema()) - c.Assert(err, IsNil) - info, err := lp.convert2PhysicalPlan(&requiredProperty{}) - c.Assert(err, IsNil) - c.Assert(ToString(EliminateProjection(info.p)), Equals, ca.best, Commentf("for %s", ca.sql)) - } -} - func (s *testPlanSuite) TestRefine(c *C) { defer testleak.AfterTest(c)() cases := []struct { @@ -1441,7 +1073,7 @@ func (s *testPlanSuite) TestColumnPruning(c *C) { c.Assert(err, IsNil) _, err = p.PruneColumnsAndResolveIndices(p.GetSchema()) c.Assert(err, IsNil) - check(p, c, ca.ans, comment) + checkDataSourceCols(p, c, ca.ans, comment) } } @@ -1638,37 +1270,6 @@ func (s *testPlanSuite) TestNewRangeBuilder(c *C) { } } -func (s *testPlanSuite) TestTableScanWithOrder(c *C) { - defer testleak.AfterTest(c)() - // Sort result by scanning PKHandle column. - sql := "select * from t order by a limit 1;" - stmt, err := s.ParseOneStmt(sql, "", "") - c.Assert(err, IsNil) - - err = mockResolve(stmt) - c.Assert(err, IsNil) - - builder := &planBuilder{ - allocator: new(idAllocator), - ctx: mock.NewContext(), - colMapper: make(map[*ast.ColumnNameExpr]int), - } - p := builder.build(stmt) - c.Assert(builder.err, IsNil) - logic, ok := p.(LogicalPlan) - c.Assert(ok, IsTrue) - // Get physical plan. - info, err := logic.convert2PhysicalPlan(&requiredProperty{}) - c.Assert(err, IsNil) - // Limit->Projection->PhysicalTableScan - // Get PhysicalTableScan plan. - cpp, ok := info.p.GetChildByIndex(0).GetChildByIndex(0).(*PhysicalTableScan) - c.Assert(cpp, NotNil) - c.Assert(ok, IsTrue) - // Make sure KeepOrder is true. - c.Assert(cpp.KeepOrder, IsTrue) -} - func (s *testPlanSuite) TestConstantFolding(c *C) { defer testleak.AfterTest(c)() @@ -1741,155 +1342,7 @@ func (s *testPlanSuite) TestConstantFolding(c *C) { } } -func (s *testPlanSuite) TestProjectionElimination(c *C) { - defer testleak.AfterTest(c)() - cases := []struct { - sql string - ans string - }{ - // projection can be eliminated in following cases. - { - sql: "select a from t", - ans: "Table(t)", - }, - { - sql: "select a from t where a > 1", - ans: "Table(t)", - }, - { - sql: "select a from t where a is null", - ans: "Table(t)", - }, - { - sql: "select a, b from t where b > 0", - ans: "Table(t)->Selection", - }, - { - sql: "select a as c1, b as c2 from t where a = 3", - ans: "Table(t)", - }, - { - sql: "select a as c1, b as c2 from t as t1 where t1.a = 0", - ans: "Table(t)", - }, - { - sql: "select a from t where exists(select 1 from t as x where x.a < t.a)", - ans: "SemiJoin{Table(t)->Table(t)}", - }, - { - sql: "select a from (select d as a from t where d = 0) k where k.a = 5", - ans: "Dummy", - }, - { - sql: "select t1.a from t t1 where t1.a in (select t2.a from t t2 where t2.a > 1)", - ans: "SemiJoin{Table(t)->Table(t)}", - }, - { - sql: "select t1.a, t2.b from t t1, t t2 where t1.a > 0 and t2.b < 0", - ans: "RightHashJoin{Table(t)->Table(t)->Selection}", - }, - { - sql: "select t1.a, t1.b, t2.a, t2.b from t t1, t t2 where t1.a > 0 and t2.b < 0", - ans: "RightHashJoin{Table(t)->Table(t)->Selection}", - }, - { - sql: "select * from (t t1 join t t2) join (t t3 join t t4)", - ans: "LeftHashJoin{LeftHashJoin{Table(t)->Table(t)}->LeftHashJoin{Table(t)->Table(t)}}", - }, - // projection can not be eliminated in following cases. - { - sql: "select t1.b, t1.a, t2.b, t2.a from t t1, t t2 where t1.a > 0 and t2.b < 0", - ans: "RightHashJoin{Table(t)->Table(t)->Selection}->Projection", - }, - { - sql: "select d, c, b, a from t where a = b and b = 1", - ans: "Table(t)->Selection->Projection", - }, - { - sql: "select d as a, b as c from t as t1 where d > 0 and b < 0", - ans: "Table(t)->Selection->Projection", - }, - { - sql: "select c as a, c as b from t", - ans: "Table(t)->Projection", - }, - { - sql: "select c as a, c as b from t where d > 0", - ans: "Table(t)->Selection->Projection", - }, - { - sql: "select t1.a, t2.b, t2.a, t1.b from t t1, t t2 where t1.a > 0 and t2.b < 0", - ans: "RightHashJoin{Table(t)->Table(t)->Selection}->Projection", - }, - { - sql: "select t1.a from t t1 where t1.a in (select t2.a from t t2 where t1.a > 1)", - ans: "Table(t)->Apply(Table(t)->Selection->Projection)->Selection->Projection", - }, - } - for _, ca := range cases { - comment := Commentf("for %s", ca.sql) - stmt, err := s.ParseOneStmt(ca.sql, "", "") - c.Assert(err, IsNil, comment) - ast.SetFlag(stmt) - - err = mockResolve(stmt) - c.Assert(err, IsNil) - - builder := &planBuilder{ - allocator: new(idAllocator), - ctx: mock.NewContext(), - } - p := builder.build(stmt) - c.Assert(builder.err, IsNil) - lp := p.(LogicalPlan) - _, lp, err = lp.PredicatePushDown(nil) - c.Assert(err, IsNil) - _, err = lp.PruneColumnsAndResolveIndices(lp.GetSchema()) - c.Assert(err, IsNil) - info, err := lp.convert2PhysicalPlan(&requiredProperty{}) - p = EliminateProjection(info.p) - c.Assert(ToString(p), Equals, ca.ans, Commentf("for %s", ca.sql)) - } -} - -func (s *testPlanSuite) TestCoveringIndex(c *C) { - cases := []struct { - columnNames []string - indexNames []string - indexLens []int - isCovering bool - }{ - {[]string{"a"}, []string{"a"}, []int{-1}, true}, - {[]string{"a"}, []string{"a", "b"}, []int{-1, -1}, true}, - {[]string{"a", "b"}, []string{"b", "a"}, []int{-1, -1}, true}, - {[]string{"a", "b"}, []string{"b", "c"}, []int{-1, -1}, false}, - {[]string{"a", "b"}, []string{"a", "b"}, []int{50, -1}, false}, - {[]string{"a", "b"}, []string{"a", "c"}, []int{-1, -1}, false}, - {[]string{"id", "a"}, []string{"a", "b"}, []int{-1, -1}, true}, - } - for _, ca := range cases { - var columns []*model.ColumnInfo - var pkIsHandle bool - for _, cn := range ca.columnNames { - col := &model.ColumnInfo{Name: model.NewCIStr(cn)} - if cn == "id" { - pkIsHandle = true - col.Flag = mysql.PriKeyFlag - } - columns = append(columns, col) - } - var indexCols []*model.IndexColumn - for i := range ca.indexNames { - icn := ca.indexNames[i] - icl := ca.indexLens[i] - indexCols = append(indexCols, &model.IndexColumn{Name: model.NewCIStr(icn), Length: icl}) - } - covering := isCoveringIndex(columns, indexCols, pkIsHandle) - c.Assert(covering, Equals, ca.isCovering) - } -} - -func check(p Plan, c *C, ans map[string][]string, comment CommentInterface) { +func checkDataSourceCols(p Plan, c *C, ans map[string][]string, comment CommentInterface) { switch p.(type) { case *PhysicalTableScan: colList, ok := ans[p.GetID()] @@ -1899,7 +1352,7 @@ func check(p Plan, c *C, ans map[string][]string, comment CommentInterface) { } } for _, child := range p.GetChildren() { - check(child, c, ans, comment) + checkDataSourceCols(child, c, ans, comment) } } @@ -1970,3 +1423,103 @@ func (s *testPlanSuite) TestConstantPropagation(c *C) { c.Assert(strings.Join(result, ", "), Equals, ca.after, Commentf("for %s", ca.sql)) } } + +func (s *testPlanSuite) TestValidate(c *C) { + defer testleak.AfterTest(c)() + cases := []struct { + sql string + err *terror.Error + }{ + { + sql: "select date_format((1,2), '%H');", + err: ErrOneColumn, + }, + { + sql: "select cast((1,2) as date)", + err: ErrOneColumn, + }, + { + sql: "select (1,2) between (3,4) and (5,6)", + err: ErrOneColumn, + }, + { + sql: "select (1,2) rlike '1'", + err: ErrOneColumn, + }, + { + sql: "select (1,2) like '1'", + err: ErrOneColumn, + }, + { + sql: "select case(1,2) when(1,2) then true end", + err: ErrOneColumn, + }, + { + sql: "select (1,2) in ((3,4),(5,6))", + err: nil, + }, + { + sql: "select (1,2) in ((3,4),5)", + err: ErrSameColumns, + }, + { + sql: "select (1,2) is true", + err: ErrOneColumn, + }, + { + sql: "select (1,2) is null", + err: ErrOneColumn, + }, + { + sql: "select (+(1,2))=(1,2)", + err: nil, + }, + { + sql: "select (-(1,2))=(1,2)", + err: ErrOneColumn, + }, + { + sql: "select (1,2)||(1,2)", + err: ErrOneColumn, + }, + { + sql: "select (1,2) < (3,4)", + err: nil, + }, + { + sql: "select (1,2) < 3", + err: ErrSameColumns, + }, + { + sql: "select 1, * from t", + err: ErrInvalidWildCard, + }, + { + sql: "select *, 1 from t", + err: nil, + }, + { + sql: "select 1, t.* from t", + err: nil, + }, + } + for _, ca := range cases { + sql := ca.sql + comment := Commentf("for %s", sql) + stmt, err := s.ParseOneStmt(sql, "", "") + c.Assert(err, IsNil, comment) + err = mockResolve(stmt) + c.Assert(err, IsNil) + builder := &planBuilder{ + allocator: new(idAllocator), + ctx: mock.NewContext(), + colMapper: make(map[*ast.ColumnNameExpr]int), + } + builder.build(stmt) + if ca.err == nil { + c.Assert(builder.err, IsNil, comment) + } else { + c.Assert(ca.err.Equal(builder.err), IsTrue, comment) + } + } +} diff --git a/plan/logical_plan_builder.go b/plan/logical_plan_builder.go index 43691665c5407..3b573b8baab35 100644 --- a/plan/logical_plan_builder.go +++ b/plan/logical_plan_builder.go @@ -738,11 +738,15 @@ func (b *planBuilder) resolveGbyExprs(p LogicalPlan, gby *ast.GroupByClause, fie } func (b *planBuilder) unfoldWildStar(p LogicalPlan, selectFields []*ast.SelectField) (resultList []*ast.SelectField) { - for _, field := range selectFields { + for i, field := range selectFields { if field.WildCard == nil { resultList = append(resultList, field) continue } + if field.WildCard.Table.L == "" && i > 0 { + b.err = ErrInvalidWildCard + return + } dbName := field.WildCard.Schema tblName := field.WildCard.Table for _, col := range p.GetSchema() { @@ -781,6 +785,9 @@ func (b *planBuilder) buildSelect(sel *ast.SelectStmt) LogicalPlan { return nil } sel.Fields.Fields = b.unfoldWildStar(p, sel.Fields.Fields) + if b.err != nil { + return nil + } if sel.GroupBy != nil { p, gbyCols = b.resolveGbyExprs(p, sel.GroupBy, sel.Fields.Fields) if b.err != nil { diff --git a/plan/optimizer.go b/plan/optimizer.go index ec0e0575ca408..97923a1b448d3 100644 --- a/plan/optimizer.go +++ b/plan/optimizer.go @@ -101,7 +101,7 @@ func PrepareStmt(is infoschema.InfoSchema, ctx context.Context, node ast.Node) e const ( CodeOneColumn terror.ErrCode = 1 CodeSameColumns terror.ErrCode = 2 - CodeMultiWildCard terror.ErrCode = 3 + CodeInvalidWildCard terror.ErrCode = 3 CodeUnsupported terror.ErrCode = 4 CodeInvalidGroupFuncUse terror.ErrCode = 5 CodeIllegalReference terror.ErrCode = 6 @@ -111,7 +111,7 @@ const ( var ( ErrOneColumn = terror.ClassOptimizer.New(CodeOneColumn, "Operand should contain 1 column(s)") ErrSameColumns = terror.ClassOptimizer.New(CodeSameColumns, "Operands should contain same columns") - ErrMultiWildCard = terror.ClassOptimizer.New(CodeMultiWildCard, "wildcard field exist more than once") + ErrInvalidWildCard = terror.ClassOptimizer.New(CodeInvalidWildCard, "Wildcard fields without any table name appears in wrong place") ErrCartesianProductUnsupported = terror.ClassOptimizer.New(CodeUnsupported, "Cartesian product is unsupported") ErrInvalidGroupFuncUse = terror.ClassOptimizer.New(CodeInvalidGroupFuncUse, "Invalid use of group function") ErrIllegalReference = terror.ClassOptimizer.New(CodeIllegalReference, "Illegal reference") @@ -121,7 +121,7 @@ func init() { mySQLErrCodes := map[terror.ErrCode]uint16{ CodeOneColumn: mysql.ErrOperandColumns, CodeSameColumns: mysql.ErrOperandColumns, - CodeMultiWildCard: mysql.ErrParse, + CodeInvalidWildCard: mysql.ErrParse, CodeInvalidGroupFuncUse: mysql.ErrInvalidGroupFuncUse, CodeIllegalReference: mysql.ErrIllegalReference, } diff --git a/plan/physical_plan_builder.go b/plan/physical_plan_builder.go index 512f0c6470fb4..583caf8411048 100644 --- a/plan/physical_plan_builder.go +++ b/plan/physical_plan_builder.go @@ -19,6 +19,7 @@ import ( "github.com/juju/errors" "github.com/ngaut/log" "github.com/pingcap/tidb/expression" + "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/model" "github.com/pingcap/tidb/mysql" @@ -155,11 +156,7 @@ func (p *DataSource) convert2TableScan(prop *requiredProperty) (*physicalPlanInf } ts.AccessCondition, newSel.Conditions = detachTableScanConditions(conds, table) if client != nil { - var memDB bool - switch p.DBName.L { - case "information_schema", "performance_schema": - memDB = true - } + memDB := infoschema.IsMemoryDB(p.DBName.L) if !memDB && client.SupportRequestType(kv.ReqTypeSelect, 0) { ts.ConditionPBExpr, ts.conditions, newSel.Conditions = expressionsToPB(newSel.Conditions, client) } @@ -236,11 +233,7 @@ func (p *DataSource) convert2IndexScan(prop *requiredProperty, index *model.Inde } is.AccessCondition, newSel.Conditions = detachIndexScanConditions(conds, is) if client != nil { - var memDB bool - switch p.DBName.L { - case "information_schema", "performance_schema": - memDB = true - } + memDB := infoschema.IsMemoryDB(p.DBName.L) if !memDB && client.SupportRequestType(kv.ReqTypeIndex, 0) { is.ConditionPBExpr, is.conditions, newSel.Conditions = expressionsToPB(newSel.Conditions, client) } diff --git a/plan/physical_plan_test.go b/plan/physical_plan_test.go new file mode 100644 index 0000000000000..f5f3bc46fadb2 --- /dev/null +++ b/plan/physical_plan_test.go @@ -0,0 +1,543 @@ +// Copyright 2016 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package plan + +import ( + "fmt" + + . "github.com/pingcap/check" + "github.com/pingcap/tidb/ast" + "github.com/pingcap/tidb/expression" + "github.com/pingcap/tidb/model" + "github.com/pingcap/tidb/mysql" + "github.com/pingcap/tidb/util/mock" + "github.com/pingcap/tidb/util/testleak" +) + +func (s *testPlanSuite) TestPushDownOrderbyAndLimit(c *C) { + defer testleak.AfterTest(c)() + cases := []struct { + sql string + best string + orderByItmes string + limit string + }{ + { + sql: "select * from t order by a limit 5", + best: "Table(t)->Limit->Projection", + orderByItmes: "[]", + limit: "5", + }, + { + sql: "select * from t limit 5", + best: "Table(t)->Limit->Projection", + orderByItmes: "[]", + limit: "5", + }, + { + sql: "select c from t order by c limit 5", + best: "Index(t.c_d_e)[[,+inf]]->Limit->Projection", + orderByItmes: "[]", + limit: "5", + }, + { + sql: "select * from t order by d limit 1", + best: "Table(t)->Sort + Limit(1) + Offset(0)->Projection", + orderByItmes: "[(test.t.d, false)]", + limit: "1", + }, + { + sql: "select * from t where c > 0 order by d limit 1", + best: "Index(t.c_d_e)[(0,+inf]]->Sort + Limit(1) + Offset(0)->Projection", + orderByItmes: "[(test.t.d, false)]", + limit: "1", + }, + { + sql: "select * from t a where a.c < 10000 and a.d in (1000, a.e) order by a.b limit 2", + best: "Index(t.c_d_e)[[-inf,10000)]->Selection->Sort + Limit(2) + Offset(0)->Projection", + orderByItmes: "[]", + limit: "nil", + }, + } + for _, ca := range cases { + comment := Commentf("for %s", ca.sql) + stmt, err := s.ParseOneStmt(ca.sql, "", "") + c.Assert(err, IsNil, comment) + ast.SetFlag(stmt) + + err = mockResolve(stmt) + c.Assert(err, IsNil) + builder := &planBuilder{ + allocator: new(idAllocator), + ctx: mockContext(), + colMapper: make(map[*ast.ColumnNameExpr]int), + } + p := builder.build(stmt) + c.Assert(builder.err, IsNil) + lp := p.(LogicalPlan) + + _, lp, err = lp.PredicatePushDown(nil) + c.Assert(err, IsNil) + _, err = lp.PruneColumnsAndResolveIndices(lp.GetSchema()) + c.Assert(err, IsNil) + info, err := lp.convert2PhysicalPlan(&requiredProperty{}) + c.Assert(err, IsNil) + c.Assert(ToString(info.p), Equals, ca.best, Commentf("for %s", ca.sql)) + p = info.p + for { + var ts *physicalTableSource + switch x := p.(type) { + case *PhysicalTableScan: + ts = &x.physicalTableSource + case *PhysicalIndexScan: + ts = &x.physicalTableSource + } + if ts != nil { + c.Assert(fmt.Sprintf("%s", ts.sortItems), Equals, ca.orderByItmes, Commentf("for %s", ca.sql)) + var limitStr string + if ts.LimitCount == nil { + limitStr = fmt.Sprint("nil") + } else { + limitStr = fmt.Sprintf("%d", *ts.LimitCount) + } + c.Assert(limitStr, Equals, ca.limit, Commentf("for %s", ca.sql)) + break + } + p = p.GetChildByIndex(0) + } + } +} + +// TestPushDownExpression tests whether expressions have been pushed down successfully. +func (s *testPlanSuite) TestPushDownExpression(c *C) { + defer testleak.AfterTest(c)() + cases := []struct { + sql string + cond string // readable expressions. + }{ + { + sql: "a and b", + cond: "test.t.b", + }, + { + sql: "a or (b and c)", + cond: "or(test.t.a, and(test.t.b, test.t.c))", + }, + { + sql: "c=1 and d =1 and e =1 and b=1", + cond: "eq(test.t.b, 1)", + }, + { + sql: "a or b", + cond: "or(test.t.a, test.t.b)", + }, + { + sql: "a and (b or c)", + cond: "or(test.t.b, test.t.c)", + }, + { + sql: "not a", + cond: "not(test.t.a)", + }, + { + sql: "a xor b", + cond: "xor(test.t.a, test.t.b)", + }, + { + sql: "a & b", + cond: "bitand(test.t.a, test.t.b)", + }, + { + sql: "a | b", + cond: "bitor(test.t.a, test.t.b)", + }, + { + sql: "a ^ b", + cond: "bitxor(test.t.a, test.t.b)", + }, + { + sql: "~a", + cond: "bitneg(test.t.a)", + }, + { + sql: "a = case a when b then 1 when a then 0 end", + cond: "eq(test.t.a, case(eq(test.t.a, test.t.b), 1, eq(test.t.a, test.t.a), 0))", + }, + // if + { + sql: "a = if(a, 1, 0)", + cond: "eq(test.t.a, if(test.t.a, 1, 0))", + }, + // coalesce + { + sql: "a = coalesce(null, null, a, b)", + cond: "eq(test.t.a, coalesce(, , test.t.a, test.t.b))", + }, + } + for _, ca := range cases { + sql := "select * from t where " + ca.sql + comment := Commentf("for %s", sql) + stmt, err := s.ParseOneStmt(sql, "", "") + c.Assert(err, IsNil, comment) + ast.SetFlag(stmt) + + err = mockResolve(stmt) + c.Assert(err, IsNil) + builder := &planBuilder{ + allocator: new(idAllocator), + ctx: mockContext(), + colMapper: make(map[*ast.ColumnNameExpr]int), + } + p := builder.build(stmt) + c.Assert(builder.err, IsNil) + lp := p.(LogicalPlan) + + _, lp, err = lp.PredicatePushDown(nil) + c.Assert(err, IsNil) + _, err = lp.PruneColumnsAndResolveIndices(lp.GetSchema()) + c.Assert(err, IsNil) + info, err := lp.convert2PhysicalPlan(&requiredProperty{}) + c.Assert(err, IsNil) + p = info.p + for { + var ts *physicalTableSource + switch x := p.(type) { + case *PhysicalTableScan: + ts = &x.physicalTableSource + case *PhysicalIndexScan: + ts = &x.physicalTableSource + } + if ts != nil { + c.Assert(fmt.Sprintf("%s", expression.ComposeCNFCondition(ts.conditions).String()), Equals, ca.cond, Commentf("for %s", sql)) + break + } + p = p.GetChildByIndex(0) + } + } +} + +func (s *testPlanSuite) TestCBO(c *C) { + defer testleak.AfterTest(c)() + cases := []struct { + sql string + best string + }{ + { + sql: "select * from t t1 use index(e)", + best: "Table(t)", + }, + { + sql: "select * from t t1 use index(c_d_e)", + best: "Index(t.c_d_e)[[,+inf]]", + }, + { + sql: "select * from t where (t.c > 0 and t.c < 1) or (t.c > 2 and t.c < 3) or (t.c > 4 and t.c < 5) or (t.c > 6 and t.c < 7) or (t.c > 9 and t.c < 10)", + best: "Index(t.c_d_e)[(0,1) (2,3) (4,5) (6,7) (9,10)]", + }, + { + sql: "select sum(t.a) from t where t.c in (1,2) and t.d in (1,3) group by t.d order by t.d", + best: "Index(t.c_d_e)[[1 1,1 1] [1 3,1 3] [2 1,2 1] [2 3,2 3]]->HashAgg->Sort->Trim", + }, + { + sql: "select * from t t1 ignore index(e) where c < 0", + best: "Index(t.c_d_e)[[-inf,0)]", + }, + { + sql: "select * from t t1 ignore index(c_d_e) where c < 0", + best: "Table(t)->Selection", + }, + { + sql: "select * from t where f in (1,2) and g in(1,2,3,4,5)", + best: "Index(t.f_g)[[1 1,1 1] [1 2,1 2] [1 3,1 3] [1 4,1 4] [1 5,1 5] [2 1,2 1] [2 2,2 2] [2 3,2 3] [2 4,2 4] [2 5,2 5]]", + }, + { + sql: "select * from t t1 where 1 = 0", + best: "Dummy", + }, + { + sql: "select * from t t1 where c in (1,2,3,4,5,6,7,8,9,0)", + best: "Index(t.c_d_e)[[0,0] [1,1] [2,2] [3,3] [4,4] [5,5] [6,6] [7,7] [8,8] [9,9]]", + }, + { + sql: "select * from t t1 where a in (1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9)", + best: "Table(t)", + }, + { + sql: "select count(*) from t t1 having 1 = 0", + best: "Dummy->HashAgg->Selection", + }, + { + sql: "select sum(a.b), sum(b.b) from t a join t b on a.c = b.c group by a.d order by a.d", + best: "LeftHashJoin{Table(t)->Table(t)}(a.c,b.c)->HashAgg->Sort->Trim", + }, + { + sql: "select count(*) from t group by c", + best: "Index(t.c_d_e)[[,+inf]]->StreamAgg", + }, + { + sql: "select count(*) from t group by e order by d limit 1", + best: "Table(t)->HashAgg->Sort + Limit(1) + Offset(0)->Trim", + }, + { + sql: "select count(*) from t group by a", + best: "Table(t)->StreamAgg", + }, + { + sql: "select count(*) from t group by a order by a", + best: "Table(t)->StreamAgg->Trim", + }, + { + sql: "select count(distinct e) from t where c = 1 group by d", + best: "Index(t.c_d_e)[[1,1]]->StreamAgg", + }, + { + sql: "select count(distinct e) from t group by d", + best: "Table(t)->HashAgg", + }, + { + // Multi distinct column can't apply stream agg. + sql: "select count(distinct e), sum(distinct c) from t where c = 1 group by d", + best: "Index(t.c_d_e)[[1,1]]->StreamAgg", + }, + { + sql: "select * from t a where a.c = 1 order by a.d limit 2", + best: "Index(t.c_d_e)[[1,1]]", + }, + { + sql: "select * from t a order by a.c desc limit 2", + best: "Index(t.c_d_e)[[,+inf]]->Limit", + }, + { + sql: "select * from t t1, t t2 right join t t3 on t2.a = t3.b order by t1.a, t1.b, t2.a, t2.b, t3.a, t3.b", + best: "RightHashJoin{Table(t)->RightHashJoin{Table(t)->Table(t)}(t2.a,t3.b)}->Sort", + }, + { + sql: "select * from t a where 1 = a.c and a.d > 1 order by a.d desc limit 2", + best: "Index(t.c_d_e)[(1 1,1 +inf]]", + }, + { + sql: "select * from t a where a.c < 10000 order by a.a limit 2", + best: "Index(t.c_d_e)[[-inf,10000)]->Sort + Limit(2) + Offset(0)", + }, + { + sql: "select * from t a where a.c < 10000 and a.d in (1000, a.e) order by a.a limit 2", + best: "Index(t.c_d_e)[[-inf,10000)]->Selection->Sort + Limit(2) + Offset(0)", + }, + { + sql: "select * from (select * from t) a left outer join (select * from t) b on 1 order by a.c", + best: "LeftHashJoin{Index(t.c_d_e)[[,+inf]]->Table(t)}", + }, + { + sql: "select * from (select * from t) a left outer join (select * from t) b on 1 order by b.c", + best: "LeftHashJoin{Table(t)->Table(t)}->Sort", + }, + { + sql: "select * from (select * from t) a right outer join (select * from t) b on 1 order by a.c", + best: "RightHashJoin{Table(t)->Table(t)}->Sort", + }, + { + sql: "select * from (select * from t) a right outer join (select * from t) b on 1 order by b.c", + best: "RightHashJoin{Table(t)->Index(t.c_d_e)[[,+inf]]}", + }, + { + sql: "select * from t a where exists(select * from t b where a.a = b.a) and a.c = 1 order by a.d limit 3", + best: "SemiJoin{Index(t.c_d_e)[[1,1]]->Table(t)}->Limit", + }, + { + sql: "select exists(select * from t b where a.a = b.a and b.c = 1) from t a order by a.c limit 3", + best: "SemiJoinWithAux{Index(t.c_d_e)[[,+inf]]->Limit->Index(t.c_d_e)[[1,1]]}->Projection->Trim", + }, + { + sql: "select * from (select t.a from t union select t.d from t where t.c = 1 union select t.c from t) k order by a limit 1", + best: "UnionAll{Table(t)->Index(t.c_d_e)[[1,1]]->Projection->Index(t.c_d_e)[[,+inf]]}->Distinct->Limit", + }, + { + sql: "select * from (select t.a from t union select t.d from t union select t.c from t) k order by a limit 1", + best: "UnionAll{Table(t)->Table(t)->Table(t)}->Distinct->Sort + Limit(1) + Offset(0)", + }, + } + for _, ca := range cases { + comment := Commentf("for %s", ca.sql) + stmt, err := s.ParseOneStmt(ca.sql, "", "") + c.Assert(err, IsNil, comment) + + err = mockResolve(stmt) + c.Assert(err, IsNil) + + builder := &planBuilder{ + allocator: new(idAllocator), + ctx: mock.NewContext(), + colMapper: make(map[*ast.ColumnNameExpr]int), + } + p := builder.build(stmt) + c.Assert(builder.err, IsNil) + lp := p.(LogicalPlan) + + _, lp, err = lp.PredicatePushDown(nil) + c.Assert(err, IsNil) + _, err = lp.PruneColumnsAndResolveIndices(lp.GetSchema()) + c.Assert(err, IsNil) + info, err := lp.convert2PhysicalPlan(&requiredProperty{}) + c.Assert(err, IsNil) + c.Assert(ToString(EliminateProjection(info.p)), Equals, ca.best, Commentf("for %s", ca.sql)) + } +} + +func (s *testPlanSuite) TestProjectionElimination(c *C) { + defer testleak.AfterTest(c)() + cases := []struct { + sql string + ans string + }{ + // projection can be eliminated in following cases. + { + sql: "select a from t", + ans: "Table(t)", + }, + { + sql: "select a from t where a > 1", + ans: "Table(t)", + }, + { + sql: "select a from t where a is null", + ans: "Table(t)", + }, + { + sql: "select a, b from t where b > 0", + ans: "Table(t)->Selection", + }, + { + sql: "select a as c1, b as c2 from t where a = 3", + ans: "Table(t)", + }, + { + sql: "select a as c1, b as c2 from t as t1 where t1.a = 0", + ans: "Table(t)", + }, + { + sql: "select a from t where exists(select 1 from t as x where x.a < t.a)", + ans: "SemiJoin{Table(t)->Table(t)}", + }, + { + sql: "select a from (select d as a from t where d = 0) k where k.a = 5", + ans: "Dummy", + }, + { + sql: "select t1.a from t t1 where t1.a in (select t2.a from t t2 where t2.a > 1)", + ans: "SemiJoin{Table(t)->Table(t)}", + }, + { + sql: "select t1.a, t2.b from t t1, t t2 where t1.a > 0 and t2.b < 0", + ans: "RightHashJoin{Table(t)->Table(t)->Selection}", + }, + { + sql: "select t1.a, t1.b, t2.a, t2.b from t t1, t t2 where t1.a > 0 and t2.b < 0", + ans: "RightHashJoin{Table(t)->Table(t)->Selection}", + }, + { + sql: "select * from (t t1 join t t2) join (t t3 join t t4)", + ans: "LeftHashJoin{LeftHashJoin{Table(t)->Table(t)}->LeftHashJoin{Table(t)->Table(t)}}", + }, + // projection can not be eliminated in following cases. + { + sql: "select t1.b, t1.a, t2.b, t2.a from t t1, t t2 where t1.a > 0 and t2.b < 0", + ans: "RightHashJoin{Table(t)->Table(t)->Selection}->Projection", + }, + { + sql: "select d, c, b, a from t where a = b and b = 1", + ans: "Table(t)->Selection->Projection", + }, + { + sql: "select d as a, b as c from t as t1 where d > 0 and b < 0", + ans: "Table(t)->Selection->Projection", + }, + { + sql: "select c as a, c as b from t", + ans: "Table(t)->Projection", + }, + { + sql: "select c as a, c as b from t where d > 0", + ans: "Table(t)->Selection->Projection", + }, + { + sql: "select t1.a, t2.b, t2.a, t1.b from t t1, t t2 where t1.a > 0 and t2.b < 0", + ans: "RightHashJoin{Table(t)->Table(t)->Selection}->Projection", + }, + { + sql: "select t1.a from t t1 where t1.a in (select t2.a from t t2 where t1.a > 1)", + ans: "Table(t)->Apply(Table(t)->Selection->Projection)->Selection->Projection", + }, + } + for _, ca := range cases { + comment := Commentf("for %s", ca.sql) + stmt, err := s.ParseOneStmt(ca.sql, "", "") + c.Assert(err, IsNil, comment) + ast.SetFlag(stmt) + + err = mockResolve(stmt) + c.Assert(err, IsNil) + + builder := &planBuilder{ + allocator: new(idAllocator), + ctx: mock.NewContext(), + } + p := builder.build(stmt) + c.Assert(builder.err, IsNil) + lp := p.(LogicalPlan) + _, lp, err = lp.PredicatePushDown(nil) + c.Assert(err, IsNil) + _, err = lp.PruneColumnsAndResolveIndices(lp.GetSchema()) + c.Assert(err, IsNil) + info, err := lp.convert2PhysicalPlan(&requiredProperty{}) + p = EliminateProjection(info.p) + c.Assert(ToString(p), Equals, ca.ans, Commentf("for %s", ca.sql)) + } +} + +func (s *testPlanSuite) TestCoveringIndex(c *C) { + cases := []struct { + columnNames []string + indexNames []string + indexLens []int + isCovering bool + }{ + {[]string{"a"}, []string{"a"}, []int{-1}, true}, + {[]string{"a"}, []string{"a", "b"}, []int{-1, -1}, true}, + {[]string{"a", "b"}, []string{"b", "a"}, []int{-1, -1}, true}, + {[]string{"a", "b"}, []string{"b", "c"}, []int{-1, -1}, false}, + {[]string{"a", "b"}, []string{"a", "b"}, []int{50, -1}, false}, + {[]string{"a", "b"}, []string{"a", "c"}, []int{-1, -1}, false}, + {[]string{"id", "a"}, []string{"a", "b"}, []int{-1, -1}, true}, + } + for _, ca := range cases { + var columns []*model.ColumnInfo + var pkIsHandle bool + for _, cn := range ca.columnNames { + col := &model.ColumnInfo{Name: model.NewCIStr(cn)} + if cn == "id" { + pkIsHandle = true + col.Flag = mysql.PriKeyFlag + } + columns = append(columns, col) + } + var indexCols []*model.IndexColumn + for i := range ca.indexNames { + icn := ca.indexNames[i] + icl := ca.indexLens[i] + indexCols = append(indexCols, &model.IndexColumn{Name: model.NewCIStr(icn), Length: icl}) + } + covering := isCoveringIndex(columns, indexCols, pkIsHandle) + c.Assert(covering, Equals, ca.isCovering) + } +} diff --git a/plan/physical_plans.go b/plan/physical_plans.go index e1c259cd6be08..4bfb1091ae908 100644 --- a/plan/physical_plans.go +++ b/plan/physical_plans.go @@ -111,6 +111,47 @@ type physicalTableSource struct { conditions []expression.Expression } +// MarshalJSON implements json.Marshaler interface. +func (p *physicalTableSource) MarshalJSON() ([]byte, error) { + buffer := bytes.NewBufferString("{") + limit := 0 + if p.LimitCount != nil { + limit = int(*p.LimitCount) + } + buffer.WriteString(fmt.Sprintf("\"limit\": %d, \n", limit)) + if p.Aggregated { + buffer.WriteString(fmt.Sprint("\"aggregated push down\": true, \n")) + gbyItems, err := json.Marshal(p.gbyItems) + if err != nil { + return nil, errors.Trace(err) + } + buffer.WriteString(fmt.Sprintf("\"gby items\": %s, \n", gbyItems)) + aggFuncs, err := json.Marshal(p.aggFuncs) + if err != nil { + return nil, errors.Trace(err) + } + buffer.WriteString(fmt.Sprintf("\"agg funcs\": %s, \n", aggFuncs)) + } else if len(p.sortItems) > 0 { + sortItems, err := json.Marshal(p.sortItems) + if err != nil { + return nil, errors.Trace(err) + } + buffer.WriteString(fmt.Sprintf("\"sort items\": %s, \n", sortItems)) + } + access, err := json.Marshal(p.AccessCondition) + if err != nil { + return nil, errors.Trace(err) + } + filter, err := json.Marshal(p.conditions) + if err != nil { + return nil, errors.Trace(err) + } + // print condition infos + buffer.WriteString(fmt.Sprintf("\"access conditions\": %s, \n", access)) + buffer.WriteString(fmt.Sprintf("\"filter conditions\": %s}", filter)) + return buffer.Bytes(), nil +} + func (p *physicalTableSource) clearForAggPushDown() { p.AggFields = nil p.AggFuncsPB = nil @@ -341,11 +382,7 @@ func (p *PhysicalIndexScan) Copy() PhysicalPlan { // MarshalJSON implements json.Marshaler interface. func (p *PhysicalIndexScan) MarshalJSON() ([]byte, error) { - limit := 0 - if p.LimitCount != nil { - limit = int(*p.LimitCount) - } - access, err := json.Marshal(p.AccessCondition) + pushDownInfo, err := json.Marshal(&p.physicalTableSource) if err != nil { return nil, errors.Trace(err) } @@ -358,10 +395,8 @@ func (p *PhysicalIndexScan) MarshalJSON() ([]byte, error) { "\n \"desc\": %v,"+ "\n \"out of order\": %v,"+ "\n \"double read\": %v,"+ - "\n \"access condition\": %s,"+ - "\n \"count of pushed aggregate functions\": %d,"+ - "\n \"limit\": %d\n}", - p.DBName.O, p.Table.Name.O, p.Index.Name.O, p.Ranges, p.Desc, p.OutOfOrder, p.DoubleRead, access, len(p.AggFuncsPB), limit)) + "\n \"push down info\": %s\n}", + p.DBName.O, p.Table.Name.O, p.Index.Name.O, p.Ranges, p.Desc, p.OutOfOrder, p.DoubleRead, pushDownInfo)) return buffer.Bytes(), nil } @@ -373,11 +408,7 @@ func (p *PhysicalTableScan) Copy() PhysicalPlan { // MarshalJSON implements json.Marshaler interface. func (p *PhysicalTableScan) MarshalJSON() ([]byte, error) { - limit := 0 - if p.LimitCount != nil { - limit = int(*p.LimitCount) - } - access, err := json.Marshal(p.AccessCondition) + pushDownInfo, err := json.Marshal(&p.physicalTableSource) if err != nil { return nil, errors.Trace(err) } @@ -387,10 +418,8 @@ func (p *PhysicalTableScan) MarshalJSON() ([]byte, error) { "\n \"table\": \"%s\","+ "\n \"desc\": %v,"+ "\n \"keep order\": %v,"+ - "\n \"access condition\": %s,"+ - "\n \"count of pushed aggregate functions\": %d,"+ - "\n \"limit\": %d}", - p.DBName.O, p.Table.Name.O, p.Desc, p.KeepOrder, access, len(p.AggFuncsPB), limit)) + "\n \"push down info\": %s}", + p.DBName.O, p.Table.Name.O, p.Desc, p.KeepOrder, pushDownInfo)) return buffer.Bytes(), nil } diff --git a/plan/validator.go b/plan/validator.go index 6a3c8ef94fd40..a6903bb8f085a 100644 --- a/plan/validator.go +++ b/plan/validator.go @@ -21,7 +21,6 @@ import ( "github.com/pingcap/tidb/ast" "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/parser" - "github.com/pingcap/tidb/parser/opcode" "github.com/pingcap/tidb/util/types" ) @@ -68,30 +67,12 @@ func (v *validator) Leave(in ast.Node) (out ast.Node, ok bool) { switch x := in.(type) { case *ast.AggregateFuncExpr: v.inAggregate = false - case *ast.BetweenExpr: - v.checkAllOneColumn(x.Expr, x.Left, x.Right) - case *ast.BinaryOperationExpr: - v.checkBinaryOperation(x) - case *ast.ByItem: - v.checkAllOneColumn(x.Expr) case *ast.CreateTableStmt: v.checkAutoIncrement(x) - case *ast.CompareSubqueryExpr: - v.checkSameColumns(x.L, x.R) - case *ast.FieldList: - v.checkFieldList(x) - case *ast.HavingClause: - v.checkAllOneColumn(x.Expr) - case *ast.IsNullExpr: - v.checkAllOneColumn(x.Expr) - case *ast.IsTruthExpr: - v.checkAllOneColumn(x.Expr) case *ast.ParamMarkerExpr: if !v.inPrepare { v.err = parser.ErrSyntax.Gen("syntax error, unexpected '?'") } - case *ast.PatternInExpr: - v.checkSameColumns(append(x.List, x.Expr)...) case *ast.Limit: if x.Count > math.MaxUint64-x.Offset { x.Count = math.MaxUint64 - x.Offset @@ -101,23 +82,6 @@ func (v *validator) Leave(in ast.Node) (out ast.Node, ok bool) { return in, v.err == nil } -// checkAllOneColumn checks that all expressions have one column. -// Expression may have more than one column when it is a rowExpr or -// a Subquery with more than one result fields. -func (v *validator) checkAllOneColumn(exprs ...ast.ExprNode) { - for _, expr := range exprs { - switch x := expr.(type) { - case *ast.RowExpr: - v.err = ErrOneColumn - case *ast.SubqueryExpr: - if len(x.Query.GetResultFields()) != 1 { - v.err = ErrOneColumn - } - } - } - return -} - func checkAutoIncrementOp(colDef *ast.ColumnDef, num int) (bool, error) { var hasAutoIncrement bool @@ -216,58 +180,6 @@ func (v *validator) checkAutoIncrement(stmt *ast.CreateTableStmt) { } } -func (v *validator) checkBinaryOperation(x *ast.BinaryOperationExpr) { - // row constructor only supports comparison operation. - switch x.Op { - case opcode.LT, opcode.LE, opcode.GE, opcode.GT, opcode.EQ, opcode.NE, opcode.NullEQ: - v.checkSameColumns(x.L, x.R) - default: - v.checkAllOneColumn(x.L, x.R) - } -} - -func columnCount(ex ast.ExprNode) int { - switch x := ex.(type) { - case *ast.RowExpr: - return len(x.Values) - case *ast.SubqueryExpr: - return len(x.Query.GetResultFields()) - default: - return 1 - } -} - -func (v *validator) checkSameColumns(exprs ...ast.ExprNode) { - if len(exprs) == 0 { - return - } - count := columnCount(exprs[0]) - for i := 1; i < len(exprs); i++ { - if columnCount(exprs[i]) != count { - v.err = ErrSameColumns - return - } - } -} - -// checkFieldList checks if there is only one '*' and each field has only one column. -func (v *validator) checkFieldList(x *ast.FieldList) { - var hasWildCard bool - for _, val := range x.Fields { - if val.WildCard != nil && val.WildCard.Table.L == "" { - if hasWildCard { - v.err = ErrMultiWildCard - return - } - hasWildCard = true - } - v.checkAllOneColumn(val.Expr) - if v.err != nil { - return - } - } -} - func (v *validator) checkCreateTableGrammar(stmt *ast.CreateTableStmt) { countPrimayKey := 0 for _, colDef := range stmt.Cols { diff --git a/server/conn.go b/server/conn.go index 3d1a72f6e8153..5733a168c5bf1 100644 --- a/server/conn.go +++ b/server/conn.go @@ -405,7 +405,9 @@ func (cc *clientConn) dispatch(data []byte) error { } func (cc *clientConn) useDB(db string) (err error) { - _, err = cc.ctx.Execute("use " + db) + // if input is "use `SELECT`", mysql client just send "SELECT" + // so we add `` around db. + _, err = cc.ctx.Execute("use `" + db + "`") if err != nil { return errors.Trace(err) } diff --git a/server/driver_tidb.go b/server/driver_tidb.go index 8fc1af8701c17..72520607b7b83 100644 --- a/server/driver_tidb.go +++ b/server/driver_tidb.go @@ -212,7 +212,7 @@ func (tc *TiDBContext) Auth(user string, auth []byte, salt []byte) bool { // FieldList implements IContext FieldList method. func (tc *TiDBContext) FieldList(table string) (colums []*ColumnInfo, err error) { - rs, err := tc.Execute("SELECT * FROM " + table + " LIMIT 0") + rs, err := tc.Execute("SELECT * FROM `" + table + "` LIMIT 0") if err != nil { return nil, errors.Trace(err) } diff --git a/session.go b/session.go index b8046d8224fa8..dce18c6f39a88 100644 --- a/session.go +++ b/session.go @@ -268,6 +268,8 @@ func (s *session) String() string { return string(b) } +const sqlLogMaxLen = 1024 + func (s *session) Retry() error { variable.GetSessionVars(s).RetryInfo.Retrying = true nh := s.history.clone() @@ -300,7 +302,11 @@ func (s *session) Retry() error { variable.GetSessionVars(s).RetryInfo.ResetOffset() for _, sr := range nh.history { st := sr.st - log.Warnf("Retry %s", st.OriginText()) + txt := st.OriginText() + if len(txt) > sqlLogMaxLen { + txt = txt[:sqlLogMaxLen] + } + log.Warnf("Retry %s (len:%d)", txt, len(st.OriginText())) _, err = runStmt(s, st) if err != nil { if kv.IsRetryableError(err) { diff --git a/session_test.go b/session_test.go index 72daee952a7d1..990179ad7ba4a 100644 --- a/session_test.go +++ b/session_test.go @@ -1226,7 +1226,7 @@ func (s *testSessionSuite) TestShow(c *C) { match(c, row.Data, "autocommit", "ON") mustExecSQL(c, se, "drop table if exists t") - mustExecSQL(c, se, "create table if not exists t (c int)") + mustExecSQL(c, se, `create table if not exists t (c int) comment '注释'`) r = mustExecSQL(c, se, `show columns from t`) rows, err := GetRows(r) c.Assert(err, IsNil) @@ -1254,6 +1254,13 @@ func (s *testSessionSuite) TestShow(c *C) { c.Assert(row.Data, HasLen, 2) c.Assert(row.Data[0].GetString(), Equals, "t") + r = mustExecSQL(c, se, fmt.Sprintf("show table status from %s like 't';", s.dbName)) + row, err = r.Next() + c.Assert(err, IsNil) + c.Assert(row.Data, HasLen, 18) + c.Assert(row.Data[0].GetString(), Equals, "t") + c.Assert(row.Data[17].GetString(), Equals, "注释") + r = mustExecSQL(c, se, "show databases like 'test'") row, err = r.Next() c.Assert(err, IsNil) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 691afd86d0ffd..9c6aec61b2dfb 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -123,6 +123,9 @@ type SessionVars struct { // SnapshotInfoschema is used with SnapshotTS, when the schema version at snapshotTS less than current schema // version, we load an old version schema for query. SnapshotInfoschema interface{} + + // SkipConstraintCheck is true when importing data. + SkipConstraintCheck bool } // sessionVarsKeyType is a dummy type to avoid naming collision in context. @@ -269,6 +272,8 @@ func (s *SessionVars) SetSystemVar(key string, value types.Datum) error { case AutocommitVar: isAutocommit := strings.EqualFold(sVal, "ON") || sVal == "1" s.SetStatusFlag(mysql.ServerStatusAutocommit, isAutocommit) + case TiDBSkipConstraintCheck: + s.setSkipConstraintCheck(sVal) } s.systems[key] = sVal return nil @@ -291,6 +296,14 @@ func (s *SessionVars) setSnapshotTS(sVal string) error { return nil } +func (s *SessionVars) setSkipConstraintCheck(sVal string) { + if sVal == "1" { + s.SkipConstraintCheck = true + } else { + s.SkipConstraintCheck = false + } +} + // GetSystemVar gets a system variable. func (s *SessionVars) GetSystemVar(key string) types.Datum { var d types.Datum @@ -298,6 +311,11 @@ func (s *SessionVars) GetSystemVar(key string) types.Datum { sVal, ok := s.systems[key] if ok { d.SetString(sVal) + } else { + // TiDBSkipConstraintCheck is a session scope vars. We do not store it in the global table. + if key == TiDBSkipConstraintCheck { + d.SetString(SysVars[TiDBSkipConstraintCheck].Value) + } } return d } diff --git a/sessionctx/variable/session_test.go b/sessionctx/variable/session_test.go index 7fb74b09e39a4..ac5a32b68d0e2 100644 --- a/sessionctx/variable/session_test.go +++ b/sessionctx/variable/session_test.go @@ -68,4 +68,22 @@ func (*testSessionSuite) TestSession(c *C) { c.Assert(collation, Equals, "utf8_general_ci") c.Assert(v.SetSystemVar("character_set_results", types.Datum{}), IsNil) + + // Test case for get TiDBSkipConstraintCheck session variable + d := v.GetSystemVar(variable.TiDBSkipConstraintCheck) + c.Assert(d.GetString(), Equals, "0") + + // Test case for tidb_skip_constraint_check + c.Assert(v.SkipConstraintCheck, IsFalse) + v.SetSystemVar(variable.TiDBSkipConstraintCheck, types.NewStringDatum("0")) + c.Assert(v.SkipConstraintCheck, IsFalse) + v.SetSystemVar(variable.TiDBSkipConstraintCheck, types.NewStringDatum("1")) + c.Assert(v.SkipConstraintCheck, IsTrue) + v.SetSystemVar(variable.TiDBSkipConstraintCheck, types.NewStringDatum("0")) + c.Assert(v.SkipConstraintCheck, IsFalse) + + // Test case for change TiDBSkipConstraintCheck session variable. + v.SetSystemVar(variable.TiDBSkipConstraintCheck, types.NewStringDatum("1")) + d = v.GetSystemVar(variable.TiDBSkipConstraintCheck) + c.Assert(d.GetString(), Equals, "1") } diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 97606b6c7dae9..b0932e58df52b 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -84,6 +84,7 @@ func init() { tidbSysVars[DistSQLScanConcurrencyVar] = true tidbSysVars[DistSQLJoinConcurrencyVar] = true tidbSysVars[TiDBSnapshot] = true + tidbSysVars[TiDBSkipConstraintCheck] = true } // we only support MySQL now @@ -590,6 +591,7 @@ var defaultSysVars = []*SysVar{ {ScopeSession, TiDBSnapshot, ""}, {ScopeGlobal | ScopeSession, DistSQLScanConcurrencyVar, "10"}, {ScopeGlobal | ScopeSession, DistSQLJoinConcurrencyVar, "5"}, + {ScopeSession, TiDBSkipConstraintCheck, "0"}, } // TiDB system variables @@ -597,6 +599,7 @@ const ( TiDBSnapshot = "tidb_snapshot" DistSQLScanConcurrencyVar = "tidb_distsql_scan_concurrency" DistSQLJoinConcurrencyVar = "tidb_distsql_join_concurrency" + TiDBSkipConstraintCheck = "tidb_skip_constraint_check" ) // SetNamesVariables is the system variable names related to set names statements. diff --git a/store/tikv/txn_committer.go b/store/tikv/2pc.go similarity index 64% rename from store/tikv/txn_committer.go rename to store/tikv/2pc.go index 6f884a7eac26c..764e89a7cc9de 100644 --- a/store/tikv/txn_committer.go +++ b/store/tikv/2pc.go @@ -15,6 +15,7 @@ package tikv import ( "bytes" + "math" "sync" "github.com/juju/errors" @@ -26,12 +27,34 @@ import ( "golang.org/x/net/context" ) -type txnCommitter struct { +type twoPhaseCommitAction int + +const ( + actionPrewrite twoPhaseCommitAction = 1 + actionCommit twoPhaseCommitAction = 2 + actionCleanup twoPhaseCommitAction = 3 +) + +func (ca twoPhaseCommitAction) String() string { + switch ca { + case actionPrewrite: + return "prewrite" + case actionCommit: + return "commit" + case actionCleanup: + return "cleanup" + } + return "unknown" +} + +// twoPhaseCommitter executes a two-phase commit protocol. +type twoPhaseCommitter struct { store *tikvStore txn *tikvTxn startTS uint64 keys [][]byte mutations map[string]*pb.Mutation + lockTTL uint64 commitTS uint64 mu struct { sync.RWMutex @@ -40,7 +63,8 @@ type txnCommitter struct { } } -func newTxnCommitter(txn *tikvTxn) (*txnCommitter, error) { +// newTwoPhaseCommitter creates a twoPhaseCommitter. +func newTwoPhaseCommitter(txn *tikvTxn) (*twoPhaseCommitter, error) { var keys [][]byte var size int mutations := make(map[string]*pb.Mutation) @@ -64,8 +88,6 @@ func newTxnCommitter(txn *tikvTxn) (*txnCommitter, error) { if err != nil { return nil, errors.Trace(err) } - txnWriteKVCountHistogram.Observe(float64(len(keys))) - txnWriteSizeHistogram.Observe(float64(size / 1024)) // Transactions without Put/Del, only Locks are readonly. // We can skip commit directly. if len(keys) == 0 { @@ -78,25 +100,47 @@ func newTxnCommitter(txn *tikvTxn) (*txnCommitter, error) { Key: lockKey, } keys = append(keys, lockKey) + size += len(lockKey) + } + } + txnWriteKVCountHistogram.Observe(float64(len(keys))) + txnWriteSizeHistogram.Observe(float64(size / 1024)) + + // Increase lockTTL for large transactions. + // The formula is `ttl = ttlFactor * sqrt(sizeInMiB)`. + // When writeSize <= 256K, ttl is defaultTTL (3s); + // When writeSize is 1MiB, 100MiB, or 400MiB, ttl is 6s, 60s, 120s correspondingly; + // When writeSize >= 400MiB, ttl is maxTTL (120s). + var lockTTL uint64 + if size > txnCommitBatchSize { + sizeMiB := float64(size) / 1024 / 1024 + lockTTL = uint64(float64(ttlFactor) * math.Sqrt(float64(sizeMiB))) + if lockTTL < defaultLockTTL { + lockTTL = defaultLockTTL + } + if lockTTL > maxLockTTL { + lockTTL = maxLockTTL } } - return &txnCommitter{ + + return &twoPhaseCommitter{ store: txn.store, txn: txn, startTS: txn.StartTS(), keys: keys, mutations: mutations, + lockTTL: lockTTL, }, nil } -func (c *txnCommitter) primary() []byte { +func (c *twoPhaseCommitter) primary() []byte { return c.keys[0] } -// iterKeys groups keys into batches, then applies `f` to them. If the flag -// asyncNonPrimary is set, it will return as soon as the primary batch is -// processed. -func (c *txnCommitter) iterKeys(bo *Backoffer, keys [][]byte, f func(*Backoffer, batchKeys) error, sizeFn func([]byte) int, asyncNonPrimary bool) error { +// doActionOnKeys groups keys into primary batch and secondary batches, if primary batch exists in the key, +// it does action on primary batch first, then on secondary batches. If action is commit, secondary batches +// is done in background goroutine. +func (c *twoPhaseCommitter) doActionOnKeys(bo *Backoffer, action twoPhaseCommitAction, keys [][]byte) error { if len(keys) == 0 { return nil } @@ -104,67 +148,80 @@ func (c *txnCommitter) iterKeys(bo *Backoffer, keys [][]byte, f func(*Backoffer, if err != nil { return errors.Trace(err) } - firstIsPrimary := bytes.Equal(keys[0], c.primary()) var batches []batchKeys - // Make sure the group that contains primary key goes first. - if firstIsPrimary { - batches = appendBatchBySize(batches, firstRegion, groups[firstRegion], sizeFn, txnCommitBatchSize) - delete(groups, firstRegion) + var sizeFunc = c.keySize + if action == actionPrewrite { + sizeFunc = c.keyValueSize } + // Make sure the group that contains primary key goes first. + batches = appendBatchBySize(batches, firstRegion, groups[firstRegion], sizeFunc, txnCommitBatchSize) + delete(groups, firstRegion) for id, g := range groups { - batches = appendBatchBySize(batches, id, g, sizeFn, txnCommitBatchSize) + batches = appendBatchBySize(batches, id, g, sizeFunc, txnCommitBatchSize) } + firstIsPrimary := bytes.Equal(keys[0], c.primary()) if firstIsPrimary { - err = c.doBatches(bo, batches[:1], f) + err = c.doActionOnBatches(bo, action, batches[:1]) if err != nil { return errors.Trace(err) } batches = batches[1:] } - if asyncNonPrimary { + if action == actionCommit { + // Commit secondary batches in background goroutine to reduce latency. go func() { - e := c.doBatches(bo, batches, f) + e := c.doActionOnBatches(bo, action, batches) if e != nil { - log.Warnf("txnCommitter async doBatches err: %v", e) + log.Warnf("2PC async doActionOnBatches %s err: %v", action, e) } }() - return nil + } else { + err = c.doActionOnBatches(bo, action, batches) } - err = c.doBatches(bo, batches, f) return errors.Trace(err) } -// doBatches applies f to batches parallelly. -func (c *txnCommitter) doBatches(bo *Backoffer, batches []batchKeys, f func(*Backoffer, batchKeys) error) error { +// doActionOnBatches does action to batches in parallel. +func (c *twoPhaseCommitter) doActionOnBatches(bo *Backoffer, action twoPhaseCommitAction, batches []batchKeys) error { if len(batches) == 0 { return nil } + var singleBatchActionFunc func(bo *Backoffer, batch batchKeys) error + switch action { + case actionPrewrite: + singleBatchActionFunc = c.prewriteSingleBatch + case actionCommit: + singleBatchActionFunc = c.commitSingleBatch + case actionCleanup: + singleBatchActionFunc = c.cleanupSingleBatch + } if len(batches) == 1 { - e := f(bo, batches[0]) + e := singleBatchActionFunc(bo, batches[0]) if e != nil { - log.Warnf("txnCommitter doBatches failed: %v, tid: %d", e, c.startTS) + log.Warnf("2PC doActionOnBatches %s failed: %v, tid: %d", action, e, c.startTS) } return errors.Trace(e) } // For prewrite, stop sending other requests after receiving first error. var cancel context.CancelFunc - if bo.ctx.Value(cancelOnFirstError) != nil { + if action == actionPrewrite { cancel = bo.WithCancel() } - ch := make(chan error) + // Concurrently do the work for each batch. + ch := make(chan error, len(batches)) for _, batch := range batches { go func(batch batchKeys) { - ch <- f(bo.Fork(), batch) + ch <- singleBatchActionFunc(bo.Fork(), batch) }(batch) } var err error for i := 0; i < len(batches); i++ { if e := <-ch; e != nil { - log.Warnf("txnCommitter doBatches failed: %v, tid: %d", e, c.startTS) + log.Warnf("2PC doActionOnBatches %s failed: %v, tid: %d", action, e, c.startTS) if cancel != nil { cancel() } @@ -174,19 +231,19 @@ func (c *txnCommitter) doBatches(bo *Backoffer, batches []batchKeys, f func(*Bac return errors.Trace(err) } -func (c *txnCommitter) keyValueSize(key []byte) int { - size := c.keySize(key) +func (c *twoPhaseCommitter) keyValueSize(key []byte) int { + size := len(key) if mutation := c.mutations[string(key)]; mutation != nil { size += len(mutation.Value) } return size } -func (c *txnCommitter) keySize(key []byte) int { +func (c *twoPhaseCommitter) keySize(key []byte) int { return len(key) } -func (c *txnCommitter) prewriteSingleRegion(bo *Backoffer, batch batchKeys) error { +func (c *twoPhaseCommitter) prewriteSingleBatch(bo *Backoffer, batch batchKeys) error { mutations := make([]*pb.Mutation, len(batch.keys)) for i, k := range batch.keys { mutations[i] = c.mutations[string(k)] @@ -197,6 +254,7 @@ func (c *txnCommitter) prewriteSingleRegion(bo *Backoffer, batch batchKeys) erro Mutations: mutations, PrimaryLock: c.primary(), StartVersion: c.startTS, + LockTtl: c.lockTTL, }, } @@ -231,7 +289,7 @@ func (c *txnCommitter) prewriteSingleRegion(bo *Backoffer, batch batchKeys) erro if err1 != nil { return errors.Trace(err1) } - log.Debugf("prewrite encounters lock: %v", lock) + log.Debugf("2PC prewrite encounters lock: %v", lock) locks = append(locks, lock) } ok, err := c.store.lockResolver.ResolveLocks(bo, locks) @@ -239,7 +297,7 @@ func (c *txnCommitter) prewriteSingleRegion(bo *Backoffer, batch batchKeys) erro return errors.Trace(err) } if !ok { - err = bo.Backoff(boTxnLock, errors.Errorf("prewrite lockedKeys: %d", len(locks))) + err = bo.Backoff(boTxnLock, errors.Errorf("2PC prewrite lockedKeys: %d", len(locks))) if err != nil { return errors.Trace(err) } @@ -247,7 +305,7 @@ func (c *txnCommitter) prewriteSingleRegion(bo *Backoffer, batch batchKeys) erro } } -func (c *txnCommitter) commitSingleRegion(bo *Backoffer, batch batchKeys) error { +func (c *twoPhaseCommitter) commitSingleBatch(bo *Backoffer, batch batchKeys) error { req := &pb.Request{ Type: pb.MessageType_CmdCommit, CmdCommitReq: &pb.CmdCommitRequest{ @@ -277,15 +335,15 @@ func (c *txnCommitter) commitSingleRegion(bo *Backoffer, batch batchKeys) error if keyErr := commitResp.GetError(); keyErr != nil { c.mu.RLock() defer c.mu.RUnlock() - err = errors.Errorf("commit failed: %v", keyErr.String()) + err = errors.Errorf("2PC commit failed: %v", keyErr.String()) if c.mu.committed { // No secondary key could be rolled back after it's primary key is committed. // There must be a serious bug somewhere. - log.Errorf("txn failed commit key after primary key committed: %v, tid: %d", err, c.startTS) + log.Errorf("2PC failed commit key after primary key committed: %v, tid: %d", err, c.startTS) return errors.Trace(err) } // The transaction maybe rolled back by concurrent transactions. - log.Warnf("txn failed commit primary key: %v, retry later, tid: %d", err, c.startTS) + log.Warnf("2PC failed commit primary key: %v, retry later, tid: %d", err, c.startTS) return errors.Annotate(err, txnRetryableMark) } @@ -297,7 +355,7 @@ func (c *txnCommitter) commitSingleRegion(bo *Backoffer, batch batchKeys) error return nil } -func (c *txnCommitter) cleanupSingleRegion(bo *Backoffer, batch batchKeys) error { +func (c *twoPhaseCommitter) cleanupSingleBatch(bo *Backoffer, batch batchKeys) error { req := &pb.Request{ Type: pb.MessageType_CmdBatchRollback, CmdBatchRollbackReq: &pb.CmdBatchRollbackRequest{ @@ -318,24 +376,23 @@ func (c *txnCommitter) cleanupSingleRegion(bo *Backoffer, batch batchKeys) error return errors.Trace(err) } if keyErr := resp.GetCmdBatchRollbackResp().GetError(); keyErr != nil { - err = errors.Errorf("cleanup failed: %s", keyErr) - log.Errorf("txn failed cleanup key: %v, tid: %d", err, c.startTS) + err = errors.Errorf("2PC cleanup failed: %s", keyErr) + log.Errorf("2PC failed cleanup key: %v, tid: %d", err, c.startTS) return errors.Trace(err) } return nil } -func (c *txnCommitter) prewriteKeys(bo *Backoffer, keys [][]byte) error { - bo.ctx = context.WithValue(bo.ctx, cancelOnFirstError, struct{}{}) - return c.iterKeys(bo, keys, c.prewriteSingleRegion, c.keyValueSize, false) +func (c *twoPhaseCommitter) prewriteKeys(bo *Backoffer, keys [][]byte) error { + return c.doActionOnKeys(bo, actionPrewrite, keys) } -func (c *txnCommitter) commitKeys(bo *Backoffer, keys [][]byte) error { - return c.iterKeys(bo, keys, c.commitSingleRegion, c.keySize, true) +func (c *twoPhaseCommitter) commitKeys(bo *Backoffer, keys [][]byte) error { + return c.doActionOnKeys(bo, actionCommit, keys) } -func (c *txnCommitter) cleanupKeys(bo *Backoffer, keys [][]byte) error { - return c.iterKeys(bo, keys, c.cleanupSingleRegion, c.keySize, false) +func (c *twoPhaseCommitter) cleanupKeys(bo *Backoffer, keys [][]byte) error { + return c.doActionOnKeys(bo, actionCleanup, keys) } // The max time a Txn may use (in ms) from its startTS to commitTS. @@ -343,7 +400,8 @@ func (c *txnCommitter) cleanupKeys(bo *Backoffer, keys [][]byte) error { // should be less than `gcRunInterval`. const maxTxnTimeUse = 590000 -func (c *txnCommitter) Commit() error { +// execute executes the two-phase commit protocol. +func (c *twoPhaseCommitter) execute() error { ctx := context.Background() defer func() { // Always clean up all written keys if the txn does not commit. @@ -355,9 +413,9 @@ func (c *txnCommitter) Commit() error { go func() { err := c.cleanupKeys(NewBackoffer(cleanupMaxBackoff, ctx), writtenKeys) if err != nil { - log.Infof("txn cleanup err: %v, tid: %d", err, c.startTS) + log.Infof("2PC cleanup err: %v, tid: %d", err, c.startTS) } else { - log.Infof("txn clean up done, tid: %d", c.startTS) + log.Infof("2PC clean up done, tid: %d", c.startTS) } }() } @@ -372,13 +430,13 @@ func (c *txnCommitter) Commit() error { } } if err != nil { - log.Warnf("txn commit failed on prewrite: %v, tid: %d", err, c.startTS) + log.Warnf("2PC failed on prewrite: %v, tid: %d", err, c.startTS) return errors.Trace(err) } commitTS, err := c.store.getTimestampWithRetry(NewBackoffer(tsoMaxBackoff, ctx)) if err != nil { - log.Warnf("txn get commitTS failed: %v, tid: %d", err, c.startTS) + log.Warnf("2PC get commitTS failed: %v, tid: %d", err, c.startTS) return errors.Trace(err) } c.commitTS = commitTS @@ -391,15 +449,15 @@ func (c *txnCommitter) Commit() error { err = c.commitKeys(NewBackoffer(commitMaxBackoff, ctx), c.keys) if err != nil { if !c.mu.committed { - log.Warnf("txn commit failed on commit: %v, tid: %d", err, c.startTS) + log.Warnf("2PC failed on commit: %v, tid: %d", err, c.startTS) return errors.Trace(err) } - log.Warnf("txn commit succeed with error: %v, tid: %d", err, c.startTS) + log.Warnf("2PC succeed with error: %v, tid: %d", err, c.startTS) } return nil } -func (c *txnCommitter) prewriteBinlog() chan error { +func (c *twoPhaseCommitter) prewriteBinlog() chan error { if !c.shouldWriteBinlog() { return nil } @@ -416,7 +474,7 @@ func (c *txnCommitter) prewriteBinlog() chan error { return ch } -func (c *txnCommitter) writeFinishBinlog(tp binlog.BinlogType, commitTS int64) { +func (c *twoPhaseCommitter) writeFinishBinlog(tp binlog.BinlogType, commitTS int64) { if !c.shouldWriteBinlog() { return } @@ -431,7 +489,7 @@ func (c *txnCommitter) writeFinishBinlog(tp binlog.BinlogType, commitTS int64) { }() } -func (c *txnCommitter) shouldWriteBinlog() bool { +func (c *twoPhaseCommitter) shouldWriteBinlog() bool { if binloginfo.PumpClient == nil { return false } @@ -440,8 +498,8 @@ func (c *txnCommitter) shouldWriteBinlog() bool { } // TiKV recommends each RPC packet should be less than ~1MB. We keep each packet's -// Key+Value size below 512KB. -const txnCommitBatchSize = 512 * 1024 +// Key+Value size below 32KB. +const txnCommitBatchSize = 32 * 1024 // batchKeys is a batch of keys in the same region. type batchKeys struct { diff --git a/store/tikv/txn_committer_test.go b/store/tikv/2pc_test.go similarity index 95% rename from store/tikv/txn_committer_test.go rename to store/tikv/2pc_test.go index 6f25014721a4f..1b3051bdf3268 100644 --- a/store/tikv/txn_committer_test.go +++ b/store/tikv/2pc_test.go @@ -133,7 +133,7 @@ func (s *testCommitterSuite) TestPrewriteRollback(c *C) { c.Assert(err, IsNil) err = txn1.Set([]byte("b"), []byte("b1")) c.Assert(err, IsNil) - committer, err := newTxnCommitter(txn1) + committer, err := newTwoPhaseCommitter(txn1) c.Assert(err, IsNil) err = committer.prewriteKeys(NewBackoffer(prewriteMaxBackoff, ctx), committer.keys) c.Assert(err, IsNil) @@ -151,7 +151,7 @@ func (s *testCommitterSuite) TestPrewriteRollback(c *C) { c.Assert(err, IsNil) err = txn1.Set([]byte("b"), []byte("b1")) c.Assert(err, IsNil) - committer, err = newTxnCommitter(txn1) + committer, err = newTwoPhaseCommitter(txn1) c.Assert(err, IsNil) err = committer.prewriteKeys(NewBackoffer(prewriteMaxBackoff, ctx), committer.keys) c.Assert(err, IsNil) @@ -173,11 +173,10 @@ func (s *testCommitterSuite) TestContextCancel(c *C) { c.Assert(err, IsNil) err = txn1.Set([]byte("b"), []byte("b1")) c.Assert(err, IsNil) - committer, err := newTxnCommitter(txn1) + committer, err := newTwoPhaseCommitter(txn1) c.Assert(err, IsNil) bo := NewBackoffer(prewriteMaxBackoff, context.Background()) - bo.ctx = context.WithValue(bo.ctx, cancelOnFirstError, struct{}{}) cancel := bo.WithCancel() cancel() // cancel the context err = committer.prewriteKeys(bo, committer.keys) diff --git a/store/tikv/backoff.go b/store/tikv/backoff.go index a34ce977b884e..d2637ff282a3b 100644 --- a/store/tikv/backoff.go +++ b/store/tikv/backoff.go @@ -140,8 +140,6 @@ func NewBackoffer(maxSleep int, ctx context.Context) *Backoffer { } } -var cancelOnFirstError struct{} - // WithCancel returns a cancel function which, when called, would cancel backoffer's context. func (b *Backoffer) WithCancel() context.CancelFunc { var cancel context.CancelFunc diff --git a/store/tikv/lock_resolver.go b/store/tikv/lock_resolver.go index 0d79622d35534..3dda7c6175da2 100644 --- a/store/tikv/lock_resolver.go +++ b/store/tikv/lock_resolver.go @@ -69,16 +69,36 @@ func (s TxnStatus) IsCommitted() bool { return s > 0 } // CommitTS returns the txn's commitTS. It is valid iff `IsCommitted` is true. func (s TxnStatus) CommitTS() uint64 { return uint64(s) } -// locks after 3000ms is considered unusual (the client created the lock might -// be dead). Other client may cleanup this kind of lock. +// By default, locks after 3000ms is considered unusual (the client created the +// lock might be dead). Other client may cleanup this kind of lock. // For locks created recently, we will do backoff and retry. -var lockTTL uint64 = 3000 +var defaultLockTTL uint64 = 3000 + +// TODO: Consider if it's appropriate. +var maxLockTTL uint64 = 120000 + +// ttl = ttlFactor * sqrt(writeSizeInMiB) +var ttlFactor = 6000 // Lock represents a lock from tikv server. type Lock struct { Key []byte Primary []byte TxnID uint64 + TTL uint64 +} + +func newLock(l *kvrpcpb.LockInfo) *Lock { + ttl := l.GetLockTtl() + if ttl == 0 { + ttl = defaultLockTTL + } + return &Lock{ + Key: l.GetKey(), + Primary: l.GetPrimaryLock(), + TxnID: l.GetLockVersion(), + TTL: ttl, + } } func (lr *LockResolver) saveResolved(txnID uint64, status TxnStatus) { @@ -123,7 +143,7 @@ func (lr *LockResolver) ResolveLocks(bo *Backoffer, locks []*Lock) (ok bool, err var expiredLocks []*Lock for _, l := range locks { - if lr.store.oracle.IsExpired(l.TxnID, lockTTL) { + if lr.store.oracle.IsExpired(l.TxnID, l.TTL) { lockResolverCounter.WithLabelValues("expired").Inc() expiredLocks = append(expiredLocks, l) } else { diff --git a/store/tikv/lock_test.go b/store/tikv/lock_test.go index 99be52b67e758..f594ec05864b8 100644 --- a/store/tikv/lock_test.go +++ b/store/tikv/lock_test.go @@ -15,6 +15,7 @@ package tikv import ( . "github.com/pingcap/check" + "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/tidb/kv" "golang.org/x/net/context" ) @@ -48,20 +49,20 @@ func (s *testLockSuite) lockKey(c *C, key, value, primaryKey, primaryValue []byt err = txn.Delete(primaryKey) } c.Assert(err, IsNil) - committer, err := newTxnCommitter(txn) + tpc, err := newTwoPhaseCommitter(txn) c.Assert(err, IsNil) - committer.keys = [][]byte{primaryKey, key} + tpc.keys = [][]byte{primaryKey, key} - err = committer.prewriteKeys(NewBackoffer(prewriteMaxBackoff, context.Background()), committer.keys) + err = tpc.prewriteKeys(NewBackoffer(prewriteMaxBackoff, context.Background()), tpc.keys) c.Assert(err, IsNil) if commitPrimary { - committer.commitTS, err = s.store.oracle.GetTimestamp() + tpc.commitTS, err = s.store.oracle.GetTimestamp() c.Assert(err, IsNil) - err = committer.commitKeys(NewBackoffer(commitMaxBackoff, context.Background()), [][]byte{primaryKey}) + err = tpc.commitKeys(NewBackoffer(commitMaxBackoff, context.Background()), [][]byte{primaryKey}) c.Assert(err, IsNil) } - return txn.startTS, committer.commitTS + return txn.startTS, tpc.commitTS } func (s *testLockSuite) putAlphabets(c *C) { @@ -172,8 +173,61 @@ func (s *testLockSuite) TestGetTxnStatus(c *C) { c.Assert(status.IsCommitted(), IsFalse) } +func (s *testLockSuite) prewriteTxn(c *C, txn *tikvTxn) { + committer, err := newTwoPhaseCommitter(txn) + c.Assert(err, IsNil) + err = committer.prewriteKeys(NewBackoffer(prewriteMaxBackoff, context.Background()), committer.keys) + c.Assert(err, IsNil) +} + +func (s *testLockSuite) mustGetLock(c *C, key []byte) *Lock { + ver, err := s.store.CurrentVersion() + c.Assert(err, IsNil) + bo := NewBackoffer(getMaxBackoff, context.Background()) + req := &kvrpcpb.Request{ + Type: kvrpcpb.MessageType_CmdGet, + CmdGetReq: &kvrpcpb.CmdGetRequest{ + Key: key, + Version: ver.Ver, + }, + } + region, err := s.store.regionCache.GetRegion(bo, key) + c.Assert(err, IsNil) + resp, err := s.store.SendKVReq(bo, req, region.VerID(), readTimeoutShort) + c.Assert(err, IsNil) + cmdGetResp := resp.GetCmdGetResp() + c.Assert(cmdGetResp, NotNil) + keyErr := cmdGetResp.GetError() + c.Assert(keyErr, NotNil) + lock, err := extractLockFromKeyErr(keyErr) + c.Assert(err, IsNil) + return lock +} + +func (s *testLockSuite) TestLockTTL(c *C) { + txn, err := s.store.Begin() + c.Assert(err, IsNil) + txn.Set(kv.Key("key"), []byte("value")) + s.prewriteTxn(c, txn.(*tikvTxn)) + l := s.mustGetLock(c, []byte("key")) + c.Assert(l.TTL, Equals, defaultLockTTL) + + // Huge txn has a greater TTL. + txn, err = s.store.Begin() + txn.Set(kv.Key("key"), []byte("value")) + for i := 0; i < 2048; i++ { + k, v := randKV(1024, 1024) + txn.Set(kv.Key(k), []byte(v)) + } + s.prewriteTxn(c, txn.(*tikvTxn)) + l = s.mustGetLock(c, []byte("key")) + c.Assert(l.TTL, Equals, uint64(ttlFactor*2)) +} + func init() { // Speed up tests. - lockTTL = 3 + defaultLockTTL = 3 + maxLockTTL = 120 + ttlFactor = 6 oracleUpdateInterval = 2 } diff --git a/store/tikv/mock-tikv/cop_handler.go b/store/tikv/mock-tikv/cop_handler.go index 9c603f102e5c9..d831148645897 100644 --- a/store/tikv/mock-tikv/cop_handler.go +++ b/store/tikv/mock-tikv/cop_handler.go @@ -20,6 +20,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/juju/errors" "github.com/pingcap/kvproto/pkg/coprocessor" + "github.com/pingcap/kvproto/pkg/kvrpcpb" "github.com/pingcap/tidb/distsql" "github.com/pingcap/tidb/distsql/xeval" "github.com/pingcap/tidb/kv" @@ -107,7 +108,16 @@ func (h *rpcHandler) handleCopRequest(req *coprocessor.Request) (*coprocessor.Re selResp.Error = toPBError(err) selResp.Chunks = chunks if err != nil { - resp.OtherError = err.Error() + if locked, ok := errors.Cause(err).(*ErrLocked); ok { + resp.Locked = &kvrpcpb.LockInfo{ + Key: locked.Key, + PrimaryLock: locked.Primary, + LockVersion: locked.StartTS, + LockTtl: locked.TTL, + } + } else { + resp.OtherError = err.Error() + } } data, err := proto.Marshal(selResp) if err != nil { @@ -520,7 +530,6 @@ func (h *rpcHandler) getIndexRowFromRange(ctx *selectContext, ran kv.KeyRange, d pair = pairs[0] } if pair.Err != nil { - // TODO: handle lock error. return nil, errors.Trace(pair.Err) } if pair.Key == nil { diff --git a/store/tikv/mock-tikv/errors.go b/store/tikv/mock-tikv/errors.go index bcb39f184e3ba..ad76c96e87ca7 100644 --- a/store/tikv/mock-tikv/errors.go +++ b/store/tikv/mock-tikv/errors.go @@ -21,6 +21,7 @@ type ErrLocked struct { Key []byte Primary []byte StartTS uint64 + TTL uint64 } // Error formats the lock to a string. diff --git a/store/tikv/mock-tikv/mvcc.go b/store/tikv/mock-tikv/mvcc.go index 9639bde426e36..b19fa4d2fb61f 100644 --- a/store/tikv/mock-tikv/mvcc.go +++ b/store/tikv/mock-tikv/mvcc.go @@ -42,6 +42,7 @@ type mvccLock struct { primary []byte value []byte op kvrpcpb.Op + ttl uint64 } type mvccEntry struct { @@ -73,6 +74,7 @@ func (e *mvccEntry) Clone() *mvccEntry { primary: append([]byte(nil), e.lock.primary...), value: append([]byte(nil), e.lock.value...), op: e.lock.op, + ttl: e.lock.ttl, } } return &entry @@ -87,6 +89,7 @@ func (e *mvccEntry) lockErr() error { Key: e.key, Primary: e.lock.primary, StartTS: e.lock.startTS, + TTL: e.lock.ttl, } } @@ -104,7 +107,7 @@ func (e *mvccEntry) Get(ts uint64) ([]byte, error) { return nil, nil } -func (e *mvccEntry) Prewrite(mutation *kvrpcpb.Mutation, startTS uint64, primary []byte) error { +func (e *mvccEntry) Prewrite(mutation *kvrpcpb.Mutation, startTS uint64, primary []byte, ttl uint64) error { if len(e.values) > 0 { if e.values[0].commitTS >= startTS { return ErrRetryable("write conflict") @@ -121,6 +124,7 @@ func (e *mvccEntry) Prewrite(mutation *kvrpcpb.Mutation, startTS uint64, primary primary: primary, value: mutation.Value, op: mutation.GetOp(), + ttl: ttl, } return nil } @@ -311,14 +315,14 @@ func (s *MvccStore) submit(ents ...*mvccEntry) { } // Prewrite acquires a lock on a key. (1st phase of 2PC). -func (s *MvccStore) Prewrite(mutations []*kvrpcpb.Mutation, primary []byte, startTS uint64) []error { +func (s *MvccStore) Prewrite(mutations []*kvrpcpb.Mutation, primary []byte, startTS uint64, ttl uint64) []error { s.Lock() defer s.Unlock() var errs []error for _, m := range mutations { entry := s.getOrNewEntry(m.Key) - err := entry.Prewrite(m, startTS, primary) + err := entry.Prewrite(m, startTS, primary, ttl) s.submit(entry) errs = append(errs, err) } diff --git a/store/tikv/mock-tikv/mvcc_test.go b/store/tikv/mock-tikv/mvcc_test.go index 500d47bcba3d0..83b2395186dd8 100644 --- a/store/tikv/mock-tikv/mvcc_test.go +++ b/store/tikv/mock-tikv/mvcc_test.go @@ -86,7 +86,7 @@ func (s *testMockTiKVSuite) mustGetOK(c *C, key string, ts uint64, expect string } func (s *testMockTiKVSuite) mustPutOK(c *C, key, value string, startTS, commitTS uint64) { - errs := s.store.Prewrite(putMutations(key, value), encodeKey(key), startTS) + errs := s.store.Prewrite(putMutations(key, value), encodeKey(key), startTS, 0) for _, err := range errs { c.Assert(err, IsNil) } @@ -101,7 +101,7 @@ func (s *testMockTiKVSuite) mustDeleteOK(c *C, key string, startTS, commitTS uin Key: encodeKey(key), }, } - errs := s.store.Prewrite(mutations, encodeKey(key), startTS) + errs := s.store.Prewrite(mutations, encodeKey(key), startTS, 0) for _, err := range errs { c.Assert(err, IsNil) } @@ -120,7 +120,7 @@ func (s *testMockTiKVSuite) mustScanOK(c *C, start string, limit int, ts uint64, } func (s *testMockTiKVSuite) mustPrewriteOK(c *C, mutations []*kvrpcpb.Mutation, primary string, startTS uint64) { - errs := s.store.Prewrite(mutations, encodeKey(primary), startTS) + errs := s.store.Prewrite(mutations, encodeKey(primary), startTS, 0) for _, err := range errs { c.Assert(err, IsNil) } diff --git a/store/tikv/mock-tikv/rpc.go b/store/tikv/mock-tikv/rpc.go index a2307c75229a1..f3835cc4635f7 100644 --- a/store/tikv/mock-tikv/rpc.go +++ b/store/tikv/mock-tikv/rpc.go @@ -172,7 +172,7 @@ func (h *rpcHandler) onPrewrite(req *kvrpcpb.CmdPrewriteRequest) *kvrpcpb.CmdPre panic("onPrewrite: key not in region") } } - errors := h.mvccStore.Prewrite(req.Mutations, req.PrimaryLock, req.GetStartVersion()) + errors := h.mvccStore.Prewrite(req.Mutations, req.PrimaryLock, req.GetStartVersion(), req.GetLockTtl()) return &kvrpcpb.CmdPrewriteResponse{ Errors: convertToKeyErrors(errors), } @@ -249,6 +249,7 @@ func convertToKeyError(err error) *kvrpcpb.KeyError { Key: locked.Key, PrimaryLock: locked.Primary, LockVersion: locked.StartTS, + LockTtl: locked.TTL, }, } } diff --git a/store/tikv/snapshot.go b/store/tikv/snapshot.go index f2000a070abca..8cd3bbff51e7e 100644 --- a/store/tikv/snapshot.go +++ b/store/tikv/snapshot.go @@ -258,11 +258,3 @@ func extractLockFromKeyErr(keyErr *pb.KeyError) (*Lock, error) { } return nil, errors.Errorf("unexpected KeyError: %s", keyErr.String()) } - -func newLock(l *pb.LockInfo) *Lock { - return &Lock{ - Key: l.GetKey(), - Primary: l.GetPrimaryLock(), - TxnID: l.GetLockVersion(), - } -} diff --git a/store/tikv/txn.go b/store/tikv/txn.go index 8f956125a1a80..b9fe8e314b41a 100644 --- a/store/tikv/txn.go +++ b/store/tikv/txn.go @@ -124,14 +124,14 @@ func (txn *tikvTxn) Commit() error { return errors.Trace(err) } - committer, err := newTxnCommitter(txn) + committer, err := newTwoPhaseCommitter(txn) if err != nil { return errors.Trace(err) } if committer == nil { return nil } - err = committer.Commit() + err = committer.execute() if err != nil { committer.writeFinishBinlog(binlog.BinlogType_Rollback, 0) return errors.Trace(err) diff --git a/table/table.go b/table/table.go index 5deaa44c17c18..2f812080934c7 100644 --- a/table/table.go +++ b/table/table.go @@ -143,6 +143,17 @@ const ( codeNoDefaultValue = 1364 ) +// Slice is used for table sorting. +type Slice []Table + +func (s Slice) Len() int { return len(s) } + +func (s Slice) Less(i, j int) bool { + return s[i].Meta().Name.O < s[j].Meta().Name.O +} + +func (s Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + func init() { tableMySQLErrCodes := map[terror.ErrCode]uint16{ codeColumnCantNull: mysql.ErrBadNull, diff --git a/table/tables/tables.go b/table/tables/tables.go index 51f1f121d1d93..43dcb0ef94e93 100644 --- a/table/tables/tables.go +++ b/table/tables/tables.go @@ -391,6 +391,10 @@ func (t *Table) genIndexKeyStr(colVals []types.Datum) (string, error) { return strings.Join(strVals, "-"), nil } +func skipConstraintCheck(ctx context.Context) bool { + return variable.GetSessionVars(ctx).SkipConstraintCheck +} + // Add data into indices. func (t *Table) addIndices(ctx context.Context, recordID int64, r []types.Datum, bs *kv.BufferStore) (int64, error) { txn, err := ctx.GetTxn(false) @@ -399,7 +403,8 @@ func (t *Table) addIndices(ctx context.Context, recordID int64, r []types.Datum, } // Clean up lazy check error environment defer txn.DelOption(kv.PresumeKeyNotExistsError) - if t.meta.PKIsHandle { + skipCheck := skipConstraintCheck(ctx) + if t.meta.PKIsHandle && !skipCheck { // Check key exists. recordKey := t.RecordKey(recordID) e := kv.ErrKeyExists.FastGen("Duplicate entry '%d' for key 'PRIMARY'", recordID) @@ -423,7 +428,7 @@ func (t *Table) addIndices(ctx context.Context, recordID int64, r []types.Datum, return 0, errors.Trace(err2) } var dupKeyErr error - if v.Meta().Unique || v.Meta().Primary { + if !skipCheck && (v.Meta().Unique || v.Meta().Primary) { entryKey, err1 := t.genIndexKeyStr(colVals) if err1 != nil { return 0, errors.Trace(err1) diff --git a/util/types/datum.go b/util/types/datum.go index a7b316c3d4088..4789d0e5b34c0 100644 --- a/util/types/datum.go +++ b/util/types/datum.go @@ -958,7 +958,7 @@ func (d *Datum) convertToMysqlDecimal(target *FieldType) (Datum, error) { case KindString, KindBytes: err = dec.FromString(d.GetBytes()) case KindMysqlDecimal: - dec = d.GetMysqlDecimal() + *dec = *d.GetMysqlDecimal() case KindMysqlTime: dec = d.GetMysqlTime().ToNumber() case KindMysqlDuration: