diff --git a/go/vt/proto/topodata/topodata.pb.go b/go/vt/proto/topodata/topodata.pb.go index a9743090119..6fe977f8396 100644 --- a/go/vt/proto/topodata/topodata.pb.go +++ b/go/vt/proto/topodata/topodata.pb.go @@ -48,7 +48,7 @@ func (x KeyspaceIdType) String() string { return proto.EnumName(KeyspaceIdType_name, int32(x)) } func (KeyspaceIdType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_topodata_cb9e1ed4dfa42564, []int{0} + return fileDescriptor_topodata_23985cc74c86747c, []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_cb9e1ed4dfa42564, []int{1} + return fileDescriptor_topodata_23985cc74c86747c, []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_cb9e1ed4dfa42564, []int{0} + return fileDescriptor_topodata_23985cc74c86747c, []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_cb9e1ed4dfa42564, []int{1} + return fileDescriptor_topodata_23985cc74c86747c, []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_cb9e1ed4dfa42564, []int{2} + return fileDescriptor_topodata_23985cc74c86747c, []int{2} } func (m *Tablet) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tablet.Unmarshal(m, b) @@ -394,7 +394,7 @@ func (m *Shard) Reset() { *m = Shard{} } func (m *Shard) String() string { return proto.CompactTextString(m) } func (*Shard) ProtoMessage() {} func (*Shard) Descriptor() ([]byte, []int) { - return fileDescriptor_topodata_cb9e1ed4dfa42564, []int{3} + return fileDescriptor_topodata_23985cc74c86747c, []int{3} } func (m *Shard) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Shard.Unmarshal(m, b) @@ -469,7 +469,7 @@ 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_cb9e1ed4dfa42564, []int{3, 0} + return fileDescriptor_topodata_23985cc74c86747c, []int{3, 0} } func (m *Shard_ServedType) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Shard_ServedType.Unmarshal(m, b) @@ -526,7 +526,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_cb9e1ed4dfa42564, []int{3, 1} + return fileDescriptor_topodata_23985cc74c86747c, []int{3, 1} } func (m *Shard_SourceShard) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Shard_SourceShard.Unmarshal(m, b) @@ -587,8 +587,11 @@ type Shard_TabletControl struct { TabletType TabletType `protobuf:"varint,1,opt,name=tablet_type,json=tabletType,enum=topodata.TabletType" json:"tablet_type,omitempty"` Cells []string `protobuf:"bytes,2,rep,name=cells" json:"cells,omitempty"` // what to do - DisableQueryService bool `protobuf:"varint,3,opt,name=disable_query_service,json=disableQueryService" json:"disable_query_service,omitempty"` - BlacklistedTables []string `protobuf:"bytes,4,rep,name=blacklisted_tables,json=blacklistedTables" json:"blacklisted_tables,omitempty"` + DisableQueryService bool `protobuf:"varint,3,opt,name=disable_query_service,json=disableQueryService" json:"disable_query_service,omitempty"` + BlacklistedTables []string `protobuf:"bytes,4,rep,name=blacklisted_tables,json=blacklistedTables" 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" json:"frozen,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -598,7 +601,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_cb9e1ed4dfa42564, []int{3, 2} + return fileDescriptor_topodata_23985cc74c86747c, []int{3, 2} } func (m *Shard_TabletControl) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Shard_TabletControl.Unmarshal(m, b) @@ -646,6 +649,13 @@ func (m *Shard_TabletControl) GetBlacklistedTables() []string { return nil } +func (m *Shard_TabletControl) GetFrozen() bool { + if m != nil { + return m.Frozen + } + return false +} + // A Keyspace contains data about a keyspace. type Keyspace struct { // name of the column used for sharding @@ -666,7 +676,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_cb9e1ed4dfa42564, []int{4} + return fileDescriptor_topodata_23985cc74c86747c, []int{4} } func (m *Keyspace) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Keyspace.Unmarshal(m, b) @@ -725,7 +735,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_cb9e1ed4dfa42564, []int{4, 0} + return fileDescriptor_topodata_23985cc74c86747c, []int{4, 0} } func (m *Keyspace_ServedFrom) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Keyspace_ServedFrom.Unmarshal(m, b) @@ -781,7 +791,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_cb9e1ed4dfa42564, []int{5} + return fileDescriptor_topodata_23985cc74c86747c, []int{5} } func (m *ShardReplication) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShardReplication.Unmarshal(m, b) @@ -820,7 +830,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_cb9e1ed4dfa42564, []int{5, 0} + return fileDescriptor_topodata_23985cc74c86747c, []int{5, 0} } func (m *ShardReplication_Node) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShardReplication_Node.Unmarshal(m, b) @@ -861,7 +871,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_cb9e1ed4dfa42564, []int{6} + return fileDescriptor_topodata_23985cc74c86747c, []int{6} } func (m *ShardReference) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShardReference.Unmarshal(m, b) @@ -912,7 +922,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_cb9e1ed4dfa42564, []int{7} + return fileDescriptor_topodata_23985cc74c86747c, []int{7} } func (m *SrvKeyspace) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SrvKeyspace.Unmarshal(m, b) @@ -974,7 +984,7 @@ func (m *SrvKeyspace_KeyspacePartition) Reset() { *m = SrvKeyspace_Keysp func (m *SrvKeyspace_KeyspacePartition) String() string { return proto.CompactTextString(m) } func (*SrvKeyspace_KeyspacePartition) ProtoMessage() {} func (*SrvKeyspace_KeyspacePartition) Descriptor() ([]byte, []int) { - return fileDescriptor_topodata_cb9e1ed4dfa42564, []int{7, 0} + return fileDescriptor_topodata_23985cc74c86747c, []int{7, 0} } func (m *SrvKeyspace_KeyspacePartition) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SrvKeyspace_KeyspacePartition.Unmarshal(m, b) @@ -1024,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_cb9e1ed4dfa42564, []int{7, 1} + return fileDescriptor_topodata_23985cc74c86747c, []int{7, 1} } func (m *SrvKeyspace_ServedFrom) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SrvKeyspace_ServedFrom.Unmarshal(m, b) @@ -1082,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_cb9e1ed4dfa42564, []int{8} + return fileDescriptor_topodata_23985cc74c86747c, []int{8} } func (m *CellInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CellInfo.Unmarshal(m, b) @@ -1146,80 +1156,81 @@ func init() { proto.RegisterEnum("topodata.TabletType", TabletType_name, TabletType_value) } -func init() { proto.RegisterFile("topodata.proto", fileDescriptor_topodata_cb9e1ed4dfa42564) } - -var fileDescriptor_topodata_cb9e1ed4dfa42564 = []byte{ - // 1145 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x5f, 0x6f, 0xe2, 0x46, - 0x10, 0xaf, 0xc1, 0x10, 0x18, 0x03, 0xe7, 0xdb, 0xe6, 0x2a, 0xcb, 0xd5, 0xa9, 0x08, 0xe9, 0x54, - 0x74, 0x55, 0xa1, 0xe2, 0x7a, 0x6d, 0x74, 0x52, 0xa5, 0x10, 0xc2, 0xf5, 0xc8, 0x1f, 0x42, 0x0d, - 0x51, 0x9b, 0x4a, 0x95, 0xe5, 0xe0, 0x0d, 0x67, 0xc5, 0x78, 0xb9, 0xdd, 0x05, 0x89, 0xcf, 0x70, - 0x0f, 0xbd, 0xe7, 0x7e, 0x93, 0x3e, 0xf5, 0xb1, 0x5f, 0xab, 0xda, 0x5d, 0x1b, 0x0c, 0x69, 0xd2, - 0x5c, 0x95, 0xb7, 0x99, 0x9d, 0x3f, 0x9e, 0xf9, 0xcd, 0x6f, 0x06, 0xa0, 0xc2, 0xc9, 0x8c, 0xf8, - 0x1e, 0xf7, 0x1a, 0x33, 0x4a, 0x38, 0x41, 0x85, 0x44, 0xaf, 0xb5, 0xa0, 0x70, 0x8c, 0x97, 0x8e, - 0x17, 0x4d, 0x30, 0xda, 0x85, 0x1c, 0xe3, 0x1e, 0xe5, 0x96, 0x56, 0xd5, 0xea, 0x25, 0x47, 0x29, - 0xc8, 0x84, 0x2c, 0x8e, 0x7c, 0x2b, 0x23, 0xdf, 0x84, 0x58, 0x7b, 0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b, 0xc4, 0xac, 0x5c, 0x35, 0x2b, 0xb0, 0x91, - 0x0a, 0x7a, 0x0d, 0x8f, 0xb8, 0xec, 0xd1, 0x1d, 0x93, 0x88, 0x53, 0x12, 0x32, 0x2b, 0xbf, 0x4d, - 0x7d, 0x95, 0x59, 0x41, 0xd1, 0x51, 0x5e, 0x4e, 0x85, 0xa7, 0x55, 0x66, 0x5f, 0x00, 0xac, 0x4b, - 0x47, 0x2f, 0xc1, 0x88, 0xb3, 0x4a, 0xce, 0x6a, 0x77, 0x70, 0x16, 0xf8, 0x4a, 0x5e, 0x97, 0x98, - 0x49, 0x95, 0x68, 0xff, 0xa1, 0x81, 0x91, 0x6a, 0x2b, 0x39, 0x06, 0xda, 0xea, 0x18, 0x6c, 0xac, - 0x5f, 0xe6, 0xb6, 0xf5, 0xcb, 0xde, 0xba, 0x7e, 0xfa, 0x3d, 0xc6, 0xf7, 0x19, 0xe4, 0x65, 0xa1, - 0x09, 0x7c, 0xb1, 0x66, 0xff, 0xa5, 0x41, 0x79, 0x03, 0x99, 0x07, 0xed, 0x1d, 0xb5, 0xe0, 0x89, - 0x1f, 0x30, 0xe1, 0xe5, 0xbe, 0x9b, 0x63, 0xba, 0x74, 0x05, 0x27, 0x82, 0x31, 0x96, 0xdd, 0x14, - 0x9c, 0x4f, 0x63, 0xe3, 0x4f, 0xc2, 0x36, 0x54, 0x26, 0xf4, 0x35, 0xa0, 0xcb, 0xd0, 0x1b, 0x5f, - 0x87, 0x01, 0xe3, 0x82, 0x6e, 0xaa, 0x6c, 0x5d, 0xa6, 0x7d, 0x9c, 0xb2, 0xc8, 0x42, 0x58, 0xed, - 0xef, 0x8c, 0xbc, 0xd9, 0x0a, 0xad, 0x6f, 0x60, 0x57, 0x02, 0x14, 0x44, 0x13, 0x77, 0x4c, 0xc2, - 0xf9, 0x34, 0x92, 0x87, 0x24, 0xde, 0x31, 0x94, 0xd8, 0x3a, 0xd2, 0x24, 0x6e, 0x09, 0x3a, 0xba, - 0x19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0x28, 0x75, 0x7f, - 0x19, 0x74, 0x9d, 0xde, 0x69, 0xb7, 0x3f, 0x6a, 0x9f, 0x98, 0x39, 0x11, 0x73, 0xd0, 0xee, 0x1c, - 0x9f, 0x0f, 0xcc, 0xbc, 0x4a, 0x36, 0x1c, 0x9d, 0x39, 0x5d, 0x73, 0x47, 0x28, 0x87, 0x4e, 0xbb, - 0xd7, 0xef, 0x1e, 0x9a, 0x05, 0x3b, 0x63, 0x6a, 0x07, 0x7b, 0xf0, 0x28, 0x20, 0x8d, 0x45, 0xc0, - 0x31, 0x63, 0xea, 0x7f, 0xf3, 0xaf, 0xcf, 0x62, 0x2d, 0x20, 0x4d, 0x25, 0x35, 0x27, 0xa4, 0xb9, - 0xe0, 0x4d, 0x69, 0x6d, 0x26, 0x83, 0xb9, 0xcc, 0x4b, 0xfd, 0xc5, 0x3f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0xad, 0xf5, 0xb6, 0x82, 0x77, 0x0b, 0x00, 0x00, +func init() { proto.RegisterFile("topodata.proto", fileDescriptor_topodata_23985cc74c86747c) } + +var fileDescriptor_topodata_23985cc74c86747c = []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, 0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0xdb, 0x1d, 0x20, 0xaa, 0x40, 0xe9, 0x74, 0x38, 0xee, + 0x4f, 0x9c, 0xff, 0x21, 0x80, 0xf2, 0xe9, 0x60, 0x38, 0xf9, 0xea, 0x4b, 0xc7, 0x90, 0xcf, 0x8f, + 0x5f, 0x4d, 0xfa, 0x63, 0xa7, 0x70, 0xef, 0xad, 0x01, 0xb0, 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, } diff --git a/go/vt/topo/shard.go b/go/vt/topo/shard.go index a6697b283a2..eff52454207 100644 --- a/go/vt/topo/shard.go +++ b/go/vt/topo/shard.go @@ -440,8 +440,6 @@ func (si *ShardInfo) UpdateDisableQueryService(ctx context.Context, tabletType t DisableQueryService: true, BlacklistedTables: nil, }) - } else { - log.Warningf("Trying to remove TabletControl.DisableQueryService for missing type %v for shard %v/%v", tabletType, si.keyspace, si.shardName) } return nil } @@ -452,12 +450,16 @@ func (si *ShardInfo) UpdateDisableQueryService(ctx context.Context, tabletType t 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 @@ -501,56 +503,15 @@ func (si *ShardInfo) GetServedTypesPerCell(cell string) []topodatapb.TabletType return result } -// CheckServedTypesMigration makes sure the provided migration is possible -func (si *ShardInfo) CheckServedTypesMigration(tabletType topodatapb.TabletType, cells []string, remove bool) error { - // we can't remove a type we don't have - if si.GetServedType(tabletType) == nil && remove { - return fmt.Errorf("supplied type %v cannot be migrated out of the shard because it is not a served type: %v", tabletType, si) - } - - // master is a special case with a few extra checks - if tabletType == topodatapb.TabletType_MASTER { - if len(cells) > 0 { - return fmt.Errorf("cannot migrate only some cells for MASTER in shard %v/%v. Do not specify a list of cells", si.keyspace, si.shardName) - } - if remove && len(si.ServedTypes) > 1 { - // Log which types must be migrated first. - var types []string - for _, servedType := range si.ServedTypes { - if servedType.TabletType != topodatapb.TabletType_MASTER { - types = append(types, servedType.TabletType.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, ", ")) - } - } - - return nil -} - -// UpdateServedTypesMap handles ServedTypesMap. It can add or remove -// records, cells, ... +// UpdateServedTypesMap handles ServedTypesMap. It can add or remove cells. func (si *ShardInfo) UpdateServedTypesMap(tabletType topodatapb.TabletType, cells []string, remove bool) error { - // check parameters to be sure - if err := si.CheckServedTypesMigration(tabletType, cells, remove); err != nil { - return err - } - sst := si.GetServedType(tabletType) - if sst == nil { - // the record doesn't exist - if remove { - log.Warningf("Trying to remove ShardServedType for missing type %v in shard %v/%v", tabletType, si.keyspace, si.shardName) - } else { - si.ServedTypes = append(si.ServedTypes, &topodatapb.Shard_ServedType{ - TabletType: tabletType, - Cells: cells, - }) - } - 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 @@ -561,12 +522,21 @@ func (si *ShardInfo) UpdateServedTypesMap(tabletType topodatapb.TabletType, cell } } si.ServedTypes = servedTypes - } else { - sst.Cells = result + return nil } - } else { - sst.Cells = addCells(sst.Cells, cells) + 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 } diff --git a/go/vt/topo/shard_test.go b/go/vt/topo/shard_test.go index b7652498b42..9323f0c85c4 100644 --- a/go/vt/topo/shard_test.go +++ b/go/vt/topo/shard_test.go @@ -18,7 +18,6 @@ package topo import ( "reflect" - "strings" "testing" "golang.org/x/net/context" @@ -329,29 +328,16 @@ func TestUpdateServedTypesMap(t *testing.T) { t.Fatalf("migrate master failed: %v", err) } - // try to migrate master away, see it fail - if err := si.UpdateServedTypesMap(topodatapb.TabletType_MASTER, nil, true); err == nil || err.Error() != "cannot migrate MASTER away from ks/sh until everything else is migrated. Make sure that the following types are migrated first: RDONLY, REPLICA" { - t.Fatalf("migrate master away unexpected error: %v", err) - } - // Migrate each serving type away from this shard. // RDONLY if err := si.UpdateServedTypesMap(topodatapb.TabletType_RDONLY, nil, true); err != nil { t.Fatalf("remove master failed: %v", err) } - // Cannot migrate a type away (here RDONLY) which is not served (anymore). - if err := si.UpdateServedTypesMap(topodatapb.TabletType_RDONLY, nil, true); err == nil || !strings.HasPrefix(err.Error(), "supplied type RDONLY cannot be migrated out of the shard because it is not a served type: ") { - t.Fatalf("migrate rdonly should have failed because it's already migrated: %v", err) - } // REPLICA if err := si.UpdateServedTypesMap(topodatapb.TabletType_REPLICA, nil, true); err != nil { t.Fatalf("remove master failed: %v", err) } // MASTER - // Migration fails if a list of cells is specified. - if err := si.UpdateServedTypesMap(topodatapb.TabletType_MASTER, []string{"first", "third"}, true); err == nil || err.Error() != "cannot migrate only some cells for MASTER in shard ks/sh. Do not specify a list of cells" { - t.Fatalf("remove master failed: %v", err) - } if err := si.UpdateServedTypesMap(topodatapb.TabletType_MASTER, nil, true); err != nil { t.Fatalf("remove master failed: %v", err) } diff --git a/go/vt/wrangler/keyspace.go b/go/vt/wrangler/keyspace.go index f8bec63978a..91ef72bebfa 100644 --- a/go/vt/wrangler/keyspace.go +++ b/go/vt/wrangler/keyspace.go @@ -126,49 +126,9 @@ func (wr *Wrangler) MigrateServedTypes(ctx context.Context, keyspace, shard stri return fmt.Errorf("Shard %v is not involved in any overlapping shards", shard) } - // find which list is which: the sources have no source - // shards, the destination have source shards. We check the - // first entry in the lists, then just check they're - // consistent - var sourceShards []*topo.ShardInfo - var destinationShards []*topo.ShardInfo - if len(os.Left[0].SourceShards) == 0 { - if len(os.Right[0].SourceShards) == 0 { - return fmt.Errorf("neither Shard '%v' nor Shard '%v' have a 'SourceShards' entry. Did you successfully run vtworker SplitClone before? Or did you already migrate the MASTER type?", os.Left[0].ShardName(), os.Right[0].ShardName()) - } - sourceShards = os.Left - destinationShards = os.Right - } else { - sourceShards = os.Right - destinationShards = os.Left - } - - // Verify the sources has the type we're migrating (or not if reverse) - for _, si := range sourceShards { - if err := si.CheckServedTypesMigration(servedType, cells, !reverse); err != nil { - return err - } - } - - // Verify the destinations do not have the type we're - // migrating (or do if reverse) - for _, si := range destinationShards { - if err := si.CheckServedTypesMigration(servedType, cells, reverse); err != nil { - return err - } - } - - // re-read all the shards so we are up to date - wr.Logger().Infof("Re-reading all shards") - for i, si := range sourceShards { - if sourceShards[i], err = wr.ts.GetShard(ctx, si.Keyspace(), si.ShardName()); err != nil { - return err - } - } - for i, si := range destinationShards { - if destinationShards[i], err = wr.ts.GetShard(ctx, si.Keyspace(), si.ShardName()); err != nil { - return err - } + sourceShards, destinationShards, err := wr.findSourceDest(ctx, os) + if err != nil { + return err } // execute the migration @@ -187,43 +147,49 @@ func (wr *Wrangler) MigrateServedTypes(ctx context.Context, keyspace, shard stri return err } - // Send a refresh to the tablets we just disabled, iff: - // - we're not migrating a master - // - we don't have any errors - // - we're not told to skip the refresh - if servedType != topodatapb.TabletType_MASTER && !skipReFreshState { - rec := concurrency.AllErrorRecorder{} - var refreshShards []*topo.ShardInfo - if reverse { - // For a backwards migration, we just disabled query service on the destination shards - refreshShards = destinationShards - } else { - // For a forwards migration, we just disabled query service on the source shards - refreshShards = sourceShards - } + // Master migrate performs its own refresh. + // Otherwise, honor skipRefreshState if requested. + if servedType == topodatapb.TabletType_MASTER || skipReFreshState { + return nil + } - // TODO(b/26388813): Integrate vtctl WaitForDrain here instead of just sleeping. - var waitForDrainSleep time.Duration - switch servedType { - case topodatapb.TabletType_RDONLY: - waitForDrainSleep = *waitForDrainSleepRdonly - case topodatapb.TabletType_REPLICA: - waitForDrainSleep = *waitForDrainSleepReplica - default: - wr.Logger().Warningf("invalid TabletType: %v for MigrateServedTypes command", servedType) - } + // refresh + // TODO(b/26388813): Integrate vtctl WaitForDrain here instead of just sleeping. + // Anything that's not a replica will use the RDONLY sleep time. + waitForDrainSleep := *waitForDrainSleepRdonly + if servedType == topodatapb.TabletType_REPLICA { + waitForDrainSleep = *waitForDrainSleepReplica + } + wr.Logger().Infof("WaitForDrain: Sleeping for %.0f seconds before shutting down query service on old tablets...", waitForDrainSleep.Seconds()) + time.Sleep(waitForDrainSleep) + wr.Logger().Infof("WaitForDrain: Sleeping finished. Shutting down queryservice on old tablets now.") - wr.Logger().Infof("WaitForDrain: Sleeping for %.0f seconds before shutting down query service on old tablets...", waitForDrainSleep.Seconds()) - time.Sleep(waitForDrainSleep) - wr.Logger().Infof("WaitForDrain: Sleeping finished. Shutting down queryservice on old tablets now.") + rec := concurrency.AllErrorRecorder{} + refreshShards := sourceShards + if reverse { + // For a backwards migration, we should refresh (disable) destination shards instead. + refreshShards = destinationShards + } + for _, si := range refreshShards { + rec.RecordError(wr.RefreshTabletsByShard(ctx, si, []topodatapb.TabletType{servedType}, cells)) + } + return rec.Error() +} - for _, si := range refreshShards { - rec.RecordError(wr.RefreshTabletsByShard(ctx, si, []topodatapb.TabletType{servedType}, cells)) +// findSourceDest derives the source and destination from the overlapping shards. +// Whichever side has SourceShards is a destination. +func (wr *Wrangler) findSourceDest(ctx context.Context, os *topotools.OverlappingShards) (sourceShards, destinationShards []*topo.ShardInfo, err error) { + for _, left := range os.Left { + if len(left.SourceShards) != 0 { + return os.Right, os.Left, nil } - return rec.Error() } - - return nil + for _, right := range os.Right { + if len(right.SourceShards) != 0 { + return os.Left, os.Right, nil + } + } + return nil, nil, fmt.Errorf("neither Shard '%v' nor Shard '%v' have a 'SourceShards' entry. Did you successfully run vtworker SplitClone before? Or did you already migrate the MASTER type?", os.Left[0].ShardName(), os.Right[0].ShardName()) } func (wr *Wrangler) getMastersPosition(ctx context.Context, shards []*topo.ShardInfo) (map[*topo.ShardInfo]string, error) { @@ -288,7 +254,11 @@ func (wr *Wrangler) waitForFilteredReplication(ctx context.Context, sourcePositi } if err := wr.tmc.VReplicationWaitForPos(ctx, ti.Tablet, int(sourceShard.Uid), pos); err != nil { - rec.RecordError(err) + if strings.Contains(err.Error(), "not found") { + wr.Logger().Infof("%v stream %d was not found. Skipping wait.", topoproto.TabletAliasString(si.MasterAlias), sourceShard.Uid) + } else { + rec.RecordError(err) + } } else { wr.Logger().Infof("%v caught up", topoproto.TabletAliasString(si.MasterAlias)) } @@ -365,6 +335,16 @@ 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) (err error) { + // Ensure other served types have migrated. + if si := sourceShards[0]; len(si.ServedTypes) > 1 { + var types []string + for _, servedType := range si.ServedTypes { + if servedType.TabletType != topodatapb.TabletType_MASTER { + types = append(types, servedType.TabletType.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, ", ")) + } ev := &events.MigrateServedTypes{ KeyspaceName: keyspace, @@ -379,42 +359,55 @@ func (wr *Wrangler) masterMigrateServedType(ctx context.Context, keyspace string } }() - // For master type migration, need to: + // Phase 1 // - switch the source shards to read-only by disabling query service // - gather all replication points - // - wait for filtered replication to catch up before we continue + // - wait for filtered replication to catch up + // - mark source shards as frozen event.DispatchUpdate(ev, "disabling query service on all source masters") - if err = wr.updateShardRecords(ctx, sourceShards, nil, topodatapb.TabletType_MASTER, true); err != nil { + if err := wr.updateShardRecords(ctx, sourceShards, nil, topodatapb.TabletType_MASTER, true); err != nil { + wr.cancelMasterMigrateServedTypes(ctx, sourceShards) return err } if err := wr.refreshMasters(ctx, sourceShards); err != nil { + wr.cancelMasterMigrateServedTypes(ctx, sourceShards) return err } event.DispatchUpdate(ev, "getting positions of source masters") masterPositions, err := wr.getMastersPosition(ctx, sourceShards) if err != nil { + wr.cancelMasterMigrateServedTypes(ctx, sourceShards) return err } event.DispatchUpdate(ev, "waiting for destination masters to catch up") if err := wr.waitForFilteredReplication(ctx, masterPositions, destinationShards, filteredReplicationWaitTime); err != nil { + wr.cancelMasterMigrateServedTypes(ctx, sourceShards) + return err + } + + // We've reached the point of no return. Freeze the tablet control records in the source masters. + if err := wr.freezeMasterMigrateServedType(ctx, sourceShards); err != nil { + wr.cancelMasterMigrateServedTypes(ctx, sourceShards) return err } + // Phase 2 // Destination shards need different handling than what updateShardRecords does. event.DispatchUpdate(ev, "updating destination shards") for i, si := range destinationShards { - // Stop VReplication streams if we're migrating master (forward only). ti, err := wr.ts.GetTablet(ctx, si.MasterAlias) if err != nil { return err } + // Stop VReplication streams. for _, sourceShard := range si.SourceShards { if _, err := wr.tmc.VReplicationExec(ctx, ti.Tablet, binlogplayer.DeleteVReplication(sourceShard.Uid)); err != nil { return err } } + // 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 @@ -423,7 +416,6 @@ func (wr *Wrangler) masterMigrateServedType(ctx context.Context, keyspace string return err } - // Final migration. Remove source shards. si.SourceShards = nil return nil }) @@ -432,9 +424,6 @@ func (wr *Wrangler) masterMigrateServedType(ctx context.Context, keyspace string } } - // And tell the new shards masters they can now be read-write. - // Invoking a remote action will also make the tablet stop filtered - // replication. event.DispatchUpdate(ev, "setting destination masters read-write") if err := wr.refreshMasters(ctx, destinationShards); err != nil { return err @@ -444,6 +433,16 @@ func (wr *Wrangler) masterMigrateServedType(ctx context.Context, keyspace string return nil } +func (wr *Wrangler) cancelMasterMigrateServedTypes(ctx context.Context, sourceShards []*topo.ShardInfo) { + if err := wr.updateShardRecords(ctx, sourceShards, nil, topodatapb.TabletType_MASTER, false); err != nil { + wr.Logger().Errorf("failed to re-enable source masters: %v", err) + return + } + if err := wr.refreshMasters(ctx, sourceShards); err != nil { + wr.Logger().Errorf("failed to refresh source masters: %v", err) + } +} + // 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) (err error) { for i, si := range shards { @@ -465,6 +464,25 @@ func (wr *Wrangler) updateShardRecords(ctx context.Context, shards []*topo.Shard return nil } +// freezeMasterMigrateServedType freezes the tablet control record for the source masters +// to prevent them from being removed. +func (wr *Wrangler) freezeMasterMigrateServedType(ctx context.Context, shards []*topo.ShardInfo) (err error) { + for i, si := range shards { + shards[i], err = wr.ts.UpdateShardFields(ctx, si.Keyspace(), si.ShardName(), func(si *topo.ShardInfo) error { + tc := si.GetTabletControl(topodatapb.TabletType_MASTER) + if tc == nil { + return fmt.Errorf("unexpected: missing tablet control record for source %v/%v", si.Keyspace(), si.ShardName()) + } + tc.Frozen = true + return nil + }) + if err != nil { + return err + } + } + return nil +} + // WaitForDrain blocks until the selected tablets (cells/keyspace/shard/tablet_type) // have reported a QPS rate of 0.0. // NOTE: This is just an observation of one point in time and no guarantee that diff --git a/proto/topodata.proto b/proto/topodata.proto index 116fd3e6627..4fe5584f57f 100644 --- a/proto/topodata.proto +++ b/proto/topodata.proto @@ -221,6 +221,10 @@ message Shard { // what to do bool disable_query_service = 3; repeated string blacklisted_tables = 4; + + // frozen is set if we've started failing over traffic for + // the master. If set, this record should not be removed. + bool frozen = 5; } // tablet_controls has at most one entry per TabletType. diff --git a/py/vtproto/topodata_pb2.py b/py/vtproto/topodata_pb2.py index 019f81a5683..e74204fad56 100644 --- a/py/vtproto/topodata_pb2.py +++ b/py/vtproto/topodata_pb2.py @@ -20,7 +20,7 @@ name='topodata.proto', package='topodata', syntax='proto3', - 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\"\xcb\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\x84\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\"\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\"\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') ) _KEYSPACEIDTYPE = _descriptor.EnumDescriptor( @@ -44,8 +44,8 @@ ], containing_type=None, options=None, - serialized_start=2062, - serialized_end=2112, + serialized_start=2078, + serialized_end=2128, ) _sym_db.RegisterEnumDescriptor(_KEYSPACEIDTYPE) @@ -99,8 +99,8 @@ ], containing_type=None, options=_descriptor._ParseOptions(descriptor_pb2.EnumOptions(), _b('\020\001')), - serialized_start=2115, - serialized_end=2259, + serialized_start=2131, + serialized_end=2275, ) _sym_db.RegisterEnumDescriptor(_TABLETTYPE) @@ -502,6 +502,13 @@ message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='frozen', full_name='topodata.Shard.TabletControl.frozen', index=4, + 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, + is_extension=False, extension_scope=None, + options=None, file=DESCRIPTOR), ], extensions=[ ], @@ -515,7 +522,7 @@ oneofs=[ ], serialized_start=1007, - serialized_end=1139, + serialized_end=1155, ) _SHARD = _descriptor.Descriptor( @@ -580,7 +587,7 @@ oneofs=[ ], serialized_start=552, - serialized_end=1139, + serialized_end=1155, ) @@ -624,8 +631,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1293, - serialized_end=1381, + serialized_start=1309, + serialized_end=1397, ) _KEYSPACE = _descriptor.Descriptor( @@ -668,8 +675,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1142, - serialized_end=1387, + serialized_start=1158, + serialized_end=1403, ) @@ -699,8 +706,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1457, - serialized_end=1508, + serialized_start=1473, + serialized_end=1524, ) _SHARDREPLICATION = _descriptor.Descriptor( @@ -729,8 +736,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1389, - serialized_end=1508, + serialized_start=1405, + serialized_end=1524, ) @@ -767,8 +774,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1510, - serialized_end=1579, + serialized_start=1526, + serialized_end=1595, ) @@ -805,8 +812,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1799, - serialized_end=1913, + serialized_start=1815, + serialized_end=1929, ) _SRVKEYSPACE_SERVEDFROM = _descriptor.Descriptor( @@ -842,8 +849,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1915, - serialized_end=1988, + serialized_start=1931, + serialized_end=2004, ) _SRVKEYSPACE = _descriptor.Descriptor( @@ -893,8 +900,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1582, - serialized_end=1994, + serialized_start=1598, + serialized_end=2010, ) @@ -938,8 +945,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1996, - serialized_end=2060, + serialized_start=2012, + serialized_end=2076, ) _TABLET_PORTMAPENTRY.containing_type = _TABLET diff --git a/test/resharding.py b/test/resharding.py index 8d1379855f0..13488a30094 100755 --- a/test/resharding.py +++ b/test/resharding.py @@ -973,6 +973,12 @@ def test_resharding(self): utils.check_tablet_query_service(self, shard_1_ny_rdonly, True, False) utils.check_tablet_query_service(self, shard_1_rdonly1, False, True) + # rerun migrate to ensure it doesn't fail + # skip refresh to make it go faster + utils.run_vtctl(['MigrateServedTypes', '--cells=test_nj', + '-skip-refresh-state=true', + 'test_keyspace/80-', 'rdonly'], auto_log=True) + # now serve rdonly from the split shards, everywhere utils.run_vtctl(['MigrateServedTypes', 'test_keyspace/80-', 'rdonly'], auto_log=True) @@ -992,6 +998,11 @@ def test_resharding(self): utils.check_tablet_query_service(self, shard_1_ny_rdonly, False, True) utils.check_tablet_query_service(self, shard_1_rdonly1, False, True) + # rerun migrate to ensure it doesn't fail + # skip refresh to make it go faster + utils.run_vtctl(['MigrateServedTypes', '-skip-refresh-state=true', + 'test_keyspace/80-', 'rdonly'], auto_log=True) + # then serve replica from the split shards destination_shards = ['test_keyspace/80-c0', 'test_keyspace/c0-'] @@ -1091,8 +1102,39 @@ def test_resharding(self): 'test_keyspace/c0-', '1', 'test_keyspace/80-'], auto_log=True) - # then serve master from the split shards, make sure the source master's - # query service is now turned off + # do a Migrate that will fail waiting for replication + # which should cause the Migrate to be canceled and the source + # master to be serving again. + utils.run_vtctl(['MigrateServedTypes', + '-filtered_replication_wait_time', '0s', + 'test_keyspace/80-', 'master'], + auto_log=True, expect_fail=True) + utils.check_srv_keyspace('test_nj', 'test_keyspace', + 'Partitions(master): -80 80-\n' + 'Partitions(rdonly): -80 80-c0 c0-\n' + 'Partitions(replica): -80 80-c0 c0-\n', + keyspace_id_type=base_sharding.keyspace_id_type, + sharding_column_name='custom_ksid_col') + utils.check_tablet_query_service(self, shard_1_master, True, False) + + # sabotage master migration and make it fail in an unfinished state + utils.run_vtctl(['SetShardTabletControl', '-blacklisted_tables=t', + 'test_keyspace/c0-', 'master'], auto_log=True) + utils.run_vtctl(['MigrateServedTypes', 'test_keyspace/80-', 'master'], + auto_log=True, expect_fail=True) + + # remove sabotage, but make it fail early. This should not result + # in the source master serving, because this failure is past the + # point of no return. + utils.run_vtctl(['SetShardTabletControl', '-blacklisted_tables=t', + '-remove', 'test_keyspace/c0-', 'master'], auto_log=True) + utils.run_vtctl(['MigrateServedTypes', + '-filtered_replication_wait_time', '0s', + 'test_keyspace/80-', 'master'], + auto_log=True, expect_fail=True) + utils.check_tablet_query_service(self, shard_1_master, False, True) + + # finally, do the Migration that's expected to succeed utils.run_vtctl(['MigrateServedTypes', 'test_keyspace/80-', 'master'], auto_log=True) utils.check_srv_keyspace('test_nj', 'test_keyspace', diff --git a/test/utils.py b/test/utils.py index 045bfcf86c3..d7e65ff23dc 100644 --- a/test/utils.py +++ b/test/utils.py @@ -302,8 +302,9 @@ def run_fail(cmd, **kargs): proc = subprocess.Popen(args, **kargs) proc.args = args stdout, stderr = proc.communicate() - if proc.returncode == 0: + if proc.returncode == 0 or options.verbose == 2: logging.info('stdout:\n%sstderr:\n%s', stdout, stderr) + if proc.returncode == 0: raise TestError('expected fail:', args, stdout, stderr) return stdout, stderr @@ -1217,6 +1218,8 @@ def start(self, enable_schema_change_dir=False, extra_flags=None): '-workflow_manager_init', '-workflow_manager_use_election', '-schema_swap_delay_between_errors', '1s', + '-wait_for_drain_sleep_rdonly', '1s', + '-wait_for_drain_sleep_replica', '1s', ] + environment.topo_server().flags() if extra_flags: args += extra_flags