Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions go/vt/vtorc/db/generate_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CREATE TABLE database_instance (
hostname varchar(128) NOT NULL,
port smallint NOT NULL,
tablet_type smallint(5) NOT NULL,
cell varchar(32) NOT NULL,
last_checked timestamp not null default (''),
last_seen timestamp NULL DEFAULT NULL,
server_id int NOT NULL,
Expand Down Expand Up @@ -74,8 +75,6 @@ CREATE TABLE database_instance (
relay_log_pos bigint not null default 0,
replication_depth TINYint not null default 0,
has_replication_filters TINYint not null default 0,
data_center varchar(32) not null default '',
physical_environment varchar(32) not null default '',
is_co_primary TINYint not null default 0,
sql_delay int not null default 0,
binlog_server TINYint not null default 0,
Expand All @@ -100,7 +99,6 @@ CREATE TABLE database_instance (
ancestry_uuid text not null default '',
replication_sql_thread_state tinyint signed not null default 0,
replication_io_thread_state tinyint signed not null default 0,
region varchar(32) not null default '',
semi_sync_primary_timeout int NOT NULL DEFAULT 0,
semi_sync_primary_wait_for_replica_count int NOT NULL DEFAULT 0,
semi_sync_primary_status TINYint NOT NULL DEFAULT 0,
Expand Down
8 changes: 4 additions & 4 deletions go/vt/vtorc/inst/analysis_dao_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ var (
// The initialSQL is a set of insert commands copied from a dump of an actual running VTOrc instances. The relevant insert commands are here.
// This is a dump taken from a test running 4 tablets, zone1-101 is the primary, zone1-100 is a replica, zone1-112 is a rdonly and zone2-200 is a cross-cell replica.
initialSQL = []string{
`INSERT INTO database_instance VALUES('zone1-0000000112','localhost',6747,3,'2022-12-28 07:26:04','2022-12-28 07:26:04',213696377,'8.0.31','ROW',1,1,'vt-0000000112-bin.000001',15963,'localhost',6714,8,4.0,1,1,'vt-0000000101-bin.000001',15583,'vt-0000000101-bin.000001',15583,0,0,1,'','',1,'vt-0000000112-relay-bin.000002',15815,1,0,'zone1','',0,0,0,1,'729a4cc4-8680-11ed-a104-47706090afbd:1-54','729a5138-8680-11ed-9240-92a06c3be3c2','2022-12-28 07:26:04','',1,0,0,'Homebrew','8.0','FULL',10816929,0,0,'ON',1,'729a4cc4-8680-11ed-a104-47706090afbd','','729a4cc4-8680-11ed-a104-47706090afbd,729a5138-8680-11ed-9240-92a06c3be3c2',1,1,'',1000000000000000000,1,0,0,0,false,false);`,
`INSERT INTO database_instance VALUES('zone1-0000000100','localhost',6711,2,'2022-12-28 07:26:04','2022-12-28 07:26:04',1094500338,'8.0.31','ROW',1,1,'vt-0000000100-bin.000001',15963,'localhost',6714,8,4.0,1,1,'vt-0000000101-bin.000001',15583,'vt-0000000101-bin.000001',15583,0,0,1,'','',1,'vt-0000000100-relay-bin.000002',15815,1,0,'zone1','',0,0,0,1,'729a4cc4-8680-11ed-a104-47706090afbd:1-54','729a5138-8680-11ed-acf8-d6b0ef9f4eaa','2022-12-28 07:26:04','',1,0,0,'Homebrew','8.0','FULL',10103920,0,1,'ON',1,'729a4cc4-8680-11ed-a104-47706090afbd','','729a4cc4-8680-11ed-a104-47706090afbd,729a5138-8680-11ed-acf8-d6b0ef9f4eaa',1,1,'',1000000000000000000,1,0,1,0,false,false);`,
`INSERT INTO database_instance VALUES('zone1-0000000101','localhost',6714,1,'2022-12-28 07:26:04','2022-12-28 07:26:04',390954723,'8.0.31','ROW',1,1,'vt-0000000101-bin.000001',15583,'',0,0,0,0,0,'',0,'',0,NULL,NULL,0,'','',0,'',0,0,0,'zone1','',0,0,0,1,'729a4cc4-8680-11ed-a104-47706090afbd:1-54','729a4cc4-8680-11ed-a104-47706090afbd','2022-12-28 07:26:04','',0,0,0,'Homebrew','8.0','FULL',11366095,1,1,'ON',1,'','','729a4cc4-8680-11ed-a104-47706090afbd',-1,-1,'',1000000000000000000,1,1,0,2,false,false);`,
`INSERT INTO database_instance VALUES('zone2-0000000200','localhost',6756,2,'2022-12-28 07:26:05','2022-12-28 07:26:05',444286571,'8.0.31','ROW',1,1,'vt-0000000200-bin.000001',15963,'localhost',6714,8,4.0,1,1,'vt-0000000101-bin.000001',15583,'vt-0000000101-bin.000001',15583,0,0,1,'','',1,'vt-0000000200-relay-bin.000002',15815,1,0,'zone2','',0,0,0,1,'729a4cc4-8680-11ed-a104-47706090afbd:1-54','729a497c-8680-11ed-8ad4-3f51d747db75','2022-12-28 07:26:05','',1,0,0,'Homebrew','8.0','FULL',10443112,0,1,'ON',1,'729a4cc4-8680-11ed-a104-47706090afbd','','729a4cc4-8680-11ed-a104-47706090afbd,729a497c-8680-11ed-8ad4-3f51d747db75',1,1,'',1000000000000000000,1,0,1,0,false,false);`,
`INSERT INTO database_instance VALUES('zone1-0000000112','localhost',6747,3,'zone1','2022-12-28 07:26:04','2022-12-28 07:26:04',213696377,'8.0.31','ROW',1,1,'vt-0000000112-bin.000001',15963,'localhost',6714,8,4.0,1,1,'vt-0000000101-bin.000001',15583,'vt-0000000101-bin.000001',15583,0,0,1,'','',1,'vt-0000000112-relay-bin.000002',15815,1,0,0,0,0,1,'729a4cc4-8680-11ed-a104-47706090afbd:1-54','729a5138-8680-11ed-9240-92a06c3be3c2','2022-12-28 07:26:04','',1,0,0,'Homebrew','8.0','FULL',10816929,0,0,'ON',1,'729a4cc4-8680-11ed-a104-47706090afbd','','729a4cc4-8680-11ed-a104-47706090afbd,729a5138-8680-11ed-9240-92a06c3be3c2',1,1,1000000000000000000,1,0,0,0,false,false);`,
`INSERT INTO database_instance VALUES('zone1-0000000100','localhost',6711,2,'zone1','2022-12-28 07:26:04','2022-12-28 07:26:04',1094500338,'8.0.31','ROW',1,1,'vt-0000000100-bin.000001',15963,'localhost',6714,8,4.0,1,1,'vt-0000000101-bin.000001',15583,'vt-0000000101-bin.000001',15583,0,0,1,'','',1,'vt-0000000100-relay-bin.000002',15815,1,0,0,0,0,1,'729a4cc4-8680-11ed-a104-47706090afbd:1-54','729a5138-8680-11ed-acf8-d6b0ef9f4eaa','2022-12-28 07:26:04','',1,0,0,'Homebrew','8.0','FULL',10103920,0,1,'ON',1,'729a4cc4-8680-11ed-a104-47706090afbd','','729a4cc4-8680-11ed-a104-47706090afbd,729a5138-8680-11ed-acf8-d6b0ef9f4eaa',1,1,1000000000000000000,1,0,1,0,false,false);`,
`INSERT INTO database_instance VALUES('zone1-0000000101','localhost',6714,1,'zone1','2022-12-28 07:26:04','2022-12-28 07:26:04',390954723,'8.0.31','ROW',1,1,'vt-0000000101-bin.000001',15583,'',0,0,0,0,0,'',0,'',0,NULL,NULL,0,'','',0,'',0,0,0,0,0,0,1,'729a4cc4-8680-11ed-a104-47706090afbd:1-54','729a4cc4-8680-11ed-a104-47706090afbd','2022-12-28 07:26:04','',0,0,0,'Homebrew','8.0','FULL',11366095,1,1,'ON',1,'','','729a4cc4-8680-11ed-a104-47706090afbd',-1,-1,1000000000000000000,1,1,0,2,false,false);`,
`INSERT INTO database_instance VALUES('zone2-0000000200','localhost',6756,2,'zone2','2022-12-28 07:26:05','2022-12-28 07:26:05',444286571,'8.0.31','ROW',1,1,'vt-0000000200-bin.000001',15963,'localhost',6714,8,4.0,1,1,'vt-0000000101-bin.000001',15583,'vt-0000000101-bin.000001',15583,0,0,1,'','',1,'vt-0000000200-relay-bin.000002',15815,1,0,0,0,0,1,'729a4cc4-8680-11ed-a104-47706090afbd:1-54','729a497c-8680-11ed-8ad4-3f51d747db75','2022-12-28 07:26:05','',1,0,0,'Homebrew','8.0','FULL',10443112,0,1,'ON',1,'729a4cc4-8680-11ed-a104-47706090afbd','','729a4cc4-8680-11ed-a104-47706090afbd,729a497c-8680-11ed-8ad4-3f51d747db75',1,1,1000000000000000000,1,0,1,0,false,false);`,
`INSERT INTO vitess_tablet VALUES('zone1-0000000100','localhost',6711,'ks','0','zone1',2,'0001-01-01 00:00:00+00:00',X'616c6961733a7b63656c6c3a227a6f6e653122207569643a3130307d20686f73746e616d653a226c6f63616c686f73742220706f72745f6d61703a7b6b65793a2267727063222076616c75653a363731307d20706f72745f6d61703a7b6b65793a227674222076616c75653a363730397d206b657973706163653a226b73222073686172643a22302220747970653a5245504c494341206d7973716c5f686f73746e616d653a226c6f63616c686f737422206d7973716c5f706f72743a363731312064625f7365727665725f76657273696f6e3a22382e302e3331222064656661756c745f636f6e6e5f636f6c6c6174696f6e3a3435');`,
`INSERT INTO vitess_tablet VALUES('zone1-0000000101','localhost',6714,'ks','0','zone1',1,'2022-12-28 07:23:25.129898+00:00',X'616c6961733a7b63656c6c3a227a6f6e653122207569643a3130317d20686f73746e616d653a226c6f63616c686f73742220706f72745f6d61703a7b6b65793a2267727063222076616c75653a363731337d20706f72745f6d61703a7b6b65793a227674222076616c75653a363731327d206b657973706163653a226b73222073686172643a22302220747970653a5052494d415259206d7973716c5f686f73746e616d653a226c6f63616c686f737422206d7973716c5f706f72743a36373134207072696d6172795f7465726d5f73746172745f74696d653a7b7365636f6e64733a31363732323132323035206e616e6f7365636f6e64733a3132393839383030307d2064625f7365727665725f76657273696f6e3a22382e302e3331222064656661756c745f636f6e6e5f636f6c6c6174696f6e3a3435');`,
`INSERT INTO vitess_tablet VALUES('zone1-0000000112','localhost',6747,'ks','0','zone1',3,'0001-01-01 00:00:00+00:00',X'616c6961733a7b63656c6c3a227a6f6e653122207569643a3131327d20686f73746e616d653a226c6f63616c686f73742220706f72745f6d61703a7b6b65793a2267727063222076616c75653a363734367d20706f72745f6d61703a7b6b65793a227674222076616c75653a363734357d206b657973706163653a226b73222073686172643a22302220747970653a52444f4e4c59206d7973716c5f686f73746e616d653a226c6f63616c686f737422206d7973716c5f706f72743a363734372064625f7365727665725f76657273696f6e3a22382e302e3331222064656661756c745f636f6e6e5f636f6c6c6174696f6e3a3435');`,
Expand Down
4 changes: 1 addition & 3 deletions go/vt/vtorc/inst/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Instance struct {
// TabletType is the tablet type that the instance
// publishes to the VtGates and believes itself to be.
TabletType topodatapb.TabletType
Cell string
ServerID uint
ServerUUID string
Version string
Expand Down Expand Up @@ -76,9 +77,6 @@ type Instance struct {
primaryExecutedGtidSet string // Not exported

ReplicationLagSeconds sql.NullInt64
DataCenter string
Region string
PhysicalEnvironment string
ReplicationDepth uint
IsCoPrimary bool
HasReplicationCredentials bool
Expand Down
20 changes: 7 additions & 13 deletions go/vt/vtorc/inst/instance_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func ReadTopologyInstanceBufferable(tabletAlias string, latency *stopwatch.Named
// No `goto Cleanup` after this point.
// -------------------------------------------------------------------------

instance.DataCenter = tablet.Alias.Cell
instance.Cell = tablet.Alias.Cell
instance.InstanceAlias = topoproto.TabletAliasString(tablet.Alias)

{
Expand Down Expand Up @@ -532,6 +532,7 @@ func readInstanceRow(m sqlutils.RowMap) *Instance {
instance.Hostname = m.GetString("hostname")
instance.Port = m.GetInt("port")
instance.TabletType = topodatapb.TabletType(m.GetInt("tablet_type"))
instance.Cell = m.GetString("cell")
instance.ServerID = m.GetUint("server_id")
instance.ServerUUID = m.GetString("server_uuid")
instance.Version = m.GetString("version")
Expand Down Expand Up @@ -573,9 +574,6 @@ func readInstanceRow(m sqlutils.RowMap) *Instance {
instance.SecondsBehindPrimary = m.GetNullInt64("replication_lag_seconds")
instance.ReplicationLagSeconds = m.GetNullInt64("replica_lag_seconds")
instance.SQLDelay = m.GetUint32("sql_delay")
instance.DataCenter = m.GetString("data_center")
instance.Region = m.GetString("region")
instance.PhysicalEnvironment = m.GetString("physical_environment")
instance.SemiSyncEnforced = m.GetBool("semi_sync_enforced")
instance.SemiSyncPrimaryEnabled = m.GetBool("semi_sync_primary_enabled")
instance.SemiSyncPrimaryTimeout = m.GetUint64("semi_sync_primary_timeout")
Expand Down Expand Up @@ -830,6 +828,7 @@ func mkInsertForInstances(instances []*Instance, instanceWasActuallyFound bool,
"alias",
"hostname",
"port",
"cell",
"last_checked",
"last_attempted_check",
"last_check_partial_success",
Expand Down Expand Up @@ -875,9 +874,6 @@ func mkInsertForInstances(instances []*Instance, instanceWasActuallyFound bool,
"replication_lag_seconds",
"replica_lag_seconds",
"sql_delay",
"data_center",
"region",
"physical_environment",
"replication_depth",
"is_co_primary",
"has_replication_credentials",
Expand All @@ -899,9 +895,9 @@ func mkInsertForInstances(instances []*Instance, instanceWasActuallyFound bool,
for i := range columns {
values[i] = "?"
}
values[3] = "DATETIME('now')" // last_checked
values[4] = "DATETIME('now')" // last_attempted_check
values[5] = "1" // last_check_partial_success
values[4] = "DATETIME('now')" // last_checked
values[5] = "DATETIME('now')" // last_attempted_check
values[6] = "1" // last_check_partial_success

if updateLastSeen {
columns = append(columns, "last_seen")
Expand All @@ -915,6 +911,7 @@ func mkInsertForInstances(instances []*Instance, instanceWasActuallyFound bool,
args = append(args, instance.InstanceAlias)
args = append(args, instance.Hostname)
args = append(args, instance.Port)
args = append(args, instance.Cell)
args = append(args, int(instance.TabletType))
args = append(args, instance.ServerID)
args = append(args, instance.ServerUUID)
Expand Down Expand Up @@ -957,9 +954,6 @@ func mkInsertForInstances(instances []*Instance, instanceWasActuallyFound bool,
args = append(args, instance.SecondsBehindPrimary)
args = append(args, instance.ReplicationLagSeconds)
args = append(args, instance.SQLDelay)
args = append(args, instance.DataCenter)
args = append(args, instance.Region)
args = append(args, instance.PhysicalEnvironment)
args = append(args, instance.ReplicationDepth)
args = append(args, instance.IsCoPrimary)
args = append(args, instance.HasReplicationCredentials)
Expand Down
Loading
Loading