Move serving state from global topo to srv keyspace

Initial stab at: https://github.com/vitessio/vitess/issues/4496

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
This commit is contained in:
Rafael Chacon 2019-01-07 13:15:48 -08:00
Родитель 909468555f
Коммит 196cf77dd0
20 изменённых файлов: 1161 добавлений и 896 удалений

Просмотреть файл

@ -48,7 +48,7 @@ func (x KeyspaceIdType) String() string {
return proto.EnumName(KeyspaceIdType_name, int32(x))
}
func (KeyspaceIdType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{0}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{0}
}
// TabletType represents the type of a given tablet.
@ -117,7 +117,7 @@ func (x TabletType) String() string {
return proto.EnumName(TabletType_name, int32(x))
}
func (TabletType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{1}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{1}
}
// KeyRange describes a range of sharding keys, when range-based
@ -134,7 +134,7 @@ func (m *KeyRange) Reset() { *m = KeyRange{} }
func (m *KeyRange) String() string { return proto.CompactTextString(m) }
func (*KeyRange) ProtoMessage() {}
func (*KeyRange) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{0}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{0}
}
func (m *KeyRange) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_KeyRange.Unmarshal(m, b)
@ -184,7 +184,7 @@ func (m *TabletAlias) Reset() { *m = TabletAlias{} }
func (m *TabletAlias) String() string { return proto.CompactTextString(m) }
func (*TabletAlias) ProtoMessage() {}
func (*TabletAlias) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{1}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{1}
}
func (m *TabletAlias) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TabletAlias.Unmarshal(m, b)
@ -260,7 +260,7 @@ func (m *Tablet) Reset() { *m = Tablet{} }
func (m *Tablet) String() string { return proto.CompactTextString(m) }
func (*Tablet) ProtoMessage() {}
func (*Tablet) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{2}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{2}
}
func (m *Tablet) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Tablet.Unmarshal(m, b)
@ -372,29 +372,26 @@ type Shard struct {
// helpful to have it decomposed here.
// Once set at creation time, it is never changed.
KeyRange *KeyRange `protobuf:"bytes,2,opt,name=key_range,json=keyRange,proto3" json:"key_range,omitempty"`
// served_types has at most one entry per TabletType
// The keyspace lock is always taken when changing this.
ServedTypes []*Shard_ServedType `protobuf:"bytes,3,rep,name=served_types,json=servedTypes,proto3" json:"served_types,omitempty"`
// SourceShards is the list of shards we're replicating from,
// using filtered replication.
// The keyspace lock is always taken when changing this.
SourceShards []*Shard_SourceShard `protobuf:"bytes,4,rep,name=source_shards,json=sourceShards,proto3" json:"source_shards,omitempty"`
// Cells is the list of cells that contain tablets for this shard.
// No lock is necessary to update this field.
Cells []string `protobuf:"bytes,5,rep,name=cells,proto3" json:"cells,omitempty"`
// tablet_controls has at most one entry per TabletType.
// The keyspace lock is always taken when changing this.
TabletControls []*Shard_TabletControl `protobuf:"bytes,6,rep,name=tablet_controls,json=tabletControls,proto3" json:"tablet_controls,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
TabletControls []*Shard_TabletControl `protobuf:"bytes,6,rep,name=tablet_controls,json=tabletControls,proto3" json:"tablet_controls,omitempty"`
// is_master_serving sets whether this shard master is serving traffic or not.
// The keyspace lock is always taken when changing this.
IsMasterServing bool `protobuf:"varint,7,opt,name=is_master_serving,json=isMasterServing,proto3" json:"is_master_serving,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Shard) Reset() { *m = Shard{} }
func (m *Shard) String() string { return proto.CompactTextString(m) }
func (*Shard) ProtoMessage() {}
func (*Shard) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{3}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{3}
}
func (m *Shard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Shard.Unmarshal(m, b)
@ -428,13 +425,6 @@ func (m *Shard) GetKeyRange() *KeyRange {
return nil
}
func (m *Shard) GetServedTypes() []*Shard_ServedType {
if m != nil {
return m.ServedTypes
}
return nil
}
func (m *Shard) GetSourceShards() []*Shard_SourceShard {
if m != nil {
return m.SourceShards
@ -442,13 +432,6 @@ func (m *Shard) GetSourceShards() []*Shard_SourceShard {
return nil
}
func (m *Shard) GetCells() []string {
if m != nil {
return m.Cells
}
return nil
}
func (m *Shard) GetTabletControls() []*Shard_TabletControl {
if m != nil {
return m.TabletControls
@ -456,51 +439,11 @@ func (m *Shard) GetTabletControls() []*Shard_TabletControl {
return nil
}
// ServedType is an entry in the served_types
type Shard_ServedType struct {
TabletType TabletType `protobuf:"varint,1,opt,name=tablet_type,json=tabletType,proto3,enum=topodata.TabletType" json:"tablet_type,omitempty"`
Cells []string `protobuf:"bytes,2,rep,name=cells,proto3" json:"cells,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Shard_ServedType) Reset() { *m = Shard_ServedType{} }
func (m *Shard_ServedType) String() string { return proto.CompactTextString(m) }
func (*Shard_ServedType) ProtoMessage() {}
func (*Shard_ServedType) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{3, 0}
}
func (m *Shard_ServedType) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Shard_ServedType.Unmarshal(m, b)
}
func (m *Shard_ServedType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Shard_ServedType.Marshal(b, m, deterministic)
}
func (dst *Shard_ServedType) XXX_Merge(src proto.Message) {
xxx_messageInfo_Shard_ServedType.Merge(dst, src)
}
func (m *Shard_ServedType) XXX_Size() int {
return xxx_messageInfo_Shard_ServedType.Size(m)
}
func (m *Shard_ServedType) XXX_DiscardUnknown() {
xxx_messageInfo_Shard_ServedType.DiscardUnknown(m)
}
var xxx_messageInfo_Shard_ServedType proto.InternalMessageInfo
func (m *Shard_ServedType) GetTabletType() TabletType {
func (m *Shard) GetIsMasterServing() bool {
if m != nil {
return m.TabletType
return m.IsMasterServing
}
return TabletType_UNKNOWN
}
func (m *Shard_ServedType) GetCells() []string {
if m != nil {
return m.Cells
}
return nil
return false
}
// SourceShard represents a data source for filtered replication
@ -526,7 +469,7 @@ func (m *Shard_SourceShard) Reset() { *m = Shard_SourceShard{} }
func (m *Shard_SourceShard) String() string { return proto.CompactTextString(m) }
func (*Shard_SourceShard) ProtoMessage() {}
func (*Shard_SourceShard) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{3, 1}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{3, 0}
}
func (m *Shard_SourceShard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Shard_SourceShard.Unmarshal(m, b)
@ -584,11 +527,9 @@ func (m *Shard_SourceShard) GetTables() []string {
// TabletControl controls tablet's behavior
type Shard_TabletControl struct {
// which tablet type is affected
TabletType TabletType `protobuf:"varint,1,opt,name=tablet_type,json=tabletType,proto3,enum=topodata.TabletType" json:"tablet_type,omitempty"`
Cells []string `protobuf:"bytes,2,rep,name=cells,proto3" json:"cells,omitempty"`
// what to do
DisableQueryService bool `protobuf:"varint,3,opt,name=disable_query_service,json=disableQueryService,proto3" json:"disable_query_service,omitempty"`
BlacklistedTables []string `protobuf:"bytes,4,rep,name=blacklisted_tables,json=blacklistedTables,proto3" json:"blacklisted_tables,omitempty"`
TabletType TabletType `protobuf:"varint,1,opt,name=tablet_type,json=tabletType,proto3,enum=topodata.TabletType" json:"tablet_type,omitempty"`
Cells []string `protobuf:"bytes,2,rep,name=cells,proto3" json:"cells,omitempty"`
BlacklistedTables []string `protobuf:"bytes,4,rep,name=blacklisted_tables,json=blacklistedTables,proto3" json:"blacklisted_tables,omitempty"`
// frozen is set if we've started failing over traffic for
// the master. If set, this record should not be removed.
Frozen bool `protobuf:"varint,5,opt,name=frozen,proto3" json:"frozen,omitempty"`
@ -601,7 +542,7 @@ func (m *Shard_TabletControl) Reset() { *m = Shard_TabletControl{} }
func (m *Shard_TabletControl) String() string { return proto.CompactTextString(m) }
func (*Shard_TabletControl) ProtoMessage() {}
func (*Shard_TabletControl) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{3, 2}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{3, 1}
}
func (m *Shard_TabletControl) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Shard_TabletControl.Unmarshal(m, b)
@ -635,13 +576,6 @@ func (m *Shard_TabletControl) GetCells() []string {
return nil
}
func (m *Shard_TabletControl) GetDisableQueryService() bool {
if m != nil {
return m.DisableQueryService
}
return false
}
func (m *Shard_TabletControl) GetBlacklistedTables() []string {
if m != nil {
return m.BlacklistedTables
@ -676,7 +610,7 @@ func (m *Keyspace) Reset() { *m = Keyspace{} }
func (m *Keyspace) String() string { return proto.CompactTextString(m) }
func (*Keyspace) ProtoMessage() {}
func (*Keyspace) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{4}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{4}
}
func (m *Keyspace) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Keyspace.Unmarshal(m, b)
@ -735,7 +669,7 @@ func (m *Keyspace_ServedFrom) Reset() { *m = Keyspace_ServedFrom{} }
func (m *Keyspace_ServedFrom) String() string { return proto.CompactTextString(m) }
func (*Keyspace_ServedFrom) ProtoMessage() {}
func (*Keyspace_ServedFrom) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{4, 0}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{4, 0}
}
func (m *Keyspace_ServedFrom) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Keyspace_ServedFrom.Unmarshal(m, b)
@ -791,7 +725,7 @@ func (m *ShardReplication) Reset() { *m = ShardReplication{} }
func (m *ShardReplication) String() string { return proto.CompactTextString(m) }
func (*ShardReplication) ProtoMessage() {}
func (*ShardReplication) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{5}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{5}
}
func (m *ShardReplication) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShardReplication.Unmarshal(m, b)
@ -830,7 +764,7 @@ func (m *ShardReplication_Node) Reset() { *m = ShardReplication_Node{} }
func (m *ShardReplication_Node) String() string { return proto.CompactTextString(m) }
func (*ShardReplication_Node) ProtoMessage() {}
func (*ShardReplication_Node) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{5, 0}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{5, 0}
}
func (m *ShardReplication_Node) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShardReplication_Node.Unmarshal(m, b)
@ -871,7 +805,7 @@ func (m *ShardReference) Reset() { *m = ShardReference{} }
func (m *ShardReference) String() string { return proto.CompactTextString(m) }
func (*ShardReference) ProtoMessage() {}
func (*ShardReference) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{6}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{6}
}
func (m *ShardReference) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShardReference.Unmarshal(m, b)
@ -905,6 +839,63 @@ func (m *ShardReference) GetKeyRange() *KeyRange {
return nil
}
// ShardTabletControl is used as a pointer from a SrvKeyspace to a Shard
type ShardTabletControl struct {
// Copied from Shard.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
KeyRange *KeyRange `protobuf:"bytes,2,opt,name=key_range,json=keyRange,proto3" json:"key_range,omitempty"`
// Disable query serving in this shard
QueryServiceDisabled bool `protobuf:"varint,3,opt,name=query_service_disabled,json=queryServiceDisabled,proto3" json:"query_service_disabled,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ShardTabletControl) Reset() { *m = ShardTabletControl{} }
func (m *ShardTabletControl) String() string { return proto.CompactTextString(m) }
func (*ShardTabletControl) ProtoMessage() {}
func (*ShardTabletControl) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_42e6e5b7e6808654, []int{7}
}
func (m *ShardTabletControl) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShardTabletControl.Unmarshal(m, b)
}
func (m *ShardTabletControl) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ShardTabletControl.Marshal(b, m, deterministic)
}
func (dst *ShardTabletControl) XXX_Merge(src proto.Message) {
xxx_messageInfo_ShardTabletControl.Merge(dst, src)
}
func (m *ShardTabletControl) XXX_Size() int {
return xxx_messageInfo_ShardTabletControl.Size(m)
}
func (m *ShardTabletControl) XXX_DiscardUnknown() {
xxx_messageInfo_ShardTabletControl.DiscardUnknown(m)
}
var xxx_messageInfo_ShardTabletControl proto.InternalMessageInfo
func (m *ShardTabletControl) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *ShardTabletControl) GetKeyRange() *KeyRange {
if m != nil {
return m.KeyRange
}
return nil
}
func (m *ShardTabletControl) GetQueryServiceDisabled() bool {
if m != nil {
return m.QueryServiceDisabled
}
return false
}
// SrvKeyspace is a rollup node for the keyspace itself.
type SrvKeyspace struct {
// The partitions this keyspace is serving, per tablet type.
@ -922,7 +913,7 @@ func (m *SrvKeyspace) Reset() { *m = SrvKeyspace{} }
func (m *SrvKeyspace) String() string { return proto.CompactTextString(m) }
func (*SrvKeyspace) ProtoMessage() {}
func (*SrvKeyspace) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{7}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{8}
}
func (m *SrvKeyspace) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SrvKeyspace.Unmarshal(m, b)
@ -974,17 +965,19 @@ type SrvKeyspace_KeyspacePartition struct {
// The type this partition applies to.
ServedType TabletType `protobuf:"varint,1,opt,name=served_type,json=servedType,proto3,enum=topodata.TabletType" json:"served_type,omitempty"`
// List of non-overlapping continuous shards sorted by range.
ShardReferences []*ShardReference `protobuf:"bytes,2,rep,name=shard_references,json=shardReferences,proto3" json:"shard_references,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
ShardReferences []*ShardReference `protobuf:"bytes,2,rep,name=shard_references,json=shardReferences,proto3" json:"shard_references,omitempty"`
// List of shard tablet controls
ShardTabletControls []*ShardTabletControl `protobuf:"bytes,3,rep,name=shard_tablet_controls,json=shardTabletControls,proto3" json:"shard_tablet_controls,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SrvKeyspace_KeyspacePartition) Reset() { *m = SrvKeyspace_KeyspacePartition{} }
func (m *SrvKeyspace_KeyspacePartition) String() string { return proto.CompactTextString(m) }
func (*SrvKeyspace_KeyspacePartition) ProtoMessage() {}
func (*SrvKeyspace_KeyspacePartition) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{7, 0}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{8, 0}
}
func (m *SrvKeyspace_KeyspacePartition) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SrvKeyspace_KeyspacePartition.Unmarshal(m, b)
@ -1018,6 +1011,13 @@ func (m *SrvKeyspace_KeyspacePartition) GetShardReferences() []*ShardReference {
return nil
}
func (m *SrvKeyspace_KeyspacePartition) GetShardTabletControls() []*ShardTabletControl {
if m != nil {
return m.ShardTabletControls
}
return nil
}
// ServedFrom indicates a relationship between a TabletType and the
// keyspace name that's serving it.
type SrvKeyspace_ServedFrom struct {
@ -1034,7 +1034,7 @@ func (m *SrvKeyspace_ServedFrom) Reset() { *m = SrvKeyspace_ServedFrom{}
func (m *SrvKeyspace_ServedFrom) String() string { return proto.CompactTextString(m) }
func (*SrvKeyspace_ServedFrom) ProtoMessage() {}
func (*SrvKeyspace_ServedFrom) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{7, 1}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{8, 1}
}
func (m *SrvKeyspace_ServedFrom) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SrvKeyspace_ServedFrom.Unmarshal(m, b)
@ -1092,7 +1092,7 @@ func (m *CellInfo) Reset() { *m = CellInfo{} }
func (m *CellInfo) String() string { return proto.CompactTextString(m) }
func (*CellInfo) ProtoMessage() {}
func (*CellInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_693bf5422a92a7f4, []int{8}
return fileDescriptor_topodata_42e6e5b7e6808654, []int{9}
}
func (m *CellInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CellInfo.Unmarshal(m, b)
@ -1140,7 +1140,6 @@ func init() {
proto.RegisterMapType((map[string]int32)(nil), "topodata.Tablet.PortMapEntry")
proto.RegisterMapType((map[string]string)(nil), "topodata.Tablet.TagsEntry")
proto.RegisterType((*Shard)(nil), "topodata.Shard")
proto.RegisterType((*Shard_ServedType)(nil), "topodata.Shard.ServedType")
proto.RegisterType((*Shard_SourceShard)(nil), "topodata.Shard.SourceShard")
proto.RegisterType((*Shard_TabletControl)(nil), "topodata.Shard.TabletControl")
proto.RegisterType((*Keyspace)(nil), "topodata.Keyspace")
@ -1148,6 +1147,7 @@ func init() {
proto.RegisterType((*ShardReplication)(nil), "topodata.ShardReplication")
proto.RegisterType((*ShardReplication_Node)(nil), "topodata.ShardReplication.Node")
proto.RegisterType((*ShardReference)(nil), "topodata.ShardReference")
proto.RegisterType((*ShardTabletControl)(nil), "topodata.ShardTabletControl")
proto.RegisterType((*SrvKeyspace)(nil), "topodata.SrvKeyspace")
proto.RegisterType((*SrvKeyspace_KeyspacePartition)(nil), "topodata.SrvKeyspace.KeyspacePartition")
proto.RegisterType((*SrvKeyspace_ServedFrom)(nil), "topodata.SrvKeyspace.ServedFrom")
@ -1156,81 +1156,83 @@ func init() {
proto.RegisterEnum("topodata.TabletType", TabletType_name, TabletType_value)
}
func init() { proto.RegisterFile("topodata.proto", fileDescriptor_topodata_693bf5422a92a7f4) }
func init() { proto.RegisterFile("topodata.proto", fileDescriptor_topodata_42e6e5b7e6808654) }
var fileDescriptor_topodata_693bf5422a92a7f4 = []byte{
// 1162 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x6f, 0x8f, 0xda, 0x46,
0x13, 0x7f, 0x0c, 0x86, 0x33, 0x63, 0x8e, 0x38, 0xfb, 0x24, 0x95, 0xe5, 0x2a, 0x2a, 0x42, 0x8a,
0x8a, 0x52, 0x15, 0x2a, 0xd2, 0xb4, 0xa7, 0x48, 0x95, 0x42, 0x08, 0x69, 0xb8, 0x24, 0x1c, 0x5d,
0x38, 0xb5, 0xa9, 0x54, 0x59, 0x3e, 0xbc, 0x47, 0xac, 0x33, 0x5e, 0xb2, 0xbb, 0x20, 0xd1, 0xaf,
0xd0, 0x17, 0xcd, 0xeb, 0xbe, 0xed, 0xa7, 0xe8, 0x27, 0xe8, 0x47, 0xe8, 0xd7, 0xa9, 0x76, 0xd7,
0x06, 0xc3, 0x35, 0xe9, 0xa5, 0xba, 0x77, 0x33, 0x3b, 0x7f, 0x3c, 0xf3, 0x9b, 0xdf, 0x0c, 0x40,
0x4d, 0x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xb0, 0xed, 0x07, 0xd9, 0x70, 0x70, 0x3a,
0x7c, 0x3e, 0x3c, 0xf9, 0x7e, 0xa8, 0x43, 0x5e, 0x76, 0xc7, 0x93, 0x3e, 0x76, 0x0c, 0x69, 0xc0,
0xfd, 0xd1, 0x8b, 0x41, 0xaf, 0xeb, 0x14, 0xa4, 0x01, 0x3f, 0x39, 0x19, 0xbe, 0x78, 0xe5, 0x14,
0x55, 0xae, 0xee, 0xa4, 0xf7, 0x4c, 0x8b, 0xe3, 0x51, 0x17, 0xf7, 0x1d, 0x13, 0x39, 0x50, 0xed,
0xff, 0x30, 0xea, 0xe3, 0xc1, 0xcb, 0xfe, 0x70, 0xd2, 0x7d, 0xe1, 0x94, 0x64, 0xcc, 0xe3, 0x6e,
0xef, 0xf9, 0xe9, 0xc8, 0x29, 0xeb, 0x64, 0xe3, 0xc9, 0x09, 0xee, 0x3b, 0x07, 0x52, 0x79, 0x82,
0xbb, 0x83, 0x61, 0xff, 0x89, 0x63, 0x79, 0x05, 0xc7, 0x78, 0x7c, 0x04, 0x37, 0x22, 0xda, 0x5a,
0x45, 0x82, 0x70, 0xae, 0xff, 0x4f, 0xff, 0x78, 0x37, 0xd5, 0x22, 0xda, 0xd6, 0x52, 0x7b, 0x46,
0xdb, 0x2b, 0xd1, 0x56, 0xd6, 0x76, 0x36, 0x98, 0xb3, 0xb2, 0xd2, 0xef, 0xff, 0x1d, 0x00, 0x00,
0xff, 0xff, 0x74, 0x1e, 0xdb, 0x99, 0x8f, 0x0b, 0x00, 0x00,
var fileDescriptor_topodata_42e6e5b7e6808654 = []byte{
// 1192 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xef, 0x6e, 0x1b, 0x45,
0x10, 0xe7, 0xec, 0xb3, 0x73, 0x9e, 0x73, 0x9c, 0xeb, 0x92, 0x56, 0x27, 0x43, 0x45, 0x64, 0xa9,
0xc2, 0x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ee, 0x81, 0xe7, 0xd4, 0x0b, 0x9e, 0xf5, 0x78, 0x1f, 0xb6, 0x62, 0xde, 0xba, 0x8c, 0x15, 0x93,
0xd2, 0xfc, 0x1b, 0xff, 0xe1, 0x4e, 0xa6, 0xc5, 0x7c, 0xd7, 0x48, 0xbb, 0x63, 0xbe, 0x7b, 0xa9,
0x76, 0xd1, 0xba, 0x3b, 0x7f, 0x98, 0xd3, 0x32, 0xea, 0xf7, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff,
0xed, 0x99, 0x0d, 0x60, 0xcd, 0x0b, 0x00, 0x00,
}

Просмотреть файл

@ -136,24 +136,14 @@ func (ts *Server) UpdateCellInfoFields(ctx context.Context, cell string, update
// DeleteCellInfo deletes the specified CellInfo.
// We first make sure no Shard record points to the cell.
func (ts *Server) DeleteCellInfo(ctx context.Context, cell string) error {
// Get all keyspaces.
keyspaces, err := ts.GetKeyspaces(ctx)
srvKeyspaces, err := ts.GetSrvKeyspaceNames(ctx, cell)
if err != nil {
return fmt.Errorf("GetKeyspaces() failed: %v", err)
return fmt.Errorf("GetSrvKeyspaceNames() failed: %v", err)
}
// For each keyspace, make sure no shard points at the cell.
for _, keyspace := range keyspaces {
shards, err := ts.FindAllShardsInKeyspace(ctx, keyspace)
if err != nil {
return fmt.Errorf("FindAllShardsInKeyspace(%v) failed: %v", keyspace, err)
}
for shard, si := range shards {
if si.HasCell(cell) {
return fmt.Errorf("cell %v is used by shard %v/%v, cannot remove it. Use 'vtctl RemoveShardCell' to remove unused cells in a Shard", cell, keyspace, shard)
}
}
if len(srvKeyspaces) != 0 {
// TODO @rafael - implement this function and expose it via a vtctld command
return fmt.Errorf("cell %v has serving keyspaces. Before deleting, delete serving keyspace with: DeleteSrvKeyspaces", cell)
}
filePath := pathForCellInfo(cell)

Просмотреть файл

@ -145,6 +145,10 @@ func CompareShardReplications(ctx context.Context, fromTS, toTS *topo.Server) er
if err != nil {
return fmt.Errorf("fromTS.GetKeyspaces: %v", err)
}
cells, err := fromTS.GetCellInfoNames(ctx)
if err != nil {
return fmt.Errorf("GetCellInfoNames(): %v", err)
}
for _, keyspace := range keyspaces {
shards, err := fromTS.GetShardNames(ctx, keyspace)
@ -153,14 +157,7 @@ func CompareShardReplications(ctx context.Context, fromTS, toTS *topo.Server) er
}
for _, shard := range shards {
// read the source shard to get the cells
si, err := fromTS.GetShard(ctx, keyspace, shard)
if err != nil {
return fmt.Errorf("GetShard(%v, %v): %v", keyspace, shard, err)
}
for _, cell := range si.Shard.Cells {
for _, cell := range cells {
fromSRi, err := fromTS.GetShardReplication(ctx, cell, keyspace, shard)
if err != nil {
return fmt.Errorf("GetShardReplication(%v, %v, %v): %v", cell, keyspace, shard, err)

Просмотреть файл

@ -146,6 +146,11 @@ func CopyShardReplications(ctx context.Context, fromTS, toTS *topo.Server) {
log.Fatalf("fromTS.GetKeyspaces: %v", err)
}
cells, err := fromTS.GetCellInfoNames(ctx)
if err != nil {
log.Fatalf("GetCellInfoNames(): %v", err)
}
for _, keyspace := range keyspaces {
shards, err := fromTS.GetShardNames(ctx, keyspace)
if err != nil {
@ -153,14 +158,7 @@ func CopyShardReplications(ctx context.Context, fromTS, toTS *topo.Server) {
}
for _, shard := range shards {
// read the source shard to get the cells
si, err := fromTS.GetShard(ctx, keyspace, shard)
if err != nil {
log.Fatalf("GetShard(%v, %v): %v", keyspace, shard, err)
}
for _, cell := range si.Shard.Cells {
for _, cell := range cells {
sri, err := fromTS.GetShardReplication(ctx, cell, keyspace, shard)
if err != nil {
log.Fatalf("GetShardReplication(%v, %v, %v): %v", cell, keyspace, shard, err)

Просмотреть файл

@ -56,6 +56,18 @@ func addCells(left, right []string) []string {
return left
}
// removeCellsFromList will remove the cells from the provided list. It returns
// the new list, and a boolean that indicates the returned list is empty.
func removeCellsFromList(cells, toRemove []string) []string {
leftoverCells := make([]string, 0, len(cells))
for _, cell := range cells {
if !InCellList(cell, toRemove) {
leftoverCells = append(leftoverCells, cell)
}
}
return leftoverCells
}
// removeCells will remove the cells from the provided list. It returns
// the new list, and a boolean that indicates the returned list is empty.
func removeCells(cells, toRemove, fullList []string) ([]string, bool) {
@ -160,11 +172,6 @@ func (si *ShardInfo) HasMaster() bool {
return !topoproto.TabletAliasIsZero(si.Shard.MasterAlias)
}
// HasCell returns true if the cell is listed in the Cells for the shard.
func (si *ShardInfo) HasCell(cell string) bool {
return topoproto.ShardHasCell(si.Shard, cell)
}
// GetShard is a high level function to read shard data.
// It generates trace spans.
func (ts *Server) GetShard(ctx context.Context, keyspace, shard string) (*ShardInfo, error) {
@ -265,17 +272,15 @@ func (ts *Server) CreateShard(ctx context.Context, keyspace, shard string) (err
return err
}
// start the shard with all serving types. If it overlaps with
// other shards for some serving types, remove them.
servedTypes := map[topodatapb.TabletType]bool{
topodatapb.TabletType_MASTER: true,
topodatapb.TabletType_REPLICA: true,
topodatapb.TabletType_RDONLY: true,
}
value := &topodatapb.Shard{
KeyRange: keyRange,
}
isMasterServing := true
// start the shard IsMasterServing. If it overlaps with
// other shards for some serving types, remove them.
if IsShardUsingRangeBasedSharding(name) {
// if we are using range-based sharding, we don't want
// overlapping shards to all serve and confuse the clients.
@ -285,18 +290,12 @@ func (ts *Server) CreateShard(ctx context.Context, keyspace, shard string) (err
}
for _, si := range sis {
if si.KeyRange == nil || key.KeyRangesIntersect(si.KeyRange, keyRange) {
for _, st := range si.ServedTypes {
delete(servedTypes, st.TabletType)
}
isMasterServing = false
}
}
}
for st := range servedTypes {
value.ServedTypes = append(value.ServedTypes, &topodatapb.Shard_ServedType{
TabletType: st,
})
}
value.IsMasterServing = isMasterServing
// Marshal and save.
data, err := proto.Marshal(value)
@ -394,20 +393,14 @@ func (si *ShardInfo) UpdateSourceBlacklistedTables(ctx context.Context, tabletTy
// trying to add more constraints with no existing record
si.TabletControls = append(si.TabletControls, &topodatapb.Shard_TabletControl{
TabletType: tabletType,
Cells: cells,
DisableQueryService: false,
BlacklistedTables: tables,
TabletType: tabletType,
Cells: cells,
BlacklistedTables: tables,
})
return nil
}
// we have an existing record, check table lists matches and
// DisableQueryService is not set
if tc.DisableQueryService {
return fmt.Errorf("cannot safely alter BlacklistedTables as DisableQueryService is set for shard %v/%v", si.keyspace, si.shardName)
}
if remove {
si.removeCellsFromTabletControl(tc, tabletType, cells)
} else {
@ -420,54 +413,9 @@ func (si *ShardInfo) UpdateSourceBlacklistedTables(ctx context.Context, tabletTy
return nil
}
// UpdateDisableQueryService will make sure the disableQueryService is
// set appropriately in the shard record. Note we don't support a lot
// of the corner cases:
// - we don't support DisableQueryService at the same time as BlacklistedTables,
// because it's not used in the same context (vertical vs horizontal sharding)
// This function should be called while holding the keyspace lock.
func (si *ShardInfo) UpdateDisableQueryService(ctx context.Context, tabletType topodatapb.TabletType, cells []string, disableQueryService bool) error {
if err := CheckKeyspaceLocked(ctx, si.keyspace); err != nil {
return err
}
tc := si.GetTabletControl(tabletType)
if tc == nil {
// handle the case where the TabletControl object is new
if disableQueryService {
si.TabletControls = append(si.TabletControls, &topodatapb.Shard_TabletControl{
TabletType: tabletType,
Cells: cells,
DisableQueryService: true,
BlacklistedTables: nil,
})
}
return nil
}
// we have an existing record, check table list is empty and
// DisableQueryService is set
if len(tc.BlacklistedTables) > 0 {
return fmt.Errorf("cannot safely alter DisableQueryService as BlacklistedTables is set")
}
if !tc.DisableQueryService {
// This code is unreachable because we always delete the control record when we enable QueryService.
return fmt.Errorf("cannot safely alter DisableQueryService as DisableQueryService is not set, this record should not be there for shard %v/%v", si.keyspace, si.shardName)
}
if disableQueryService {
tc.Cells = addCells(tc.Cells, cells)
} else {
if tc.Frozen {
return fmt.Errorf("migrate has gone past the point of no return, cannot re-enable serving for %v/%v", si.keyspace, si.shardName)
}
si.removeCellsFromTabletControl(tc, tabletType, cells)
}
return nil
}
func (si *ShardInfo) removeCellsFromTabletControl(tc *topodatapb.Shard_TabletControl, tabletType topodatapb.TabletType, cells []string) {
result, emptyList := removeCells(tc.Cells, cells, si.Cells)
if emptyList {
result := removeCellsFromList(tc.Cells, cells)
if len(result) == 0 {
// we don't have any cell left, we need to clear this record
var tabletControls []*topodatapb.Shard_TabletControl
for _, tc := range si.TabletControls {
@ -481,64 +429,42 @@ func (si *ShardInfo) removeCellsFromTabletControl(tc *topodatapb.Shard_TabletCon
}
}
// GetServedType returns the Shard_ServedType for a TabletType, or nil
func (si *ShardInfo) GetServedType(tabletType topodatapb.TabletType) *topodatapb.Shard_ServedType {
for _, st := range si.ServedTypes {
if st.TabletType == tabletType {
return st
}
}
return nil
}
// GetServedTypesPerCell returns the list of types this shard is serving
// in the provided cell.
func (si *ShardInfo) GetServedTypesPerCell(cell string) []topodatapb.TabletType {
result := make([]topodatapb.TabletType, 0, len(si.ServedTypes))
for _, st := range si.ServedTypes {
if InCellList(cell, st.Cells) {
result = append(result, st.TabletType)
}
}
return result
}
// UpdateServedTypesMap handles ServedTypesMap. It can add or remove cells.
func (si *ShardInfo) UpdateServedTypesMap(tabletType topodatapb.TabletType, cells []string, remove bool) error {
sst := si.GetServedType(tabletType)
// func (si *ShardInfo) UpdateServedTypesMap(tabletType topodatapb.TabletType, cells []string, remove bool) error {
// sst := si.GetServedType(tabletType)
if remove {
if sst == nil {
// nothing to remove
return nil
}
result, emptyList := removeCells(sst.Cells, cells, si.Cells)
if emptyList {
// we don't have any cell left, we need to clear this record
var servedTypes []*topodatapb.Shard_ServedType
for _, st := range si.ServedTypes {
if st.TabletType != tabletType {
servedTypes = append(servedTypes, st)
}
}
si.ServedTypes = servedTypes
return nil
}
sst.Cells = result
return nil
}
// if remove {
// if sst == nil {
// // nothing to remove
// return nil
// }
// result, emptyList := removeCells(sst.Cells, cells, si.Cells)
// if emptyList {
// // we don't have any cell left, we need to clear this record
// var servedTypes []*topodatapb.Shard_ServedType
// for _, st := range si.ServedTypes {
// if st.TabletType != tabletType {
// servedTypes = append(servedTypes, st)
// }
// }
// si.ServedTypes = servedTypes
// return nil
// }
// sst.Cells = result
// return nil
// }
// add
if sst == nil {
si.ServedTypes = append(si.ServedTypes, &topodatapb.Shard_ServedType{
TabletType: tabletType,
Cells: cells,
})
return nil
}
sst.Cells = addCells(sst.Cells, cells)
return nil
}
// // add
// if sst == nil {
// si.ServedTypes = append(si.ServedTypes, &topodatapb.Shard_ServedType{
// TabletType: tabletType,
// Cells: cells,
// })
// return nil
// }
// sst.Cells = addCells(sst.Cells, cells)
// return nil
// }
//
// Utility functions for shards
@ -602,25 +528,41 @@ func (ts *Server) FindAllTabletAliasesInShardByCell(ctx context.Context, keyspac
wg := sync.WaitGroup{}
mutex := sync.Mutex{}
rec := concurrency.AllErrorRecorder{}
for _, cell := range si.Cells {
if !InCellList(cell, cells) {
continue
result := make([]*topodatapb.TabletAlias, 0, len(resultAsMap))
for _, cell := range cells {
srvKeyspace, err := ts.GetSrvKeyspace(ctx, cell, keyspace)
if err != nil {
return result, err
}
wg.Add(1)
go func(cell string) {
defer wg.Done()
sri, err := ts.GetShardReplication(ctx, cell, keyspace, shard)
if err != nil {
rec.RecordError(fmt.Errorf("GetShardReplication(%v, %v, %v) failed: %v", cell, keyspace, shard, err))
return
}
mutex.Lock()
for _, node := range sri.Nodes {
resultAsMap[topoproto.TabletAliasString(node.TabletAlias)] = node.TabletAlias
shardInCell := func() bool {
for _, partition := range srvKeyspace.GetPartitions() {
for _, shardReference := range partition.ShardReferences {
if shardReference.GetName() == shard {
return true
}
}
}
mutex.Unlock()
}(cell)
return false
}()
if shardInCell {
wg.Add(1)
go func(cell string) {
defer wg.Done()
sri, err := ts.GetShardReplication(ctx, cell, keyspace, shard)
if err != nil {
rec.RecordError(fmt.Errorf("GetShardReplication(%v, %v, %v) failed: %v", cell, keyspace, shard, err))
return
}
mutex.Lock()
for _, node := range sri.Nodes {
resultAsMap[topoproto.TabletAliasString(node.TabletAlias)] = node.TabletAlias
}
mutex.Unlock()
}(cell)
}
}
wg.Wait()
err = nil
@ -629,7 +571,6 @@ func (ts *Server) FindAllTabletAliasesInShardByCell(ctx context.Context, keyspac
err = NewError(PartialResult, shard)
}
result := make([]*topodatapb.TabletAlias, 0, len(resultAsMap))
for _, a := range resultAsMap {
v := *a
result = append(result, &v)

Просмотреть файл

@ -17,12 +17,19 @@ limitations under the License.
package topo
import (
"bytes"
"encoding/hex"
"fmt"
"path"
"sync"
"github.com/golang/protobuf/proto"
"golang.org/x/net/context"
"vitess.io/vitess/go/vt/concurrency"
"vitess.io/vitess/go/vt/topo/topoproto"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
)
@ -115,6 +122,238 @@ func (ts *Server) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]strin
}
}
// GetShardServingCells returns cells where this shard is serving
func (ts *Server) GetShardServingCells(ctx context.Context, si *ShardInfo) (servingCells []string, err error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
servingCells = make([]string, len(cells))
var mu sync.Mutex
for _, cell := range cells {
wg.Add(1)
go func(cell, keyspace string) {
defer wg.Done()
srvKeyspace, err := ts.GetSrvKeyspace(ctx, cell, si.keyspace)
switch {
case err != nil:
for _, partition := range srvKeyspace.GetPartitions() {
for _, shardReference := range partition.ShardReferences {
if shardReference.GetName() == si.ShardName() {
mu.Lock()
defer mu.Unlock()
servingCells = append(servingCells, cell)
}
}
}
case IsErrType(err, NoNode):
// NOOP
return
default:
rec.RecordError(err)
return
}
}(cell, si.Keyspace())
}
wg.Wait()
if rec.HasErrors() {
return nil, NewError(PartialResult, rec.Error().Error())
}
return servingCells, nil
}
// GetShardServingTypes returns served types for given shard across all cells
func (ts *Server) GetShardServingTypes(ctx context.Context, si *ShardInfo) (servingTypes []topodatapb.TabletType, err error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
servingTypes = make([]topodatapb.TabletType, len(cells))
var mu sync.Mutex
for _, cell := range cells {
wg.Add(1)
go func(cell, keyspace string) {
defer wg.Done()
srvKeyspace, err := ts.GetSrvKeyspace(ctx, cell, si.keyspace)
switch {
case err != nil:
for _, partition := range srvKeyspace.GetPartitions() {
for _, shardReference := range partition.ShardReferences {
if shardReference.GetName() == si.ShardName() {
mu.Lock()
defer mu.Unlock()
found := false
for _, servingType := range servingTypes {
if servingType == partition.ServedType {
found = true
}
}
if !found {
servingTypes = append(servingTypes, partition.ServedType)
}
}
}
}
case IsErrType(err, NoNode):
// NOOP
return
default:
rec.RecordError(err)
return
}
}(cell, si.Keyspace())
}
wg.Wait()
if rec.HasErrors() {
return nil, NewError(PartialResult, rec.Error().Error())
}
return servingTypes, nil
}
// RemoveShardServingKeyspace ...
func (ts *Server) RemoveShardServingKeyspace(ctx context.Context, si *ShardInfo, cells []string) (err error) {
if err = CheckKeyspaceLocked(ctx, si.keyspace); err != nil {
return err
}
// The caller intents to update all cells in this case
if len(cells) == 0 {
cells, err = ts.GetCellInfoNames(ctx)
if err != nil {
return err
}
}
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
for _, cell := range cells {
wg.Add(1)
go func(cell, keyspace string) {
defer wg.Done()
srvKeyspace, err := ts.GetSrvKeyspace(ctx, cell, si.keyspace)
switch {
case err == nil:
shardReferences := make([]*topodatapb.ShardReference, 0)
for _, partition := range srvKeyspace.GetPartitions() {
for _, shardReference := range partition.ShardReferences {
if shardReference.GetName() != si.ShardName() {
shardReferences = append(shardReferences, shardReference)
}
}
if err := OrderAndCheckPartitions(cell, srvKeyspace); err != nil {
rec.RecordError(err)
return
}
}
if err := OrderAndCheckPartitions(cell, srvKeyspace); err != nil {
rec.RecordError(err)
return
}
err = ts.UpdateSrvKeyspace(ctx, cell, si.keyspace, srvKeyspace)
if err != nil {
rec.RecordError(err)
return
}
case IsErrType(err, NoNode):
// NOOP
default:
rec.RecordError(err)
return
}
if err != nil {
rec.RecordError(err)
return
}
}(cell, si.Keyspace())
}
wg.Wait()
if rec.HasErrors() {
return NewError(PartialResult, rec.Error().Error())
}
return nil
}
// UpdateDisableQueryService will make sure the disableQueryService is
// set appropriately in the shard record. Note we don't support a lot
// of the corner cases:
// - we don't support DisableQueryService at the same time as BlacklistedTables,
// because it's not used in the same context (vertical vs horizontal sharding)
// This function should be called while holding the keyspace lock.
func (ts *Server) UpdateDisableQueryService(ctx context.Context, si *ShardInfo, tabletType topodatapb.TabletType, cells []string, disableQueryService bool) (err error) {
if err = CheckKeyspaceLocked(ctx, si.keyspace); err != nil {
return err
}
tc := si.GetTabletControl(tabletType)
// we have an existing record, check table list is empty and
// DisableQueryService is set
if tc != nil && len(tc.BlacklistedTables) > 0 {
return fmt.Errorf("cannot safely alter DisableQueryService as BlacklistedTables is set")
}
// The caller intents to update all cells in this case
if len(cells) == 0 {
cells, err = ts.GetCellInfoNames(ctx)
if err != nil {
return err
}
}
wg := sync.WaitGroup{}
rec := concurrency.AllErrorRecorder{}
for _, cell := range cells {
wg.Add(1)
go func(cell, keyspace string) {
defer wg.Done()
srvKeyspace, err := ts.GetSrvKeyspace(ctx, cell, si.keyspace)
if err != nil {
rec.RecordError(err)
return
}
for _, partition := range srvKeyspace.GetPartitions() {
if partition.GetServedType() != tabletType {
continue
}
found := false
for _, tabletControl := range partition.GetShardTabletControls() {
if tabletControl.GetName() == si.ShardName() {
found = true
tabletControl.QueryServiceDisabled = disableQueryService
}
}
if !found {
shardTabletControl := &topodatapb.ShardTabletControl{
Name: si.ShardName(),
KeyRange: si.KeyRange,
QueryServiceDisabled: true,
}
partition.ShardTabletControls = append(partition.GetShardTabletControls(), shardTabletControl)
}
}
err = ts.UpdateSrvKeyspace(ctx, cell, si.keyspace, srvKeyspace)
if err != nil {
rec.RecordError(err)
return
}
}(cell, si.Keyspace())
}
wg.Wait()
if rec.HasErrors() {
return NewError(PartialResult, rec.Error().Error())
}
return nil
}
// UpdateSrvKeyspace saves a new SrvKeyspace. It is a blind write.
func (ts *Server) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *topodatapb.SrvKeyspace) error {
conn, err := ts.ConnForCell(ctx, cell)
@ -142,6 +381,28 @@ func (ts *Server) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string)
return conn.Delete(ctx, nodePath, nil)
}
// GetSrvKeyspaceAllCells returns the SrvKeyspace for all cells
func (ts *Server) GetSrvKeyspaceAllCells(ctx context.Context, keyspace string) ([]*topodatapb.SrvKeyspace, error) {
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, err
}
srvKeyspaces := make([]*topodatapb.SrvKeyspace, len(cells))
for _, cell := range cells {
srvKeyspace, err := ts.GetSrvKeyspace(ctx, cell, keyspace)
switch {
case err == nil:
srvKeyspaces = append(srvKeyspaces, srvKeyspace)
case IsErrType(err, NoNode):
// NOOP
default:
return srvKeyspaces, err
}
}
return srvKeyspaces, nil
}
// GetSrvKeyspace returns the SrvKeyspace for a cell/keyspace.
func (ts *Server) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*topodatapb.SrvKeyspace, error) {
conn, err := ts.ConnForCell(ctx, cell)
@ -160,3 +421,54 @@ func (ts *Server) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*t
}
return srvKeyspace, nil
}
// OrderAndCheckPartitions will re-order the partition list, and check
// it's correct.
func OrderAndCheckPartitions(cell string, srvKeyspace *topodatapb.SrvKeyspace) error {
// now check them all
for _, partition := range srvKeyspace.Partitions {
tabletType := partition.ServedType
topoproto.ShardReferenceArray(partition.ShardReferences).Sort()
// check the first Start is MinKey, the last End is MaxKey,
// and the values in between match: End[i] == Start[i+1]
first := partition.ShardReferences[0]
if first.KeyRange != nil && len(first.KeyRange.Start) != 0 {
return fmt.Errorf("keyspace partition for %v in cell %v does not start with min key", tabletType, cell)
}
last := partition.ShardReferences[len(partition.ShardReferences)-1]
if last.KeyRange != nil && len(last.KeyRange.End) != 0 {
return fmt.Errorf("keyspace partition for %v in cell %v does not end with max key", tabletType, cell)
}
for i := range partition.ShardReferences[0 : len(partition.ShardReferences)-1] {
currShard := partition.ShardReferences[i]
nextShard := partition.ShardReferences[i+1]
currHasKeyRange := currShard.KeyRange != nil
nextHasKeyRange := nextShard.KeyRange != nil
if currHasKeyRange != nextHasKeyRange {
return fmt.Errorf("shards with inconsistent KeyRanges for %v in cell %v. shards: %v, %v", tabletType, cell, currShard, nextShard)
}
if !currHasKeyRange {
// this is the custom sharding case, all KeyRanges must be nil
continue
}
if bytes.Compare(currShard.KeyRange.End, nextShard.KeyRange.Start) != 0 {
return fmt.Errorf("non-contiguous KeyRange values for %v in cell %v at shard %v to %v: %v != %v", tabletType, cell, i, i+1, hex.EncodeToString(currShard.KeyRange.End), hex.EncodeToString(nextShard.KeyRange.Start))
}
}
}
return nil
}
// ShardIsServing returns true if this shard is found in any of the partitions in the srvKeyspace
func ShardIsServing(srvKeyspace *topodatapb.SrvKeyspace, shard *topodatapb.Shard) bool {
for _, partition := range srvKeyspace.GetPartitions() {
for _, shardReference := range partition.GetShardReferences() {
if shardReference.GetKeyRange() == shard.KeyRange {
return true
}
}
}
return false
}

Просмотреть файл

@ -61,13 +61,3 @@ func SourceShardAsHTML(source *topodatapb.Shard_SourceShard) template.HTML {
}
return template.HTML(result)
}
// ShardHasCell returns true if the cell is listed in the Cells for the shard.
func ShardHasCell(shard *topodatapb.Shard, cell string) bool {
for _, c := range shard.Cells {
if c == cell {
return true
}
}
return false
}

Просмотреть файл

@ -17,8 +17,6 @@ limitations under the License.
package topotools
import (
"bytes"
"encoding/hex"
"fmt"
"sync"
@ -42,25 +40,6 @@ func RebuildKeyspace(ctx context.Context, log logutil.Logger, ts *topo.Server, k
return RebuildKeyspaceLocked(ctx, log, ts, keyspace, cells)
}
// findCellsForRebuild will find all the cells in the given keyspace
// and create an entry if the map for them
func findCellsForRebuild(ki *topo.KeyspaceInfo, shardMap map[string]*topo.ShardInfo, cells []string, srvKeyspaceMap map[string]*topodatapb.SrvKeyspace) {
for _, si := range shardMap {
for _, cell := range si.Cells {
if !topo.InCellList(cell, cells) {
continue
}
if _, ok := srvKeyspaceMap[cell]; !ok {
srvKeyspaceMap[cell] = &topodatapb.SrvKeyspace{
ShardingColumnName: ki.ShardingColumnName,
ShardingColumnType: ki.ShardingColumnType,
ServedFrom: ki.ComputeCellServedFrom(cell),
}
}
}
}
}
// RebuildKeyspaceLocked should only be used with an action lock on the keyspace
// - otherwise the consistency of the serving graph data can't be
// guaranteed.
@ -90,15 +69,24 @@ func RebuildKeyspaceLocked(ctx context.Context, log logutil.Logger, ts *topo.Ser
// key: cell
// value: topo.SrvKeyspace object being built
srvKeyspaceMap := make(map[string]*topodatapb.SrvKeyspace)
findCellsForRebuild(ki, shards, cells, srvKeyspaceMap)
// Then we add the cells from the keyspaces we might be 'ServedFrom'.
for _, ksf := range ki.ServedFroms {
servedFromShards, err := ts.FindAllShardsInKeyspace(ctx, ksf.Keyspace)
if err != nil {
return err
for _, cell := range cells {
_, err := ts.GetSrvKeyspace(ctx, cell, keyspace)
switch {
case err == nil:
// NOOP
case topo.IsErrType(err, topo.NoNode):
if _, ok := srvKeyspaceMap[cell]; !ok {
srvKeyspaceMap[cell] = &topodatapb.SrvKeyspace{
ShardingColumnName: ki.ShardingColumnName,
ShardingColumnType: ki.ShardingColumnType,
ServedFrom: ki.ComputeCellServedFrom(cell),
}
}
default:
// Couldn't get srvKeyspace, not
log.Warningf("Couldn't get srvKeyspace for cell %v, skip rebuilding", cell)
}
findCellsForRebuild(ki, servedFromShards, cells, srvKeyspaceMap)
}
// for each entry in the srvKeyspaceMap map, we do the following:
@ -108,9 +96,12 @@ func RebuildKeyspaceLocked(ctx context.Context, log logutil.Logger, ts *topo.Ser
// - sort the shards in the list by range
// - check the ranges are compatible (no hole, covers everything)
for cell, srvKeyspace := range srvKeyspaceMap {
// this is not an error
for _, si := range shards {
servedTypes := si.GetServedTypesPerCell(cell)
if !si.IsMasterServing {
continue
}
servedTypes := []topodatapb.TabletType{topodatapb.TabletType_MASTER, topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY}
// for each type this shard is supposed to serve,
// add it to srvKeyspace.Partitions
for _, tabletType := range servedTypes {
@ -128,11 +119,11 @@ func RebuildKeyspaceLocked(ctx context.Context, log logutil.Logger, ts *topo.Ser
}
}
if err := orderAndCheckPartitions(cell, srvKeyspace); err != nil {
if err := topo.OrderAndCheckPartitions(cell, srvKeyspace); err != nil {
return err
}
}
}
// And then finally save the keyspace objects, in parallel.
rec := concurrency.AllErrorRecorder{}
wg := sync.WaitGroup{}
@ -149,42 +140,3 @@ func RebuildKeyspaceLocked(ctx context.Context, log logutil.Logger, ts *topo.Ser
wg.Wait()
return rec.Error()
}
// orderAndCheckPartitions will re-order the partition list, and check
// it's correct.
func orderAndCheckPartitions(cell string, srvKeyspace *topodatapb.SrvKeyspace) error {
// now check them all
for _, partition := range srvKeyspace.Partitions {
tabletType := partition.ServedType
topoproto.ShardReferenceArray(partition.ShardReferences).Sort()
// check the first Start is MinKey, the last End is MaxKey,
// and the values in between match: End[i] == Start[i+1]
first := partition.ShardReferences[0]
if first.KeyRange != nil && len(first.KeyRange.Start) != 0 {
return fmt.Errorf("keyspace partition for %v in cell %v does not start with min key", tabletType, cell)
}
last := partition.ShardReferences[len(partition.ShardReferences)-1]
if last.KeyRange != nil && len(last.KeyRange.End) != 0 {
return fmt.Errorf("keyspace partition for %v in cell %v does not end with max key", tabletType, cell)
}
for i := range partition.ShardReferences[0 : len(partition.ShardReferences)-1] {
currShard := partition.ShardReferences[i]
nextShard := partition.ShardReferences[i+1]
currHasKeyRange := currShard.KeyRange != nil
nextHasKeyRange := nextShard.KeyRange != nil
if currHasKeyRange != nextHasKeyRange {
return fmt.Errorf("shards with inconsistent KeyRanges for %v in cell %v. shards: %v, %v", tabletType, cell, currShard, nextShard)
}
if !currHasKeyRange {
// this is the custom sharding case, all KeyRanges must be nil
continue
}
if bytes.Compare(currShard.KeyRange.End, nextShard.KeyRange.Start) != 0 {
return fmt.Errorf("non-contiguous KeyRange values for %v in cell %v at shard %v to %v: %v != %v", tabletType, cell, i, i+1, hex.EncodeToString(currShard.KeyRange.End), hex.EncodeToString(nextShard.KeyRange.Start))
}
}
}
return nil
}

Просмотреть файл

@ -1319,7 +1319,10 @@ func commandSetShardTabletControl(ctx context.Context, wr *wrangler.Wrangler, su
cells = strings.Split(*cellsStr, ",")
}
return wr.SetShardTabletControl(ctx, keyspace, shard, tabletType, cells, *remove, *disableQueryService, blacklistedTables)
if len(blacklistedTables) > 0 {
return wr.SetShardTabletControl(ctx, keyspace, shard, tabletType, cells, *remove, blacklistedTables)
}
return wr.UpdateDisableQueryService(ctx, keyspace, shard, tabletType, cells, *disableQueryService)
}
func commandSourceShardDelete(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {

Просмотреть файл

@ -122,22 +122,6 @@ func (agent *ActionAgent) InitTablet(port, gRPCPort int32) error {
}
}
// See if we need to add the tablet's cell to the shard's cell list.
if !si.HasCell(agent.TabletAlias.Cell) {
if err := agent.withRetry(ctx, "updating Cells list in Shard if necessary", func() error {
si, err = agent.TopoServer.UpdateShardFields(ctx, *initKeyspace, shard, func(si *topo.ShardInfo) error {
if si.HasCell(agent.TabletAlias.Cell) {
// Someone else already did it.
return topo.NewError(topo.NoUpdateNeeded, agent.TabletAlias.String())
}
si.Cells = append(si.Cells, agent.TabletAlias.Cell)
return nil
})
return err
}); err != nil {
return vterrors.Wrap(err, "couldn't add tablet's cell to shard record")
}
}
log.Infof("Initializing the tablet for type %v", tabletType)
// figure out the hostname

Просмотреть файл

@ -217,12 +217,25 @@ func (agent *ActionAgent) changeCallback(ctx context.Context, oldTablet, newTabl
disallowQueryReason = "master tablet with filtered replication on"
}
}
srvKeyspace, err := agent.TopoServer.GetSrvKeyspace(ctx, newTablet.Alias.Cell, newTablet.Keyspace)
if err != nil {
log.Error("Fail to get SrvKeyspace")
} else {
for _, partition := range srvKeyspace.GetPartitions() {
for _, tabletControl := range partition.GetShardTabletControls() {
if tabletControl.Name == newTablet.Shard {
if tabletControl.QueryServiceDisabled {
allowQuery = false
disallowQueryReason = "SrvKeyspace.QueryServiceEnabled set to false"
}
}
}
}
}
if tc := shardInfo.GetTabletControl(newTablet.Type); tc != nil {
if topo.InCellList(newTablet.Alias.Cell, tc.Cells) {
if tc.DisableQueryService {
allowQuery = false
disallowQueryReason = "TabletControl.DisableQueryService set"
}
blacklistedTables = tc.BlacklistedTables
}
}

Просмотреть файл

@ -290,7 +290,12 @@ func (scw *LegacySplitCloneWorker) init(ctx context.Context) error {
// one side should have served types, the other one none,
// figure out wich is which, then double check them all
if len(os.Left[0].ServedTypes) > 0 {
leftServingTypes, err := scw.wr.TopoServer().GetShardServingTypes(ctx, os.Left[0])
if err != nil {
return fmt.Errorf("cannot get shard serving cells for: %v", os.Left[0])
}
if len(leftServingTypes) > 0 {
scw.sourceShards = os.Left
scw.destinationShards = os.Right
} else {
@ -311,13 +316,29 @@ func (scw *LegacySplitCloneWorker) init(ctx context.Context) error {
servingTypes := []topodatapb.TabletType{topodatapb.TabletType_MASTER, topodatapb.TabletType_REPLICA, topodatapb.TabletType_RDONLY}
for _, st := range servingTypes {
for _, si := range scw.sourceShards {
if si.GetServedType(st) == nil {
shardServingTypes, err := scw.wr.TopoServer().GetShardServingTypes(ctx, si)
if err != nil {
return fmt.Errorf("failed to get ServingTypes for source shard %v/%v", si.Keyspace(), si.ShardName())
}
found := false
for _, shardServingType := range shardServingTypes {
if shardServingType == st {
found = true
}
}
if !found {
return fmt.Errorf("source shard %v/%v is not serving type %v", si.Keyspace(), si.ShardName(), st)
}
}
}
for _, si := range scw.destinationShards {
if len(si.ServedTypes) > 0 {
shardServingTypes, err := scw.wr.TopoServer().GetShardServingTypes(ctx, si)
if err != nil {
return fmt.Errorf("failed to get ServingTypes for destination shard %v/%v", si.Keyspace(), si.ShardName())
}
if len(shardServingTypes) > 0 {
return fmt.Errorf("destination shard %v/%v is serving some types", si.Keyspace(), si.ShardName())
}
}

Просмотреть файл

@ -550,7 +550,7 @@ func (scw *SplitCloneWorker) init(ctx context.Context) error {
}
}
if err := scw.sanityCheckShardInfos(); err != nil {
if err := scw.sanityCheckShardInfos(ctx); err != nil {
return vterrors.Wrap(err, "failed sanityCheckShardInfos")
}
@ -596,7 +596,11 @@ func (scw *SplitCloneWorker) initShardsForHorizontalResharding(ctx context.Conte
// one side should have served types, the other one none,
// figure out wich is which, then double check them all
if len(os.Left[0].ServedTypes) > 0 {
leftServingTypes, err := scw.wr.TopoServer().GetShardServingTypes(ctx, os.Left[0])
if err != nil {
return fmt.Errorf("cannot get shard serving cells for: %v", os.Left[0])
}
if len(leftServingTypes) > 0 {
scw.sourceShards = os.Left
scw.destinationShards = os.Right
} else {
@ -662,7 +666,7 @@ func (scw *SplitCloneWorker) initShardsForVerticalSplit(ctx context.Context) err
return nil
}
func (scw *SplitCloneWorker) sanityCheckShardInfos() error {
func (scw *SplitCloneWorker) sanityCheckShardInfos(ctx context.Context) error {
// Verify that filtered replication is not already enabled.
for _, si := range scw.destinationShards {
if len(si.SourceShards) > 0 {
@ -674,7 +678,18 @@ func (scw *SplitCloneWorker) sanityCheckShardInfos() error {
// Verify that the source is serving all serving types.
for _, st := range servingTypes {
for _, si := range scw.sourceShards {
if si.GetServedType(st) == nil {
shardServingTypes, err := scw.wr.TopoServer().GetShardServingTypes(ctx, si)
if err != nil {
return fmt.Errorf("failed to get ServingTypes for source shard %v/%v", si.Keyspace(), si.ShardName())
}
found := false
for _, shardServingType := range shardServingTypes {
if shardServingType == st {
found = true
}
}
if !found {
return fmt.Errorf("source shard %v/%v is not serving type %v", si.Keyspace(), si.ShardName(), st)
}
}
@ -684,15 +699,32 @@ func (scw *SplitCloneWorker) sanityCheckShardInfos() error {
case horizontalResharding:
// Verify that the destination is not serving yet.
for _, si := range scw.destinationShards {
if len(si.ServedTypes) > 0 {
shardServingTypes, err := scw.wr.TopoServer().GetShardServingTypes(ctx, si)
if err != nil {
return fmt.Errorf("failed to get ServingTypes for destination shard %v/%v", si.Keyspace(), si.ShardName())
}
if len(shardServingTypes) > 0 {
return fmt.Errorf("destination shard %v/%v is serving some types", si.Keyspace(), si.ShardName())
}
}
case verticalSplit:
// Verify that the destination is serving all types.
for _, st := range servingTypes {
for _, si := range scw.destinationShards {
if si.GetServedType(st) == nil {
shardServingTypes, err := scw.wr.TopoServer().GetShardServingTypes(ctx, si)
if err != nil {
return fmt.Errorf("failed to get ServingTypes for source shard %v/%v", si.Keyspace(), si.ShardName())
}
found := false
for _, shardServingType := range shardServingTypes {
if shardServingType == st {
found = true
}
}
if !found {
return fmt.Errorf("source shard %v/%v is not serving type %v", si.Keyspace(), si.ShardName(), st)
}
}

Просмотреть файл

@ -167,7 +167,11 @@ func findSourceAndDestinationShards(ts *topo.Server, keyspace string) ([][][]str
var sourceShardInfo *topo.ShardInfo
var destinationShardInfos []*topo.ShardInfo
// Judge which side is source shard by checking the number of servedTypes.
if len(os.Left[0].ServedTypes) > 0 {
leftServingTypes, err := ts.GetShardServingTypes(context.Background(), os.Left[0])
if err != nil {
return nil, err
}
if len(leftServingTypes) > 0 {
sourceShardInfo = os.Left[0]
destinationShardInfos = os.Right
} else {

Просмотреть файл

@ -145,9 +145,7 @@ func (wr *Wrangler) printShards(ctx context.Context, si []*topo.ShardInfo) error
wr.Logger().Printf(" %v\n", row)
}
}
if len(si.ServedTypes) != 0 {
wr.Logger().Printf(" Served Types: %v\n", si.ServedTypes)
}
wr.Logger().Printf(" Served Types: %v\n", si.IsMasterServing)
if len(si.TabletControls) != 0 {
wr.Logger().Printf(" Tablet Controls: %v\n", si.TabletControls)
}
@ -191,9 +189,18 @@ func (wr *Wrangler) cancelHorizontalResharding(ctx context.Context, keyspace, sh
if err != nil {
return err
}
// get srvKeyspaces in all cells to check if they are already serving this shard
srvKeyspaces, err := wr.ts.GetSrvKeyspaceAllCells(ctx, keyspace)
if err != nil {
return err
}
for _, si := range destinationShards {
if len(si.ServedTypes) != 0 {
return fmt.Errorf("some served types have migrated for %v/%v, please undo them before canceling", keyspace, shard)
for _, srvKeyspace := range srvKeyspaces {
if topo.ShardIsServing(srvKeyspace, si.Shard) {
return fmt.Errorf("some served types have migrated for %v/%v, please undo them before canceling", keyspace, shard)
}
}
}
for i, si := range destinationShards {
@ -491,14 +498,26 @@ func (wr *Wrangler) replicaMigrateServedType(ctx context.Context, keyspace strin
// masterMigrateServedType operates with the keyspace locked
func (wr *Wrangler) masterMigrateServedType(ctx context.Context, keyspace string, sourceShards, destinationShards []*topo.ShardInfo, filteredReplicationWaitTime time.Duration, reverseReplication bool) (err error) {
// Ensure other served types have migrated.
if si := sourceShards[0]; len(si.ServedTypes) > 1 {
srvKeyspaces, err := wr.ts.GetSrvKeyspaceAllCells(ctx, keyspace)
if err != nil {
return err
}
si := sourceShards[0]
for _, srvKeyspace := range srvKeyspaces {
var types []string
for _, servedType := range si.ServedTypes {
if servedType.TabletType != topodatapb.TabletType_MASTER {
types = append(types, servedType.TabletType.String())
for _, partition := range srvKeyspace.GetPartitions() {
if partition.GetServedType() != topodatapb.TabletType_MASTER {
for _, shardReference := range partition.GetShardReferences() {
if shardReference.GetKeyRange() == si.GetKeyRange() {
types = append(types, partition.GetServedType().String())
}
}
}
}
return fmt.Errorf("cannot migrate MASTER away from %v/%v until everything else is migrated. Make sure that the following types are migrated first: %v", si.Keyspace(), si.ShardName(), strings.Join(types, ", "))
if len(types) > 0 {
return fmt.Errorf("cannot migrate MASTER away from %v/%v until everything else is migrated. Make sure that the following types are migrated first: %v", si.Keyspace(), si.ShardName(), strings.Join(types, ", "))
}
}
ev := &events.MigrateServedTypes{
@ -577,19 +596,14 @@ func (wr *Wrangler) masterMigrateServedType(ctx context.Context, keyspace string
}
// Similar to updateShardRecords, but we also remove SourceShards.
destinationShards[i], err = wr.ts.UpdateShardFields(ctx, si.Keyspace(), si.ShardName(), func(si *topo.ShardInfo) error {
if err := si.UpdateServedTypesMap(topodatapb.TabletType_MASTER, nil, false); err != nil {
return err
}
if err := si.UpdateDisableQueryService(ctx, topodatapb.TabletType_MASTER, nil, false); err != nil {
return err
}
si.SourceShards = nil
return nil
})
if err != nil {
return err
}
wr.ts.UpdateDisableQueryService(ctx, si, topodatapb.TabletType_MASTER, nil, false)
}
event.DispatchUpdate(ev, "setting destination masters read-write")
@ -700,15 +714,20 @@ func (wr *Wrangler) startReverseReplication(ctx context.Context, sourceShards []
// updateShardRecords updates the shard records based on 'from' or 'to' direction.
func (wr *Wrangler) updateShardRecords(ctx context.Context, shards []*topo.ShardInfo, cells []string, servedType topodatapb.TabletType, isFrom bool, clearSourceShards bool) (err error) {
for i, si := range shards {
err := wr.ts.UpdateDisableQueryService(ctx, si, servedType, cells, isFrom /* disable */)
if err != nil {
return err
}
shards[i], err = wr.ts.UpdateShardFields(ctx, si.Keyspace(), si.ShardName(), func(si *topo.ShardInfo) error {
if clearSourceShards {
si.SourceShards = nil
}
if err := si.UpdateServedTypesMap(servedType, cells, isFrom /* remove */); err != nil {
return err
}
return si.UpdateDisableQueryService(ctx, servedType, cells, isFrom /* disable */)
return nil
})
if err != nil {
return err
}
@ -747,13 +766,13 @@ func (wr *Wrangler) updateFrozenFlag(ctx context.Context, shards []*topo.ShardIn
// be observed.
func (wr *Wrangler) WaitForDrain(ctx context.Context, cells []string, keyspace, shard string, servedType topodatapb.TabletType,
retryDelay, healthCheckTopologyRefresh, healthcheckRetryDelay, healthCheckTimeout, initialWait time.Duration) error {
var err error
if len(cells) == 0 {
// Retrieve list of cells for the shard from the topology.
shardInfo, err := wr.ts.GetShard(ctx, keyspace, shard)
cells, err = wr.ts.GetCellInfoNames(ctx)
if err != nil {
return fmt.Errorf("failed to retrieve list of all cells. GetShard() failed: %v", err)
return fmt.Errorf("failed to retrieve list of all cells. GetCellInfoNames() failed: %v", err)
}
cells = shardInfo.Cells
}
// Check all cells in parallel.
@ -976,7 +995,8 @@ func (wr *Wrangler) migrateServedFromLocked(ctx context.Context, ki *topo.Keyspa
if reverse {
ki.UpdateServedFromMap(servedType, cells, destinationShard.SourceShards[0].Keyspace, false, nil)
} else {
ki.UpdateServedFromMap(servedType, cells, destinationShard.SourceShards[0].Keyspace, true, destinationShard.Cells)
// Check with Sugi, I think in this world, there is no longer the concept of a destinationShard.Cells, so it must be think as all cells all the time.
ki.UpdateServedFromMap(servedType, cells, destinationShard.SourceShards[0].Keyspace, true, nil)
}
// re-read and check the destination shard

Просмотреть файл

@ -30,14 +30,11 @@ import (
// updateShardCellsAndMaster will update the 'Cells' and possibly
// MasterAlias records for the shard, if needed.
func (wr *Wrangler) updateShardCellsAndMaster(ctx context.Context, si *topo.ShardInfo, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType, allowMasterOverride bool) error {
func (wr *Wrangler) updateShardMaster(ctx context.Context, si *topo.ShardInfo, tabletAlias *topodatapb.TabletAlias, tabletType topodatapb.TabletType, allowMasterOverride bool) error {
// See if we need to update the Shard:
// - add the tablet's cell to the shard's Cells if needed
// - change the master if needed
shardUpdateRequired := false
if !si.HasCell(tabletAlias.Cell) {
shardUpdateRequired = true
}
if tabletType == topodatapb.TabletType_MASTER && !topoproto.TabletAliasEqual(si.MasterAlias, tabletAlias) {
shardUpdateRequired = true
}
@ -48,10 +45,6 @@ func (wr *Wrangler) updateShardCellsAndMaster(ctx context.Context, si *topo.Shar
// run the update
_, err := wr.ts.UpdateShardFields(ctx, si.Keyspace(), si.ShardName(), func(s *topo.ShardInfo) error {
wasUpdated := false
if !s.HasCell(tabletAlias.Cell) {
s.Cells = append(s.Cells, tabletAlias.Cell)
wasUpdated = true
}
if tabletType == topodatapb.TabletType_MASTER && !topoproto.TabletAliasEqual(s.MasterAlias, tabletAlias) {
if !topoproto.TabletAliasIsZero(s.MasterAlias) && !allowMasterOverride {
@ -81,26 +74,20 @@ func (wr *Wrangler) SetShardServedTypes(ctx context.Context, keyspace, shard str
defer unlock(&err)
// and update the shard
_, err = wr.ts.UpdateShardFields(ctx, keyspace, shard, func(si *topo.ShardInfo) error {
return si.UpdateServedTypesMap(servedType, cells, remove)
})
// TODO: What should we do with this method?
//_, err = wr.ts.UpdateShardFields(ctx, keyspace, shard, func(si *topo.ShardInfo) error {
//return si.UpdateServedTypesMap(servedType, cells, remove)
//})
return err
}
// SetShardTabletControl changes the TabletControl records
// for a shard. It does not rebuild any serving graph or do
// cross-shard consistency check.
// - if disableQueryService is set, tables has to be empty
// - if disableQueryService is not set, and tables is empty, we remove
// the TabletControl record for the cells
// - sets black listed tables in tablet control record
//
// This takes the keyspace lock as to not interfere with resharding operations.
func (wr *Wrangler) SetShardTabletControl(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove, disableQueryService bool, blacklistedTables []string) (err error) {
// check input
if disableQueryService && len(blacklistedTables) > 0 {
return fmt.Errorf("SetShardTabletControl cannot have both DisableQueryService and BlacklistedTables set")
}
func (wr *Wrangler) SetShardTabletControl(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, remove bool, blacklistedTables []string) (err error) {
// lock the keyspace
ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetShardTabletControl")
if lockErr != nil {
@ -110,17 +97,32 @@ func (wr *Wrangler) SetShardTabletControl(ctx context.Context, keyspace, shard s
// update the shard
_, err = wr.ts.UpdateShardFields(ctx, keyspace, shard, func(si *topo.ShardInfo) error {
if len(blacklistedTables) == 0 && !remove {
// we are setting the DisableQueryService flag only
return si.UpdateDisableQueryService(ctx, tabletType, cells, disableQueryService)
}
// we are setting / removing the blacklisted tables only
return si.UpdateSourceBlacklistedTables(ctx, tabletType, cells, remove, blacklistedTables)
})
return err
}
// UpdateDisableQueryService changes the TabletControl records
// for a shard. It updates serving graph
//
// This takes the keyspace lock as to not interfere with resharding operations.
func (wr *Wrangler) UpdateDisableQueryService(ctx context.Context, keyspace, shard string, tabletType topodatapb.TabletType, cells []string, disableQueryService bool) (err error) {
// lock the keyspace
ctx, unlock, lockErr := wr.ts.LockKeyspace(ctx, keyspace, "SetShardTabletControl")
if lockErr != nil {
return lockErr
}
defer unlock(&err)
si, err := wr.ts.GetShard(ctx, keyspace, shard)
if err != nil {
return err
}
// disable query service for shard
return wr.ts.UpdateDisableQueryService(ctx, si, tabletType, cells, disableQueryService)
}
// DeleteShard will do all the necessary changes in the topology server
// to entirely remove a shard.
func (wr *Wrangler) DeleteShard(ctx context.Context, keyspace, shard string, recursive, evenIfServing bool) error {
@ -135,14 +137,23 @@ func (wr *Wrangler) DeleteShard(ctx context.Context, keyspace, shard string, rec
return err
}
servingCells, err := wr.ts.GetShardServingCells(ctx, shardInfo)
if err != nil {
return err
}
// Check the Serving map for the shard, we don't want to
// remove a serving shard if not absolutely sure.
if !evenIfServing && len(shardInfo.ServedTypes) > 0 {
if !evenIfServing && len(servingCells) > 0 {
return fmt.Errorf("shard %v/%v is still serving, cannot delete it, use even_if_serving flag if needed", keyspace, shard)
}
cells, err := wr.ts.GetCellInfoNames(ctx)
if err != nil {
return err
}
// Go through all the cells.
for _, cell := range shardInfo.Cells {
for _, cell := range cells {
var aliases []*topodatapb.TabletAlias
// Get the ShardReplication object for that cell. Try
@ -216,7 +227,7 @@ func (wr *Wrangler) DeleteShard(ctx context.Context, keyspace, shard string, rec
// Try to remove the replication graph and serving graph in each cell,
// regardless of its existence.
for _, cell := range shardInfo.Cells {
for _, cell := range cells {
if err := wr.ts.DeleteShardReplication(ctx, cell, keyspace, shard); err != nil && !topo.IsErrType(err, topo.NoNode) {
wr.Logger().Warningf("Cannot delete ShardReplication in cell %v for %v/%v: %v", cell, keyspace, shard, err)
}
@ -240,8 +251,10 @@ func (wr *Wrangler) RemoveShardCell(ctx context.Context, keyspace, shard, cell s
return err
}
shardServingCells, err := wr.ts.GetShardServingCells(ctx, shardInfo)
// check the cell is in the list already
if !topo.InCellList(cell, shardInfo.Cells) {
if !topo.InCellList(cell, shardServingCells) {
return fmt.Errorf("cell %v in not in shard info", cell)
}
@ -286,22 +299,9 @@ func (wr *Wrangler) RemoveShardCell(ctx context.Context, keyspace, shard, cell s
}
// now we can update the shard
wr.Logger().Infof("Removing cell %v from shard %v/%v", cell, keyspace, shard)
_, err = wr.ts.UpdateShardFields(ctx, keyspace, shard, func(si *topo.ShardInfo) error {
// since no lock is taken, protect against corner cases.
if len(si.Cells) == 0 {
return topo.NewError(topo.NoUpdateNeeded, si.Keyspace()+"/"+si.ShardName())
}
var newCells []string
for _, c := range si.Cells {
if c != cell {
newCells = append(newCells, c)
}
}
si.Cells = newCells
return nil
})
return err
wr.Logger().Infof("Removing cell %v from SrvKeyspace %v/%v", cell, keyspace, shard)
return wr.ts.RemoveShardServingKeyspace(ctx, shardInfo, shardServingCells)
}
// SourceShardDelete will delete a SourceShard inside a shard, by index.

Просмотреть файл

@ -71,7 +71,7 @@ func (wr *Wrangler) InitTablet(ctx context.Context, tablet *topodatapb.Tablet, a
}
// update the shard record if needed
if err := wr.updateShardCellsAndMaster(ctx, si, tablet.Alias, tablet.Type, allowMasterOverride); err != nil {
if err := wr.updateShardMaster(ctx, si, tablet.Alias, tablet.Type, allowMasterOverride); err != nil {
return err
}

Просмотреть файл

@ -173,16 +173,6 @@ message Shard {
// Once set at creation time, it is never changed.
KeyRange key_range = 2;
// ServedType is an entry in the served_types
message ServedType {
TabletType tablet_type = 1;
repeated string cells = 2;
}
// served_types has at most one entry per TabletType
// The keyspace lock is always taken when changing this.
repeated ServedType served_types = 3;
// SourceShard represents a data source for filtered replication
// accross shards. When this is used in a destination shard, the master
// of that shard will run filtered replication.
@ -208,18 +198,15 @@ message Shard {
// The keyspace lock is always taken when changing this.
repeated SourceShard source_shards = 4;
// Cells is the list of cells that contain tablets for this shard.
// No lock is necessary to update this field.
repeated string cells = 5;
// TabletControl controls tablet's behavior
message TabletControl {
// which tablet type is affected
TabletType tablet_type = 1;
repeated string cells = 2;
// what to do
bool disable_query_service = 3;
// OBSOLETE: disable_query_service 3
reserved 3;
repeated string blacklisted_tables = 4;
// frozen is set if we've started failing over traffic for
@ -230,6 +217,13 @@ message Shard {
// tablet_controls has at most one entry per TabletType.
// The keyspace lock is always taken when changing this.
repeated TabletControl tablet_controls = 6;
// is_master_serving sets whether this shard master is serving traffic or not.
// The keyspace lock is always taken when changing this.
bool is_master_serving = 7;
// OBSOLETE fields: served_types (3), cells (5)
reserved 3, 5;
}
// A Keyspace contains data about a keyspace.
@ -282,6 +276,16 @@ message ShardReference {
// Copied from Shard.
string name = 1;
KeyRange key_range = 2;
// Disable query serving in this shard
}
// ShardTabletControl is used as a pointer from a SrvKeyspace to a Shard
message ShardTabletControl {
// Copied from Shard.
string name = 1;
KeyRange key_range = 2;
// Disable query serving in this shard
bool query_service_disabled = 3;
}
// SrvKeyspace is a rollup node for the keyspace itself.
@ -292,6 +296,9 @@ message SrvKeyspace {
// List of non-overlapping continuous shards sorted by range.
repeated ShardReference shard_references = 2;
// List of shard tablet controls
repeated ShardTabletControl shard_tablet_controls = 3;
}
// The partitions this keyspace is serving, per tablet type.

Просмотреть файл

@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package='topodata',
syntax='proto3',
serialized_options=_b('\n\017io.vitess.protoZ%vitess.io/vitess/go/vt/proto/topodata'),
serialized_pb=_b('\n\x0etopodata.proto\x12\x08topodata\"&\n\x08KeyRange\x12\r\n\x05start\x18\x01 \x01(\x0c\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x0c\"(\n\x0bTabletAlias\x12\x0c\n\x04\x63\x65ll\x18\x01 \x01(\t\x12\x0b\n\x03uid\x18\x02 \x01(\r\"\xb6\x03\n\x06Tablet\x12$\n\x05\x61lias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\x12\x10\n\x08hostname\x18\x02 \x01(\t\x12/\n\x08port_map\x18\x04 \x03(\x0b\x32\x1d.topodata.Tablet.PortMapEntry\x12\x10\n\x08keyspace\x18\x05 \x01(\t\x12\r\n\x05shard\x18\x06 \x01(\t\x12%\n\tkey_range\x18\x07 \x01(\x0b\x32\x12.topodata.KeyRange\x12\"\n\x04type\x18\x08 \x01(\x0e\x32\x14.topodata.TabletType\x12\x18\n\x10\x64\x62_name_override\x18\t \x01(\t\x12(\n\x04tags\x18\n \x03(\x0b\x32\x1a.topodata.Tablet.TagsEntry\x12\x16\n\x0emysql_hostname\x18\x0c \x01(\t\x12\x12\n\nmysql_port\x18\r \x01(\x05\x1a.\n\x0cPortMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01J\x04\x08\x03\x10\x04J\x04\x08\x0b\x10\x0c\"\xdb\x04\n\x05Shard\x12+\n\x0cmaster_alias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x30\n\x0cserved_types\x18\x03 \x03(\x0b\x32\x1a.topodata.Shard.ServedType\x12\x32\n\rsource_shards\x18\x04 \x03(\x0b\x32\x1b.topodata.Shard.SourceShard\x12\r\n\x05\x63\x65lls\x18\x05 \x03(\t\x12\x36\n\x0ftablet_controls\x18\x06 \x03(\x0b\x32\x1d.topodata.Shard.TabletControl\x1a\x46\n\nServedType\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x1ar\n\x0bSourceShard\x12\x0b\n\x03uid\x18\x01 \x01(\r\x12\x10\n\x08keyspace\x18\x02 \x01(\t\x12\r\n\x05shard\x18\x03 \x01(\t\x12%\n\tkey_range\x18\x04 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x0e\n\x06tables\x18\x05 \x03(\t\x1a\x94\x01\n\rTabletControl\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x12\x1d\n\x15\x64isable_query_service\x18\x03 \x01(\x08\x12\x1a\n\x12\x62lacklisted_tables\x18\x04 \x03(\t\x12\x0e\n\x06\x66rozen\x18\x05 \x01(\x08\"\xf5\x01\n\x08Keyspace\x12\x1c\n\x14sharding_column_name\x18\x01 \x01(\t\x12\x36\n\x14sharding_column_type\x18\x02 \x01(\x0e\x32\x18.topodata.KeyspaceIdType\x12\x33\n\x0cserved_froms\x18\x04 \x03(\x0b\x32\x1d.topodata.Keyspace.ServedFrom\x1aX\n\nServedFrom\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x12\x10\n\x08keyspace\x18\x03 \x01(\tJ\x04\x08\x03\x10\x04\"w\n\x10ShardReplication\x12.\n\x05nodes\x18\x01 \x03(\x0b\x32\x1f.topodata.ShardReplication.Node\x1a\x33\n\x04Node\x12+\n\x0ctablet_alias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\"E\n\x0eShardReference\x12\x0c\n\x04name\x18\x01 \x01(\t\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\"\x9c\x03\n\x0bSrvKeyspace\x12;\n\npartitions\x18\x01 \x03(\x0b\x32\'.topodata.SrvKeyspace.KeyspacePartition\x12\x1c\n\x14sharding_column_name\x18\x02 \x01(\t\x12\x36\n\x14sharding_column_type\x18\x03 \x01(\x0e\x32\x18.topodata.KeyspaceIdType\x12\x35\n\x0bserved_from\x18\x04 \x03(\x0b\x32 .topodata.SrvKeyspace.ServedFrom\x1ar\n\x11KeyspacePartition\x12)\n\x0bserved_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\x32\n\x10shard_references\x18\x02 \x03(\x0b\x32\x18.topodata.ShardReference\x1aI\n\nServedFrom\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\x10\n\x08keyspace\x18\x02 \x01(\tJ\x04\x08\x05\x10\x06\"@\n\x08\x43\x65llInfo\x12\x16\n\x0eserver_address\x18\x01 \x01(\t\x12\x0c\n\x04root\x18\x02 \x01(\t\x12\x0e\n\x06region\x18\x03 \x01(\t*2\n\x0eKeyspaceIdType\x12\t\n\x05UNSET\x10\x00\x12\n\n\x06UINT64\x10\x01\x12\t\n\x05\x42YTES\x10\x02*\x90\x01\n\nTabletType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06MASTER\x10\x01\x12\x0b\n\x07REPLICA\x10\x02\x12\n\n\x06RDONLY\x10\x03\x12\t\n\x05\x42\x41TCH\x10\x03\x12\t\n\x05SPARE\x10\x04\x12\x10\n\x0c\x45XPERIMENTAL\x10\x05\x12\n\n\x06\x42\x41\x43KUP\x10\x06\x12\x0b\n\x07RESTORE\x10\x07\x12\x0b\n\x07\x44RAINED\x10\x08\x1a\x02\x10\x01\x42\x38\n\x0fio.vitess.protoZ%vitess.io/vitess/go/vt/proto/topodatab\x06proto3')
serialized_pb=_b('\n\x0etopodata.proto\x12\x08topodata\"&\n\x08KeyRange\x12\r\n\x05start\x18\x01 \x01(\x0c\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x0c\"(\n\x0bTabletAlias\x12\x0c\n\x04\x63\x65ll\x18\x01 \x01(\t\x12\x0b\n\x03uid\x18\x02 \x01(\r\"\xb6\x03\n\x06Tablet\x12$\n\x05\x61lias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\x12\x10\n\x08hostname\x18\x02 \x01(\t\x12/\n\x08port_map\x18\x04 \x03(\x0b\x32\x1d.topodata.Tablet.PortMapEntry\x12\x10\n\x08keyspace\x18\x05 \x01(\t\x12\r\n\x05shard\x18\x06 \x01(\t\x12%\n\tkey_range\x18\x07 \x01(\x0b\x32\x12.topodata.KeyRange\x12\"\n\x04type\x18\x08 \x01(\x0e\x32\x14.topodata.TabletType\x12\x18\n\x10\x64\x62_name_override\x18\t \x01(\t\x12(\n\x04tags\x18\n \x03(\x0b\x32\x1a.topodata.Tablet.TagsEntry\x12\x16\n\x0emysql_hostname\x18\x0c \x01(\t\x12\x12\n\nmysql_port\x18\r \x01(\x05\x1a.\n\x0cPortMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01J\x04\x08\x03\x10\x04J\x04\x08\x0b\x10\x0c\"\xdf\x03\n\x05Shard\x12+\n\x0cmaster_alias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x32\n\rsource_shards\x18\x04 \x03(\x0b\x32\x1b.topodata.Shard.SourceShard\x12\x36\n\x0ftablet_controls\x18\x06 \x03(\x0b\x32\x1d.topodata.Shard.TabletControl\x12\x19\n\x11is_master_serving\x18\x07 \x01(\x08\x1ar\n\x0bSourceShard\x12\x0b\n\x03uid\x18\x01 \x01(\r\x12\x10\n\x08keyspace\x18\x02 \x01(\t\x12\r\n\x05shard\x18\x03 \x01(\t\x12%\n\tkey_range\x18\x04 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x0e\n\x06tables\x18\x05 \x03(\t\x1a{\n\rTabletControl\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x12\x1a\n\x12\x62lacklisted_tables\x18\x04 \x03(\t\x12\x0e\n\x06\x66rozen\x18\x05 \x01(\x08J\x04\x08\x03\x10\x04J\x04\x08\x03\x10\x04J\x04\x08\x05\x10\x06\"\xf5\x01\n\x08Keyspace\x12\x1c\n\x14sharding_column_name\x18\x01 \x01(\t\x12\x36\n\x14sharding_column_type\x18\x02 \x01(\x0e\x32\x18.topodata.KeyspaceIdType\x12\x33\n\x0cserved_froms\x18\x04 \x03(\x0b\x32\x1d.topodata.Keyspace.ServedFrom\x1aX\n\nServedFrom\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x12\x10\n\x08keyspace\x18\x03 \x01(\tJ\x04\x08\x03\x10\x04\"w\n\x10ShardReplication\x12.\n\x05nodes\x18\x01 \x03(\x0b\x32\x1f.topodata.ShardReplication.Node\x1a\x33\n\x04Node\x12+\n\x0ctablet_alias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\"E\n\x0eShardReference\x12\x0c\n\x04name\x18\x01 \x01(\t\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\"i\n\x12ShardTabletControl\x12\x0c\n\x04name\x18\x01 \x01(\t\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x1e\n\x16query_service_disabled\x18\x03 \x01(\x08\"\xda\x03\n\x0bSrvKeyspace\x12;\n\npartitions\x18\x01 \x03(\x0b\x32\'.topodata.SrvKeyspace.KeyspacePartition\x12\x1c\n\x14sharding_column_name\x18\x02 \x01(\t\x12\x36\n\x14sharding_column_type\x18\x03 \x01(\x0e\x32\x18.topodata.KeyspaceIdType\x12\x35\n\x0bserved_from\x18\x04 \x03(\x0b\x32 .topodata.SrvKeyspace.ServedFrom\x1a\xaf\x01\n\x11KeyspacePartition\x12)\n\x0bserved_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\x32\n\x10shard_references\x18\x02 \x03(\x0b\x32\x18.topodata.ShardReference\x12;\n\x15shard_tablet_controls\x18\x03 \x03(\x0b\x32\x1c.topodata.ShardTabletControl\x1aI\n\nServedFrom\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\x10\n\x08keyspace\x18\x02 \x01(\tJ\x04\x08\x05\x10\x06\"@\n\x08\x43\x65llInfo\x12\x16\n\x0eserver_address\x18\x01 \x01(\t\x12\x0c\n\x04root\x18\x02 \x01(\t\x12\x0e\n\x06region\x18\x03 \x01(\t*2\n\x0eKeyspaceIdType\x12\t\n\x05UNSET\x10\x00\x12\n\n\x06UINT64\x10\x01\x12\t\n\x05\x42YTES\x10\x02*\x90\x01\n\nTabletType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06MASTER\x10\x01\x12\x0b\n\x07REPLICA\x10\x02\x12\n\n\x06RDONLY\x10\x03\x12\t\n\x05\x42\x41TCH\x10\x03\x12\t\n\x05SPARE\x10\x04\x12\x10\n\x0c\x45XPERIMENTAL\x10\x05\x12\n\n\x06\x42\x41\x43KUP\x10\x06\x12\x0b\n\x07RESTORE\x10\x07\x12\x0b\n\x07\x44RAINED\x10\x08\x1a\x02\x10\x01\x42\x38\n\x0fio.vitess.protoZ%vitess.io/vitess/go/vt/proto/topodatab\x06proto3')
)
_KEYSPACEIDTYPE = _descriptor.EnumDescriptor(
@ -44,8 +44,8 @@ _KEYSPACEIDTYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=None,
serialized_start=2078,
serialized_end=2128,
serialized_start=2123,
serialized_end=2173,
)
_sym_db.RegisterEnumDescriptor(_KEYSPACEIDTYPE)
@ -99,8 +99,8 @@ _TABLETTYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
serialized_options=_b('\020\001'),
serialized_start=2131,
serialized_end=2275,
serialized_start=2176,
serialized_end=2320,
)
_sym_db.RegisterEnumDescriptor(_TABLETTYPE)
@ -372,43 +372,6 @@ _TABLET = _descriptor.Descriptor(
)
_SHARD_SERVEDTYPE = _descriptor.Descriptor(
name='ServedType',
full_name='topodata.Shard.ServedType',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='tablet_type', full_name='topodata.Shard.ServedType.tablet_type', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cells', full_name='topodata.Shard.ServedType.cells', index=1,
number=2, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=818,
serialized_end=888,
)
_SHARD_SOURCESHARD = _descriptor.Descriptor(
name='SourceShard',
full_name='topodata.Shard.SourceShard',
@ -463,8 +426,8 @@ _SHARD_SOURCESHARD = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=890,
serialized_end=1004,
serialized_start=780,
serialized_end=894,
)
_SHARD_TABLETCONTROL = _descriptor.Descriptor(
@ -489,21 +452,14 @@ _SHARD_TABLETCONTROL = _descriptor.Descriptor(
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='disable_query_service', full_name='topodata.Shard.TabletControl.disable_query_service', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='blacklisted_tables', full_name='topodata.Shard.TabletControl.blacklisted_tables', index=3,
name='blacklisted_tables', full_name='topodata.Shard.TabletControl.blacklisted_tables', index=2,
number=4, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='frozen', full_name='topodata.Shard.TabletControl.frozen', index=4,
name='frozen', full_name='topodata.Shard.TabletControl.frozen', index=3,
number=5, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
@ -521,8 +477,8 @@ _SHARD_TABLETCONTROL = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1007,
serialized_end=1155,
serialized_start=896,
serialized_end=1019,
)
_SHARD = _descriptor.Descriptor(
@ -547,37 +503,30 @@ _SHARD = _descriptor.Descriptor(
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='served_types', full_name='topodata.Shard.served_types', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='source_shards', full_name='topodata.Shard.source_shards', index=3,
name='source_shards', full_name='topodata.Shard.source_shards', index=2,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cells', full_name='topodata.Shard.cells', index=4,
number=5, type=9, cpp_type=9, label=3,
name='tablet_controls', full_name='topodata.Shard.tablet_controls', index=3,
number=6, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='tablet_controls', full_name='topodata.Shard.tablet_controls', index=5,
number=6, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
name='is_master_serving', full_name='topodata.Shard.is_master_serving', index=4,
number=7, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_SHARD_SERVEDTYPE, _SHARD_SOURCESHARD, _SHARD_TABLETCONTROL, ],
nested_types=[_SHARD_SOURCESHARD, _SHARD_TABLETCONTROL, ],
enum_types=[
],
serialized_options=None,
@ -587,7 +536,7 @@ _SHARD = _descriptor.Descriptor(
oneofs=[
],
serialized_start=552,
serialized_end=1155,
serialized_end=1031,
)
@ -631,8 +580,8 @@ _KEYSPACE_SERVEDFROM = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1309,
serialized_end=1397,
serialized_start=1185,
serialized_end=1273,
)
_KEYSPACE = _descriptor.Descriptor(
@ -675,8 +624,8 @@ _KEYSPACE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1158,
serialized_end=1403,
serialized_start=1034,
serialized_end=1279,
)
@ -706,8 +655,8 @@ _SHARDREPLICATION_NODE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1473,
serialized_end=1524,
serialized_start=1349,
serialized_end=1400,
)
_SHARDREPLICATION = _descriptor.Descriptor(
@ -736,8 +685,8 @@ _SHARDREPLICATION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1405,
serialized_end=1524,
serialized_start=1281,
serialized_end=1400,
)
@ -774,8 +723,53 @@ _SHARDREFERENCE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1526,
serialized_end=1595,
serialized_start=1402,
serialized_end=1471,
)
_SHARDTABLETCONTROL = _descriptor.Descriptor(
name='ShardTabletControl',
full_name='topodata.ShardTabletControl',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='topodata.ShardTabletControl.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='key_range', full_name='topodata.ShardTabletControl.key_range', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='query_service_disabled', full_name='topodata.ShardTabletControl.query_service_disabled', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=1473,
serialized_end=1578,
)
@ -800,6 +794,13 @@ _SRVKEYSPACE_KEYSPACEPARTITION = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='shard_tablet_controls', full_name='topodata.SrvKeyspace.KeyspacePartition.shard_tablet_controls', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
@ -812,8 +813,8 @@ _SRVKEYSPACE_KEYSPACEPARTITION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1815,
serialized_end=1929,
serialized_start=1799,
serialized_end=1974,
)
_SRVKEYSPACE_SERVEDFROM = _descriptor.Descriptor(
@ -849,8 +850,8 @@ _SRVKEYSPACE_SERVEDFROM = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1931,
serialized_end=2004,
serialized_start=1976,
serialized_end=2049,
)
_SRVKEYSPACE = _descriptor.Descriptor(
@ -900,8 +901,8 @@ _SRVKEYSPACE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1598,
serialized_end=2010,
serialized_start=1581,
serialized_end=2055,
)
@ -945,8 +946,8 @@ _CELLINFO = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=2012,
serialized_end=2076,
serialized_start=2057,
serialized_end=2121,
)
_TABLET_PORTMAPENTRY.containing_type = _TABLET
@ -956,15 +957,12 @@ _TABLET.fields_by_name['port_map'].message_type = _TABLET_PORTMAPENTRY
_TABLET.fields_by_name['key_range'].message_type = _KEYRANGE
_TABLET.fields_by_name['type'].enum_type = _TABLETTYPE
_TABLET.fields_by_name['tags'].message_type = _TABLET_TAGSENTRY
_SHARD_SERVEDTYPE.fields_by_name['tablet_type'].enum_type = _TABLETTYPE
_SHARD_SERVEDTYPE.containing_type = _SHARD
_SHARD_SOURCESHARD.fields_by_name['key_range'].message_type = _KEYRANGE
_SHARD_SOURCESHARD.containing_type = _SHARD
_SHARD_TABLETCONTROL.fields_by_name['tablet_type'].enum_type = _TABLETTYPE
_SHARD_TABLETCONTROL.containing_type = _SHARD
_SHARD.fields_by_name['master_alias'].message_type = _TABLETALIAS
_SHARD.fields_by_name['key_range'].message_type = _KEYRANGE
_SHARD.fields_by_name['served_types'].message_type = _SHARD_SERVEDTYPE
_SHARD.fields_by_name['source_shards'].message_type = _SHARD_SOURCESHARD
_SHARD.fields_by_name['tablet_controls'].message_type = _SHARD_TABLETCONTROL
_KEYSPACE_SERVEDFROM.fields_by_name['tablet_type'].enum_type = _TABLETTYPE
@ -975,8 +973,10 @@ _SHARDREPLICATION_NODE.fields_by_name['tablet_alias'].message_type = _TABLETALIA
_SHARDREPLICATION_NODE.containing_type = _SHARDREPLICATION
_SHARDREPLICATION.fields_by_name['nodes'].message_type = _SHARDREPLICATION_NODE
_SHARDREFERENCE.fields_by_name['key_range'].message_type = _KEYRANGE
_SHARDTABLETCONTROL.fields_by_name['key_range'].message_type = _KEYRANGE
_SRVKEYSPACE_KEYSPACEPARTITION.fields_by_name['served_type'].enum_type = _TABLETTYPE
_SRVKEYSPACE_KEYSPACEPARTITION.fields_by_name['shard_references'].message_type = _SHARDREFERENCE
_SRVKEYSPACE_KEYSPACEPARTITION.fields_by_name['shard_tablet_controls'].message_type = _SHARDTABLETCONTROL
_SRVKEYSPACE_KEYSPACEPARTITION.containing_type = _SRVKEYSPACE
_SRVKEYSPACE_SERVEDFROM.fields_by_name['tablet_type'].enum_type = _TABLETTYPE
_SRVKEYSPACE_SERVEDFROM.containing_type = _SRVKEYSPACE
@ -990,6 +990,7 @@ DESCRIPTOR.message_types_by_name['Shard'] = _SHARD
DESCRIPTOR.message_types_by_name['Keyspace'] = _KEYSPACE
DESCRIPTOR.message_types_by_name['ShardReplication'] = _SHARDREPLICATION
DESCRIPTOR.message_types_by_name['ShardReference'] = _SHARDREFERENCE
DESCRIPTOR.message_types_by_name['ShardTabletControl'] = _SHARDTABLETCONTROL
DESCRIPTOR.message_types_by_name['SrvKeyspace'] = _SRVKEYSPACE
DESCRIPTOR.message_types_by_name['CellInfo'] = _CELLINFO
DESCRIPTOR.enum_types_by_name['KeyspaceIdType'] = _KEYSPACEIDTYPE
@ -1035,13 +1036,6 @@ _sym_db.RegisterMessage(Tablet.TagsEntry)
Shard = _reflection.GeneratedProtocolMessageType('Shard', (_message.Message,), dict(
ServedType = _reflection.GeneratedProtocolMessageType('ServedType', (_message.Message,), dict(
DESCRIPTOR = _SHARD_SERVEDTYPE,
__module__ = 'topodata_pb2'
# @@protoc_insertion_point(class_scope:topodata.Shard.ServedType)
))
,
SourceShard = _reflection.GeneratedProtocolMessageType('SourceShard', (_message.Message,), dict(
DESCRIPTOR = _SHARD_SOURCESHARD,
__module__ = 'topodata_pb2'
@ -1060,7 +1054,6 @@ Shard = _reflection.GeneratedProtocolMessageType('Shard', (_message.Message,), d
# @@protoc_insertion_point(class_scope:topodata.Shard)
))
_sym_db.RegisterMessage(Shard)
_sym_db.RegisterMessage(Shard.ServedType)
_sym_db.RegisterMessage(Shard.SourceShard)
_sym_db.RegisterMessage(Shard.TabletControl)
@ -1101,6 +1094,13 @@ ShardReference = _reflection.GeneratedProtocolMessageType('ShardReference', (_me
))
_sym_db.RegisterMessage(ShardReference)
ShardTabletControl = _reflection.GeneratedProtocolMessageType('ShardTabletControl', (_message.Message,), dict(
DESCRIPTOR = _SHARDTABLETCONTROL,
__module__ = 'topodata_pb2'
# @@protoc_insertion_point(class_scope:topodata.ShardTabletControl)
))
_sym_db.RegisterMessage(ShardTabletControl)
SrvKeyspace = _reflection.GeneratedProtocolMessageType('SrvKeyspace', (_message.Message,), dict(
KeyspacePartition = _reflection.GeneratedProtocolMessageType('KeyspacePartition', (_message.Message,), dict(

Различия файлов скрыты, потому что одна или несколько строк слишком длинны