diff --git a/go/vt/proto/vtadmin/vtadmin.pb.go b/go/vt/proto/vtadmin/vtadmin.pb.go index 09506b95a19..90beb3595b4 100644 --- a/go/vt/proto/vtadmin/vtadmin.pb.go +++ b/go/vt/proto/vtadmin/vtadmin.pb.go @@ -238,12 +238,14 @@ func (m *Keyspace) GetShards() map[string]*vtctldata.Shard { } type Schema struct { - Cluster *Cluster `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` - Keyspace string `protobuf:"bytes,2,opt,name=keyspace,proto3" json:"keyspace,omitempty"` - TableDefinitions []*tabletmanagerdata.TableDefinition `protobuf:"bytes,3,rep,name=table_definitions,json=tableDefinitions,proto3" json:"table_definitions,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Cluster *Cluster `protobuf:"bytes,1,opt,name=cluster,proto3" json:"cluster,omitempty"` + Keyspace string `protobuf:"bytes,2,opt,name=keyspace,proto3" json:"keyspace,omitempty"` + TableDefinitions []*tabletmanagerdata.TableDefinition `protobuf:"bytes,3,rep,name=table_definitions,json=tableDefinitions,proto3" json:"table_definitions,omitempty"` + // TableSizes is a mapping of table name to TableSize information. + TableSizes map[string]*Schema_TableSize `protobuf:"bytes,4,rep,name=table_sizes,json=tableSizes,proto3" json:"table_sizes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Schema) Reset() { *m = Schema{} } @@ -300,6 +302,133 @@ func (m *Schema) GetTableDefinitions() []*tabletmanagerdata.TableDefinition { return nil } +func (m *Schema) GetTableSizes() map[string]*Schema_TableSize { + if m != nil { + return m.TableSizes + } + return nil +} + +type Schema_ShardTableSize struct { + RowCount uint64 `protobuf:"varint,1,opt,name=row_count,json=rowCount,proto3" json:"row_count,omitempty"` + DataLength uint64 `protobuf:"varint,2,opt,name=data_length,json=dataLength,proto3" json:"data_length,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Schema_ShardTableSize) Reset() { *m = Schema_ShardTableSize{} } +func (m *Schema_ShardTableSize) String() string { return proto.CompactTextString(m) } +func (*Schema_ShardTableSize) ProtoMessage() {} +func (*Schema_ShardTableSize) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{3, 1} +} +func (m *Schema_ShardTableSize) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Schema_ShardTableSize) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Schema_ShardTableSize.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Schema_ShardTableSize) XXX_Merge(src proto.Message) { + xxx_messageInfo_Schema_ShardTableSize.Merge(m, src) +} +func (m *Schema_ShardTableSize) XXX_Size() int { + return m.Size() +} +func (m *Schema_ShardTableSize) XXX_DiscardUnknown() { + xxx_messageInfo_Schema_ShardTableSize.DiscardUnknown(m) +} + +var xxx_messageInfo_Schema_ShardTableSize proto.InternalMessageInfo + +func (m *Schema_ShardTableSize) GetRowCount() uint64 { + if m != nil { + return m.RowCount + } + return 0 +} + +func (m *Schema_ShardTableSize) GetDataLength() uint64 { + if m != nil { + return m.DataLength + } + return 0 +} + +// TableSize aggregates table size information across all shards containing +// in the given keyspace and cluster, as well as per-shard size information. +type Schema_TableSize struct { + RowCount uint64 `protobuf:"varint,1,opt,name=row_count,json=rowCount,proto3" json:"row_count,omitempty"` + DataLength uint64 `protobuf:"varint,2,opt,name=data_length,json=dataLength,proto3" json:"data_length,omitempty"` + ByShard map[string]*Schema_ShardTableSize `protobuf:"bytes,3,rep,name=by_shard,json=byShard,proto3" json:"by_shard,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Schema_TableSize) Reset() { *m = Schema_TableSize{} } +func (m *Schema_TableSize) String() string { return proto.CompactTextString(m) } +func (*Schema_TableSize) ProtoMessage() {} +func (*Schema_TableSize) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{3, 2} +} +func (m *Schema_TableSize) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Schema_TableSize) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Schema_TableSize.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Schema_TableSize) XXX_Merge(src proto.Message) { + xxx_messageInfo_Schema_TableSize.Merge(m, src) +} +func (m *Schema_TableSize) XXX_Size() int { + return m.Size() +} +func (m *Schema_TableSize) XXX_DiscardUnknown() { + xxx_messageInfo_Schema_TableSize.DiscardUnknown(m) +} + +var xxx_messageInfo_Schema_TableSize proto.InternalMessageInfo + +func (m *Schema_TableSize) GetRowCount() uint64 { + if m != nil { + return m.RowCount + } + return 0 +} + +func (m *Schema_TableSize) GetDataLength() uint64 { + if m != nil { + return m.DataLength + } + return 0 +} + +func (m *Schema_TableSize) GetByShard() map[string]*Schema_ShardTableSize { + if m != nil { + return m.ByShard + } + return nil +} + // Tablet groups the topo information of a tablet together with the Vitess // cluster it belongs to. type Tablet struct { @@ -637,11 +766,12 @@ func (m *Workflow) GetWorkflow() *vtctldata.Workflow { } type FindSchemaRequest struct { - Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"` - ClusterIds []string `protobuf:"bytes,2,rep,name=cluster_ids,json=clusterIds,proto3" json:"cluster_ids,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"` + ClusterIds []string `protobuf:"bytes,2,rep,name=cluster_ids,json=clusterIds,proto3" json:"cluster_ids,omitempty"` + TableSizeOptions *GetSchemaTableSizeOptions `protobuf:"bytes,3,opt,name=table_size_options,json=tableSizeOptions,proto3" json:"table_size_options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *FindSchemaRequest) Reset() { *m = FindSchemaRequest{} } @@ -691,6 +821,13 @@ func (m *FindSchemaRequest) GetClusterIds() []string { return nil } +func (m *FindSchemaRequest) GetTableSizeOptions() *GetSchemaTableSizeOptions { + if m != nil { + return m.TableSizeOptions + } + return nil +} + type GetClustersRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -966,12 +1103,13 @@ func (m *GetKeyspacesResponse) GetKeyspaces() []*Keyspace { } type GetSchemaRequest struct { - ClusterId string `protobuf:"bytes,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` - Keyspace string `protobuf:"bytes,2,opt,name=keyspace,proto3" json:"keyspace,omitempty"` - Table string `protobuf:"bytes,3,opt,name=table,proto3" json:"table,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ClusterId string `protobuf:"bytes,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` + Keyspace string `protobuf:"bytes,2,opt,name=keyspace,proto3" json:"keyspace,omitempty"` + Table string `protobuf:"bytes,3,opt,name=table,proto3" json:"table,omitempty"` + TableSizeOptions *GetSchemaTableSizeOptions `protobuf:"bytes,4,opt,name=table_size_options,json=tableSizeOptions,proto3" json:"table_size_options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetSchemaRequest) Reset() { *m = GetSchemaRequest{} } @@ -1028,11 +1166,19 @@ func (m *GetSchemaRequest) GetTable() string { return "" } +func (m *GetSchemaRequest) GetTableSizeOptions() *GetSchemaTableSizeOptions { + if m != nil { + return m.TableSizeOptions + } + return nil +} + type GetSchemasRequest struct { - ClusterIds []string `protobuf:"bytes,1,rep,name=cluster_ids,json=clusterIds,proto3" json:"cluster_ids,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ClusterIds []string `protobuf:"bytes,1,rep,name=cluster_ids,json=clusterIds,proto3" json:"cluster_ids,omitempty"` + TableSizeOptions *GetSchemaTableSizeOptions `protobuf:"bytes,2,opt,name=table_size_options,json=tableSizeOptions,proto3" json:"table_size_options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetSchemasRequest) Reset() { *m = GetSchemasRequest{} } @@ -1075,6 +1221,13 @@ func (m *GetSchemasRequest) GetClusterIds() []string { return nil } +func (m *GetSchemasRequest) GetTableSizeOptions() *GetSchemaTableSizeOptions { + if m != nil { + return m.TableSizeOptions + } + return nil +} + type GetSchemasResponse struct { Schemas []*Schema `protobuf:"bytes,1,rep,name=schemas,proto3" json:"schemas,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1122,6 +1275,53 @@ func (m *GetSchemasResponse) GetSchemas() []*Schema { return nil } +type GetSchemaTableSizeOptions struct { + AggregateSizes bool `protobuf:"varint,1,opt,name=aggregate_sizes,json=aggregateSizes,proto3" json:"aggregate_sizes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSchemaTableSizeOptions) Reset() { *m = GetSchemaTableSizeOptions{} } +func (m *GetSchemaTableSizeOptions) String() string { return proto.CompactTextString(m) } +func (*GetSchemaTableSizeOptions) ProtoMessage() {} +func (*GetSchemaTableSizeOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_609739e22a0a50b3, []int{19} +} +func (m *GetSchemaTableSizeOptions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetSchemaTableSizeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetSchemaTableSizeOptions.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetSchemaTableSizeOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSchemaTableSizeOptions.Merge(m, src) +} +func (m *GetSchemaTableSizeOptions) XXX_Size() int { + return m.Size() +} +func (m *GetSchemaTableSizeOptions) XXX_DiscardUnknown() { + xxx_messageInfo_GetSchemaTableSizeOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSchemaTableSizeOptions proto.InternalMessageInfo + +func (m *GetSchemaTableSizeOptions) GetAggregateSizes() bool { + if m != nil { + return m.AggregateSizes + } + return false +} + type GetTabletRequest struct { Hostname string `protobuf:"bytes,1,opt,name=hostname,proto3" json:"hostname,omitempty"` // ClusterIDs is an optional parameter to narrow the scope of the search, if @@ -1137,7 +1337,7 @@ 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_609739e22a0a50b3, []int{19} + return fileDescriptor_609739e22a0a50b3, []int{20} } func (m *GetTabletRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1191,7 +1391,7 @@ 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_609739e22a0a50b3, []int{20} + return fileDescriptor_609739e22a0a50b3, []int{21} } func (m *GetTabletsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1238,7 +1438,7 @@ 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_609739e22a0a50b3, []int{21} + return fileDescriptor_609739e22a0a50b3, []int{22} } func (m *GetTabletsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1286,7 +1486,7 @@ func (m *GetVSchemaRequest) Reset() { *m = GetVSchemaRequest{} } func (m *GetVSchemaRequest) String() string { return proto.CompactTextString(m) } func (*GetVSchemaRequest) ProtoMessage() {} func (*GetVSchemaRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{22} + return fileDescriptor_609739e22a0a50b3, []int{23} } func (m *GetVSchemaRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1340,7 +1540,7 @@ func (m *GetVSchemasRequest) Reset() { *m = GetVSchemasRequest{} } func (m *GetVSchemasRequest) String() string { return proto.CompactTextString(m) } func (*GetVSchemasRequest) ProtoMessage() {} func (*GetVSchemasRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{23} + return fileDescriptor_609739e22a0a50b3, []int{24} } func (m *GetVSchemasRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1387,7 +1587,7 @@ func (m *GetVSchemasResponse) Reset() { *m = GetVSchemasResponse{} } func (m *GetVSchemasResponse) String() string { return proto.CompactTextString(m) } func (*GetVSchemasResponse) ProtoMessage() {} func (*GetVSchemasResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{24} + return fileDescriptor_609739e22a0a50b3, []int{25} } func (m *GetVSchemasResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1437,7 +1637,7 @@ func (m *GetWorkflowRequest) Reset() { *m = GetWorkflowRequest{} } func (m *GetWorkflowRequest) String() string { return proto.CompactTextString(m) } func (*GetWorkflowRequest) ProtoMessage() {} func (*GetWorkflowRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{25} + return fileDescriptor_609739e22a0a50b3, []int{26} } func (m *GetWorkflowRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1523,7 +1723,7 @@ func (m *GetWorkflowsRequest) Reset() { *m = GetWorkflowsRequest{} } func (m *GetWorkflowsRequest) String() string { return proto.CompactTextString(m) } func (*GetWorkflowsRequest) ProtoMessage() {} func (*GetWorkflowsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{26} + return fileDescriptor_609739e22a0a50b3, []int{27} } func (m *GetWorkflowsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1591,7 +1791,7 @@ func (m *GetWorkflowsResponse) Reset() { *m = GetWorkflowsResponse{} } func (m *GetWorkflowsResponse) String() string { return proto.CompactTextString(m) } func (*GetWorkflowsResponse) ProtoMessage() {} func (*GetWorkflowsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{27} + return fileDescriptor_609739e22a0a50b3, []int{28} } func (m *GetWorkflowsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1640,7 +1840,7 @@ func (m *VTExplainRequest) Reset() { *m = VTExplainRequest{} } func (m *VTExplainRequest) String() string { return proto.CompactTextString(m) } func (*VTExplainRequest) ProtoMessage() {} func (*VTExplainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{28} + return fileDescriptor_609739e22a0a50b3, []int{29} } func (m *VTExplainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1701,7 +1901,7 @@ func (m *VTExplainResponse) Reset() { *m = VTExplainResponse{} } func (m *VTExplainResponse) String() string { return proto.CompactTextString(m) } func (*VTExplainResponse) ProtoMessage() {} func (*VTExplainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_609739e22a0a50b3, []int{29} + return fileDescriptor_609739e22a0a50b3, []int{30} } func (m *VTExplainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1744,6 +1944,10 @@ func init() { proto.RegisterType((*Keyspace)(nil), "vtadmin.Keyspace") proto.RegisterMapType((map[string]*vtctldata.Shard)(nil), "vtadmin.Keyspace.ShardsEntry") proto.RegisterType((*Schema)(nil), "vtadmin.Schema") + proto.RegisterMapType((map[string]*Schema_TableSize)(nil), "vtadmin.Schema.TableSizesEntry") + proto.RegisterType((*Schema_ShardTableSize)(nil), "vtadmin.Schema.ShardTableSize") + proto.RegisterType((*Schema_TableSize)(nil), "vtadmin.Schema.TableSize") + proto.RegisterMapType((map[string]*Schema_ShardTableSize)(nil), "vtadmin.Schema.TableSize.ByShardEntry") proto.RegisterType((*Tablet)(nil), "vtadmin.Tablet") proto.RegisterType((*VSchema)(nil), "vtadmin.VSchema") proto.RegisterType((*Vtctld)(nil), "vtadmin.Vtctld") @@ -1759,6 +1963,7 @@ func init() { proto.RegisterType((*GetSchemaRequest)(nil), "vtadmin.GetSchemaRequest") proto.RegisterType((*GetSchemasRequest)(nil), "vtadmin.GetSchemasRequest") proto.RegisterType((*GetSchemasResponse)(nil), "vtadmin.GetSchemasResponse") + proto.RegisterType((*GetSchemaTableSizeOptions)(nil), "vtadmin.GetSchemaTableSizeOptions") proto.RegisterType((*GetTabletRequest)(nil), "vtadmin.GetTabletRequest") proto.RegisterType((*GetTabletsRequest)(nil), "vtadmin.GetTabletsRequest") proto.RegisterType((*GetTabletsResponse)(nil), "vtadmin.GetTabletsResponse") @@ -1776,85 +1981,99 @@ func init() { func init() { proto.RegisterFile("vtadmin.proto", fileDescriptor_609739e22a0a50b3) } var fileDescriptor_609739e22a0a50b3 = []byte{ - // 1244 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xdd, 0x6f, 0xdb, 0x54, - 0x14, 0x8f, 0x93, 0x36, 0x89, 0x4f, 0xb6, 0xd5, 0xbd, 0xab, 0xb4, 0xcc, 0xfd, 0x58, 0x75, 0x05, - 0xa8, 0x43, 0x2c, 0x96, 0x02, 0x9d, 0x28, 0x20, 0x4d, 0xdb, 0x5a, 0xa2, 0xad, 0x22, 0x45, 0x6e, - 0xf1, 0xa4, 0xbd, 0x04, 0x37, 0xf1, 0x52, 0xab, 0xae, 0x9d, 0xc5, 0xb7, 0x29, 0x79, 0x86, 0x47, - 0x9e, 0x11, 0x8f, 0xf0, 0xdf, 0xf0, 0x82, 0xc4, 0x9f, 0x00, 0xe5, 0x91, 0x7f, 0x02, 0xf9, 0x7e, - 0xf9, 0xda, 0x4e, 0xbf, 0x60, 0x6f, 0xbe, 0xf7, 0x9e, 0x7b, 0xce, 0xef, 0x7c, 0xfd, 0xce, 0x35, - 0xdc, 0x9e, 0x10, 0x77, 0x70, 0xe2, 0x87, 0xad, 0xd1, 0x38, 0x22, 0x11, 0xaa, 0xf1, 0xa5, 0x79, - 0x8f, 0xb8, 0x87, 0x81, 0x47, 0x4e, 0xdc, 0xd0, 0x1d, 0x7a, 0xe3, 0x81, 0x4b, 0x5c, 0x26, 0x61, - 0xde, 0x21, 0xd1, 0x28, 0x52, 0xd6, 0xb7, 0x27, 0x71, 0xff, 0xc8, 0x3b, 0x11, 0xcb, 0x85, 0x09, - 0xe9, 0x93, 0x20, 0x3d, 0xc7, 0x8f, 0xa0, 0xf6, 0x3c, 0x38, 0x8d, 0x89, 0x37, 0x46, 0x77, 0xa0, - 0xec, 0x0f, 0x9a, 0xda, 0xba, 0xb6, 0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, 0x48, 0x29, 0x5d, 0x89, 0x6a, 0x61, 0x3a, 0x98, 0xcb, 0x33, 0xcf, - 0x72, 0x18, 0xf8, 0x4b, 0x38, 0x83, 0x21, 0x43, 0xf7, 0x66, 0x9e, 0x54, 0x25, 0x06, 0x4e, 0xc7, - 0x59, 0x0c, 0x59, 0x66, 0xcf, 0x62, 0xc8, 0xf1, 0x37, 0x2e, 0xa1, 0x2f, 0xa8, 0x22, 0xa7, 0x50, - 0x22, 0x05, 0xae, 0x36, 0x0b, 0x7c, 0x28, 0x6b, 0x44, 0xb0, 0x69, 0xb6, 0x46, 0x72, 0xd4, 0x9c, - 0xad, 0x11, 0xa7, 0x18, 0x8d, 0x27, 0x54, 0x97, 0x7c, 0xe3, 0x2d, 0xcf, 0x62, 0x00, 0xa1, 0xab, - 0xf8, 0x37, 0x28, 0x2b, 0x24, 0xfd, 0x8b, 0x5c, 0xb9, 0x80, 0x43, 0x66, 0x54, 0x48, 0x81, 0x61, - 0x70, 0x09, 0x6d, 0x83, 0x2e, 0x3b, 0x4f, 0xc9, 0x4e, 0xbe, 0xd3, 0x4d, 0x73, 0xd6, 0x91, 0xd0, - 0xf2, 0xec, 0xf1, 0x6f, 0xe7, 0x6b, 0xda, 0x1f, 0xe7, 0x6b, 0xda, 0x9f, 0xe7, 0x6b, 0xda, 0xcf, - 0x7f, 0xaf, 0x95, 0x5e, 0xbf, 0x37, 0xf1, 0x89, 0x17, 0xc7, 0x2d, 0x3f, 0xb2, 0xd8, 0x97, 0x35, - 0x8c, 0xac, 0x09, 0xb1, 0xe8, 0xdf, 0xb3, 0xc5, 0x75, 0x1d, 0x56, 0xe9, 0xf2, 0xe3, 0x7f, 0x03, - 0x00, 0x00, 0xff, 0xff, 0xe0, 0x66, 0xc0, 0xf2, 0xaf, 0x0f, 0x00, 0x00, + // 1465 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0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, 0x76, 0x65, 0xa8, 0x59, 0x23, 0x49, + 0x43, 0x88, 0x3e, 0x82, 0x0a, 0x4b, 0x18, 0xba, 0x5f, 0x3b, 0x61, 0xbd, 0x40, 0x53, 0x5d, 0x96, + 0xe0, 0x18, 0x7c, 0x96, 0xa7, 0x1b, 0x45, 0xb0, 0x76, 0x01, 0x91, 0x06, 0xe3, 0x0b, 0xa8, 0xa6, + 0xdc, 0x73, 0xda, 0xd6, 0x4c, 0xb6, 0x6d, 0x7d, 0x61, 0x01, 0xa5, 0x7f, 0x46, 0x07, 0x56, 0x68, + 0x4f, 0xa5, 0x13, 0x6d, 0x80, 0x1e, 0xf8, 0x53, 0xab, 0xef, 0x1f, 0x7b, 0x84, 0xa6, 0x2f, 0x98, + 0xe5, 0xc0, 0x9f, 0xde, 0x8b, 0xd6, 0xe8, 0x32, 0x54, 0xa2, 0x4d, 0x5b, 0x23, 0xc7, 0x1b, 0x92, + 0x43, 0x5a, 0xa9, 0x60, 0x42, 0x64, 0xfa, 0x94, 0x5a, 0x8c, 0xbf, 0x35, 0xd0, 0x5f, 0x53, 0x2e, + 0x74, 0x07, 0xca, 0x07, 0x33, 0x8b, 0xb2, 0x86, 0xf7, 0xff, 0xca, 0xc2, 0x3d, 0x35, 0xee, 0xce, + 0xe8, 0x3e, 0x58, 0xef, 0x4a, 0x07, 0x6c, 0x65, 0x3c, 0x81, 0x73, 0xaa, 0x63, 0x4e, 0xd7, 0xae, + 0x27, 0xbb, 0xb6, 0x95, 0xae, 0x90, 0xec, 0x8e, 0x4a, 0xbd, 0xdf, 0x34, 0x28, 0x52, 0x07, 0x39, + 0x13, 0xf5, 0x76, 0xa0, 0xc8, 0x48, 0x24, 0xe9, 0x2d, 0x05, 0x87, 0x65, 0x33, 0xb9, 0x1f, 0xb5, + 0x60, 0x39, 0x24, 0x36, 0x71, 0xea, 0xf9, 0x6d, 0x6d, 0x67, 0xa5, 0xb5, 0x29, 0x73, 0xb2, 0xb8, + 0x46, 0xd7, 0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2, 0x84, 0xc6, 0xb4, 0x01, + 0xe2, 0xc1, 0xa0, 0x74, 0x35, 0x33, 0xb5, 0x8c, 0x8d, 0xb9, 0xbe, 0x14, 0x06, 0xfe, 0x43, 0x22, + 0x81, 0x21, 0x21, 0xf7, 0x46, 0x5a, 0x54, 0x25, 0x06, 0x2e, 0xc7, 0x49, 0x0c, 0x49, 0x65, 0x4f, + 0x62, 0x48, 0xe9, 0x37, 0x5e, 0x42, 0x1f, 0xd2, 0x44, 0xbd, 0x0c, 0x45, 0x32, 0x5a, 0x6d, 0x64, + 0xf4, 0x50, 0x72, 0x44, 0xa8, 0x69, 0x92, 0x23, 0x29, 0x69, 0x4e, 0x72, 0xa4, 0x97, 0xed, 0xc6, + 0x6d, 0x9a, 0x4b, 0x7e, 0x22, 0x6f, 0xcc, 0x53, 0x00, 0x91, 0x2b, 0xfb, 0x1f, 0x89, 0x64, 0x48, + 0xfc, 0xdf, 0xca, 0xe6, 0x02, 0x0d, 0x99, 0xc3, 0x90, 0x8c, 0xc2, 0xe0, 0x25, 0xb4, 0x0b, 0xba, + 0xbc, 0x79, 0xca, 0xe9, 0xa4, 0x6f, 0xba, 0x61, 0xcc, 0x73, 0x89, 0x2c, 0x77, 0x6f, 0xfe, 0xfa, + 0x62, 0x4b, 0xfb, 0xfd, 0xc5, 0x96, 0xf6, 0xc7, 0x8b, 0x2d, 0xed, 0xc7, 0xbf, 0xb6, 0x96, 0x9e, + 0xbc, 0x31, 0x71, 0x89, 0x13, 0x86, 0x0d, 0xd7, 0x6f, 0xb2, 0xa7, 0xe6, 0xd0, 0x6f, 0x4e, 0x48, + 0x93, 0xfe, 0xa7, 0xd4, 0xe4, 0xb9, 0x0e, 0x8a, 0x74, 0xf9, 0xee, 0x7f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x30, 0xe9, 0x27, 0x5f, 0xc5, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2605,6 +2824,32 @@ func (m *Schema) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.TableSizes) > 0 { + for k := range m.TableSizes { + v := m.TableSizes[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintVtadmin(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintVtadmin(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } if len(m.TableDefinitions) > 0 { for iNdEx := len(m.TableDefinitions) - 1; iNdEx >= 0; iNdEx-- { { @@ -2641,7 +2886,7 @@ func (m *Schema) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Tablet) Marshal() (dAtA []byte, err error) { +func (m *Schema_ShardTableSize) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2651,12 +2896,12 @@ func (m *Tablet) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Tablet) MarshalTo(dAtA []byte) (int, error) { +func (m *Schema_ShardTableSize) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Tablet) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Schema_ShardTableSize) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2665,39 +2910,20 @@ func (m *Tablet) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.State != 0 { - i = encodeVarintVtadmin(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x18 - } - if m.Tablet != nil { - { - size, err := m.Tablet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVtadmin(dAtA, i, uint64(size)) - } + if m.DataLength != 0 { + i = encodeVarintVtadmin(dAtA, i, uint64(m.DataLength)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - if m.Cluster != nil { - { - size, err := m.Cluster.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVtadmin(dAtA, i, uint64(size)) - } + if m.RowCount != 0 { + i = encodeVarintVtadmin(dAtA, i, uint64(m.RowCount)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *VSchema) Marshal() (dAtA []byte, err error) { +func (m *Schema_TableSize) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2707,12 +2933,12 @@ func (m *VSchema) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *VSchema) MarshalTo(dAtA []byte) (int, error) { +func (m *Schema_TableSize) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *VSchema) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Schema_TableSize) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2721,41 +2947,46 @@ func (m *VSchema) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.VSchema != nil { - { - size, err := m.VSchema.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.ByShard) > 0 { + for k := range m.ByShard { + v := m.ByShard[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - i -= size - i = encodeVarintVtadmin(dAtA, i, uint64(size)) + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintVtadmin(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintVtadmin(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a } - i-- - dAtA[i] = 0x1a } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Name))) + if m.DataLength != 0 { + i = encodeVarintVtadmin(dAtA, i, uint64(m.DataLength)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - if m.Cluster != nil { - { - size, err := m.Cluster.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVtadmin(dAtA, i, uint64(size)) - } + if m.RowCount != 0 { + i = encodeVarintVtadmin(dAtA, i, uint64(m.RowCount)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *Vtctld) Marshal() (dAtA []byte, err error) { +func (m *Tablet) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2765,7 +2996,121 @@ func (m *Vtctld) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Vtctld) MarshalTo(dAtA []byte) (int, error) { +func (m *Tablet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Tablet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.State != 0 { + i = encodeVarintVtadmin(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x18 + } + if m.Tablet != nil { + { + size, err := m.Tablet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Cluster != nil { + { + size, err := m.Cluster.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VSchema) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VSchema) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VSchema) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.VSchema != nil { + { + size, err := m.VSchema.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintVtadmin(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.Cluster != nil { + { + size, err := m.Cluster.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Vtctld) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Vtctld) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } @@ -2952,6 +3297,18 @@ func (m *FindSchemaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.TableSizeOptions != nil { + { + size, err := m.TableSizeOptions.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } if len(m.ClusterIds) > 0 { for iNdEx := len(m.ClusterIds) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.ClusterIds[iNdEx]) @@ -3217,6 +3574,18 @@ func (m *GetSchemaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.TableSizeOptions != nil { + { + size, err := m.TableSizeOptions.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if len(m.Table) > 0 { i -= len(m.Table) copy(dAtA[i:], m.Table) @@ -3265,6 +3634,18 @@ func (m *GetSchemasRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.TableSizeOptions != nil { + { + size, err := m.TableSizeOptions.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVtadmin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.ClusterIds) > 0 { for iNdEx := len(m.ClusterIds) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.ClusterIds[iNdEx]) @@ -3318,6 +3699,43 @@ func (m *GetSchemasResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GetSchemaTableSizeOptions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetSchemaTableSizeOptions) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetSchemaTableSizeOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.AggregateSizes { + i-- + if m.AggregateSizes { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *GetTabletRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -3921,6 +4339,68 @@ func (m *Schema) Size() (n int) { n += 1 + l + sovVtadmin(uint64(l)) } } + if len(m.TableSizes) > 0 { + for k, v := range m.TableSizes { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovVtadmin(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovVtadmin(uint64(len(k))) + l + n += mapEntrySize + 1 + sovVtadmin(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Schema_ShardTableSize) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RowCount != 0 { + n += 1 + sovVtadmin(uint64(m.RowCount)) + } + if m.DataLength != 0 { + n += 1 + sovVtadmin(uint64(m.DataLength)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Schema_TableSize) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RowCount != 0 { + n += 1 + sovVtadmin(uint64(m.RowCount)) + } + if m.DataLength != 0 { + n += 1 + sovVtadmin(uint64(m.DataLength)) + } + if len(m.ByShard) > 0 { + for k, v := range m.ByShard { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovVtadmin(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovVtadmin(uint64(len(k))) + l + n += mapEntrySize + 1 + sovVtadmin(uint64(mapEntrySize)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -4068,6 +4548,10 @@ func (m *FindSchemaRequest) Size() (n int) { n += 1 + l + sovVtadmin(uint64(l)) } } + if m.TableSizeOptions != nil { + l = m.TableSizeOptions.Size() + n += 1 + l + sovVtadmin(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -4194,6 +4678,10 @@ func (m *GetSchemaRequest) Size() (n int) { if l > 0 { n += 1 + l + sovVtadmin(uint64(l)) } + if m.TableSizeOptions != nil { + l = m.TableSizeOptions.Size() + n += 1 + l + sovVtadmin(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -4212,6 +4700,10 @@ func (m *GetSchemasRequest) Size() (n int) { n += 1 + l + sovVtadmin(uint64(l)) } } + if m.TableSizeOptions != nil { + l = m.TableSizeOptions.Size() + n += 1 + l + sovVtadmin(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -4236,6 +4728,21 @@ func (m *GetSchemasResponse) Size() (n int) { return n } +func (m *GetSchemaTableSizeOptions) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AggregateSizes { + n += 2 + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func (m *GetTabletRequest) Size() (n int) { if m == nil { return 0 @@ -5105,17 +5612,459 @@ func (m *Schema) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipVtadmin(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthVtadmin - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthVtadmin + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableSizes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TableSizes == nil { + m.TableSizes = make(map[string]*Schema_TableSize) + } + var mapkey string + var mapvalue *Schema_TableSize + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthVtadmin + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthVtadmin + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthVtadmin + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &Schema_TableSize{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.TableSizes[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Schema_ShardTableSize) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ShardTableSize: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ShardTableSize: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowCount", wireType) + } + m.RowCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DataLength", wireType) + } + m.DataLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DataLength |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Schema_TableSize) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TableSize: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TableSize: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowCount", wireType) + } + m.RowCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DataLength", wireType) + } + m.DataLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DataLength |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ByShard", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ByShard == nil { + m.ByShard = make(map[string]*Schema_ShardTableSize) + } + var mapkey string + var mapvalue *Schema_ShardTableSize + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthVtadmin + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthVtadmin + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthVtadmin + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &Schema_ShardTableSize{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.ByShard[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -6024,6 +6973,42 @@ func (m *FindSchemaRequest) Unmarshal(dAtA []byte) error { } m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableSizeOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TableSizeOptions == nil { + m.TableSizeOptions = &GetSchemaTableSizeOptions{} + } + if err := m.TableSizeOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVtadmin(dAtA[iNdEx:]) @@ -6664,6 +7649,42 @@ func (m *GetSchemaRequest) Unmarshal(dAtA []byte) error { } m.Table = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableSizeOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TableSizeOptions == nil { + m.TableSizeOptions = &GetSchemaTableSizeOptions{} + } + if err := m.TableSizeOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVtadmin(dAtA[iNdEx:]) @@ -6750,6 +7771,42 @@ func (m *GetSchemasRequest) Unmarshal(dAtA []byte) error { } m.ClusterIds = append(m.ClusterIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableSizeOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVtadmin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVtadmin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TableSizeOptions == nil { + m.TableSizeOptions = &GetSchemaTableSizeOptions{} + } + if err := m.TableSizeOptions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipVtadmin(dAtA[iNdEx:]) @@ -6863,6 +7920,80 @@ func (m *GetSchemasResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *GetSchemaTableSizeOptions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetSchemaTableSizeOptions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetSchemaTableSizeOptions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AggregateSizes", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVtadmin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AggregateSizes = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipVtadmin(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVtadmin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *GetTabletRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/go/vt/vtadmin/api.go b/go/vt/vtadmin/api.go index d61968613aa..770e6f0cacd 100644 --- a/go/vt/vtadmin/api.go +++ b/go/vt/vtadmin/api.go @@ -19,6 +19,7 @@ package vtadmin import ( "context" "encoding/json" + stderrors "errors" "fmt" "net/http" "strings" @@ -39,6 +40,7 @@ import ( vtadminhttp "vitess.io/vitess/go/vt/vtadmin/http" vthandlers "vitess.io/vitess/go/vt/vtadmin/http/handlers" "vitess.io/vitess/go/vt/vtadmin/sort" + "vitess.io/vitess/go/vt/vtadmin/vtadminproto" "vitess.io/vitess/go/vt/vterrors" "vitess.io/vitess/go/vt/vtexplain" @@ -176,7 +178,10 @@ func (api *API) FindSchema(ctx context.Context, req *vtadminpb.FindSchemaRequest return } - schemas, err := api.getSchemas(ctx, c, tablets) + schemas, err := api.getSchemas(ctx, c, cluster.GetSchemaOptions{ + Tablets: tablets, + TableSizeOptions: req.TableSizeOptions, + }) if err != nil { err := fmt.Errorf("%w: while collecting schemas for cluster %s", err, c.ID) rec.RecordError(err) @@ -342,18 +347,12 @@ func (api *API) GetKeyspaces(ctx context.Context, req *vtadminpb.GetKeyspacesReq go func(c *cluster.Cluster, ks *vtctldatapb.Keyspace) { defer kwg.Done() - span, ctx := trace.NewSpan(ctx, "Cluster.FindAllShardsInKeyspace") - defer span.Finish() - - cluster.AnnotateSpan(c, span) - span.Annotate("keyspace", ks.Name) - - sr, err := c.Vtctld.FindAllShardsInKeyspace(ctx, &vtctldatapb.FindAllShardsInKeyspaceRequest{ - Keyspace: ks.Name, + shards, err := c.FindAllShardsInKeyspace(ctx, ks.Name, cluster.FindAllShardsInKeyspaceOptions{ + SkipDial: true, }) if err != nil { - er.RecordError(fmt.Errorf("FindAllShardsInKeyspace(%s): %w", ks.Name, err)) + er.RecordError(err) return } @@ -361,7 +360,7 @@ func (api *API) GetKeyspaces(ctx context.Context, req *vtadminpb.GetKeyspacesReq kss = append(kss, &vtadminpb.Keyspace{ Cluster: c.ToProto(), Keyspace: ks, - Shards: sr.Shards, + Shards: shards, }) km.Unlock() }(c, ks) @@ -394,30 +393,19 @@ func (api *API) GetSchema(ctx context.Context, req *vtadminpb.GetSchemaRequest) span.Annotate("cluster_id", req.ClusterId) span.Annotate("keyspace", req.Keyspace) span.Annotate("table", req.Table) + vtadminproto.AnnotateSpanWithGetSchemaTableSizeOptions(req.TableSizeOptions, span) - clusters, _ := api.getClustersForRequest([]string{req.ClusterId}) - if len(clusters) == 0 { + c, ok := api.clusterMap[req.ClusterId] + if !ok { return nil, fmt.Errorf("%w: no cluster with id %s", errors.ErrUnsupportedCluster, req.ClusterId) } - cluster := clusters[0] - - tablet, err := cluster.FindTablet(ctx, func(t *vtadminpb.Tablet) bool { - return t.Tablet.Keyspace == req.Keyspace && t.State == vtadminpb.Tablet_SERVING + return c.GetSchema(ctx, req.Keyspace, cluster.GetSchemaOptions{ + BaseRequest: &vtctldatapb.GetSchemaRequest{ + Tables: []string{req.Table}, + }, + TableSizeOptions: req.TableSizeOptions, }) - if err != nil { - return nil, fmt.Errorf("%w: no serving tablet found for keyspace %s", err, req.Keyspace) - } - - span.Annotate("tablet_alias", topoproto.TabletAliasString(tablet.Tablet.Alias)) - - if err := cluster.Vtctld.Dial(ctx); err != nil { - return nil, err - } - - return cluster.GetSchema(ctx, &vtctldatapb.GetSchemaRequest{ - Tables: []string{req.Table}, - }, tablet) } // GetSchemas is part of the vtadminpb.VTAdminServer interface. @@ -449,7 +437,10 @@ func (api *API) GetSchemas(ctx context.Context, req *vtadminpb.GetSchemasRequest return } - ss, err := api.getSchemas(ctx, c, tablets) + ss, err := api.getSchemas(ctx, c, cluster.GetSchemaOptions{ + Tablets: tablets, + TableSizeOptions: req.TableSizeOptions, + }) if err != nil { er.RecordError(err) return @@ -473,7 +464,7 @@ func (api *API) GetSchemas(ctx context.Context, req *vtadminpb.GetSchemasRequest } // getSchemas returns all of the schemas across all keyspaces in the given cluster. -func (api *API) getSchemas(ctx context.Context, c *cluster.Cluster, tablets []*vtadminpb.Tablet) ([]*vtadminpb.Schema, error) { +func (api *API) getSchemas(ctx context.Context, c *cluster.Cluster, opts cluster.GetSchemaOptions) ([]*vtadminpb.Schema, error) { if err := c.Vtctld.Dial(ctx); err != nil { return nil, err } @@ -503,14 +494,26 @@ func (api *API) getSchemas(ctx context.Context, c *cluster.Cluster, tablets []*v go func(c *cluster.Cluster, ks *vtctldatapb.Keyspace) { defer wg.Done() - ss, err := api.getSchemasForKeyspace(ctx, c, ks, tablets) + ss, err := c.GetSchema(ctx, ks.Name, opts) if err != nil { + // Ignore keyspaces without any serving tablets. + if stderrors.Is(err, errors.ErrNoServingTablet) { + log.Infof(err.Error()) + return + } + er.RecordError(err) return } // Ignore keyspaces without schemas if ss == nil { + log.Infof("No schemas for %s", ks.Name) + return + } + + if len(ss.TableDefinitions) == 0 { + log.Infof("No tables in schema for %s", ks.Name) return } @@ -529,41 +532,6 @@ func (api *API) getSchemas(ctx context.Context, c *cluster.Cluster, tablets []*v return schemas, nil } -func (api *API) getSchemasForKeyspace(ctx context.Context, c *cluster.Cluster, ks *vtctldatapb.Keyspace, tablets []*vtadminpb.Tablet) (*vtadminpb.Schema, error) { - // Choose the first serving tablet. - var kt *vtadminpb.Tablet - for _, t := range tablets { - if t.Tablet.Keyspace != ks.Name || t.State != vtadminpb.Tablet_SERVING { - continue - } - - kt = t - } - - // Skip schema lookup on this keyspace if there are no serving tablets. - if kt == nil { - return nil, nil - } - - if err := c.Vtctld.Dial(ctx); err != nil { - return nil, err - } - - s, err := c.GetSchema(ctx, &vtctldatapb.GetSchemaRequest{}, kt) - if err != nil { - return nil, err - } - - // Ignore any schemas without table definitions; otherwise we return - // a vtadminpb.Schema object with only Cluster and Keyspace defined, - // which is not particularly useful. - if s == nil || len(s.TableDefinitions) == 0 { - return nil, nil - } - - return s, nil -} - // GetTablet is part of the vtadminpb.VTAdminServer interface. func (api *API) GetTablet(ctx context.Context, req *vtadminpb.GetTabletRequest) (*vtadminpb.Tablet, error) { span, ctx := trace.NewSpan(ctx, "API.GetTablet") @@ -907,7 +875,9 @@ func (api *API) VTExplain(ctx context.Context, req *vtadminpb.VTExplainRequest) go func(c *cluster.Cluster) { defer wg.Done() - res, err := c.GetSchema(ctx, &vtctldatapb.GetSchemaRequest{}, tablet) + res, err := c.GetSchema(ctx, req.Keyspace, cluster.GetSchemaOptions{ + Tablets: []*vtadminpb.Tablet{tablet}, + }) if err != nil { er.RecordError(fmt.Errorf("GetSchema(%s): %w", topoproto.TabletAliasString(tablet.Tablet.Alias), err)) return @@ -959,23 +929,16 @@ func (api *API) VTExplain(ctx context.Context, req *vtadminpb.VTExplainRequest) go func(c *cluster.Cluster) { defer wg.Done() - span, ctx := trace.NewSpan(ctx, "Cluster.FindAllShardsInKeyspace") - defer span.Finish() - - span.Annotate("keyspace", req.Keyspace) - cluster.AnnotateSpan(c, span) - - ksm, err := c.Vtctld.FindAllShardsInKeyspace(ctx, &vtctldatapb.FindAllShardsInKeyspaceRequest{ - Keyspace: req.Keyspace, + shards, err := c.FindAllShardsInKeyspace(ctx, req.Keyspace, cluster.FindAllShardsInKeyspaceOptions{ + SkipDial: true, }) - if err != nil { - er.RecordError(fmt.Errorf("FindAllShardsInKeyspace(%s): %w", req.Keyspace, err)) + er.RecordError(err) return } vtsm := make(map[string]*topodatapb.Shard) - for _, s := range ksm.Shards { + for _, s := range shards { vtsm[s.Name] = s.Shard } diff --git a/go/vt/vtadmin/api_test.go b/go/vt/vtadmin/api_test.go index f37eb8f148f..dd895fb3962 100644 --- a/go/vt/vtadmin/api_test.go +++ b/go/vt/vtadmin/api_test.go @@ -124,6 +124,7 @@ func TestFindSchema(t *testing.T) { Name: "testtable", }, }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, }, shouldErr: false, }, @@ -495,6 +496,7 @@ func TestFindSchema(t *testing.T) { Name: "testtable", }, }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, }, shouldErr: false, }, @@ -526,6 +528,234 @@ func TestFindSchema(t *testing.T) { assert.Equal(t, tt.expected, resp) }) } + + t.Run("size aggregation", func(t *testing.T) { + t.Parallel() + + c1pb := &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + } + c2pb := &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + } + + c1 := vtadmintestutil.BuildCluster( + vtadmintestutil.TestClusterConfig{ + Cluster: c1pb, + VtctldClient: &vtadmintestutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-80": { + Keyspace: "testkeyspace", + Name: "-80", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "80-": { + Keyspace: "testkeyspace", + Name: "80-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + }, + }, + }, + "ks1": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-": { + Keyspace: "ks1", + Name: "-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + }, + }, + }, + }, + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + {Name: "testkeyspace"}, + {Name: "ks1"}, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "c1zone1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + RowCount: 10, + DataLength: 100, + }, + }, + }, + }, + }, + "c1zone1-0000000200": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + RowCount: 20, + DataLength: 200, + }, + }, + }, + }, + }, + }, + }, + Tablets: []*vtadminpb.Tablet{ + { + Cluster: c1pb, + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "c1zone1", + Uid: 100, + }, + Keyspace: "testkeyspace", + Shard: "-80", + }, + State: vtadminpb.Tablet_SERVING, + }, + { + Cluster: c1pb, + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "c1zone1", + Uid: 200, + }, + Keyspace: "testkeyspace", + Shard: "80-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + }, + ) + c2 := vtadmintestutil.BuildCluster( + vtadmintestutil.TestClusterConfig{ + Cluster: c2pb, + VtctldClient: &vtadmintestutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "ks2": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-": { + Keyspace: "ks2", + Name: "-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + }, + }, + }, + }, + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "ks2", + }, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "c2z1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{}, + }, + }, + }, + Tablets: []*vtadminpb.Tablet{ + { + Cluster: c2pb, + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "c2z1", + Uid: 100, + }, + Keyspace: "ks2", + Shard: "-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + }, + ) + + api := NewAPI([]*cluster.Cluster{c1, c2}, grpcserver.Options{}, http.Options{}) + schema, err := api.FindSchema(ctx, &vtadminpb.FindSchemaRequest{ + Table: "testtable", + TableSizeOptions: &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: true, + }, + }) + + expected := &vtadminpb.Schema{ + Cluster: c1pb, + Keyspace: "testkeyspace", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + }, + }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{ + "testtable": { + RowCount: 10 + 20, + DataLength: 100 + 200, + ByShard: map[string]*vtadminpb.Schema_ShardTableSize{ + "-80": { + RowCount: 10, + DataLength: 100, + }, + "80-": { + RowCount: 20, + DataLength: 200, + }, + }, + }, + }, + } + + if schema != nil { + for _, td := range schema.TableDefinitions { + // Zero these out because they're non-deterministic and also not + // relevant to the final result. + td.RowCount = 0 + td.DataLength = 0 + } + } + + assert.NoError(t, err) + assert.Equal(t, expected, schema) + }) } func TestGetClusters(t *testing.T) { @@ -986,6 +1216,7 @@ func TestGetSchema(t *testing.T) { Name: "testtable", }, }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, }, shouldErr: false, }, @@ -1148,6 +1379,160 @@ func TestGetSchema(t *testing.T) { }) }) } + + t.Run("size aggregation", func(t *testing.T) { + t.Parallel() + + c1pb := &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + } + c1 := vtadmintestutil.BuildCluster( + vtadmintestutil.TestClusterConfig{ + Cluster: c1pb, + VtctldClient: &vtadmintestutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-80": { + Keyspace: "testkeyspace", + Name: "-80", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "80-": { + Keyspace: "testkeyspace", + Name: "80-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + }, + }, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "c1zone1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + RowCount: 10, + DataLength: 100, + }, + }, + }, + }, + }, + "c1zone1-0000000200": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + RowCount: 20, + DataLength: 200, + }, + }, + }, + }, + }, + }, + }, + Tablets: []*vtadminpb.Tablet{ + { + Cluster: c1pb, + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "c1zone1", + Uid: 100, + }, + Keyspace: "testkeyspace", + Shard: "-80", + }, + State: vtadminpb.Tablet_SERVING, + }, + { + Cluster: c1pb, + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "c1zone1", + Uid: 200, + }, + Keyspace: "testkeyspace", + Shard: "80-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + }, + ) + c2 := vtadmintestutil.BuildCluster( + vtadmintestutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + }, + ) + + api := NewAPI([]*cluster.Cluster{c1, c2}, grpcserver.Options{}, http.Options{}) + schema, err := api.GetSchema(ctx, &vtadminpb.GetSchemaRequest{ + ClusterId: c1.ID, + Keyspace: "testkeyspace", + Table: "testtable", + TableSizeOptions: &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: true, + }, + }) + + expected := &vtadminpb.Schema{ + Cluster: c1pb, + Keyspace: "testkeyspace", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + }, + }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{ + "testtable": { + RowCount: 10 + 20, + DataLength: 100 + 200, + ByShard: map[string]*vtadminpb.Schema_ShardTableSize{ + "-80": { + RowCount: 10, + DataLength: 100, + }, + "80-": { + RowCount: 20, + DataLength: 200, + }, + }, + }, + }, + } + + if schema != nil { + for _, td := range schema.TableDefinitions { + // Zero these out because they're non-deterministic and also not + // relevant to the final result. + td.RowCount = 0 + td.DataLength = 0 + } + } + + assert.NoError(t, err) + assert.Equal(t, expected, schema) + }) } func TestGetSchemas(t *testing.T) { @@ -1237,6 +1622,7 @@ func TestGetSchemas(t *testing.T) { }, }, }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, }, }, }, @@ -1336,6 +1722,7 @@ func TestGetSchemas(t *testing.T) { }, }, }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, }, { Cluster: &vtadminpb.Cluster{ @@ -1359,6 +1746,7 @@ func TestGetSchemas(t *testing.T) { }, }, }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, }, }, }, @@ -1460,6 +1848,7 @@ func TestGetSchemas(t *testing.T) { }, }, }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, }, }, }, @@ -1655,6 +2044,284 @@ func TestGetSchemas(t *testing.T) { }, vtctlds...) }) } + + t.Run("size aggregation", func(t *testing.T) { + t.Parallel() + + c1pb := &vtadminpb.Cluster{ + Id: "c1", + Name: "cluster1", + } + c2pb := &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + } + + c1 := vtadmintestutil.BuildCluster( + vtadmintestutil.TestClusterConfig{ + Cluster: c1pb, + VtctldClient: &vtadmintestutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-80": { + Keyspace: "testkeyspace", + Name: "-80", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "80-": { + Keyspace: "testkeyspace", + Name: "80-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + }, + }, + }, + "ks1": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-": { + Keyspace: "ks1", + Name: "-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + }, + }, + }, + }, + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + {Name: "testkeyspace"}, + {Name: "ks1"}, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "c1zone1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + RowCount: 10, + DataLength: 100, + }, + }, + }, + }, + }, + "c1zone1-0000000200": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + RowCount: 20, + DataLength: 200, + }, + }, + }, + }, + }, + }, + }, + Tablets: []*vtadminpb.Tablet{ + { + Cluster: c1pb, + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "c1zone1", + Uid: 100, + }, + Keyspace: "testkeyspace", + Shard: "-80", + }, + State: vtadminpb.Tablet_SERVING, + }, + { + Cluster: c1pb, + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "c1zone1", + Uid: 200, + }, + Keyspace: "testkeyspace", + Shard: "80-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + }, + ) + c2 := vtadmintestutil.BuildCluster( + vtadmintestutil.TestClusterConfig{ + Cluster: c2pb, + VtctldClient: &vtadmintestutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "ks2": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-": { + Keyspace: "ks2", + Name: "-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + }, + }, + }, + }, + GetKeyspacesResults: struct { + Keyspaces []*vtctldatapb.Keyspace + Error error + }{ + Keyspaces: []*vtctldatapb.Keyspace{ + { + Name: "ks2", + }, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "c2z1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "t2", + DataLength: 5, + RowCount: 7, + }, + { + Name: "_t2_ghc", + DataLength: 5, + RowCount: 7, + }, + }, + }, + }, + }, + }, + }, + Tablets: []*vtadminpb.Tablet{ + { + Cluster: c2pb, + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "c2z1", + Uid: 100, + }, + Keyspace: "ks2", + Shard: "-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + }, + ) + + api := NewAPI([]*cluster.Cluster{c1, c2}, grpcserver.Options{}, http.Options{}) + resp, err := api.GetSchemas(ctx, &vtadminpb.GetSchemasRequest{ + TableSizeOptions: &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: true, + }, + }) + + expected := &vtadminpb.GetSchemasResponse{ + Schemas: []*vtadminpb.Schema{ + { + Cluster: c1pb, + Keyspace: "testkeyspace", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "testtable", + }, + }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{ + "testtable": { + RowCount: 10 + 20, + DataLength: 100 + 200, + ByShard: map[string]*vtadminpb.Schema_ShardTableSize{ + "-80": { + RowCount: 10, + DataLength: 100, + }, + "80-": { + RowCount: 20, + DataLength: 200, + }, + }, + }, + }, + }, + { + Cluster: c2pb, + Keyspace: "ks2", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + {Name: "t2"}, + {Name: "_t2_ghc"}, + }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{ + "t2": { + DataLength: 5, + RowCount: 7, + ByShard: map[string]*vtadminpb.Schema_ShardTableSize{ + "-": { + DataLength: 5, + RowCount: 7, + }, + }, + }, + "_t2_ghc": { + DataLength: 5, + RowCount: 7, + ByShard: map[string]*vtadminpb.Schema_ShardTableSize{ + "-": { + DataLength: 5, + RowCount: 7, + }, + }, + }, + }, + }, + }, + } + + if resp != nil { + for _, schema := range resp.Schemas { + for _, td := range schema.TableDefinitions { + // Zero these out because they're non-deterministic and also not + // relevant to the final result. + td.RowCount = 0 + td.DataLength = 0 + } + } + } + + assert.NoError(t, err) + assert.ElementsMatch(t, expected.Schemas, resp.Schemas) + }) } func TestGetTablet(t *testing.T) { diff --git a/go/vt/vtadmin/cluster/cluster.go b/go/vt/vtadmin/cluster/cluster.go index f967a144107..f70bf0e3230 100644 --- a/go/vt/vtadmin/cluster/cluster.go +++ b/go/vt/vtadmin/cluster/cluster.go @@ -20,6 +20,7 @@ import ( "context" "database/sql" "fmt" + "math/rand" "strings" "sync" "time" @@ -38,6 +39,7 @@ import ( "vitess.io/vitess/go/vt/vtadmin/vtsql" topodatapb "vitess.io/vitess/go/vt/proto/topodata" + "vitess.io/vitess/go/vt/proto/vtadmin" vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin" vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" ) @@ -204,6 +206,42 @@ func (c *Cluster) parseTablet(rows *sql.Rows) (*vtadminpb.Tablet, error) { return tablet, nil } +// FindAllShardsInKeyspaceOptions modify the behavior of a cluster's +// FindAllShardsInKeyspace method. +type FindAllShardsInKeyspaceOptions struct { + // SkipDial indicates that the cluster can assume the vtctldclient has + // already dialed up a connection to a vtctld. + SkipDial bool +} + +// FindAllShardsInKeyspace proxies a FindAllShardsInKeyspace RPC to a cluster's +// vtctld, unpacking the response struct. +// +// It can also optionally ensure the vtctldclient has a valid connection before +// making the RPC call. +func (c *Cluster) FindAllShardsInKeyspace(ctx context.Context, keyspace string, opts FindAllShardsInKeyspaceOptions) (map[string]*vtctldatapb.Shard, error) { + span, ctx := trace.NewSpan(ctx, "Cluster.FindAllShardsInKeyspace") + defer span.Finish() + + AnnotateSpan(c, span) + span.Annotate("keyspace", keyspace) + + if !opts.SkipDial { + if err := c.Vtctld.Dial(ctx); err != nil { + return nil, fmt.Errorf("failed to Dial vtctld for cluster = %s for FindAllShardsInKeyspace: %w", c.ID, err) + } + } + + resp, err := c.Vtctld.FindAllShardsInKeyspace(ctx, &vtctldatapb.FindAllShardsInKeyspaceRequest{ + Keyspace: keyspace, + }) + if err != nil { + return nil, fmt.Errorf("FindAllShardsInKeyspace(cluster = %s, keyspace = %s) failed: %w", c.ID, keyspace, err) + } + + return resp.Shards, nil +} + // FindWorkflowsOptions is the set of options for FindWorkflows requests. type FindWorkflowsOptions struct { ActiveOnly bool @@ -373,50 +411,260 @@ func (c *Cluster) getTablets(ctx context.Context) ([]*vtadminpb.Tablet, error) { return c.parseTablets(rows) } -// GetSchema returns the schema for a GetSchemaRequest on the given tablet. The -// caller is responsible for making at least one call to c.Vtctld.Dial prior to -// calling this function. +// GetSchemaOptions contains the options that modify the behavior of the +// (*Cluster).GetSchema method. +type GetSchemaOptions struct { + // Tablets is the starting set of tablets that GetSchema will filter to find + // suitable tablet(s) to make GetSchema RPC(s) to. + // + // If empty, GetSchema will first call (*Cluster).FindTablets() to fetch all + // tablets for the keyspace. + Tablets []*vtadminpb.Tablet + // BaseRequest is used to share some common parameters to use for the + // individual tablet GetSchema RPCs made by (*Cluster).GetSchema, which + // takes a copy of this request in order to makeb certain overrides as + // needed, so these mutations are transparent to the caller. + // + // The TabletAlias field is ignored completely by (*Cluster).GetSchema, as + // it is overwritten for each tablet RPC that method makes. + // + // The TableSizesOnly field is overwritten only in certain tablet RPCs when + // SizeOpts.AggregateSizes is true. In order to move minimal bytes over the + // wire, we assume that schema definitions match across all shards, so we + // can get the full schema from just one tablet, and then just the table + // size information from the other N-1 tablets. + // + // The TableNamesOnly field is untouched by (*Cluster).GetSchema when not + // doing size aggregation. However, when doing size aggregation, if + // TableNamesOnly is true, we log a warning and override it. This is because + // TableNamesOnly is mutually exclusive with TableSizesOnly, and size + // aggregation requires setting TableSizesOnly in the cases described above. + BaseRequest *vtctldatapb.GetSchemaRequest + // TableSizeOptions control whether the (*Cluster).GetSchema method performs + // cross-shard table size aggregation (via the AggregateSizes field). + // + // If the AggregateSizes field is false, the rest of this struct is ignored, + // no size aggregation is done, and (*Cluster).GetSchema will make exactly + // one GetSchema RPC to a SERVING tablet in the keyspace. + // + // If the AggregateSizes field is true, (*Cluster).GetSchema will make a + // FindAllShardsInKeyspace vtctld RPC, and then filter the given Tablets + // (described above) to find one SERVING tablet for each shard in the + // keyspace, skipping any non-serving shards in the keyspace. + TableSizeOptions *vtadminpb.GetSchemaTableSizeOptions +} + +// GetSchema returns the schema for a given keyspace. GetSchema has a few +// different behaviors depending on the GetSchemaOptions provided, as follows: +// +// (1) If opts.Tablets is empty, we will first use FindTablets to fetch all +// tablets for the keyspace, regardless of their serving state. Additional +// filtering of either this set, or the provided Tablets, will happen later. // -// Note that the request's TabletAlias field will be ignored, using the provided -// tablet's Alias instead. This override is done on a copy of the request, so it -// is transparent to the caller. +// (2) If opts.SizeOpts.AggregateSizes is true, we will also make a call to +// FindAllShardsInKeyspace, in order to fan out GetSchema RPCs to a tablet in +// each shard. If this option is false, we make exactly one GetSchema request to +// a single, randomly-chosen, tablet in the keyspace. // -// This function takes both the request argument and tablet argument to -// (a) set the Keyspace field on the resulting Schema object, which comes from -// the provided tablet; and, (b) allow a caller, like vtadmin.API to collect a -// bunch of tablets once and make a series of GetSchema calls without Cluster -// refetching the tablet list each time. -func (c *Cluster) GetSchema(ctx context.Context, req *vtctldatapb.GetSchemaRequest, tablet *vtadminpb.Tablet) (*vtadminpb.Schema, error) { +// (3) We will only make GetSchema RPCs to tablets that are in SERVING state; we +// don't want to use a tablet that might be in a bad state as the source of +// truth for a schema. Therefore if we can't find a SERVING tablet for the +// keyspace (in non-aggregation mode) or for a shard in that keyspace (in +// aggregation mode), then we will return an error back to the caller. +func (c *Cluster) GetSchema(ctx context.Context, keyspace string, opts GetSchemaOptions) (*vtadminpb.Schema, error) { span, ctx := trace.NewSpan(ctx, "Cluster.GetSchema") defer span.Finish() + if opts.TableSizeOptions == nil { + opts.TableSizeOptions = &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: false, + } + } + + if opts.BaseRequest == nil { + opts.BaseRequest = &vtctldatapb.GetSchemaRequest{} + } + + if opts.TableSizeOptions.AggregateSizes && opts.BaseRequest.TableNamesOnly { + log.Warningf("GetSchema(cluster = %s) size aggregation is incompatible with TableNamesOnly, ignoring the latter in favor of aggregating sizes", c.ID) + opts.BaseRequest.TableNamesOnly = false + } + AnnotateSpan(c, span) + span.Annotate("keyspace", keyspace) + annotateGetSchemaRequest(opts.BaseRequest, span) + vtadminproto.AnnotateSpanWithGetSchemaTableSizeOptions(opts.TableSizeOptions, span) - // Copy the request to not mutate the caller's request object. - r := *req - r.TabletAlias = tablet.Tablet.Alias + if len(opts.Tablets) == 0 { + // Fetch all tablets for the keyspace. + var err error + + opts.Tablets, err = c.FindTablets(ctx, func(tablet *vtadminpb.Tablet) bool { + return tablet.Tablet.Keyspace == keyspace + }, -1) + if err != nil { + return nil, fmt.Errorf("%w for keyspace %s", errors.ErrNoTablet, keyspace) + } + } - span.Annotate("tablet_alias", topoproto.TabletAliasString(r.TabletAlias)) - span.Annotate("exclude_tables", strings.Join(r.ExcludeTables, ",")) - span.Annotate("tables", strings.Join(r.Tables, ",")) - span.Annotate("include_views", r.IncludeViews) - span.Annotate("table_names_only", r.TableNamesOnly) - span.Annotate("table_sizes_only", r.TableSizesOnly) + if err := c.Vtctld.Dial(ctx); err != nil { + return nil, fmt.Errorf("failed to Dial vtctld for cluster = %s for GetSchema: %w", c.ID, err) + } - schema, err := c.Vtctld.GetSchema(ctx, &r) + tabletsToQuery, err := c.getTabletsToQueryForSchemas(ctx, keyspace, opts) if err != nil { return nil, err } - if schema == nil || schema.Schema == nil { - return nil, nil + return c.getSchemaFromTablets(ctx, keyspace, tabletsToQuery, opts) +} + +// Note that for this function we use the tablets parameter, ignoring the +// opts.Tablets value completely. +func (c *Cluster) getSchemaFromTablets(ctx context.Context, keyspace string, tablets []*vtadminpb.Tablet, opts GetSchemaOptions) (*vtadminpb.Schema, error) { + var ( + m sync.Mutex + wg sync.WaitGroup + rec concurrency.AllErrorRecorder + schema = &vtadminpb.Schema{ + Cluster: c.ToProto(), + Keyspace: keyspace, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, + } + // Instead of starting at false, we start with whatever the base request + // specified. If we have exactly one tablet to query (i.e. we're not + // doing multi-shard aggregation), it's possible the request was to + // literally just get the table sizes; we shouldn't assume. If we have + // more than one tablet to query, then we are doing size aggregation, + // and we'll flip this to true after spawning the first GetSchema rpc. + sizesOnly = opts.BaseRequest.TableSizesOnly + ) + + for _, tablet := range tablets { + wg.Add(1) + + go func(tablet *vtadminpb.Tablet, sizesOnly bool) { + defer wg.Done() + + span, ctx := trace.NewSpan(ctx, "Vtctld.GetSchema") + defer span.Finish() + + req := *opts.BaseRequest + req.TableSizesOnly = sizesOnly + req.TabletAlias = tablet.Tablet.Alias + + AnnotateSpan(c, span) + annotateGetSchemaRequest(&req, span) + span.Annotate("keyspace", keyspace) + span.Annotate("shard", tablet.Tablet.Shard) + + resp, err := c.Vtctld.GetSchema(ctx, &req) + if err != nil { + err = fmt.Errorf("GetSchema(cluster = %s, keyspace = %s, tablet = %s) failed: %w", c.ID, keyspace, tablet.Tablet.Alias, err) + rec.RecordError(err) + + return + } + + if resp == nil || resp.Schema == nil { + return + } + + m.Lock() + defer m.Unlock() + + if !sizesOnly { + schema.TableDefinitions = resp.Schema.TableDefinitions + } + + if !opts.TableSizeOptions.AggregateSizes { + return + } + + for _, td := range resp.Schema.TableDefinitions { + tableSize, ok := schema.TableSizes[td.Name] + if !ok { + tableSize = &vtadminpb.Schema_TableSize{ + ByShard: map[string]*vtadminpb.Schema_ShardTableSize{}, + } + schema.TableSizes[td.Name] = tableSize + } + + if _, ok = tableSize.ByShard[tablet.Tablet.Shard]; ok { + err := fmt.Errorf("duplicate shard queries for table %s on shard %s/%s", td.Name, keyspace, tablet.Tablet.Shard) + log.Warningf("Impossible: %s", err) + rec.RecordError(err) + + return + } + + tableSize.RowCount += td.RowCount + tableSize.DataLength += td.DataLength + + tableSize.ByShard[tablet.Tablet.Shard] = &vtadminpb.Schema_ShardTableSize{ + RowCount: td.RowCount, + DataLength: td.DataLength, + } + } + }(tablet, sizesOnly) + + // If we have more than one tablet to query, we definitely don't want to + // get more than the sizes twice, so invariably set this to true for + // subsequent iterations + sizesOnly = true + } + + wg.Wait() + + if rec.HasErrors() { + return nil, rec.Error() + } + + return schema, nil +} + +func (c *Cluster) getTabletsToQueryForSchemas(ctx context.Context, keyspace string, opts GetSchemaOptions) ([]*vtadminpb.Tablet, error) { + if opts.TableSizeOptions.AggregateSizes { + shards, err := c.FindAllShardsInKeyspace(ctx, keyspace, FindAllShardsInKeyspaceOptions{SkipDial: true}) + if err != nil { + return nil, err + } + + tabletsToQuery := make([]*vtadminpb.Tablet, 0, len(shards)) + + for _, shard := range shards { + if !shard.Shard.IsMasterServing { + log.Infof("%s/%s is not serving; ignoring because IncludeNonServingShards=false", keyspace, shard.Name) + continue + } + + shardTablets := vtadminproto.FilterTablets(func(tablet *vtadminpb.Tablet) bool { + return tablet.Tablet.Shard == shard.Name && tablet.State == vtadminpb.Tablet_SERVING + }, opts.Tablets, len(opts.Tablets)) + + if len(shardTablets) == 0 { + return nil, fmt.Errorf("%w for shard %s/%s", errors.ErrNoServingTablet, shard.Keyspace, shard.Name) + } + + randomServingTablet := shardTablets[rand.Intn(len(shardTablets))] + tabletsToQuery = append(tabletsToQuery, randomServingTablet) + } + + return tabletsToQuery, nil } - return &vtadminpb.Schema{ - Cluster: c.ToProto(), - Keyspace: tablet.Tablet.Keyspace, - TableDefinitions: schema.Schema.TableDefinitions, - }, nil + keyspaceTablets := vtadminproto.FilterTablets(func(tablet *vtadminpb.Tablet) bool { + return tablet.Tablet.Keyspace == keyspace && tablet.State == vtadminpb.Tablet_SERVING + }, opts.Tablets, len(opts.Tablets)) + + if len(keyspaceTablets) == 0 { + err := fmt.Errorf("%w for keyspace %s", errors.ErrNoServingTablet, keyspace) + log.Warningf("%s. Searched tablets: %v", err, vtadminproto.Tablets(opts.Tablets).AliasStringList()) + return nil, err + } + + randomServingTablet := keyspaceTablets[rand.Intn(len(keyspaceTablets))] + return []*vtadmin.Tablet{randomServingTablet}, nil } // GetVSchema returns the vschema for a given keyspace in this cluster. The @@ -568,16 +816,5 @@ func (c *Cluster) findTablets(ctx context.Context, filter func(*vtadminpb.Tablet span.Annotate("max_result_length", n) // this is a bad name; I didn't want just "n", but it's more like, "requested result length". } - results := make([]*vtadminpb.Tablet, 0, n) - for _, t := range tablets { - if len(results) >= n { - break - } - - if filter(t) { - results = append(results, t) - } - } - - return results, nil + return vtadminproto.FilterTablets(filter, tablets, n), nil } diff --git a/go/vt/vtadmin/cluster/cluster_test.go b/go/vt/vtadmin/cluster/cluster_test.go index 5133595c015..611ef3a3c82 100644 --- a/go/vt/vtadmin/cluster/cluster_test.go +++ b/go/vt/vtadmin/cluster/cluster_test.go @@ -404,6 +404,7 @@ func TestGetSchema(t *testing.T) { }, req: &vtctldatapb.GetSchemaRequest{}, tablet: &vtadminpb.Tablet{ + State: vtadminpb.Tablet_SERVING, Tablet: &topodatapb.Tablet{ Alias: &topodatapb.TabletAlias{ Cell: "zone1", @@ -423,6 +424,7 @@ func TestGetSchema(t *testing.T) { Name: "some_table", }, }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, }, shouldErr: false, }, @@ -440,6 +442,7 @@ func TestGetSchema(t *testing.T) { }, req: &vtctldatapb.GetSchemaRequest{}, tablet: &vtadminpb.Tablet{ + State: vtadminpb.Tablet_SERVING, Tablet: &topodatapb.Tablet{ Alias: &topodatapb.TabletAlias{ Cell: "zone1", @@ -468,6 +471,7 @@ func TestGetSchema(t *testing.T) { }, req: &vtctldatapb.GetSchemaRequest{}, tablet: &vtadminpb.Tablet{ + State: vtadminpb.Tablet_SERVING, Tablet: &topodatapb.Tablet{ Alias: &topodatapb.TabletAlias{ Cell: "zone1", @@ -476,7 +480,15 @@ func TestGetSchema(t *testing.T) { Keyspace: "testkeyspace", }, }, - expected: nil, + expected: &vtadminpb.Schema{ + Cluster: &vtadminpb.Cluster{ + Id: "c2", + Name: "cluster2", + }, + Keyspace: "testkeyspace", + TableDefinitions: nil, + TableSizes: map[string]*vtadminpb.Schema_TableSize{}, + }, shouldErr: false, }, } @@ -490,7 +502,7 @@ func TestGetSchema(t *testing.T) { t.Run(tt.name, func(t *testing.T) { t.Parallel() - cluster := testutil.BuildCluster(testutil.TestClusterConfig{ + c := testutil.BuildCluster(testutil.TestClusterConfig{ Cluster: &vtadminpb.Cluster{ Id: fmt.Sprintf("c%d", i), Name: fmt.Sprintf("cluster%d", i), @@ -500,10 +512,13 @@ func TestGetSchema(t *testing.T) { DBConfig: testutil.Dbcfg{}, }) - err := cluster.Vtctld.Dial(ctx) + err := c.Vtctld.Dial(ctx) require.NoError(t, err, "could not dial test vtctld") - schema, err := cluster.GetSchema(ctx, tt.req, tt.tablet) + schema, err := c.GetSchema(ctx, "testkeyspace", cluster.GetSchemaOptions{ + Tablets: []*vtadminpb.Tablet{tt.tablet}, + BaseRequest: tt.req, + }) if tt.shouldErr { assert.Error(t, err) @@ -544,7 +559,7 @@ func TestGetSchema(t *testing.T) { }, } - cluster := testutil.BuildCluster(testutil.TestClusterConfig{ + c := testutil.BuildCluster(testutil.TestClusterConfig{ Cluster: &vtadminpb.Cluster{ Id: "c0", Name: "cluster0", @@ -552,13 +567,630 @@ func TestGetSchema(t *testing.T) { VtctldClient: vtctld, }) - err := cluster.Vtctld.Dial(ctx) + err := c.Vtctld.Dial(ctx) require.NoError(t, err, "could not dial test vtctld") - cluster.GetSchema(ctx, req, tablet) + c.GetSchema(ctx, "testkeyspace", cluster.GetSchemaOptions{ + BaseRequest: req, + Tablets: []*vtadminpb.Tablet{tablet}, + }) assert.NotEqual(t, req.TabletAlias, tablet.Tablet.Alias, "expected GetSchema to not modify original request object") }) + + t.Run("size aggregation", func(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + cfg testutil.TestClusterConfig + keyspace string + opts cluster.GetSchemaOptions + expected *vtadminpb.Schema + shouldErr bool + }{ + { + name: "success", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c0", + Name: "cluster0", + }, + Tablets: []*vtadminpb.Tablet{ + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 100, + }, + Keyspace: "testkeyspace", + Shard: "-80", + }, + State: vtadminpb.Tablet_SERVING, + }, + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 200, + }, + Keyspace: "testkeyspace", + Shard: "80-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + VtctldClient: &testutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-80": { + Name: "-80", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "80-": { + Name: "80-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "-": { + Name: "-", + Shard: &topodatapb.Shard{ + IsMasterServing: false, + }, + }, + }, + }, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "zone1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 100, + RowCount: 5, + }, + }, + }, + }, + }, + "zone1-0000000200": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 200, + RowCount: 420, + }, + }, + }, + }, + }, + }, + }, + }, + keyspace: "testkeyspace", + opts: cluster.GetSchemaOptions{ + TableSizeOptions: &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: true, + }, + }, + expected: &vtadminpb.Schema{ + Cluster: &vtadminpb.Cluster{ + Id: "c0", + Name: "cluster0", + }, + Keyspace: "testkeyspace", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 0, + RowCount: 0, + }, + }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{ + "foo": { + DataLength: 100 + 200, + RowCount: 5 + 420, + ByShard: map[string]*vtadminpb.Schema_ShardTableSize{ + "-80": { + DataLength: 100, + RowCount: 5, + }, + "80-": { + DataLength: 200, + RowCount: 420, + }, + }, + }, + }, + }, + shouldErr: false, + }, + { + name: "no serving tablets found for shard", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c0", + Name: "cluster0", + }, + Tablets: []*vtadminpb.Tablet{ + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 100, + }, + Keyspace: "testkeyspace", + Shard: "-80", + }, + State: vtadminpb.Tablet_NOT_SERVING, + }, + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 200, + }, + Keyspace: "testkeyspace", + Shard: "80-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + VtctldClient: &testutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-80": { + Name: "-80", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "80-": { + Name: "80-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "-": { + Name: "-", + Shard: &topodatapb.Shard{ + IsMasterServing: false, + }, + }, + }, + }, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "zone1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 100, + RowCount: 5, + }, + }, + }, + }, + }, + "zone1-0000000200": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 200, + RowCount: 420, + }, + }, + }, + }, + }, + }, + }, + }, + keyspace: "testkeyspace", + opts: cluster.GetSchemaOptions{ + TableSizeOptions: &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: true, + }, + }, + expected: nil, + shouldErr: true, + }, + { + name: "ignore TableNamesOnly", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c0", + Name: "cluster0", + }, + Tablets: []*vtadminpb.Tablet{ + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 100, + }, + Keyspace: "testkeyspace", + Shard: "-80", + }, + State: vtadminpb.Tablet_SERVING, + }, + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 200, + }, + Keyspace: "testkeyspace", + Shard: "80-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + VtctldClient: &testutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-80": { + Name: "-80", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "80-": { + Name: "80-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "-": { + Name: "-", + Shard: &topodatapb.Shard{ + IsMasterServing: false, + }, + }, + }, + }, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "zone1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 100, + RowCount: 5, + }, + }, + }, + }, + }, + "zone1-0000000200": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 200, + RowCount: 420, + }, + }, + }, + }, + }, + }, + }, + }, + keyspace: "testkeyspace", + opts: cluster.GetSchemaOptions{ + BaseRequest: &vtctldatapb.GetSchemaRequest{ + TableNamesOnly: true, // Just checking things to blow up if this gets set. + }, + TableSizeOptions: &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: true, + }, + }, + expected: &vtadminpb.Schema{ + Cluster: &vtadminpb.Cluster{ + Id: "c0", + Name: "cluster0", + }, + Keyspace: "testkeyspace", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 0, + RowCount: 0, + }, + }, + TableSizes: map[string]*vtadminpb.Schema_TableSize{ + "foo": { + DataLength: 100 + 200, + RowCount: 5 + 420, + ByShard: map[string]*vtadminpb.Schema_ShardTableSize{ + "-80": { + DataLength: 100, + RowCount: 5, + }, + "80-": { + DataLength: 200, + RowCount: 420, + }, + }, + }, + }, + }, + shouldErr: false, + }, + { + name: "single GetSchema error fails the request", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c0", + Name: "cluster0", + }, + Tablets: []*vtadminpb.Tablet{ + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 100, + }, + Keyspace: "testkeyspace", + Shard: "-80", + }, + State: vtadminpb.Tablet_SERVING, + }, + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 200, + }, + Keyspace: "testkeyspace", + Shard: "80-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + VtctldClient: &testutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "testkeyspace": { + Response: &vtctldatapb.FindAllShardsInKeyspaceResponse{ + Shards: map[string]*vtctldatapb.Shard{ + "-80": { + Name: "-80", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "80-": { + Name: "80-", + Shard: &topodatapb.Shard{ + IsMasterServing: true, + }, + }, + "-": { + Name: "-", + Shard: &topodatapb.Shard{ + IsMasterServing: false, + }, + }, + }, + }, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "zone1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 100, + RowCount: 5, + }, + }, + }, + }, + }, + "zone1-0000000200": { + Error: assert.AnError, + }, + }, + }, + }, + keyspace: "testkeyspace", + opts: cluster.GetSchemaOptions{ + TableSizeOptions: &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: true, + }, + }, + expected: nil, + shouldErr: true, + }, + { + name: "FindAllShardsInKeyspace error", + cfg: testutil.TestClusterConfig{ + Cluster: &vtadminpb.Cluster{ + Id: "c0", + Name: "cluster0", + }, + Tablets: []*vtadminpb.Tablet{ + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 100, + }, + Keyspace: "testkeyspace", + Shard: "-80", + }, + State: vtadminpb.Tablet_SERVING, + }, + { + Tablet: &topodatapb.Tablet{ + Alias: &topodatapb.TabletAlias{ + Cell: "zone1", + Uid: 200, + }, + Keyspace: "testkeyspace", + Shard: "80-", + }, + State: vtadminpb.Tablet_SERVING, + }, + }, + VtctldClient: &testutil.VtctldClient{ + FindAllShardsInKeyspaceResults: map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + }{ + "testkeyspace": { + Error: assert.AnError, + }, + }, + GetSchemaResults: map[string]struct { + Response *vtctldatapb.GetSchemaResponse + Error error + }{ + "zone1-0000000100": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 100, + RowCount: 5, + }, + }, + }, + }, + }, + "zone1-0000000200": { + Response: &vtctldatapb.GetSchemaResponse{ + Schema: &tabletmanagerdatapb.SchemaDefinition{ + DatabaseSchema: "CREATE DATABASE vt_testkeyspcae", + TableDefinitions: []*tabletmanagerdatapb.TableDefinition{ + { + Name: "foo", + Schema: "CREATE TABLE foo (\n\tid INT(11) NOT NULL\n) ENGINE=InnoDB", + DataLength: 200, + RowCount: 420, + }, + }, + }, + }, + }, + }, + }, + }, + keyspace: "testkeyspace", + opts: cluster.GetSchemaOptions{ + TableSizeOptions: &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: true, + }, + }, + expected: nil, + shouldErr: true, + }, + } + + for _, tt := range tests { + tt := tt + + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + if tt.keyspace == "" { + t.SkipNow() + } + + c := testutil.BuildCluster(tt.cfg) + schema, err := c.GetSchema(ctx, tt.keyspace, tt.opts) + if tt.shouldErr { + assert.Error(t, err) + + return + } + + if schema.TableDefinitions != nil { + // For simplicity, we're going to assert only on the state + // of the aggregated sizes (in schema.TableSizes), since the + // TableDefinitions size values depends on tablet iteration + // order, and that's not something we're interested in + // coupling the implementation to. + for _, td := range schema.TableDefinitions { + td.DataLength = 0 + td.RowCount = 0 + } + } + + assert.NoError(t, err) + testutil.AssertSchemaSlicesEqual(t, []*vtadminpb.Schema{tt.expected}, []*vtadminpb.Schema{schema}) + }) + } + }) } func TestFindWorkflows(t *testing.T) { diff --git a/go/vt/vtadmin/cluster/trace.go b/go/vt/vtadmin/cluster/trace.go index 9a5f8979b9a..06b16761c3c 100644 --- a/go/vt/vtadmin/cluster/trace.go +++ b/go/vt/vtadmin/cluster/trace.go @@ -17,8 +17,13 @@ limitations under the License. package cluster import ( + "strings" + "vitess.io/vitess/go/trace" + "vitess.io/vitess/go/vt/topo/topoproto" "vitess.io/vitess/go/vt/vtadmin/vtadminproto" + + vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" ) // AnnotateSpan adds the cluster_id and cluster_name to a span. @@ -27,3 +32,16 @@ func AnnotateSpan(c *Cluster, span trace.Span) { // (TODO:@ajm188) add support for discovery impls to add annotations to a // span, like `discovery_impl` and any parameters that might be relevant. } + +// (TODO: @ajm188) perhaps we want a ./go/vt/vtctl/vtctlproto package for this? +func annotateGetSchemaRequest(req *vtctldatapb.GetSchemaRequest, span trace.Span) { + if req.TabletAlias != nil { + span.Annotate("tablet_alias", topoproto.TabletAliasString(req.TabletAlias)) + } + + span.Annotate("exclude_tables", strings.Join(req.ExcludeTables, ",")) + span.Annotate("tables", strings.Join(req.Tables, ",")) + span.Annotate("include_views", req.IncludeViews) + span.Annotate("table_names_only", req.TableNamesOnly) + span.Annotate("table_sizes_only", req.TableSizesOnly) +} diff --git a/go/vt/vtadmin/errors/errors.go b/go/vt/vtadmin/errors/errors.go index 8a6a1f088e0..58c9cb104dd 100644 --- a/go/vt/vtadmin/errors/errors.go +++ b/go/vt/vtadmin/errors/errors.go @@ -16,7 +16,10 @@ limitations under the License. package errors -import "errors" +import ( + "errors" + "fmt" +) var ( // ErrAmbiguousSchema occurs when more than one schema is found for a given @@ -35,6 +38,10 @@ var ( // ErrNoSchema occurs when a schema definition cannot be found for a given // set of filter criteria. ErrNoSchema = errors.New("no such schema") + // ErrNoServingTablet occurs when a tablet with state SERVING cannot be + // found for a given set of filter criteria. It is a more specific form of + // ErrNoTablet + ErrNoServingTablet = fmt.Errorf("%w with state=SERVING", ErrNoTablet) // ErrNoSrvVSchema occurs when no SrvVSchema is found for a given keyspace. ErrNoSrvVSchema = errors.New("SrvVSchema not found") // ErrNoTablet occurs when a tablet cannot be found for a given set of diff --git a/go/vt/vtadmin/http/schemas.go b/go/vt/vtadmin/http/schemas.go index a3af0da275b..d309b5411c4 100644 --- a/go/vt/vtadmin/http/schemas.go +++ b/go/vt/vtadmin/http/schemas.go @@ -28,9 +28,15 @@ func FindSchema(ctx context.Context, r Request, api *API) *JSONResponse { vars := r.Vars() query := r.URL.Query() + sizeOpts, err := getTableSizeOpts(r) + if err != nil { + return NewJSONResponse(nil, err) + } + schema, err := api.server.FindSchema(ctx, &vtadminpb.FindSchemaRequest{ - Table: vars["table"], - ClusterIds: query["cluster"], + Table: vars["table"], + ClusterIds: query["cluster"], + TableSizeOptions: sizeOpts, }) return NewJSONResponse(schema, err) @@ -41,10 +47,16 @@ func FindSchema(ctx context.Context, r Request, api *API) *JSONResponse { func GetSchema(ctx context.Context, r Request, api *API) *JSONResponse { vars := r.Vars() + sizeOpts, err := getTableSizeOpts(r) + if err != nil { + return NewJSONResponse(nil, err) + } + schema, err := api.server.GetSchema(ctx, &vtadminpb.GetSchemaRequest{ - ClusterId: vars["cluster_id"], - Keyspace: vars["keyspace"], - Table: vars["table"], + ClusterId: vars["cluster_id"], + Keyspace: vars["keyspace"], + Table: vars["table"], + TableSizeOptions: sizeOpts, }) return NewJSONResponse(schema, err) @@ -53,9 +65,26 @@ func GetSchema(ctx context.Context, r Request, api *API) *JSONResponse { // GetSchemas implements the http wrapper for the /schemas[?cluster=[&cluster=] // route. func GetSchemas(ctx context.Context, r Request, api *API) *JSONResponse { + sizeOpts, err := getTableSizeOpts(r) + if err != nil { + return NewJSONResponse(nil, err) + } + schemas, err := api.server.GetSchemas(ctx, &vtadminpb.GetSchemasRequest{ - ClusterIds: r.URL.Query()["cluster"], + ClusterIds: r.URL.Query()["cluster"], + TableSizeOptions: sizeOpts, }) return NewJSONResponse(schemas, err) } + +func getTableSizeOpts(r Request) (*vtadminpb.GetSchemaTableSizeOptions, error) { + aggregateSizes, err := r.ParseQueryParamAsBool("aggregate_sizes", true) + if err != nil { + return nil, err + } + + return &vtadminpb.GetSchemaTableSizeOptions{ + AggregateSizes: aggregateSizes, + }, nil +} diff --git a/go/vt/vtadmin/testutil/vtctldclient.go b/go/vt/vtadmin/testutil/vtctldclient.go index b38eea5b83f..e1168678921 100644 --- a/go/vt/vtadmin/testutil/vtctldclient.go +++ b/go/vt/vtadmin/testutil/vtctldclient.go @@ -34,6 +34,10 @@ import ( type VtctldClient struct { vtctldclient.VtctldClient + FindAllShardsInKeyspaceResults map[string]struct { + Response *vtctldatapb.FindAllShardsInKeyspaceResponse + Error error + } GetKeyspacesResults struct { Keyspaces []*vtctldatapb.Keyspace Error error @@ -56,6 +60,19 @@ type VtctldClient struct { // incorrectly. var _ vtctldclient.VtctldClient = (*VtctldClient)(nil) +// FindAllShardsInKeyspace is part of the vtctldclient.VtctldClient interface. +func (fake *VtctldClient) FindAllShardsInKeyspace(ctx context.Context, req *vtctldatapb.FindAllShardsInKeyspaceRequest, opts ...grpc.CallOption) (*vtctldatapb.FindAllShardsInKeyspaceResponse, error) { + if fake.FindAllShardsInKeyspaceResults == nil { + return nil, fmt.Errorf("%w: FindAllShardsInKeyspaceResults not set on fake vtctldclient", assert.AnError) + } + + if result, ok := fake.FindAllShardsInKeyspaceResults[req.Keyspace]; ok { + return result.Response, result.Error + } + + return nil, fmt.Errorf("%w: no result set for keyspace %s", assert.AnError, req.Keyspace) +} + // GetKeyspaces is part of the vtctldclient.VtctldClient interface. func (fake *VtctldClient) GetKeyspaces(ctx context.Context, req *vtctldatapb.GetKeyspacesRequest, opts ...grpc.CallOption) (*vtctldatapb.GetKeyspacesResponse, error) { if fake.GetKeyspacesResults.Error != nil { diff --git a/go/vt/vtadmin/vtadminproto/tablet.go b/go/vt/vtadmin/vtadminproto/tablet.go index a37aa2579b9..12af6cf2edb 100644 --- a/go/vt/vtadmin/vtadminproto/tablet.go +++ b/go/vt/vtadmin/vtadminproto/tablet.go @@ -16,7 +16,50 @@ limitations under the License. package vtadminproto -import vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin" +import ( + "vitess.io/vitess/go/vt/topo/topoproto" + + vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin" +) + +// Tablets is a list of Tablet protobuf objects. +type Tablets []*vtadminpb.Tablet + +// AliasStringList returns a list of TabletAlias strings for each tablet in the +// list. +func (tablets Tablets) AliasStringList() []string { + aliases := make([]string, len(tablets)) + + for i, tablet := range tablets { + aliases[i] = topoproto.TabletAliasString(tablet.Tablet.Alias) + } + + return aliases +} + +// FilterTablets returns a subset of tablets (not exceeding maxResults) that +// satisfy the given condition. +// +// If maxResults is negative, len(tablets) is used instead. +func FilterTablets(condition func(tablet *vtadminpb.Tablet) bool, tablets []*vtadminpb.Tablet, maxResults int) []*vtadminpb.Tablet { + if maxResults < 0 { + maxResults = len(tablets) + } + + results := make([]*vtadminpb.Tablet, 0, maxResults) + + for _, tablet := range tablets { + if len(results) >= maxResults { + break + } + + if condition(tablet) { + results = append(results, tablet) + } + } + + return results +} // ParseTabletServingState returns a ServingState value from the given string. // If the string does not map to a valid value, this function returns UNKNOWN. diff --git a/go/vt/vtadmin/vtadminproto/trace.go b/go/vt/vtadmin/vtadminproto/trace.go index 6abcff02cf1..7110dd95d0c 100644 --- a/go/vt/vtadmin/vtadminproto/trace.go +++ b/go/vt/vtadmin/vtadminproto/trace.go @@ -27,3 +27,13 @@ func AnnotateClusterSpan(c *vtadminpb.Cluster, span trace.Span) { span.Annotate("cluster_id", c.Id) span.Annotate("cluster_name", c.Name) } + +// AnnotateSpanWithGetSchemaTableSizeOptions adds the aggregate_table_sizes to a +// span. It is a noop if the size options object is nil. +func AnnotateSpanWithGetSchemaTableSizeOptions(opts *vtadminpb.GetSchemaTableSizeOptions, span trace.Span) { + if opts == nil { + opts = &vtadminpb.GetSchemaTableSizeOptions{} + } + + span.Annotate("aggregate_table_sizes", opts.AggregateSizes) +} diff --git a/proto/vtadmin.proto b/proto/vtadmin.proto index 456ea8bcc6f..3b8ee1a9112 100644 --- a/proto/vtadmin.proto +++ b/proto/vtadmin.proto @@ -96,6 +96,21 @@ message Schema { string keyspace = 2; repeated tabletmanagerdata.TableDefinition table_definitions = 3; + // TableSizes is a mapping of table name to TableSize information. + map table_sizes = 4; + + message ShardTableSize { + uint64 row_count = 1; + uint64 data_length = 2; + } + + // TableSize aggregates table size information across all shards containing + // in the given keyspace and cluster, as well as per-shard size information. + message TableSize { + uint64 row_count = 1; + uint64 data_length = 2; + map by_shard = 3; + } } // Tablet groups the topo information of a tablet together with the Vitess @@ -154,6 +169,7 @@ message Workflow { message FindSchemaRequest { string table = 1; repeated string cluster_ids = 2; + GetSchemaTableSizeOptions table_size_options = 3; } message GetClustersRequest {} @@ -182,16 +198,22 @@ message GetSchemaRequest { string cluster_id = 1; string keyspace = 2; string table = 3; + GetSchemaTableSizeOptions table_size_options = 4; } message GetSchemasRequest { repeated string cluster_ids = 1; + GetSchemaTableSizeOptions table_size_options = 2; } message GetSchemasResponse { repeated Schema schemas = 1; } +message GetSchemaTableSizeOptions { + bool aggregate_sizes = 1; +} + message GetTabletRequest { string hostname = 1; // ClusterIDs is an optional parameter to narrow the scope of the search, if diff --git a/web/vtadmin/src/proto/vtadmin.d.ts b/web/vtadmin/src/proto/vtadmin.d.ts index 0a27f81915d..3c00acfff26 100644 --- a/web/vtadmin/src/proto/vtadmin.d.ts +++ b/web/vtadmin/src/proto/vtadmin.d.ts @@ -604,6 +604,9 @@ export namespace vtadmin { /** Schema table_definitions */ table_definitions?: (tabletmanagerdata.ITableDefinition[]|null); + + /** Schema table_sizes */ + table_sizes?: ({ [k: string]: vtadmin.Schema.ITableSize }|null); } /** Represents a Schema. */ @@ -624,6 +627,9 @@ export namespace vtadmin { /** Schema table_definitions. */ public table_definitions: tabletmanagerdata.ITableDefinition[]; + /** Schema table_sizes. */ + public table_sizes: { [k: string]: vtadmin.Schema.ITableSize }; + /** * Creates a new Schema instance using the specified properties. * @param [properties] Properties to set @@ -695,6 +701,207 @@ export namespace vtadmin { public toJSON(): { [k: string]: any }; } + namespace Schema { + + /** Properties of a ShardTableSize. */ + interface IShardTableSize { + + /** ShardTableSize row_count */ + row_count?: (number|Long|null); + + /** ShardTableSize data_length */ + data_length?: (number|Long|null); + } + + /** Represents a ShardTableSize. */ + class ShardTableSize implements IShardTableSize { + + /** + * Constructs a new ShardTableSize. + * @param [properties] Properties to set + */ + constructor(properties?: vtadmin.Schema.IShardTableSize); + + /** ShardTableSize row_count. */ + public row_count: (number|Long); + + /** ShardTableSize data_length. */ + public data_length: (number|Long); + + /** + * Creates a new ShardTableSize instance using the specified properties. + * @param [properties] Properties to set + * @returns ShardTableSize instance + */ + public static create(properties?: vtadmin.Schema.IShardTableSize): vtadmin.Schema.ShardTableSize; + + /** + * Encodes the specified ShardTableSize message. Does not implicitly {@link vtadmin.Schema.ShardTableSize.verify|verify} messages. + * @param message ShardTableSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtadmin.Schema.IShardTableSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShardTableSize message, length delimited. Does not implicitly {@link vtadmin.Schema.ShardTableSize.verify|verify} messages. + * @param message ShardTableSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtadmin.Schema.IShardTableSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShardTableSize message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShardTableSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtadmin.Schema.ShardTableSize; + + /** + * Decodes a ShardTableSize message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShardTableSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtadmin.Schema.ShardTableSize; + + /** + * Verifies a ShardTableSize message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ShardTableSize message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShardTableSize + */ + public static fromObject(object: { [k: string]: any }): vtadmin.Schema.ShardTableSize; + + /** + * Creates a plain object from a ShardTableSize message. Also converts values to other types if specified. + * @param message ShardTableSize + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtadmin.Schema.ShardTableSize, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShardTableSize to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TableSize. */ + interface ITableSize { + + /** TableSize row_count */ + row_count?: (number|Long|null); + + /** TableSize data_length */ + data_length?: (number|Long|null); + + /** TableSize by_shard */ + by_shard?: ({ [k: string]: vtadmin.Schema.IShardTableSize }|null); + } + + /** Represents a TableSize. */ + class TableSize implements ITableSize { + + /** + * Constructs a new TableSize. + * @param [properties] Properties to set + */ + constructor(properties?: vtadmin.Schema.ITableSize); + + /** TableSize row_count. */ + public row_count: (number|Long); + + /** TableSize data_length. */ + public data_length: (number|Long); + + /** TableSize by_shard. */ + public by_shard: { [k: string]: vtadmin.Schema.IShardTableSize }; + + /** + * Creates a new TableSize instance using the specified properties. + * @param [properties] Properties to set + * @returns TableSize instance + */ + public static create(properties?: vtadmin.Schema.ITableSize): vtadmin.Schema.TableSize; + + /** + * Encodes the specified TableSize message. Does not implicitly {@link vtadmin.Schema.TableSize.verify|verify} messages. + * @param message TableSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtadmin.Schema.ITableSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableSize message, length delimited. Does not implicitly {@link vtadmin.Schema.TableSize.verify|verify} messages. + * @param message TableSize message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtadmin.Schema.ITableSize, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableSize message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtadmin.Schema.TableSize; + + /** + * Decodes a TableSize message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtadmin.Schema.TableSize; + + /** + * Verifies a TableSize message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableSize message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableSize + */ + public static fromObject(object: { [k: string]: any }): vtadmin.Schema.TableSize; + + /** + * Creates a plain object from a TableSize message. Also converts values to other types if specified. + * @param message TableSize + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtadmin.Schema.TableSize, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableSize to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + /** Properties of a Tablet. */ interface ITablet { @@ -1229,6 +1436,9 @@ export namespace vtadmin { /** FindSchemaRequest cluster_ids */ cluster_ids?: (string[]|null); + + /** FindSchemaRequest table_size_options */ + table_size_options?: (vtadmin.IGetSchemaTableSizeOptions|null); } /** Represents a FindSchemaRequest. */ @@ -1246,6 +1456,9 @@ export namespace vtadmin { /** FindSchemaRequest cluster_ids. */ public cluster_ids: string[]; + /** FindSchemaRequest table_size_options. */ + public table_size_options?: (vtadmin.IGetSchemaTableSizeOptions|null); + /** * Creates a new FindSchemaRequest instance using the specified properties. * @param [properties] Properties to set @@ -1862,6 +2075,9 @@ export namespace vtadmin { /** GetSchemaRequest table */ table?: (string|null); + + /** GetSchemaRequest table_size_options */ + table_size_options?: (vtadmin.IGetSchemaTableSizeOptions|null); } /** Represents a GetSchemaRequest. */ @@ -1882,6 +2098,9 @@ export namespace vtadmin { /** GetSchemaRequest table. */ public table: string; + /** GetSchemaRequest table_size_options. */ + public table_size_options?: (vtadmin.IGetSchemaTableSizeOptions|null); + /** * Creates a new GetSchemaRequest instance using the specified properties. * @param [properties] Properties to set @@ -1958,6 +2177,9 @@ export namespace vtadmin { /** GetSchemasRequest cluster_ids */ cluster_ids?: (string[]|null); + + /** GetSchemasRequest table_size_options */ + table_size_options?: (vtadmin.IGetSchemaTableSizeOptions|null); } /** Represents a GetSchemasRequest. */ @@ -1972,6 +2194,9 @@ export namespace vtadmin { /** GetSchemasRequest cluster_ids. */ public cluster_ids: string[]; + /** GetSchemasRequest table_size_options. */ + public table_size_options?: (vtadmin.IGetSchemaTableSizeOptions|null); + /** * Creates a new GetSchemasRequest instance using the specified properties. * @param [properties] Properties to set @@ -2133,6 +2358,96 @@ export namespace vtadmin { public toJSON(): { [k: string]: any }; } + /** Properties of a GetSchemaTableSizeOptions. */ + interface IGetSchemaTableSizeOptions { + + /** GetSchemaTableSizeOptions aggregate_sizes */ + aggregate_sizes?: (boolean|null); + } + + /** Represents a GetSchemaTableSizeOptions. */ + class GetSchemaTableSizeOptions implements IGetSchemaTableSizeOptions { + + /** + * Constructs a new GetSchemaTableSizeOptions. + * @param [properties] Properties to set + */ + constructor(properties?: vtadmin.IGetSchemaTableSizeOptions); + + /** GetSchemaTableSizeOptions aggregate_sizes. */ + public aggregate_sizes: boolean; + + /** + * Creates a new GetSchemaTableSizeOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSchemaTableSizeOptions instance + */ + public static create(properties?: vtadmin.IGetSchemaTableSizeOptions): vtadmin.GetSchemaTableSizeOptions; + + /** + * Encodes the specified GetSchemaTableSizeOptions message. Does not implicitly {@link vtadmin.GetSchemaTableSizeOptions.verify|verify} messages. + * @param message GetSchemaTableSizeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtadmin.IGetSchemaTableSizeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSchemaTableSizeOptions message, length delimited. Does not implicitly {@link vtadmin.GetSchemaTableSizeOptions.verify|verify} messages. + * @param message GetSchemaTableSizeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtadmin.IGetSchemaTableSizeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSchemaTableSizeOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSchemaTableSizeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtadmin.GetSchemaTableSizeOptions; + + /** + * Decodes a GetSchemaTableSizeOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSchemaTableSizeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtadmin.GetSchemaTableSizeOptions; + + /** + * Verifies a GetSchemaTableSizeOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetSchemaTableSizeOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSchemaTableSizeOptions + */ + public static fromObject(object: { [k: string]: any }): vtadmin.GetSchemaTableSizeOptions; + + /** + * Creates a plain object from a GetSchemaTableSizeOptions message. Also converts values to other types if specified. + * @param message GetSchemaTableSizeOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtadmin.GetSchemaTableSizeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSchemaTableSizeOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a GetTabletRequest. */ interface IGetTabletRequest { diff --git a/web/vtadmin/src/proto/vtadmin.js b/web/vtadmin/src/proto/vtadmin.js index 615793e2de1..6755f20f513 100644 --- a/web/vtadmin/src/proto/vtadmin.js +++ b/web/vtadmin/src/proto/vtadmin.js @@ -1233,6 +1233,7 @@ $root.vtadmin = (function() { * @property {vtadmin.ICluster|null} [cluster] Schema cluster * @property {string|null} [keyspace] Schema keyspace * @property {Array.|null} [table_definitions] Schema table_definitions + * @property {Object.|null} [table_sizes] Schema table_sizes */ /** @@ -1245,6 +1246,7 @@ $root.vtadmin = (function() { */ function Schema(properties) { this.table_definitions = []; + this.table_sizes = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1275,6 +1277,14 @@ $root.vtadmin = (function() { */ Schema.prototype.table_definitions = $util.emptyArray; + /** + * Schema table_sizes. + * @member {Object.} table_sizes + * @memberof vtadmin.Schema + * @instance + */ + Schema.prototype.table_sizes = $util.emptyObject; + /** * Creates a new Schema instance using the specified properties. * @function create @@ -1306,6 +1316,11 @@ $root.vtadmin = (function() { if (message.table_definitions != null && message.table_definitions.length) for (var i = 0; i < message.table_definitions.length; ++i) $root.tabletmanagerdata.TableDefinition.encode(message.table_definitions[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.table_sizes != null && Object.hasOwnProperty.call(message, "table_sizes")) + for (var keys = Object.keys(message.table_sizes), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.vtadmin.Schema.TableSize.encode(message.table_sizes[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } return writer; }; @@ -1336,7 +1351,7 @@ $root.vtadmin = (function() { Schema.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.Schema(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.Schema(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -1351,6 +1366,28 @@ $root.vtadmin = (function() { message.table_definitions = []; message.table_definitions.push($root.tabletmanagerdata.TableDefinition.decode(reader, reader.uint32())); break; + case 4: + if (message.table_sizes === $util.emptyObject) + message.table_sizes = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.vtadmin.Schema.TableSize.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.table_sizes[key] = value; + break; default: reader.skipType(tag & 7); break; @@ -1403,6 +1440,16 @@ $root.vtadmin = (function() { return "table_definitions." + error; } } + if (message.table_sizes != null && message.hasOwnProperty("table_sizes")) { + if (!$util.isObject(message.table_sizes)) + return "table_sizes: object expected"; + var key = Object.keys(message.table_sizes); + for (var i = 0; i < key.length; ++i) { + var error = $root.vtadmin.Schema.TableSize.verify(message.table_sizes[key[i]]); + if (error) + return "table_sizes." + error; + } + } return null; }; @@ -1435,6 +1482,16 @@ $root.vtadmin = (function() { message.table_definitions[i] = $root.tabletmanagerdata.TableDefinition.fromObject(object.table_definitions[i]); } } + if (object.table_sizes) { + if (typeof object.table_sizes !== "object") + throw TypeError(".vtadmin.Schema.table_sizes: object expected"); + message.table_sizes = {}; + for (var keys = Object.keys(object.table_sizes), i = 0; i < keys.length; ++i) { + if (typeof object.table_sizes[keys[i]] !== "object") + throw TypeError(".vtadmin.Schema.table_sizes: object expected"); + message.table_sizes[keys[i]] = $root.vtadmin.Schema.TableSize.fromObject(object.table_sizes[keys[i]]); + } + } return message; }; @@ -1453,6 +1510,8 @@ $root.vtadmin = (function() { var object = {}; if (options.arrays || options.defaults) object.table_definitions = []; + if (options.objects || options.defaults) + object.table_sizes = {}; if (options.defaults) { object.cluster = null; object.keyspace = ""; @@ -1466,6 +1525,12 @@ $root.vtadmin = (function() { for (var j = 0; j < message.table_definitions.length; ++j) object.table_definitions[j] = $root.tabletmanagerdata.TableDefinition.toObject(message.table_definitions[j], options); } + var keys2; + if (message.table_sizes && (keys2 = Object.keys(message.table_sizes)).length) { + object.table_sizes = {}; + for (var j = 0; j < keys2.length; ++j) + object.table_sizes[keys2[j]] = $root.vtadmin.Schema.TableSize.toObject(message.table_sizes[keys2[j]], options); + } return object; }; @@ -1480,6 +1545,547 @@ $root.vtadmin = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + Schema.ShardTableSize = (function() { + + /** + * Properties of a ShardTableSize. + * @memberof vtadmin.Schema + * @interface IShardTableSize + * @property {number|Long|null} [row_count] ShardTableSize row_count + * @property {number|Long|null} [data_length] ShardTableSize data_length + */ + + /** + * Constructs a new ShardTableSize. + * @memberof vtadmin.Schema + * @classdesc Represents a ShardTableSize. + * @implements IShardTableSize + * @constructor + * @param {vtadmin.Schema.IShardTableSize=} [properties] Properties to set + */ + function ShardTableSize(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ShardTableSize row_count. + * @member {number|Long} row_count + * @memberof vtadmin.Schema.ShardTableSize + * @instance + */ + ShardTableSize.prototype.row_count = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ShardTableSize data_length. + * @member {number|Long} data_length + * @memberof vtadmin.Schema.ShardTableSize + * @instance + */ + ShardTableSize.prototype.data_length = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new ShardTableSize instance using the specified properties. + * @function create + * @memberof vtadmin.Schema.ShardTableSize + * @static + * @param {vtadmin.Schema.IShardTableSize=} [properties] Properties to set + * @returns {vtadmin.Schema.ShardTableSize} ShardTableSize instance + */ + ShardTableSize.create = function create(properties) { + return new ShardTableSize(properties); + }; + + /** + * Encodes the specified ShardTableSize message. Does not implicitly {@link vtadmin.Schema.ShardTableSize.verify|verify} messages. + * @function encode + * @memberof vtadmin.Schema.ShardTableSize + * @static + * @param {vtadmin.Schema.IShardTableSize} message ShardTableSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardTableSize.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.row_count != null && Object.hasOwnProperty.call(message, "row_count")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.row_count); + if (message.data_length != null && Object.hasOwnProperty.call(message, "data_length")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.data_length); + return writer; + }; + + /** + * Encodes the specified ShardTableSize message, length delimited. Does not implicitly {@link vtadmin.Schema.ShardTableSize.verify|verify} messages. + * @function encodeDelimited + * @memberof vtadmin.Schema.ShardTableSize + * @static + * @param {vtadmin.Schema.IShardTableSize} message ShardTableSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardTableSize.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShardTableSize message from the specified reader or buffer. + * @function decode + * @memberof vtadmin.Schema.ShardTableSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtadmin.Schema.ShardTableSize} ShardTableSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardTableSize.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.Schema.ShardTableSize(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.row_count = reader.uint64(); + break; + case 2: + message.data_length = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShardTableSize message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtadmin.Schema.ShardTableSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtadmin.Schema.ShardTableSize} ShardTableSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardTableSize.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShardTableSize message. + * @function verify + * @memberof vtadmin.Schema.ShardTableSize + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShardTableSize.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.row_count != null && message.hasOwnProperty("row_count")) + if (!$util.isInteger(message.row_count) && !(message.row_count && $util.isInteger(message.row_count.low) && $util.isInteger(message.row_count.high))) + return "row_count: integer|Long expected"; + if (message.data_length != null && message.hasOwnProperty("data_length")) + if (!$util.isInteger(message.data_length) && !(message.data_length && $util.isInteger(message.data_length.low) && $util.isInteger(message.data_length.high))) + return "data_length: integer|Long expected"; + return null; + }; + + /** + * Creates a ShardTableSize message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtadmin.Schema.ShardTableSize + * @static + * @param {Object.} object Plain object + * @returns {vtadmin.Schema.ShardTableSize} ShardTableSize + */ + ShardTableSize.fromObject = function fromObject(object) { + if (object instanceof $root.vtadmin.Schema.ShardTableSize) + return object; + var message = new $root.vtadmin.Schema.ShardTableSize(); + if (object.row_count != null) + if ($util.Long) + (message.row_count = $util.Long.fromValue(object.row_count)).unsigned = true; + else if (typeof object.row_count === "string") + message.row_count = parseInt(object.row_count, 10); + else if (typeof object.row_count === "number") + message.row_count = object.row_count; + else if (typeof object.row_count === "object") + message.row_count = new $util.LongBits(object.row_count.low >>> 0, object.row_count.high >>> 0).toNumber(true); + if (object.data_length != null) + if ($util.Long) + (message.data_length = $util.Long.fromValue(object.data_length)).unsigned = true; + else if (typeof object.data_length === "string") + message.data_length = parseInt(object.data_length, 10); + else if (typeof object.data_length === "number") + message.data_length = object.data_length; + else if (typeof object.data_length === "object") + message.data_length = new $util.LongBits(object.data_length.low >>> 0, object.data_length.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a ShardTableSize message. Also converts values to other types if specified. + * @function toObject + * @memberof vtadmin.Schema.ShardTableSize + * @static + * @param {vtadmin.Schema.ShardTableSize} message ShardTableSize + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShardTableSize.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.row_count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.row_count = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.data_length = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.data_length = options.longs === String ? "0" : 0; + } + if (message.row_count != null && message.hasOwnProperty("row_count")) + if (typeof message.row_count === "number") + object.row_count = options.longs === String ? String(message.row_count) : message.row_count; + else + object.row_count = options.longs === String ? $util.Long.prototype.toString.call(message.row_count) : options.longs === Number ? new $util.LongBits(message.row_count.low >>> 0, message.row_count.high >>> 0).toNumber(true) : message.row_count; + if (message.data_length != null && message.hasOwnProperty("data_length")) + if (typeof message.data_length === "number") + object.data_length = options.longs === String ? String(message.data_length) : message.data_length; + else + object.data_length = options.longs === String ? $util.Long.prototype.toString.call(message.data_length) : options.longs === Number ? new $util.LongBits(message.data_length.low >>> 0, message.data_length.high >>> 0).toNumber(true) : message.data_length; + return object; + }; + + /** + * Converts this ShardTableSize to JSON. + * @function toJSON + * @memberof vtadmin.Schema.ShardTableSize + * @instance + * @returns {Object.} JSON object + */ + ShardTableSize.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ShardTableSize; + })(); + + Schema.TableSize = (function() { + + /** + * Properties of a TableSize. + * @memberof vtadmin.Schema + * @interface ITableSize + * @property {number|Long|null} [row_count] TableSize row_count + * @property {number|Long|null} [data_length] TableSize data_length + * @property {Object.|null} [by_shard] TableSize by_shard + */ + + /** + * Constructs a new TableSize. + * @memberof vtadmin.Schema + * @classdesc Represents a TableSize. + * @implements ITableSize + * @constructor + * @param {vtadmin.Schema.ITableSize=} [properties] Properties to set + */ + function TableSize(properties) { + this.by_shard = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableSize row_count. + * @member {number|Long} row_count + * @memberof vtadmin.Schema.TableSize + * @instance + */ + TableSize.prototype.row_count = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * TableSize data_length. + * @member {number|Long} data_length + * @memberof vtadmin.Schema.TableSize + * @instance + */ + TableSize.prototype.data_length = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * TableSize by_shard. + * @member {Object.} by_shard + * @memberof vtadmin.Schema.TableSize + * @instance + */ + TableSize.prototype.by_shard = $util.emptyObject; + + /** + * Creates a new TableSize instance using the specified properties. + * @function create + * @memberof vtadmin.Schema.TableSize + * @static + * @param {vtadmin.Schema.ITableSize=} [properties] Properties to set + * @returns {vtadmin.Schema.TableSize} TableSize instance + */ + TableSize.create = function create(properties) { + return new TableSize(properties); + }; + + /** + * Encodes the specified TableSize message. Does not implicitly {@link vtadmin.Schema.TableSize.verify|verify} messages. + * @function encode + * @memberof vtadmin.Schema.TableSize + * @static + * @param {vtadmin.Schema.ITableSize} message TableSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableSize.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.row_count != null && Object.hasOwnProperty.call(message, "row_count")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.row_count); + if (message.data_length != null && Object.hasOwnProperty.call(message, "data_length")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.data_length); + if (message.by_shard != null && Object.hasOwnProperty.call(message, "by_shard")) + for (var keys = Object.keys(message.by_shard), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.vtadmin.Schema.ShardTableSize.encode(message.by_shard[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified TableSize message, length delimited. Does not implicitly {@link vtadmin.Schema.TableSize.verify|verify} messages. + * @function encodeDelimited + * @memberof vtadmin.Schema.TableSize + * @static + * @param {vtadmin.Schema.ITableSize} message TableSize message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableSize.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableSize message from the specified reader or buffer. + * @function decode + * @memberof vtadmin.Schema.TableSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtadmin.Schema.TableSize} TableSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableSize.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.Schema.TableSize(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.row_count = reader.uint64(); + break; + case 2: + message.data_length = reader.uint64(); + break; + case 3: + if (message.by_shard === $util.emptyObject) + message.by_shard = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.vtadmin.Schema.ShardTableSize.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.by_shard[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableSize message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtadmin.Schema.TableSize + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtadmin.Schema.TableSize} TableSize + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableSize.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableSize message. + * @function verify + * @memberof vtadmin.Schema.TableSize + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableSize.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.row_count != null && message.hasOwnProperty("row_count")) + if (!$util.isInteger(message.row_count) && !(message.row_count && $util.isInteger(message.row_count.low) && $util.isInteger(message.row_count.high))) + return "row_count: integer|Long expected"; + if (message.data_length != null && message.hasOwnProperty("data_length")) + if (!$util.isInteger(message.data_length) && !(message.data_length && $util.isInteger(message.data_length.low) && $util.isInteger(message.data_length.high))) + return "data_length: integer|Long expected"; + if (message.by_shard != null && message.hasOwnProperty("by_shard")) { + if (!$util.isObject(message.by_shard)) + return "by_shard: object expected"; + var key = Object.keys(message.by_shard); + for (var i = 0; i < key.length; ++i) { + var error = $root.vtadmin.Schema.ShardTableSize.verify(message.by_shard[key[i]]); + if (error) + return "by_shard." + error; + } + } + return null; + }; + + /** + * Creates a TableSize message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtadmin.Schema.TableSize + * @static + * @param {Object.} object Plain object + * @returns {vtadmin.Schema.TableSize} TableSize + */ + TableSize.fromObject = function fromObject(object) { + if (object instanceof $root.vtadmin.Schema.TableSize) + return object; + var message = new $root.vtadmin.Schema.TableSize(); + if (object.row_count != null) + if ($util.Long) + (message.row_count = $util.Long.fromValue(object.row_count)).unsigned = true; + else if (typeof object.row_count === "string") + message.row_count = parseInt(object.row_count, 10); + else if (typeof object.row_count === "number") + message.row_count = object.row_count; + else if (typeof object.row_count === "object") + message.row_count = new $util.LongBits(object.row_count.low >>> 0, object.row_count.high >>> 0).toNumber(true); + if (object.data_length != null) + if ($util.Long) + (message.data_length = $util.Long.fromValue(object.data_length)).unsigned = true; + else if (typeof object.data_length === "string") + message.data_length = parseInt(object.data_length, 10); + else if (typeof object.data_length === "number") + message.data_length = object.data_length; + else if (typeof object.data_length === "object") + message.data_length = new $util.LongBits(object.data_length.low >>> 0, object.data_length.high >>> 0).toNumber(true); + if (object.by_shard) { + if (typeof object.by_shard !== "object") + throw TypeError(".vtadmin.Schema.TableSize.by_shard: object expected"); + message.by_shard = {}; + for (var keys = Object.keys(object.by_shard), i = 0; i < keys.length; ++i) { + if (typeof object.by_shard[keys[i]] !== "object") + throw TypeError(".vtadmin.Schema.TableSize.by_shard: object expected"); + message.by_shard[keys[i]] = $root.vtadmin.Schema.ShardTableSize.fromObject(object.by_shard[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableSize message. Also converts values to other types if specified. + * @function toObject + * @memberof vtadmin.Schema.TableSize + * @static + * @param {vtadmin.Schema.TableSize} message TableSize + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableSize.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.by_shard = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.row_count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.row_count = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.data_length = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.data_length = options.longs === String ? "0" : 0; + } + if (message.row_count != null && message.hasOwnProperty("row_count")) + if (typeof message.row_count === "number") + object.row_count = options.longs === String ? String(message.row_count) : message.row_count; + else + object.row_count = options.longs === String ? $util.Long.prototype.toString.call(message.row_count) : options.longs === Number ? new $util.LongBits(message.row_count.low >>> 0, message.row_count.high >>> 0).toNumber(true) : message.row_count; + if (message.data_length != null && message.hasOwnProperty("data_length")) + if (typeof message.data_length === "number") + object.data_length = options.longs === String ? String(message.data_length) : message.data_length; + else + object.data_length = options.longs === String ? $util.Long.prototype.toString.call(message.data_length) : options.longs === Number ? new $util.LongBits(message.data_length.low >>> 0, message.data_length.high >>> 0).toNumber(true) : message.data_length; + var keys2; + if (message.by_shard && (keys2 = Object.keys(message.by_shard)).length) { + object.by_shard = {}; + for (var j = 0; j < keys2.length; ++j) + object.by_shard[keys2[j]] = $root.vtadmin.Schema.ShardTableSize.toObject(message.by_shard[keys2[j]], options); + } + return object; + }; + + /** + * Converts this TableSize to JSON. + * @function toJSON + * @memberof vtadmin.Schema.TableSize + * @instance + * @returns {Object.} JSON object + */ + TableSize.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TableSize; + })(); + return Schema; })(); @@ -2764,6 +3370,7 @@ $root.vtadmin = (function() { * @interface IFindSchemaRequest * @property {string|null} [table] FindSchemaRequest table * @property {Array.|null} [cluster_ids] FindSchemaRequest cluster_ids + * @property {vtadmin.IGetSchemaTableSizeOptions|null} [table_size_options] FindSchemaRequest table_size_options */ /** @@ -2798,6 +3405,14 @@ $root.vtadmin = (function() { */ FindSchemaRequest.prototype.cluster_ids = $util.emptyArray; + /** + * FindSchemaRequest table_size_options. + * @member {vtadmin.IGetSchemaTableSizeOptions|null|undefined} table_size_options + * @memberof vtadmin.FindSchemaRequest + * @instance + */ + FindSchemaRequest.prototype.table_size_options = null; + /** * Creates a new FindSchemaRequest instance using the specified properties. * @function create @@ -2827,6 +3442,8 @@ $root.vtadmin = (function() { if (message.cluster_ids != null && message.cluster_ids.length) for (var i = 0; i < message.cluster_ids.length; ++i) writer.uint32(/* id 2, wireType 2 =*/18).string(message.cluster_ids[i]); + if (message.table_size_options != null && Object.hasOwnProperty.call(message, "table_size_options")) + $root.vtadmin.GetSchemaTableSizeOptions.encode(message.table_size_options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -2869,6 +3486,9 @@ $root.vtadmin = (function() { message.cluster_ids = []; message.cluster_ids.push(reader.string()); break; + case 3: + message.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -2914,6 +3534,11 @@ $root.vtadmin = (function() { if (!$util.isString(message.cluster_ids[i])) return "cluster_ids: string[] expected"; } + if (message.table_size_options != null && message.hasOwnProperty("table_size_options")) { + var error = $root.vtadmin.GetSchemaTableSizeOptions.verify(message.table_size_options); + if (error) + return "table_size_options." + error; + } return null; }; @@ -2938,6 +3563,11 @@ $root.vtadmin = (function() { for (var i = 0; i < object.cluster_ids.length; ++i) message.cluster_ids[i] = String(object.cluster_ids[i]); } + if (object.table_size_options != null) { + if (typeof object.table_size_options !== "object") + throw TypeError(".vtadmin.FindSchemaRequest.table_size_options: object expected"); + message.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.fromObject(object.table_size_options); + } return message; }; @@ -2956,8 +3586,10 @@ $root.vtadmin = (function() { var object = {}; if (options.arrays || options.defaults) object.cluster_ids = []; - if (options.defaults) + if (options.defaults) { object.table = ""; + object.table_size_options = null; + } if (message.table != null && message.hasOwnProperty("table")) object.table = message.table; if (message.cluster_ids && message.cluster_ids.length) { @@ -2965,6 +3597,8 @@ $root.vtadmin = (function() { for (var j = 0; j < message.cluster_ids.length; ++j) object.cluster_ids[j] = message.cluster_ids[j]; } + if (message.table_size_options != null && message.hasOwnProperty("table_size_options")) + object.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.toObject(message.table_size_options, options); return object; }; @@ -4181,6 +4815,7 @@ $root.vtadmin = (function() { * @property {string|null} [cluster_id] GetSchemaRequest cluster_id * @property {string|null} [keyspace] GetSchemaRequest keyspace * @property {string|null} [table] GetSchemaRequest table + * @property {vtadmin.IGetSchemaTableSizeOptions|null} [table_size_options] GetSchemaRequest table_size_options */ /** @@ -4222,6 +4857,14 @@ $root.vtadmin = (function() { */ GetSchemaRequest.prototype.table = ""; + /** + * GetSchemaRequest table_size_options. + * @member {vtadmin.IGetSchemaTableSizeOptions|null|undefined} table_size_options + * @memberof vtadmin.GetSchemaRequest + * @instance + */ + GetSchemaRequest.prototype.table_size_options = null; + /** * Creates a new GetSchemaRequest instance using the specified properties. * @function create @@ -4252,6 +4895,8 @@ $root.vtadmin = (function() { writer.uint32(/* id 2, wireType 2 =*/18).string(message.keyspace); if (message.table != null && Object.hasOwnProperty.call(message, "table")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.table); + if (message.table_size_options != null && Object.hasOwnProperty.call(message, "table_size_options")) + $root.vtadmin.GetSchemaTableSizeOptions.encode(message.table_size_options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; @@ -4295,6 +4940,9 @@ $root.vtadmin = (function() { case 3: message.table = reader.string(); break; + case 4: + message.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -4339,6 +4987,11 @@ $root.vtadmin = (function() { if (message.table != null && message.hasOwnProperty("table")) if (!$util.isString(message.table)) return "table: string expected"; + if (message.table_size_options != null && message.hasOwnProperty("table_size_options")) { + var error = $root.vtadmin.GetSchemaTableSizeOptions.verify(message.table_size_options); + if (error) + return "table_size_options." + error; + } return null; }; @@ -4360,6 +5013,11 @@ $root.vtadmin = (function() { message.keyspace = String(object.keyspace); if (object.table != null) message.table = String(object.table); + if (object.table_size_options != null) { + if (typeof object.table_size_options !== "object") + throw TypeError(".vtadmin.GetSchemaRequest.table_size_options: object expected"); + message.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.fromObject(object.table_size_options); + } return message; }; @@ -4380,6 +5038,7 @@ $root.vtadmin = (function() { object.cluster_id = ""; object.keyspace = ""; object.table = ""; + object.table_size_options = null; } if (message.cluster_id != null && message.hasOwnProperty("cluster_id")) object.cluster_id = message.cluster_id; @@ -4387,6 +5046,8 @@ $root.vtadmin = (function() { object.keyspace = message.keyspace; if (message.table != null && message.hasOwnProperty("table")) object.table = message.table; + if (message.table_size_options != null && message.hasOwnProperty("table_size_options")) + object.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.toObject(message.table_size_options, options); return object; }; @@ -4411,6 +5072,7 @@ $root.vtadmin = (function() { * @memberof vtadmin * @interface IGetSchemasRequest * @property {Array.|null} [cluster_ids] GetSchemasRequest cluster_ids + * @property {vtadmin.IGetSchemaTableSizeOptions|null} [table_size_options] GetSchemasRequest table_size_options */ /** @@ -4437,6 +5099,14 @@ $root.vtadmin = (function() { */ GetSchemasRequest.prototype.cluster_ids = $util.emptyArray; + /** + * GetSchemasRequest table_size_options. + * @member {vtadmin.IGetSchemaTableSizeOptions|null|undefined} table_size_options + * @memberof vtadmin.GetSchemasRequest + * @instance + */ + GetSchemasRequest.prototype.table_size_options = null; + /** * Creates a new GetSchemasRequest instance using the specified properties. * @function create @@ -4464,6 +5134,8 @@ $root.vtadmin = (function() { if (message.cluster_ids != null && message.cluster_ids.length) for (var i = 0; i < message.cluster_ids.length; ++i) writer.uint32(/* id 1, wireType 2 =*/10).string(message.cluster_ids[i]); + if (message.table_size_options != null && Object.hasOwnProperty.call(message, "table_size_options")) + $root.vtadmin.GetSchemaTableSizeOptions.encode(message.table_size_options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -4503,6 +5175,9 @@ $root.vtadmin = (function() { message.cluster_ids = []; message.cluster_ids.push(reader.string()); break; + case 2: + message.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -4545,6 +5220,11 @@ $root.vtadmin = (function() { if (!$util.isString(message.cluster_ids[i])) return "cluster_ids: string[] expected"; } + if (message.table_size_options != null && message.hasOwnProperty("table_size_options")) { + var error = $root.vtadmin.GetSchemaTableSizeOptions.verify(message.table_size_options); + if (error) + return "table_size_options." + error; + } return null; }; @@ -4567,6 +5247,11 @@ $root.vtadmin = (function() { for (var i = 0; i < object.cluster_ids.length; ++i) message.cluster_ids[i] = String(object.cluster_ids[i]); } + if (object.table_size_options != null) { + if (typeof object.table_size_options !== "object") + throw TypeError(".vtadmin.GetSchemasRequest.table_size_options: object expected"); + message.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.fromObject(object.table_size_options); + } return message; }; @@ -4585,11 +5270,15 @@ $root.vtadmin = (function() { var object = {}; if (options.arrays || options.defaults) object.cluster_ids = []; + if (options.defaults) + object.table_size_options = null; if (message.cluster_ids && message.cluster_ids.length) { object.cluster_ids = []; for (var j = 0; j < message.cluster_ids.length; ++j) object.cluster_ids[j] = message.cluster_ids[j]; } + if (message.table_size_options != null && message.hasOwnProperty("table_size_options")) + object.table_size_options = $root.vtadmin.GetSchemaTableSizeOptions.toObject(message.table_size_options, options); return object; }; @@ -4815,6 +5504,193 @@ $root.vtadmin = (function() { return GetSchemasResponse; })(); + vtadmin.GetSchemaTableSizeOptions = (function() { + + /** + * Properties of a GetSchemaTableSizeOptions. + * @memberof vtadmin + * @interface IGetSchemaTableSizeOptions + * @property {boolean|null} [aggregate_sizes] GetSchemaTableSizeOptions aggregate_sizes + */ + + /** + * Constructs a new GetSchemaTableSizeOptions. + * @memberof vtadmin + * @classdesc Represents a GetSchemaTableSizeOptions. + * @implements IGetSchemaTableSizeOptions + * @constructor + * @param {vtadmin.IGetSchemaTableSizeOptions=} [properties] Properties to set + */ + function GetSchemaTableSizeOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSchemaTableSizeOptions aggregate_sizes. + * @member {boolean} aggregate_sizes + * @memberof vtadmin.GetSchemaTableSizeOptions + * @instance + */ + GetSchemaTableSizeOptions.prototype.aggregate_sizes = false; + + /** + * Creates a new GetSchemaTableSizeOptions instance using the specified properties. + * @function create + * @memberof vtadmin.GetSchemaTableSizeOptions + * @static + * @param {vtadmin.IGetSchemaTableSizeOptions=} [properties] Properties to set + * @returns {vtadmin.GetSchemaTableSizeOptions} GetSchemaTableSizeOptions instance + */ + GetSchemaTableSizeOptions.create = function create(properties) { + return new GetSchemaTableSizeOptions(properties); + }; + + /** + * Encodes the specified GetSchemaTableSizeOptions message. Does not implicitly {@link vtadmin.GetSchemaTableSizeOptions.verify|verify} messages. + * @function encode + * @memberof vtadmin.GetSchemaTableSizeOptions + * @static + * @param {vtadmin.IGetSchemaTableSizeOptions} message GetSchemaTableSizeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSchemaTableSizeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.aggregate_sizes != null && Object.hasOwnProperty.call(message, "aggregate_sizes")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.aggregate_sizes); + return writer; + }; + + /** + * Encodes the specified GetSchemaTableSizeOptions message, length delimited. Does not implicitly {@link vtadmin.GetSchemaTableSizeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof vtadmin.GetSchemaTableSizeOptions + * @static + * @param {vtadmin.IGetSchemaTableSizeOptions} message GetSchemaTableSizeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSchemaTableSizeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSchemaTableSizeOptions message from the specified reader or buffer. + * @function decode + * @memberof vtadmin.GetSchemaTableSizeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtadmin.GetSchemaTableSizeOptions} GetSchemaTableSizeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSchemaTableSizeOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtadmin.GetSchemaTableSizeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aggregate_sizes = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSchemaTableSizeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtadmin.GetSchemaTableSizeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtadmin.GetSchemaTableSizeOptions} GetSchemaTableSizeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSchemaTableSizeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSchemaTableSizeOptions message. + * @function verify + * @memberof vtadmin.GetSchemaTableSizeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSchemaTableSizeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.aggregate_sizes != null && message.hasOwnProperty("aggregate_sizes")) + if (typeof message.aggregate_sizes !== "boolean") + return "aggregate_sizes: boolean expected"; + return null; + }; + + /** + * Creates a GetSchemaTableSizeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtadmin.GetSchemaTableSizeOptions + * @static + * @param {Object.} object Plain object + * @returns {vtadmin.GetSchemaTableSizeOptions} GetSchemaTableSizeOptions + */ + GetSchemaTableSizeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.vtadmin.GetSchemaTableSizeOptions) + return object; + var message = new $root.vtadmin.GetSchemaTableSizeOptions(); + if (object.aggregate_sizes != null) + message.aggregate_sizes = Boolean(object.aggregate_sizes); + return message; + }; + + /** + * Creates a plain object from a GetSchemaTableSizeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof vtadmin.GetSchemaTableSizeOptions + * @static + * @param {vtadmin.GetSchemaTableSizeOptions} message GetSchemaTableSizeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSchemaTableSizeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.aggregate_sizes = false; + if (message.aggregate_sizes != null && message.hasOwnProperty("aggregate_sizes")) + object.aggregate_sizes = message.aggregate_sizes; + return object; + }; + + /** + * Converts this GetSchemaTableSizeOptions to JSON. + * @function toJSON + * @memberof vtadmin.GetSchemaTableSizeOptions + * @instance + * @returns {Object.} JSON object + */ + GetSchemaTableSizeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetSchemaTableSizeOptions; + })(); + vtadmin.GetTabletRequest = (function() { /**