From df991aa1ea53f2f4641ae97a44ac91c52073c7c2 Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Fri, 15 Jan 2021 19:01:10 -0500 Subject: [PATCH 1/5] Add tablet getter RPCs, generate protos and client, and server stubs Signed-off-by: Andrew Mason --- go/vt/proto/vtctldata/vtctldata.pb.go | 316 ++++++++++++++++---- go/vt/proto/vtctlservice/vtctlservice.pb.go | 121 ++++++-- go/vt/vtctl/grpcvtctldclient/client_gen.go | 18 ++ go/vt/vtctl/grpcvtctldserver/server.go | 10 + proto/vtctldata.proto | 23 ++ proto/vtctlservice.proto | 4 + 6 files changed, 406 insertions(+), 86 deletions(-) diff --git a/go/vt/proto/vtctldata/vtctldata.pb.go b/go/vt/proto/vtctldata/vtctldata.pb.go index 0c35388f963..ef59663d6b2 100644 --- a/go/vt/proto/vtctldata/vtctldata.pb.go +++ b/go/vt/proto/vtctldata/vtctldata.pb.go @@ -479,6 +479,183 @@ func (m *GetKeyspaceResponse) GetKeyspace() *Keyspace { return nil } +type GetTabletRequest struct { + TabletAlias *topodata.TabletAlias `protobuf:"bytes,1,opt,name=tablet_alias,json=tabletAlias,proto3" json:"tablet_alias,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetTabletRequest) Reset() { *m = GetTabletRequest{} } +func (m *GetTabletRequest) String() string { return proto.CompactTextString(m) } +func (*GetTabletRequest) ProtoMessage() {} +func (*GetTabletRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{12} +} + +func (m *GetTabletRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetTabletRequest.Unmarshal(m, b) +} +func (m *GetTabletRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetTabletRequest.Marshal(b, m, deterministic) +} +func (m *GetTabletRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTabletRequest.Merge(m, src) +} +func (m *GetTabletRequest) XXX_Size() int { + return xxx_messageInfo_GetTabletRequest.Size(m) +} +func (m *GetTabletRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetTabletRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTabletRequest proto.InternalMessageInfo + +func (m *GetTabletRequest) GetTabletAlias() *topodata.TabletAlias { + if m != nil { + return m.TabletAlias + } + return nil +} + +type GetTabletResponse struct { + Tablet *topodata.Tablet `protobuf:"bytes,1,opt,name=tablet,proto3" json:"tablet,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetTabletResponse) Reset() { *m = GetTabletResponse{} } +func (m *GetTabletResponse) String() string { return proto.CompactTextString(m) } +func (*GetTabletResponse) ProtoMessage() {} +func (*GetTabletResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{13} +} + +func (m *GetTabletResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetTabletResponse.Unmarshal(m, b) +} +func (m *GetTabletResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetTabletResponse.Marshal(b, m, deterministic) +} +func (m *GetTabletResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTabletResponse.Merge(m, src) +} +func (m *GetTabletResponse) XXX_Size() int { + return xxx_messageInfo_GetTabletResponse.Size(m) +} +func (m *GetTabletResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetTabletResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTabletResponse proto.InternalMessageInfo + +func (m *GetTabletResponse) GetTablet() *topodata.Tablet { + if m != nil { + return m.Tablet + } + return nil +} + +type GetTabletsRequest struct { + // Keyspace is the name of the keyspace to return tablets for. Omit to return + // all tablets. + Keyspace string `protobuf:"bytes,1,opt,name=keyspace,proto3" json:"keyspace,omitempty"` + // Shard is the name of the shard to return tablets for. This field is ignored + // if Keyspace is not set. + Shard string `protobuf:"bytes,2,opt,name=shard,proto3" json:"shard,omitempty"` + // Cells is an optional set of cells to return tablets for. + Cells []string `protobuf:"bytes,3,rep,name=cells,proto3" json:"cells,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetTabletsRequest) Reset() { *m = GetTabletsRequest{} } +func (m *GetTabletsRequest) String() string { return proto.CompactTextString(m) } +func (*GetTabletsRequest) ProtoMessage() {} +func (*GetTabletsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{14} +} + +func (m *GetTabletsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetTabletsRequest.Unmarshal(m, b) +} +func (m *GetTabletsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetTabletsRequest.Marshal(b, m, deterministic) +} +func (m *GetTabletsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTabletsRequest.Merge(m, src) +} +func (m *GetTabletsRequest) XXX_Size() int { + return xxx_messageInfo_GetTabletsRequest.Size(m) +} +func (m *GetTabletsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetTabletsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTabletsRequest proto.InternalMessageInfo + +func (m *GetTabletsRequest) GetKeyspace() string { + if m != nil { + return m.Keyspace + } + return "" +} + +func (m *GetTabletsRequest) GetShard() string { + if m != nil { + return m.Shard + } + return "" +} + +func (m *GetTabletsRequest) GetCells() []string { + if m != nil { + return m.Cells + } + return nil +} + +type GetTabletsResponse struct { + Tablets []*topodata.Tablet `protobuf:"bytes,1,rep,name=tablets,proto3" json:"tablets,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetTabletsResponse) Reset() { *m = GetTabletsResponse{} } +func (m *GetTabletsResponse) String() string { return proto.CompactTextString(m) } +func (*GetTabletsResponse) ProtoMessage() {} +func (*GetTabletsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f41247b323a1ab2e, []int{15} +} + +func (m *GetTabletsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetTabletsResponse.Unmarshal(m, b) +} +func (m *GetTabletsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetTabletsResponse.Marshal(b, m, deterministic) +} +func (m *GetTabletsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetTabletsResponse.Merge(m, src) +} +func (m *GetTabletsResponse) XXX_Size() int { + return xxx_messageInfo_GetTabletsResponse.Size(m) +} +func (m *GetTabletsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetTabletsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetTabletsResponse proto.InternalMessageInfo + +func (m *GetTabletsResponse) GetTablets() []*topodata.Tablet { + if m != nil { + return m.Tablets + } + return nil +} + type InitShardPrimaryRequest struct { Keyspace string `protobuf:"bytes,1,opt,name=keyspace,proto3" json:"keyspace,omitempty"` Shard string `protobuf:"bytes,2,opt,name=shard,proto3" json:"shard,omitempty"` @@ -494,7 +671,7 @@ func (m *InitShardPrimaryRequest) Reset() { *m = InitShardPrimaryRequest func (m *InitShardPrimaryRequest) String() string { return proto.CompactTextString(m) } func (*InitShardPrimaryRequest) ProtoMessage() {} func (*InitShardPrimaryRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{12} + return fileDescriptor_f41247b323a1ab2e, []int{16} } func (m *InitShardPrimaryRequest) XXX_Unmarshal(b []byte) error { @@ -561,7 +738,7 @@ func (m *InitShardPrimaryResponse) Reset() { *m = InitShardPrimaryRespon func (m *InitShardPrimaryResponse) String() string { return proto.CompactTextString(m) } func (*InitShardPrimaryResponse) ProtoMessage() {} func (*InitShardPrimaryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{13} + return fileDescriptor_f41247b323a1ab2e, []int{17} } func (m *InitShardPrimaryResponse) XXX_Unmarshal(b []byte) error { @@ -601,7 +778,7 @@ func (m *Keyspace) Reset() { *m = Keyspace{} } func (m *Keyspace) String() string { return proto.CompactTextString(m) } func (*Keyspace) ProtoMessage() {} func (*Keyspace) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{14} + return fileDescriptor_f41247b323a1ab2e, []int{18} } func (m *Keyspace) XXX_Unmarshal(b []byte) error { @@ -647,7 +824,7 @@ func (m *FindAllShardsInKeyspaceRequest) Reset() { *m = FindAllShardsInK func (m *FindAllShardsInKeyspaceRequest) String() string { return proto.CompactTextString(m) } func (*FindAllShardsInKeyspaceRequest) ProtoMessage() {} func (*FindAllShardsInKeyspaceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{15} + return fileDescriptor_f41247b323a1ab2e, []int{19} } func (m *FindAllShardsInKeyspaceRequest) XXX_Unmarshal(b []byte) error { @@ -686,7 +863,7 @@ func (m *FindAllShardsInKeyspaceResponse) Reset() { *m = FindAllShardsIn func (m *FindAllShardsInKeyspaceResponse) String() string { return proto.CompactTextString(m) } func (*FindAllShardsInKeyspaceResponse) ProtoMessage() {} func (*FindAllShardsInKeyspaceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{16} + return fileDescriptor_f41247b323a1ab2e, []int{20} } func (m *FindAllShardsInKeyspaceResponse) XXX_Unmarshal(b []byte) error { @@ -727,7 +904,7 @@ func (m *Shard) Reset() { *m = Shard{} } func (m *Shard) String() string { return proto.CompactTextString(m) } func (*Shard) ProtoMessage() {} func (*Shard) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{17} + return fileDescriptor_f41247b323a1ab2e, []int{21} } func (m *Shard) XXX_Unmarshal(b []byte) error { @@ -787,7 +964,7 @@ func (m *TableMaterializeSettings) Reset() { *m = TableMaterializeSettin func (m *TableMaterializeSettings) String() string { return proto.CompactTextString(m) } func (*TableMaterializeSettings) ProtoMessage() {} func (*TableMaterializeSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{18} + return fileDescriptor_f41247b323a1ab2e, []int{22} } func (m *TableMaterializeSettings) XXX_Unmarshal(b []byte) error { @@ -850,7 +1027,7 @@ func (m *MaterializeSettings) Reset() { *m = MaterializeSettings{} } func (m *MaterializeSettings) String() string { return proto.CompactTextString(m) } func (*MaterializeSettings) ProtoMessage() {} func (*MaterializeSettings) Descriptor() ([]byte, []int) { - return fileDescriptor_f41247b323a1ab2e, []int{19} + return fileDescriptor_f41247b323a1ab2e, []int{23} } func (m *MaterializeSettings) XXX_Unmarshal(b []byte) error { @@ -934,6 +1111,10 @@ func init() { proto.RegisterType((*GetKeyspacesResponse)(nil), "vtctldata.GetKeyspacesResponse") proto.RegisterType((*GetKeyspaceRequest)(nil), "vtctldata.GetKeyspaceRequest") proto.RegisterType((*GetKeyspaceResponse)(nil), "vtctldata.GetKeyspaceResponse") + proto.RegisterType((*GetTabletRequest)(nil), "vtctldata.GetTabletRequest") + proto.RegisterType((*GetTabletResponse)(nil), "vtctldata.GetTabletResponse") + proto.RegisterType((*GetTabletsRequest)(nil), "vtctldata.GetTabletsRequest") + proto.RegisterType((*GetTabletsResponse)(nil), "vtctldata.GetTabletsResponse") proto.RegisterType((*InitShardPrimaryRequest)(nil), "vtctldata.InitShardPrimaryRequest") proto.RegisterType((*InitShardPrimaryResponse)(nil), "vtctldata.InitShardPrimaryResponse") proto.RegisterType((*Keyspace)(nil), "vtctldata.Keyspace") @@ -948,61 +1129,66 @@ func init() { func init() { proto.RegisterFile("vtctldata.proto", fileDescriptor_f41247b323a1ab2e) } var fileDescriptor_f41247b323a1ab2e = []byte{ - // 896 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xd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x9d, 0xb2, 0xf0, 0xcf, 0x36, 0xec, 0xdd, 0x94, 0x46, 0x00, 0xdd, 0x6b, - 0x5e, 0x5e, 0xcd, 0x18, 0xbf, 0x76, 0xa5, 0xbb, 0x3b, 0x79, 0x04, 0x03, 0x1b, 0x7f, 0x63, 0xaa, - 0xbc, 0xb8, 0x6f, 0xe0, 0x6a, 0x16, 0x1f, 0xc1, 0xc0, 0xd6, 0x52, 0x3d, 0x34, 0x09, 0xf4, 0x0d, - 0x5c, 0x3d, 0x3c, 0x86, 0x81, 0x90, 0xbc, 0x48, 0xe8, 0x4c, 0x62, 0x99, 0xa4, 0xbc, 0x58, 0xdb, - 0x9d, 0xdb, 0x51, 0xf0, 0xa9, 0x42, 0xcf, 0x78, 0xb1, 0x26, 0xdf, 0x43, 0x5f, 0xab, 0x92, 0x08, - 0x9b, 0xa7, 0xdf, 0xd1, 0xe3, 0xf3, 0x49, 0xa3, 0x9d, 0xb7, 0x29, 0x1b, 0xef, 0x68, 0x6a, 0x55, - 0xa1, 0xfb, 0x15, 0x6d, 0xd7, 0xbf, 0x22, 0x23, 0xbe, 0xfe, 0x6e, 0xc8, 0x75, 0x81, 0xc2, 0xbf, - 0xeb, 0xc4, 0x57, 0xd8, 0x85, 0x82, 0x9e, 0x0c, 0x7f, 0x3a, 0x5e, 0x65, 0x12, 0x85, 0x88, 0x32, - 0x3e, 0x32, 0xa7, 0xd1, 0x9c, 0x8f, 0x56, 0xd2, 0xfc, 0xf4, 0x47, 0x55, 0x22, 0x97, 0xdb, 0x1a, - 0xf8, 0xf2, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x9d, 0x28, 0x4a, 0x50, 0x08, 0x00, 0x00, + // 970 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x5f, 0x6f, 0x1b, 0x45, + 0x10, 0x97, 0x9d, 0xda, 0xb1, 0xc7, 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 0x26, 0x92, 0x0a, 0x11, 0x24, 0x7c, 0x68, 0x5e, 0xc3, 0x19, 0x1f, + 0x2e, 0xa5, 0xf9, 0x83, 0x34, 0x2c, 0x0a, 0x39, 0x6b, 0x6a, 0xe0, 0xf3, 0x7f, 0x02, 0x00, 0x00, + 0xff, 0xff, 0x7d, 0xd2, 0xe0, 0x41, 0x7c, 0x09, 0x00, 0x00, } diff --git a/go/vt/proto/vtctlservice/vtctlservice.pb.go b/go/vt/proto/vtctlservice/vtctlservice.pb.go index 453d9b966ee..edd5f21151b 100644 --- a/go/vt/proto/vtctlservice/vtctlservice.pb.go +++ b/go/vt/proto/vtctlservice/vtctlservice.pb.go @@ -29,27 +29,30 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package func init() { proto.RegisterFile("vtctlservice.proto", fileDescriptor_27055cdbb1148d2b) } var fileDescriptor_27055cdbb1148d2b = []byte{ - // 320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x5f, 0x4b, 0xf3, 0x30, - 0x14, 0xc6, 0xdf, 0xf7, 0x62, 0xbb, 0x88, 0x83, 0x49, 0xbc, 0x10, 0x06, 0x4e, 0xac, 0x28, 0x4c, - 0xa1, 0x95, 0xf9, 0x09, 0xe6, 0x50, 0x29, 0xc2, 0xf0, 0x0f, 0x78, 0x31, 0xf0, 0x22, 0xb6, 0x47, - 0x17, 0x48, 0x93, 0x2e, 0x27, 0x2b, 0xee, 0x23, 0xf8, 0xad, 0xc5, 0xcc, 0xd4, 0xd8, 0xb5, 0xd3, - 0xbb, 0xe4, 0xfc, 0x9e, 0xf3, 0xe4, 0x90, 0x87, 0x43, 0x68, 0x61, 0x12, 0x23, 0x10, 0x74, 0xc1, - 0x13, 0x08, 0x73, 0xad, 0x8c, 0xa2, 0x1d, 0xbf, 0xd6, 0xeb, 0xda, 0x5b, 0xca, 0x0c, 0x5b, 0xe1, -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0x6b, 0x9c, 0xfd, 0xc5, 0xe9, 0x74, 0x50, 0x70, 0x03, 0x88, 0x21, - 0x57, 0xd1, 0xea, 0x14, 0xbd, 0xaa, 0xa8, 0x30, 0x91, 0x5d, 0x8f, 0xc8, 0x5f, 0x9e, 0xe7, 0xb6, - 0xad, 0x9d, 0x7f, 0x04, 0x00, 0x00, 0xff, 0xff, 0x79, 0x0f, 0x93, 0xa5, 0x67, 0x03, 0x00, 0x00, + // 355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x5f, 0x4b, 0x32, 0x41, + 0x14, 0x87, 0xdf, 0xf7, 0xe2, 0x15, 0xde, 0x49, 0x30, 0x4e, 0x17, 0x81, 0xa5, 0x91, 0x51, 0x60, + 0x81, 0x1b, 0xf6, 0x09, 0x4c, 0xca, 0x44, 0x90, 0xfe, 0xd1, 0x85, 0xd0, 0xc5, 0xb8, 0x7b, 0xca, + 0x81, 0xd9, 0x1d, 0xdd, 0x33, 0x2e, 0xf9, 0x6d, 0xfa, 0xa8, 0xd1, 0xda, 0x4c, 0xe3, 0xba, 0x6b, + 0xdd, 0xed, 0x9e, 0xe7, 0x77, 0x9e, 0x39, 0x0c, 0x67, 0x18, 0x24, 0xda, 0xd7, 0x92, 0x30, 0x4e, + 0x84, 0x8f, 0xad, 0x69, 0xac, 0xb4, 0x82, 0xb2, 0x5b, 0xab, 0x56, 0xd2, 0xbf, 0x80, 0x6b, 0xbe, + 0xc4, 0xed, 0x19, 0xfb, 0xf7, 0xf4, 0x59, 0x82, 0x09, 0xdb, 0xb9, 0x7a, 0x43, 0x7f, 0xae, 0x31, + 0xfd, 0xef, 0xaa, 0x30, 0xe4, 0x51, 0x00, 0xc7, 0xad, 0xef, 0x8e, 0x1c, 0x7e, 0x8f, 0xb3, 0x39, + 0x92, 0xae, 0x9e, 0xfc, 0x14, 0xa3, 0xa9, 0x8a, 0x08, 0x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, 0x5a, 0x42, 0x79, 0xcb, 0x2f, 0xef, 0x55, 0x79, 0x89, 0xf6, 0xd2, 0x57, 0xeb, 0xb9, 0x6f, + 0x7a, 0x5c, 0x4a, 0x6b, 0x17, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x4f, 0xa4, 0x82, 0xfe, + 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -178,6 +181,10 @@ type VtctldClient interface { GetKeyspace(ctx context.Context, in *vtctldata.GetKeyspaceRequest, opts ...grpc.CallOption) (*vtctldata.GetKeyspaceResponse, error) // GetKeyspaces returns the keyspace struct of all keyspaces in the topo. GetKeyspaces(ctx context.Context, in *vtctldata.GetKeyspacesRequest, opts ...grpc.CallOption) (*vtctldata.GetKeyspacesResponse, error) + // GetTablet returns information about a tablet. + GetTablet(ctx context.Context, in *vtctldata.GetTabletRequest, opts ...grpc.CallOption) (*vtctldata.GetTabletResponse, error) + // GetTablets returns tablets, optionally filtered by keyspace and shard. + GetTablets(ctx context.Context, in *vtctldata.GetTabletsRequest, opts ...grpc.CallOption) (*vtctldata.GetTabletsResponse, error) // InitShardPrimary sets the initial primary for a shard. Will make all other // tablets in the shard replicas of the provided primary. // @@ -249,6 +256,24 @@ func (c *vtctldClient) GetKeyspaces(ctx context.Context, in *vtctldata.GetKeyspa return out, nil } +func (c *vtctldClient) GetTablet(ctx context.Context, in *vtctldata.GetTabletRequest, opts ...grpc.CallOption) (*vtctldata.GetTabletResponse, error) { + out := new(vtctldata.GetTabletResponse) + err := c.cc.Invoke(ctx, "/vtctlservice.Vtctld/GetTablet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vtctldClient) GetTablets(ctx context.Context, in *vtctldata.GetTabletsRequest, opts ...grpc.CallOption) (*vtctldata.GetTabletsResponse, error) { + out := new(vtctldata.GetTabletsResponse) + err := c.cc.Invoke(ctx, "/vtctlservice.Vtctld/GetTablets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *vtctldClient) InitShardPrimary(ctx context.Context, in *vtctldata.InitShardPrimaryRequest, opts ...grpc.CallOption) (*vtctldata.InitShardPrimaryResponse, error) { out := new(vtctldata.InitShardPrimaryResponse) err := c.cc.Invoke(ctx, "/vtctlservice.Vtctld/InitShardPrimary", in, out, opts...) @@ -275,6 +300,10 @@ type VtctldServer interface { GetKeyspace(context.Context, *vtctldata.GetKeyspaceRequest) (*vtctldata.GetKeyspaceResponse, error) // GetKeyspaces returns the keyspace struct of all keyspaces in the topo. GetKeyspaces(context.Context, *vtctldata.GetKeyspacesRequest) (*vtctldata.GetKeyspacesResponse, error) + // GetTablet returns information about a tablet. + GetTablet(context.Context, *vtctldata.GetTabletRequest) (*vtctldata.GetTabletResponse, error) + // GetTablets returns tablets, optionally filtered by keyspace and shard. + GetTablets(context.Context, *vtctldata.GetTabletsRequest) (*vtctldata.GetTabletsResponse, error) // InitShardPrimary sets the initial primary for a shard. Will make all other // tablets in the shard replicas of the provided primary. // @@ -306,6 +335,12 @@ func (*UnimplementedVtctldServer) GetKeyspace(ctx context.Context, req *vtctldat func (*UnimplementedVtctldServer) GetKeyspaces(ctx context.Context, req *vtctldata.GetKeyspacesRequest) (*vtctldata.GetKeyspacesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetKeyspaces not implemented") } +func (*UnimplementedVtctldServer) GetTablet(ctx context.Context, req *vtctldata.GetTabletRequest) (*vtctldata.GetTabletResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTablet not implemented") +} +func (*UnimplementedVtctldServer) GetTablets(ctx context.Context, req *vtctldata.GetTabletsRequest) (*vtctldata.GetTabletsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTablets not implemented") +} func (*UnimplementedVtctldServer) InitShardPrimary(ctx context.Context, req *vtctldata.InitShardPrimaryRequest) (*vtctldata.InitShardPrimaryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InitShardPrimary not implemented") } @@ -422,6 +457,42 @@ func _Vtctld_GetKeyspaces_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Vtctld_GetTablet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(vtctldata.GetTabletRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VtctldServer).GetTablet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vtctlservice.Vtctld/GetTablet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VtctldServer).GetTablet(ctx, req.(*vtctldata.GetTabletRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Vtctld_GetTablets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(vtctldata.GetTabletsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VtctldServer).GetTablets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vtctlservice.Vtctld/GetTablets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VtctldServer).GetTablets(ctx, req.(*vtctldata.GetTabletsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Vtctld_InitShardPrimary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(vtctldata.InitShardPrimaryRequest) if err := dec(in); err != nil { @@ -468,6 +539,14 @@ var _Vtctld_serviceDesc = grpc.ServiceDesc{ MethodName: "GetKeyspaces", Handler: _Vtctld_GetKeyspaces_Handler, }, + { + MethodName: "GetTablet", + Handler: _Vtctld_GetTablet_Handler, + }, + { + MethodName: "GetTablets", + Handler: _Vtctld_GetTablets_Handler, + }, { MethodName: "InitShardPrimary", Handler: _Vtctld_InitShardPrimary_Handler, diff --git a/go/vt/vtctl/grpcvtctldclient/client_gen.go b/go/vt/vtctl/grpcvtctldclient/client_gen.go index 6e50ca8958a..f7aa71c2d05 100644 --- a/go/vt/vtctl/grpcvtctldclient/client_gen.go +++ b/go/vt/vtctl/grpcvtctldclient/client_gen.go @@ -82,6 +82,24 @@ func (client *gRPCVtctldClient) GetKeyspaces(ctx context.Context, in *vtctldatap return client.c.GetKeyspaces(ctx, in, opts...) } +// GetTablet is part of the vtctlservicepb.VtctldClient interface. +func (client *gRPCVtctldClient) GetTablet(ctx context.Context, in *vtctldatapb.GetTabletRequest, opts ...grpc.CallOption) (*vtctldatapb.GetTabletResponse, error) { + if client.c == nil { + return nil, status.Error(codes.Unavailable, connClosedMsg) + } + + return client.c.GetTablet(ctx, in, opts...) +} + +// GetTablets is part of the vtctlservicepb.VtctldClient interface. +func (client *gRPCVtctldClient) GetTablets(ctx context.Context, in *vtctldatapb.GetTabletsRequest, opts ...grpc.CallOption) (*vtctldatapb.GetTabletsResponse, error) { + if client.c == nil { + return nil, status.Error(codes.Unavailable, connClosedMsg) + } + + return client.c.GetTablets(ctx, in, opts...) +} + // InitShardPrimary is part of the vtctlservicepb.VtctldClient interface. func (client *gRPCVtctldClient) InitShardPrimary(ctx context.Context, in *vtctldatapb.InitShardPrimaryRequest, opts ...grpc.CallOption) (*vtctldatapb.InitShardPrimaryResponse, error) { if client.c == nil { diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index 6ff1c8093d3..d53ee40e4c8 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -152,6 +152,16 @@ func (s *VtctldServer) GetKeyspaces(ctx context.Context, req *vtctldatapb.GetKey return &vtctldatapb.GetKeyspacesResponse{Keyspaces: keyspaces}, nil } +// GetTablet is part of the vtctlservicepb.VtctldServer interface. +func (s *VtctldServer) GetTablet(ctx context.Context, req *vtctldatapb.GetTabletRequest) (*vtctldatapb.GetTabletResponse, error) { + panic("unimplemented!") +} + +// GetTablets is part of the vtctlservicepb.VtctldServer interface. +func (s *VtctldServer) GetTablets(ctx context.Context, req *vtctldatapb.GetTabletsRequest) (*vtctldatapb.GetTabletsResponse, error) { + panic("unimplemented!") +} + // InitShardPrimary is part of the vtctlservicepb.VtctldServer interface. func (s *VtctldServer) InitShardPrimary(ctx context.Context, req *vtctldatapb.InitShardPrimaryRequest) (*vtctldatapb.InitShardPrimaryResponse, error) { if req.Keyspace == "" { diff --git a/proto/vtctldata.proto b/proto/vtctldata.proto index bdbd048fd5a..5781b69d9d5 100644 --- a/proto/vtctldata.proto +++ b/proto/vtctldata.proto @@ -75,6 +75,29 @@ message GetKeyspaceResponse { Keyspace keyspace = 1; } +message GetTabletRequest { + topodata.TabletAlias tablet_alias = 1; +} + +message GetTabletResponse { + topodata.Tablet tablet = 1; +} + +message GetTabletsRequest { + // Keyspace is the name of the keyspace to return tablets for. Omit to return + // all tablets. + string keyspace = 1; + // Shard is the name of the shard to return tablets for. This field is ignored + // if Keyspace is not set. + string shard = 2; + // Cells is an optional set of cells to return tablets for. + repeated string cells = 3; +} + +message GetTabletsResponse { + repeated topodata.Tablet tablets = 1; +} + message InitShardPrimaryRequest { string keyspace = 1; string shard = 2; diff --git a/proto/vtctlservice.proto b/proto/vtctlservice.proto index 1dd2588f98c..866d7319252 100644 --- a/proto/vtctlservice.proto +++ b/proto/vtctlservice.proto @@ -46,6 +46,10 @@ service Vtctld { rpc GetKeyspace(vtctldata.GetKeyspaceRequest) returns (vtctldata.GetKeyspaceResponse) {}; // GetKeyspaces returns the keyspace struct of all keyspaces in the topo. rpc GetKeyspaces(vtctldata.GetKeyspacesRequest) returns (vtctldata.GetKeyspacesResponse) {}; + // GetTablet returns information about a tablet. + rpc GetTablet(vtctldata.GetTabletRequest) returns (vtctldata.GetTabletResponse) {}; + // GetTablets returns tablets, optionally filtered by keyspace and shard. + rpc GetTablets(vtctldata.GetTabletsRequest) returns (vtctldata.GetTabletsResponse) {}; // InitShardPrimary sets the initial primary for a shard. Will make all other // tablets in the shard replicas of the provided primary. // From 93abcfc2d6de603451756f39df5324492bb865d0 Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Sat, 16 Jan 2021 08:22:53 -0500 Subject: [PATCH 2/5] Add implementation and tests Signed-off-by: Andrew Mason --- go/vt/vtctl/grpcvtctldserver/server.go | 100 ++++- go/vt/vtctl/grpcvtctldserver/server_test.go | 391 ++++++++++++++++++ go/vt/vtctl/grpcvtctldserver/testutil/util.go | 31 ++ 3 files changed, 520 insertions(+), 2 deletions(-) diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index d53ee40e4c8..6a379ddb3ef 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -38,6 +38,8 @@ import ( "vitess.io/vitess/go/vt/vttablet/tmclient" logutilpb "vitess.io/vitess/go/vt/proto/logutil" + "vitess.io/vitess/go/vt/proto/topodata" + topodatapb "vitess.io/vitess/go/vt/proto/topodata" vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" vtctlservicepb "vitess.io/vitess/go/vt/proto/vtctlservice" "vitess.io/vitess/go/vt/proto/vtrpc" @@ -154,12 +156,106 @@ func (s *VtctldServer) GetKeyspaces(ctx context.Context, req *vtctldatapb.GetKey // GetTablet is part of the vtctlservicepb.VtctldServer interface. func (s *VtctldServer) GetTablet(ctx context.Context, req *vtctldatapb.GetTabletRequest) (*vtctldatapb.GetTabletResponse, error) { - panic("unimplemented!") + ti, err := s.ts.GetTablet(ctx, req.TabletAlias) + if err != nil { + return nil, err + } + + return &vtctldatapb.GetTabletResponse{ + Tablet: ti.Tablet, + }, nil } // GetTablets is part of the vtctlservicepb.VtctldServer interface. func (s *VtctldServer) GetTablets(ctx context.Context, req *vtctldatapb.GetTabletsRequest) (*vtctldatapb.GetTabletsResponse, error) { - panic("unimplemented!") + // It is possible that an old primary has not yet updated its type in the + // topo. In that case, report its type as UNKNOWN. It used to be MASTER but + // is no longer the serving primary. + adjustTypeForStalePrimary := func(ti *topo.TabletInfo, mtst time.Time) { + if ti.Type == topodatapb.TabletType_MASTER && ti.GetMasterTermStartTime().Before(mtst) { + ti.Tablet.Type = topodatapb.TabletType_UNKNOWN + } + } + + if req.Keyspace != "" && req.Shard != "" { + tabletMap, err := s.ts.GetTabletMapForShard(ctx, req.Keyspace, req.Shard) + if err != nil { + return nil, err + } + + var trueMasterTimestamp time.Time + for _, ti := range tabletMap { + if ti.Type == topodatapb.TabletType_MASTER { + masterTimestamp := ti.GetMasterTermStartTime() + if masterTimestamp.After(trueMasterTimestamp) { + trueMasterTimestamp = masterTimestamp + } + } + } + + tablets := make([]*topodata.Tablet, 0, len(tabletMap)) + for _, ti := range tabletMap { + adjustTypeForStalePrimary(ti, trueMasterTimestamp) + tablets = append(tablets, ti.Tablet) + } + + return &vtctldatapb.GetTabletsResponse{Tablets: tablets}, nil + } + + cells := req.Cells + if len(cells) == 0 { + c, err := s.ts.GetKnownCells(ctx) + if err != nil { + return nil, err + } + + cells = c + } + + var allTablets []*topodatapb.Tablet + + for _, cell := range cells { + tablets, err := topotools.GetAllTablets(ctx, s.ts, cell) + if err != nil { + return nil, err + } + + // Collect true master term start times, and optionally filter out any + // tablets by keyspace according to the request. + masterTermStartTimes := map[string]time.Time{} + filteredTablets := make([]*topo.TabletInfo, 0, len(tablets)) + + for _, tablet := range tablets { + if req.Keyspace != "" && tablet.Keyspace != req.Keyspace { + continue + } + + key := tablet.Keyspace + "." + tablet.Shard + if v, ok := masterTermStartTimes[key]; ok { + if tablet.GetMasterTermStartTime().After(v) { + masterTermStartTimes[key] = tablet.GetMasterTermStartTime() + } + } else { + masterTermStartTimes[key] = tablet.GetMasterTermStartTime() + } + + filteredTablets = append(filteredTablets, tablet) + } + + // collect the tablets with adjusted master term start times. they've + // already been filtered by the above loop, so no keyspace filtering + // here. + for _, ti := range filteredTablets { + key := ti.Keyspace + "." + ti.Shard + adjustTypeForStalePrimary(ti, masterTermStartTimes[key]) + + allTablets = append(allTablets, ti.Tablet) + } + } + + return &vtctldatapb.GetTabletsResponse{ + Tablets: allTablets, + }, nil } // InitShardPrimary is part of the vtctlservicepb.VtctldServer interface. diff --git a/go/vt/vtctl/grpcvtctldserver/server_test.go b/go/vt/vtctl/grpcvtctldserver/server_test.go index 0bd54106b3c..886d72a7e80 100644 --- a/go/vt/vtctl/grpcvtctldserver/server_test.go +++ b/go/vt/vtctl/grpcvtctldserver/server_test.go @@ -21,10 +21,12 @@ import ( "errors" "fmt" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/topo/memorytopo" "vitess.io/vitess/go/vt/vtctl/grpcvtctldserver/testutil" @@ -218,3 +220,392 @@ func TestGetKeyspaces(t *testing.T) { _, err = vtctld.GetKeyspaces(ctx, &vtctldatapb.GetKeyspacesRequest{}) assert.Error(t, err) } + +func TestGetTablet(t *testing.T) { + ctx := context.Background() + ts := memorytopo.NewServer("cell1") + vtctld := NewVtctldServer(ts) + + tablet := &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + Hostname: "localhost", + Keyspace: "testkeyspace", + Shard: "-", + Type: topodatapb.TabletType_REPLICA, + } + + testutil.AddTablet(ctx, t, ts, tablet) + + resp, err := vtctld.GetTablet(ctx, &vtctldatapb.GetTabletRequest{ + TabletAlias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + }) + assert.NoError(t, err) + assert.Equal(t, resp.Tablet, tablet) + + // not found + _, err = vtctld.GetTablet(ctx, &vtctldatapb.GetTabletRequest{ + TabletAlias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 101, + }, + }) + assert.Error(t, err) +} + +func TestGetTablets(t *testing.T) { + tests := []struct { + name string + cells []string + tablets []*topodatapb.Tablet + req *vtctldatapb.GetTabletsRequest + expected []*topodatapb.Tablet + shouldErr bool + }{ + { + name: "no tablets", + cells: []string{"cell1"}, + tablets: []*topodatapb.Tablet{}, + req: &vtctldatapb.GetTabletsRequest{}, + expected: []*topodatapb.Tablet{}, + shouldErr: false, + }, + { + name: "keyspace and shard filter", + cells: []string{"cell1"}, + tablets: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + Keyspace: "ks1", + Shard: "-80", + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 101, + }, + Keyspace: "ks1", + Shard: "80-", + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 102, + }, + Keyspace: "ks2", + Shard: "-", + }, + }, + req: &vtctldatapb.GetTabletsRequest{ + Keyspace: "ks1", + Shard: "80-", + }, + expected: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 101, + }, + Keyspace: "ks1", + Shard: "80-", + }, + }, + shouldErr: false, + }, + { + name: "keyspace filter", + cells: []string{"cell1"}, + tablets: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + Keyspace: "ks1", + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 101, + }, + Keyspace: "ks1", + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 102, + }, + Keyspace: "otherkeyspace", + }, + }, + req: &vtctldatapb.GetTabletsRequest{ + Keyspace: "ks1", + }, + expected: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + Keyspace: "ks1", + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 101, + }, + Keyspace: "ks1", + }, + }, + shouldErr: false, + }, + { + name: "keyspace and shard filter - stale primary", + cells: []string{"cell1"}, + tablets: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + Keyspace: "ks1", + Shard: "-80", + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 101, + }, + Keyspace: "ks1", + Shard: "80-", + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 102, + }, + Keyspace: "ks2", + Shard: "-", + Type: topodatapb.TabletType_MASTER, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC)), + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 103, + }, + Keyspace: "ks2", + Shard: "-", + Hostname: "stale.primary", + Type: topodatapb.TabletType_MASTER, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 14, 4, 5, 0, time.UTC)), + }, + }, + req: &vtctldatapb.GetTabletsRequest{ + Keyspace: "ks2", + Shard: "-", + }, + expected: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 102, + }, + Keyspace: "ks2", + Shard: "-", + Type: topodatapb.TabletType_MASTER, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC)), + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 103, + }, + Keyspace: "ks2", + Shard: "-", + Hostname: "stale.primary", + Type: topodatapb.TabletType_UNKNOWN, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 14, 4, 5, 0, time.UTC)), + }, + }, + shouldErr: false, + }, + { + name: "stale primary", + cells: []string{"cell1"}, + tablets: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + Keyspace: "ks1", + Shard: "-", + Hostname: "slightly less stale", + Type: topodatapb.TabletType_MASTER, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC)), + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 101, + }, + Hostname: "stale primary", + Keyspace: "ks1", + Shard: "-", + Type: topodatapb.TabletType_MASTER, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 14, 4, 5, 0, time.UTC)), + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 103, + }, + Hostname: "true primary", + Keyspace: "ks1", + Shard: "-", + Type: topodatapb.TabletType_MASTER, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 16, 4, 5, 0, time.UTC)), + }, + }, + req: &vtctldatapb.GetTabletsRequest{}, + expected: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + Keyspace: "ks1", + Shard: "-", + Hostname: "slightly less stale", + Type: topodatapb.TabletType_UNKNOWN, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC)), + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 101, + }, + Hostname: "stale primary", + Keyspace: "ks1", + Shard: "-", + Type: topodatapb.TabletType_UNKNOWN, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 14, 4, 5, 0, time.UTC)), + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 103, + }, + Hostname: "true primary", + Keyspace: "ks1", + Shard: "-", + Type: topodatapb.TabletType_MASTER, + MasterTermStartTime: logutil.TimeToProto(time.Date(2006, time.January, 2, 16, 4, 5, 0, time.UTC)), + }, + }, + shouldErr: false, + }, + { + name: "keyspace and shard filter - error", + cells: []string{"cell1"}, + tablets: []*topodatapb.Tablet{}, + req: &vtctldatapb.GetTabletsRequest{ + Keyspace: "ks1", + Shard: "-", + }, + expected: []*topodatapb.Tablet{}, + shouldErr: true, + }, + { + name: "cells filter", + cells: []string{"cell1", "cell2", "cell3"}, + tablets: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell2", + Uid: 200, + }, + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell3", + Uid: 300, + }, + }, + }, + req: &vtctldatapb.GetTabletsRequest{ + Cells: []string{"cell1", "cell3"}, + }, + expected: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + }, + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell3", + Uid: 300, + }, + }, + }, + shouldErr: false, + }, + { + name: "cells filter - error", + cells: []string{"cell1"}, + tablets: []*topodatapb.Tablet{ + { + Alias: &topodatapb.TabletAlias{ + Cell: "cell1", + Uid: 100, + }, + Keyspace: "ks1", + Shard: "-", + }, + }, + req: &vtctldatapb.GetTabletsRequest{ + Cells: []string{"cell1", "doesnotexist"}, + }, + expected: []*topodatapb.Tablet{}, + shouldErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ctx := context.Background() + ts := memorytopo.NewServer(tt.cells...) + vtctld := NewVtctldServer(ts) + + for _, tablet := range tt.tablets { + testutil.AddTablet(ctx, t, ts, tablet) + } + + resp, err := vtctld.GetTablets(ctx, tt.req) + if tt.shouldErr { + assert.Error(t, err) + return + } + + assert.NoError(t, err) + assert.ElementsMatch(t, tt.expected, resp.Tablets) + }) + } +} diff --git a/go/vt/vtctl/grpcvtctldserver/testutil/util.go b/go/vt/vtctl/grpcvtctldserver/testutil/util.go index 34400b35d58..99928b54936 100644 --- a/go/vt/vtctl/grpcvtctldserver/testutil/util.go +++ b/go/vt/vtctl/grpcvtctldserver/testutil/util.go @@ -29,6 +29,7 @@ import ( "vitess.io/vitess/go/vt/topo" "vitess.io/vitess/go/vt/vtctl/vtctldclient" + topodatapb "vitess.io/vitess/go/vt/proto/topodata" vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" vtctlservicepb "vitess.io/vitess/go/vt/proto/vtctlservice" ) @@ -67,3 +68,33 @@ func AddKeyspace(ctx context.Context, t *testing.T, ts *topo.Server, ks *vtctlda err := ts.CreateKeyspace(ctx, ks.Name, &in) require.NoError(t, err) } + +// AddTablet adds a tablet to the topology, failing a test if that tablet record +// could not be created. It shallow copies to prevent XXX_ fields from changing, +// including nested proto message fields. +// +// AddTablet also optionally adds empty keyspace and shard records to the +// topology, if they are set on the tablet record and they cannot be retrieved +// from the topo server without error. +func AddTablet(ctx context.Context, t *testing.T, ts *topo.Server, tablet *topodatapb.Tablet) { + in := *tablet + alias := *tablet.Alias + in.Alias = &alias + + err := ts.CreateTablet(ctx, &in) + require.NoError(t, err, "CreateTablet(%+v)", &in) + + if tablet.Keyspace != "" { + if _, err := ts.GetKeyspace(ctx, tablet.Keyspace); err != nil { + err := ts.CreateKeyspace(ctx, tablet.Keyspace, &topodatapb.Keyspace{}) + require.NoError(t, err, "CreateKeyspace(%s)", tablet.Keyspace) + } + + if tablet.Shard != "" { + if _, err := ts.GetShard(ctx, tablet.Keyspace, tablet.Shard); err != nil { + err := ts.CreateShard(ctx, tablet.Keyspace, tablet.Shard) + require.NoError(t, err, "CreateShard(%s, %s)", tablet.Keyspace, tablet.Shard) + } + } + } +} From d548a0c9468466ae4cda27281ef2af3094c3a6a4 Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Sat, 16 Jan 2021 14:22:39 -0500 Subject: [PATCH 3/5] Implement CLI for tablet getters Signed-off-by: Andrew Mason --- go/cmd/vtctldclient/commands.go | 112 ++++++++++++++++++++++++++++++++ go/cmd/vtctldclient/formats.go | 38 +++++++++++ 2 files changed, 150 insertions(+) create mode 100644 go/cmd/vtctldclient/formats.go diff --git a/go/cmd/vtctldclient/commands.go b/go/cmd/vtctldclient/commands.go index f479957f17a..609ca057943 100644 --- a/go/cmd/vtctldclient/commands.go +++ b/go/cmd/vtctldclient/commands.go @@ -25,8 +25,11 @@ import ( "github.com/spf13/cobra" "vitess.io/vitess/go/vt/log" + "vitess.io/vitess/go/vt/logutil" + "vitess.io/vitess/go/vt/topo" "vitess.io/vitess/go/vt/topo/topoproto" + topodatapb "vitess.io/vitess/go/vt/proto/topodata" vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" ) @@ -64,6 +67,16 @@ var ( Args: cobra.NoArgs, RunE: commandGetKeyspaces, } + getTabletCmd = &cobra.Command{ + Use: "GetTablet alias", + Args: cobra.ExactArgs(1), + RunE: commandGetTablet, + } + getTabletsCmd = &cobra.Command{ + Use: "GetTablets [--cell $c1, ...] [--keyspace $ks [--shard $shard]]", + Args: cobra.NoArgs, + RunE: commandGetTablets, + } initShardPrimaryCmd = &cobra.Command{ Use: "InitShardPrimary", Args: cobra.ExactArgs(2), @@ -166,6 +179,96 @@ func commandGetKeyspaces(cmd *cobra.Command, args []string) error { return nil } +func commandGetTablet(cmd *cobra.Command, args []string) error { + aliasStr := cmd.Flags().Arg(0) + alias, err := topoproto.ParseTabletAlias(aliasStr) + if err != nil { + return err + } + + resp, err := client.GetTablet(commandCtx, &vtctldatapb.GetTabletRequest{TabletAlias: alias}) + if err != nil { + return err + } + + data, err := MarshalJSON(resp.Tablet) + if err != nil { + return err + } + + fmt.Printf("%s\n", data) + + return nil +} + +var getTabletsArgs = struct { + Cells []string + Keyspace string + Shard string + + Format string +}{} + +func commandGetTablets(cmd *cobra.Command, args []string) error { + format := strings.ToLower(getTabletsArgs.Format) + + switch format { + case "awk", "json": + default: + return fmt.Errorf("invalid output format, got %s", getTabletsArgs.Format) + } + + resp, err := client.GetTablets(commandCtx, &vtctldatapb.GetTabletsRequest{ + Cells: getTabletsArgs.Cells, + Keyspace: getTabletsArgs.Keyspace, + Shard: getTabletsArgs.Shard, + }) + if err != nil { + return err + } + + switch format { + case "awk": + lineFn := func(t *topodatapb.Tablet) string { + ti := topo.TabletInfo{ + Tablet: t, + } + + keyspace := t.Keyspace + if keyspace == "" { + keyspace = "" + } + + shard := t.Shard + if shard == "" { + shard = "" + } + + mtst := "" + // special case for old primary that hasn't been updated in the topo + // yet. + if t.MasterTermStartTime != nil && t.MasterTermStartTime.Seconds > 0 { + mtst = logutil.ProtoToTime(t.MasterTermStartTime).Format(time.RFC3339) + } + + return fmt.Sprintf("%v %v %v %v %v %v %v %v", topoproto.TabletAliasString(t.Alias), keyspace, shard, topoproto.TabletTypeLString(t.Type), ti.Addr(), ti.MysqlAddr(), fmtMapAwkable(t.Tags), mtst) + } + + for _, t := range resp.Tablets { + fmt.Println(lineFn(t)) + } + case "json": + data, err := MarshalJSON(resp.Tablets) + if err != nil { + return err + } + + fmt.Printf("%s\n", data) + } + + return nil +} + var initShardPrimaryArgs = struct { WaitReplicasTimeout time.Duration Force bool @@ -199,12 +302,21 @@ func commandInitShardPrimary(cmd *cobra.Command, args []string) error { func init() { rootCmd.AddCommand(findAllShardsInKeyspaceCmd) + rootCmd.AddCommand(getCellInfoNamesCmd) rootCmd.AddCommand(getCellInfoCmd) rootCmd.AddCommand(getCellsAliasesCmd) + rootCmd.AddCommand(getKeyspaceCmd) rootCmd.AddCommand(getKeyspacesCmd) + rootCmd.AddCommand(getTabletCmd) + getTabletsCmd.Flags().StringSliceVarP(&getTabletsArgs.Cells, "cell", "c", nil, "TODO") + getTabletsCmd.Flags().StringVarP(&getTabletsArgs.Keyspace, "keyspace", "k", "", "TODO") + getTabletsCmd.Flags().StringVarP(&getTabletsArgs.Shard, "shard", "s", "", "TODO") + getTabletsCmd.Flags().StringVar(&getTabletsArgs.Format, "format", "awk", "Output format to use; valid choices are (json, awk)") + rootCmd.AddCommand(getTabletsCmd) + initShardPrimaryCmd.Flags().DurationVar(&initShardPrimaryArgs.WaitReplicasTimeout, "wait-replicas-timeout", 30*time.Second, "time to wait for replicas to catch up in reparenting") initShardPrimaryCmd.Flags().BoolVar(&initShardPrimaryArgs.Force, "force", false, "will force the reparent even if the provided tablet is not a master or the shard master") rootCmd.AddCommand(initShardPrimaryCmd) diff --git a/go/cmd/vtctldclient/formats.go b/go/cmd/vtctldclient/formats.go new file mode 100644 index 00000000000..152d6684579 --- /dev/null +++ b/go/cmd/vtctldclient/formats.go @@ -0,0 +1,38 @@ +/* +Copyright 2021 The Vitess Authors. + +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, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "fmt" + "sort" + "strings" +) + +func fmtMapAwkable(m map[string]string) string { + pairs := make([]string, len(m)) + i := 0 + + for k, v := range m { + pairs[i] = fmt.Sprintf("%v: %q", k, v) + + i++ + } + + sort.Strings(pairs) + + return "[" + strings.Join(pairs, " ") + "]" +} From 464f6b4784125d9cbde7d8aa2fad46548a223264 Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Sat, 16 Jan 2021 14:27:07 -0500 Subject: [PATCH 4/5] Fix duplicated import Signed-off-by: Andrew Mason --- go/vt/vtctl/grpcvtctldserver/server.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index 6a379ddb3ef..c53ec5cb79e 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -38,7 +38,6 @@ import ( "vitess.io/vitess/go/vt/vttablet/tmclient" logutilpb "vitess.io/vitess/go/vt/proto/logutil" - "vitess.io/vitess/go/vt/proto/topodata" topodatapb "vitess.io/vitess/go/vt/proto/topodata" vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" vtctlservicepb "vitess.io/vitess/go/vt/proto/vtctlservice" @@ -193,7 +192,7 @@ func (s *VtctldServer) GetTablets(ctx context.Context, req *vtctldatapb.GetTable } } - tablets := make([]*topodata.Tablet, 0, len(tabletMap)) + tablets := make([]*topodatapb.Tablet, 0, len(tabletMap)) for _, ti := range tabletMap { adjustTypeForStalePrimary(ti, trueMasterTimestamp) tablets = append(tablets, ti.Tablet) From 8c6fe3d4e0e058f6c20db62b1a438fe1e082d42a Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Sat, 16 Jan 2021 14:30:47 -0500 Subject: [PATCH 5/5] Add extra flag validation Signed-off-by: Andrew Mason --- go/cmd/vtctldclient/commands.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/go/cmd/vtctldclient/commands.go b/go/cmd/vtctldclient/commands.go index 609ca057943..9f839d03329 100644 --- a/go/cmd/vtctldclient/commands.go +++ b/go/cmd/vtctldclient/commands.go @@ -218,6 +218,10 @@ func commandGetTablets(cmd *cobra.Command, args []string) error { return fmt.Errorf("invalid output format, got %s", getTabletsArgs.Format) } + if getTabletsArgs.Keyspace == "" && getTabletsArgs.Shard != "" { + return fmt.Errorf("--shard (= %s) cannot be passed without also passing --keyspace", getTabletsArgs.Shard) + } + resp, err := client.GetTablets(commandCtx, &vtctldatapb.GetTabletsRequest{ Cells: getTabletsArgs.Cells, Keyspace: getTabletsArgs.Keyspace,