diff --git a/go/cmd/vtbackup/vtbackup.go b/go/cmd/vtbackup/vtbackup.go index 90985badcb5..05f2302448c 100644 --- a/go/cmd/vtbackup/vtbackup.go +++ b/go/cmd/vtbackup/vtbackup.go @@ -378,7 +378,7 @@ func takeBackup(ctx context.Context, topoServer *topo.Server, backupStorage back log.Infof("Replication caught up to %v after %v", status.Position, time.Since(waitStartTime)) break } - if !status.ReplicationRunning() { + if !status.Healthy() { log.Warning("Replication has stopped before backup could be taken. Trying to restart replication.") if err := startReplication(ctx, mysqld, topoServer); err != nil { log.Warningf("Failed to restart replication: %v", err) diff --git a/go/mysql/constants.go b/go/mysql/constants.go index b63e17c4b3a..49458978908 100644 --- a/go/mysql/constants.go +++ b/go/mysql/constants.go @@ -680,3 +680,33 @@ func IsSchemaApplyError(err error) bool { } return false } + +type ReplicationState int + +const ( + ReplicationStateUnknown ReplicationState = iota + ReplicationStateStopped + ReplicationStateConnecting + ReplicationStateRunning +) + +// ReplicationStatusToState converts a value you have for the IO thread(s) or SQL +// thread(s) or Group Replication applier thread(s) from MySQL or intermediate +// layers to a mysql.ReplicationState. +// on,yes,true == ReplicationStateRunning +// off,no,false == ReplicationStateStopped +// connecting == ReplicationStateConnecting +// anything else == ReplicationStateUnknown +func ReplicationStatusToState(s string) ReplicationState { + // Group Replication uses ON instead of Yes + switch strings.ToLower(s) { + case "yes", "on", "true": + return ReplicationStateRunning + case "no", "off", "false": + return ReplicationStateStopped + case "connecting": + return ReplicationStateConnecting + default: + return ReplicationStateUnknown + } +} diff --git a/go/mysql/flavor.go b/go/mysql/flavor.go index a1baecfef45..d9bc7f31a63 100644 --- a/go/mysql/flavor.go +++ b/go/mysql/flavor.go @@ -350,8 +350,10 @@ func parseReplicationStatus(fields map[string]string) ReplicationStatus { status := ReplicationStatus{ SourceHost: fields["Master_Host"], // These fields are returned from the underlying DB and cannot be renamed - IOThreadRunning: fields["Slave_IO_Running"] == "Yes" || fields["Slave_IO_Running"] == "Connecting", - SQLThreadRunning: fields["Slave_SQL_Running"] == "Yes", + IOState: ReplicationStatusToState(fields["Slave_IO_Running"]), + LastIOError: fields["Last_IO_Error"], + SQLState: ReplicationStatusToState(fields["Slave_SQL_Running"]), + LastSQLError: fields["Last_SQL_Error"], } parseInt, _ := strconv.ParseInt(fields["Master_Port"], 10, 0) status.SourcePort = int(parseInt) diff --git a/go/mysql/flavor_mysqlgr.go b/go/mysql/flavor_mysqlgr.go index 61f05a78ac4..db65ff2f7b3 100644 --- a/go/mysql/flavor_mysqlgr.go +++ b/go/mysql/flavor_mysqlgr.go @@ -141,32 +141,32 @@ func (mysqlGRFlavor) status(c *Conn) (ReplicationStatus, error) { return res, nil } - // Populate IOThreadRunning from replication_connection_status + // Populate IOState from replication_connection_status query = fmt.Sprintf(`SELECT SERVICE_STATE FROM performance_schema.replication_connection_status WHERE CHANNEL_NAME='%s'`, chanel) - var ioThreadRunning bool + var connectionState ReplicationState err = fetchStatusForGroupReplication(c, query, func(values []sqltypes.Value) error { - ioThreadRunning = values[0].ToString() == "ON" + connectionState = ReplicationStatusToState(values[0].ToString()) return nil }) if err != nil { return ReplicationStatus{}, err } - res.IOThreadRunning = ioThreadRunning - // Populate SQLThreadRunning from replication_connection_status - var sqlThreadRunning bool + res.IOState = connectionState + // Populate SQLState from replication_connection_status + var applierState ReplicationState query = fmt.Sprintf(`SELECT SERVICE_STATE FROM performance_schema.replication_applier_status_by_coordinator WHERE CHANNEL_NAME='%s'`, chanel) err = fetchStatusForGroupReplication(c, query, func(values []sqltypes.Value) error { - sqlThreadRunning = values[0].ToString() == "ON" + applierState = ReplicationStatusToState(values[0].ToString()) return nil }) if err != nil { return ReplicationStatus{}, err } - res.SQLThreadRunning = sqlThreadRunning + res.SQLState = applierState // Collect lag information // we use the difference between the last processed transaction's commit time diff --git a/go/mysql/flavor_mysqlgr_test.go b/go/mysql/flavor_mysqlgr_test.go index 3d9adfa1d52..4b7661f145b 100644 --- a/go/mysql/flavor_mysqlgr_test.go +++ b/go/mysql/flavor_mysqlgr_test.go @@ -33,8 +33,8 @@ func TestMysqlGRParsePrimaryGroupMember(t *testing.T) { parsePrimaryGroupMember(&res, rows) assert.Equal(t, "host1", res.SourceHost) assert.Equal(t, 10, res.SourcePort) - assert.Equal(t, false, res.IOThreadRunning) - assert.Equal(t, false, res.SQLThreadRunning) + assert.Equal(t, ReplicationStateUnknown, res.IOState) + assert.Equal(t, ReplicationStateUnknown, res.SQLState) } func TestMysqlGRReplicationApplierLagParse(t *testing.T) { diff --git a/go/mysql/replication_status.go b/go/mysql/replication_status.go index 2c818dcb537..114f4e7ac51 100644 --- a/go/mysql/replication_status.go +++ b/go/mysql/replication_status.go @@ -37,8 +37,10 @@ type ReplicationStatus struct { FilePosition Position FileRelayLogPosition Position SourceServerID uint - IOThreadRunning bool - SQLThreadRunning bool + IOState ReplicationState + LastIOError string + SQLState ReplicationState + LastSQLError string ReplicationLagSeconds uint ReplicationLagUnknown bool SourceHost string @@ -47,10 +49,28 @@ type ReplicationStatus struct { SourceUUID SID } -// ReplicationRunning returns true iff both the IO and SQL threads are -// running. -func (s *ReplicationStatus) ReplicationRunning() bool { - return s.IOThreadRunning && s.SQLThreadRunning +// Running returns true if both the IO and SQL threads are running. +func (s *ReplicationStatus) Running() bool { + return s.IOState == ReplicationStateRunning && s.SQLState == ReplicationStateRunning +} + +// Healthy returns true if both the SQL IO components are healthy +func (s *ReplicationStatus) Healthy() bool { + return s.SQLHealthy() && s.IOHealthy() +} + +// IOHealthy returns true if the IO thread is running OR, the +// IO thread is connecting AND there's no IO error from the last +// attempt to connect to the source. +func (s *ReplicationStatus) IOHealthy() bool { + return s.IOState == ReplicationStateRunning || + (s.IOState == ReplicationStateConnecting && s.LastIOError == "") +} + +// SQLHealthy returns true if the SQLState is running. +// For consistency and to support altering this calculation in the future. +func (s *ReplicationStatus) SQLHealthy() bool { + return s.SQLState == ReplicationStateRunning } // ReplicationStatusToProto translates a Status to proto3. @@ -61,13 +81,15 @@ func ReplicationStatusToProto(s ReplicationStatus) *replicationdatapb.Status { FilePosition: EncodePosition(s.FilePosition), FileRelayLogPosition: EncodePosition(s.FileRelayLogPosition), SourceServerId: uint32(s.SourceServerID), - IoThreadRunning: s.IOThreadRunning, - SqlThreadRunning: s.SQLThreadRunning, ReplicationLagSeconds: uint32(s.ReplicationLagSeconds), SourceHost: s.SourceHost, SourcePort: int32(s.SourcePort), ConnectRetry: int32(s.ConnectRetry), SourceUuid: s.SourceUUID.String(), + IoState: int32(s.IOState), + LastIoError: s.LastIOError, + SqlState: int32(s.SQLState), + LastSqlError: s.LastSQLError, } } @@ -102,13 +124,15 @@ func ProtoToReplicationStatus(s *replicationdatapb.Status) ReplicationStatus { FilePosition: filePos, FileRelayLogPosition: fileRelayPos, SourceServerID: uint(s.SourceServerId), - IOThreadRunning: s.IoThreadRunning, - SQLThreadRunning: s.SqlThreadRunning, ReplicationLagSeconds: uint(s.ReplicationLagSeconds), SourceHost: s.SourceHost, SourcePort: int(s.SourcePort), ConnectRetry: int(s.ConnectRetry), SourceUUID: sid, + IOState: ReplicationState(s.IoState), + LastIOError: s.LastIoError, + SQLState: ReplicationState(s.SqlState), + LastSQLError: s.LastSqlError, } } diff --git a/go/mysql/replication_status_test.go b/go/mysql/replication_status_test.go index 6c23eee3aef..556f2cfaaeb 100644 --- a/go/mysql/replication_status_test.go +++ b/go/mysql/replication_status_test.go @@ -24,34 +24,34 @@ import ( func TestStatusReplicationRunning(t *testing.T) { input := &ReplicationStatus{ - IOThreadRunning: true, - SQLThreadRunning: true, + IOState: ReplicationStatusToState("yes"), + SQLState: ReplicationStatusToState("yes"), } want := true - if got := input.ReplicationRunning(); got != want { - t.Errorf("%#v.ReplicationRunning() = %v, want %v", input, got, want) + if got := input.Running(); got != want { + t.Errorf("%#v.Running() = %v, want %v", input, got, want) } } func TestStatusIOThreadNotRunning(t *testing.T) { input := &ReplicationStatus{ - IOThreadRunning: false, - SQLThreadRunning: true, + IOState: ReplicationStatusToState("no"), + SQLState: ReplicationStatusToState("yes"), } want := false - if got := input.ReplicationRunning(); got != want { - t.Errorf("%#v.ReplicationRunning() = %v, want %v", input, got, want) + if got := input.Running(); got != want { + t.Errorf("%#v.Running() = %v, want %v", input, got, want) } } func TestStatusSQLThreadNotRunning(t *testing.T) { input := &ReplicationStatus{ - IOThreadRunning: true, - SQLThreadRunning: false, + IOState: ReplicationStatusToState("yes"), + SQLState: ReplicationStatusToState("no"), } want := false - if got := input.ReplicationRunning(); got != want { - t.Errorf("%#v.ReplicationRunning() = %v, want %v", input, got, want) + if got := input.Running(); got != want { + t.Errorf("%#v.Running() = %v, want %v", input, got, want) } } diff --git a/go/vt/mysqlctl/builtinbackupengine.go b/go/vt/mysqlctl/builtinbackupengine.go index ea0763d473a..6fbadf3fea4 100644 --- a/go/vt/mysqlctl/builtinbackupengine.go +++ b/go/vt/mysqlctl/builtinbackupengine.go @@ -159,7 +159,7 @@ func (be *BuiltinBackupEngine) ExecuteBackup(ctx context.Context, params BackupP replicaStatus, err := params.Mysqld.ReplicationStatus() switch err { case nil: - replicaStartRequired = replicaStatus.ReplicationRunning() && !*DisableActiveReparents + replicaStartRequired = replicaStatus.Healthy() && !*DisableActiveReparents case mysql.ErrNotReplica: // keep going if we're the primary, might be a degenerate case sourceIsPrimary = true diff --git a/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go b/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go index 4d49dc35cc8..5986dc6aa9a 100644 --- a/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go +++ b/go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go @@ -271,10 +271,10 @@ func (fmd *FakeMysqlDaemon) ReplicationStatus() (mysql.ReplicationStatus, error) ReplicationLagSeconds: fmd.ReplicationLagSeconds, // implemented as AND to avoid changing all tests that were // previously using Replicating = false - IOThreadRunning: fmd.Replicating && fmd.IOThreadRunning, - SQLThreadRunning: fmd.Replicating, - SourceHost: fmd.CurrentSourceHost, - SourcePort: fmd.CurrentSourcePort, + IOState: mysql.ReplicationStatusToState(fmt.Sprintf("%v", fmd.Replicating && fmd.IOThreadRunning)), + SQLState: mysql.ReplicationStatusToState(fmt.Sprintf("%v", fmd.Replicating)), + SourceHost: fmd.CurrentSourceHost, + SourcePort: fmd.CurrentSourcePort, }, nil } diff --git a/go/vt/mysqlctl/replication.go b/go/vt/mysqlctl/replication.go index 844700909de..d2d8976500b 100644 --- a/go/vt/mysqlctl/replication.go +++ b/go/vt/mysqlctl/replication.go @@ -47,7 +47,7 @@ func WaitForReplicationStart(mysqld MysqlDaemon, replicaStartDeadline int) error return err } - if status.ReplicationRunning() { + if status.Running() { return nil } time.Sleep(time.Second) diff --git a/go/vt/proto/replicationdata/replicationdata.pb.go b/go/vt/proto/replicationdata/replicationdata.pb.go index bdddfe13878..2340da87a10 100644 --- a/go/vt/proto/replicationdata/replicationdata.pb.go +++ b/go/vt/proto/replicationdata/replicationdata.pb.go @@ -92,8 +92,6 @@ type Status struct { unknownFields protoimpl.UnknownFields Position string `protobuf:"bytes,1,opt,name=position,proto3" json:"position,omitempty"` - IoThreadRunning bool `protobuf:"varint,2,opt,name=io_thread_running,json=ioThreadRunning,proto3" json:"io_thread_running,omitempty"` - SqlThreadRunning bool `protobuf:"varint,3,opt,name=sql_thread_running,json=sqlThreadRunning,proto3" json:"sql_thread_running,omitempty"` ReplicationLagSeconds uint32 `protobuf:"varint,4,opt,name=replication_lag_seconds,json=replicationLagSeconds,proto3" json:"replication_lag_seconds,omitempty"` SourceHost string `protobuf:"bytes,5,opt,name=source_host,json=sourceHost,proto3" json:"source_host,omitempty"` SourcePort int32 `protobuf:"varint,6,opt,name=source_port,json=sourcePort,proto3" json:"source_port,omitempty"` @@ -104,6 +102,10 @@ type Status struct { FileRelayLogPosition string `protobuf:"bytes,10,opt,name=file_relay_log_position,json=fileRelayLogPosition,proto3" json:"file_relay_log_position,omitempty"` SourceServerId uint32 `protobuf:"varint,11,opt,name=source_server_id,json=sourceServerId,proto3" json:"source_server_id,omitempty"` SourceUuid string `protobuf:"bytes,12,opt,name=source_uuid,json=sourceUuid,proto3" json:"source_uuid,omitempty"` + IoState int32 `protobuf:"varint,13,opt,name=io_state,json=ioState,proto3" json:"io_state,omitempty"` + LastIoError string `protobuf:"bytes,14,opt,name=last_io_error,json=lastIoError,proto3" json:"last_io_error,omitempty"` + SqlState int32 `protobuf:"varint,15,opt,name=sql_state,json=sqlState,proto3" json:"sql_state,omitempty"` + LastSqlError string `protobuf:"bytes,16,opt,name=last_sql_error,json=lastSqlError,proto3" json:"last_sql_error,omitempty"` } func (x *Status) Reset() { @@ -145,20 +147,6 @@ func (x *Status) GetPosition() string { return "" } -func (x *Status) GetIoThreadRunning() bool { - if x != nil { - return x.IoThreadRunning - } - return false -} - -func (x *Status) GetSqlThreadRunning() bool { - if x != nil { - return x.SqlThreadRunning - } - return false -} - func (x *Status) GetReplicationLagSeconds() uint32 { if x != nil { return x.ReplicationLagSeconds @@ -222,6 +210,34 @@ func (x *Status) GetSourceUuid() string { return "" } +func (x *Status) GetIoState() int32 { + if x != nil { + return x.IoState + } + return 0 +} + +func (x *Status) GetLastIoError() string { + if x != nil { + return x.LastIoError + } + return "" +} + +func (x *Status) GetSqlState() int32 { + if x != nil { + return x.SqlState + } + return 0 +} + +func (x *Status) GetLastSqlError() string { + if x != nil { + return x.LastSqlError + } + return "" +} + // StopReplicationStatus represents the replication status before calling StopReplication, and the replication status collected immediately after // calling StopReplication. type StopReplicationStatus struct { @@ -340,58 +356,64 @@ var File_replicationdata_proto protoreflect.FileDescriptor var file_replicationdata_proto_rawDesc = []byte{ 0x0a, 0x15, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x22, 0xf2, 0x03, 0x0a, 0x06, 0x53, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x22, 0xcd, 0x04, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x2a, 0x0a, 0x11, 0x69, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x72, 0x75, 0x6e, - 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x6f, 0x54, 0x68, - 0x72, 0x65, 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, 0x12, 0x73, - 0x71, 0x6c, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, - 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x73, 0x71, 0x6c, 0x54, 0x68, 0x72, 0x65, - 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x36, 0x0a, 0x17, 0x72, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x61, 0x67, 0x5f, 0x73, 0x65, 0x63, - 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x15, 0x72, 0x65, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x61, 0x67, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, - 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x68, 0x6f, 0x73, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x6f, - 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, - 0x6f, 0x72, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, - 0x65, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x52, 0x65, 0x74, 0x72, 0x79, 0x12, 0x2c, 0x0a, 0x12, 0x72, 0x65, 0x6c, 0x61, - 0x79, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x4c, 0x6f, 0x67, 0x50, 0x6f, - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, - 0x69, 0x6c, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x17, 0x66, - 0x69, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x66, 0x69, - 0x6c, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4c, 0x6f, 0x67, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x75, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x75, 0x69, 0x64, 0x22, 0x77, 0x0a, - 0x15, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x06, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, - 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x3b, 0x0a, 0x13, 0x53, 0x74, 0x6f, 0x70, - 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x12, - 0x12, 0x0a, 0x0e, 0x49, 0x4f, 0x41, 0x4e, 0x44, 0x53, 0x51, 0x4c, 0x54, 0x48, 0x52, 0x45, 0x41, - 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x4f, 0x54, 0x48, 0x52, 0x45, 0x41, 0x44, 0x4f, - 0x4e, 0x4c, 0x59, 0x10, 0x01, 0x42, 0x2e, 0x5a, 0x2c, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2e, - 0x69, 0x6f, 0x2f, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x74, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x36, 0x0a, 0x17, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, + 0x61, 0x67, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x15, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x61, 0x67, + 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x74, 0x72, 0x79, 0x12, 0x2c, + 0x0a, 0x12, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x4c, 0x6f, 0x67, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, + 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x35, 0x0a, 0x17, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, + 0x6c, 0x6f, 0x67, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x14, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4c, 0x6f, 0x67, + 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x75, 0x69, + 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, + 0x75, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x69, 0x6f, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x22, + 0x0a, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6f, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, + 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x49, 0x6f, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x71, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x73, 0x71, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x24, 0x0a, 0x0e, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x73, 0x71, 0x6c, 0x5f, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x71, 0x6c, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x4a, 0x04, 0x08, 0x03, 0x10, + 0x04, 0x52, 0x11, 0x69, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x72, 0x75, 0x6e, + 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x12, 0x73, 0x71, 0x6c, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, + 0x5f, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x77, 0x0a, 0x15, 0x53, 0x74, 0x6f, 0x70, + 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x2f, 0x0a, 0x06, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, + 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x62, 0x65, 0x66, 0x6f, + 0x72, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, + 0x61, 0x74, 0x61, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x61, 0x66, 0x74, 0x65, + 0x72, 0x22, 0x50, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, + 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x2a, 0x3b, 0x0a, 0x13, 0x53, 0x74, 0x6f, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x4f, + 0x41, 0x4e, 0x44, 0x53, 0x51, 0x4c, 0x54, 0x48, 0x52, 0x45, 0x41, 0x44, 0x10, 0x00, 0x12, 0x10, + 0x0a, 0x0c, 0x49, 0x4f, 0x54, 0x48, 0x52, 0x45, 0x41, 0x44, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x01, + 0x42, 0x2e, 0x5a, 0x2c, 0x76, 0x69, 0x74, 0x65, 0x73, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x76, 0x69, + 0x74, 0x65, 0x73, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x64, 0x61, 0x74, 0x61, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/go/vt/proto/replicationdata/replicationdata_vtproto.pb.go b/go/vt/proto/replicationdata/replicationdata_vtproto.pb.go index 4c2bbbbd10c..a0a829522a9 100644 --- a/go/vt/proto/replicationdata/replicationdata_vtproto.pb.go +++ b/go/vt/proto/replicationdata/replicationdata_vtproto.pb.go @@ -48,6 +48,32 @@ func (m *Status) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.LastSqlError) > 0 { + i -= len(m.LastSqlError) + copy(dAtA[i:], m.LastSqlError) + i = encodeVarint(dAtA, i, uint64(len(m.LastSqlError))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if m.SqlState != 0 { + i = encodeVarint(dAtA, i, uint64(m.SqlState)) + i-- + dAtA[i] = 0x78 + } + if len(m.LastIoError) > 0 { + i -= len(m.LastIoError) + copy(dAtA[i:], m.LastIoError) + i = encodeVarint(dAtA, i, uint64(len(m.LastIoError))) + i-- + dAtA[i] = 0x72 + } + if m.IoState != 0 { + i = encodeVarint(dAtA, i, uint64(m.IoState)) + i-- + dAtA[i] = 0x68 + } if len(m.SourceUuid) > 0 { i -= len(m.SourceUuid) copy(dAtA[i:], m.SourceUuid) @@ -103,26 +129,6 @@ func (m *Status) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if m.SqlThreadRunning { - i-- - if m.SqlThreadRunning { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.IoThreadRunning { - i-- - if m.IoThreadRunning { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } if len(m.Position) > 0 { i -= len(m.Position) copy(dAtA[i:], m.Position) @@ -254,12 +260,6 @@ func (m *Status) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } - if m.IoThreadRunning { - n += 2 - } - if m.SqlThreadRunning { - n += 2 - } if m.ReplicationLagSeconds != 0 { n += 1 + sov(uint64(m.ReplicationLagSeconds)) } @@ -292,6 +292,20 @@ func (m *Status) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } + if m.IoState != 0 { + n += 1 + sov(uint64(m.IoState)) + } + l = len(m.LastIoError) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.SqlState != 0 { + n += 1 + sov(uint64(m.SqlState)) + } + l = len(m.LastSqlError) + if l > 0 { + n += 2 + l + sov(uint64(l)) + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -405,46 +419,6 @@ func (m *Status) UnmarshalVT(dAtA []byte) error { } m.Position = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IoThreadRunning", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IoThreadRunning = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SqlThreadRunning", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.SqlThreadRunning = bool(v != 0) case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ReplicationLagSeconds", wireType) @@ -681,6 +655,108 @@ func (m *Status) UnmarshalVT(dAtA []byte) error { } m.SourceUuid = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IoState", wireType) + } + m.IoState = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IoState |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastIoError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastIoError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SqlState", wireType) + } + m.SqlState = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SqlState |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastSqlError", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastSqlError = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) diff --git a/go/vt/vtadmin/cluster/cluster_test.go b/go/vt/vtadmin/cluster/cluster_test.go index 05d053ee6cd..7fe2ff39d17 100644 --- a/go/vt/vtadmin/cluster/cluster_test.go +++ b/go/vt/vtadmin/cluster/cluster_test.go @@ -29,6 +29,7 @@ import ( "github.com/stretchr/testify/require" "k8s.io/apimachinery/pkg/util/sets" + "vitess.io/vitess/go/mysql" "vitess.io/vitess/go/protoutil" "vitess.io/vitess/go/test/utils" "vitess.io/vitess/go/vt/topo" @@ -2451,19 +2452,19 @@ func TestGetShardReplicationPositions(t *testing.T) { Response: &vtctldatapb.ShardReplicationPositionsResponse{ ReplicationStatuses: map[string]*replicationdatapb.Status{ "zone1-001": { - IoThreadRunning: false, - SqlThreadRunning: false, - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateStopped), + Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, "zone1-002": { // Note: in reality other fields will be set on replicating hosts as well, but this is sufficient to illustrate in the testing. - IoThreadRunning: true, - SqlThreadRunning: true, - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), + Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, "zone1-003": { - IoThreadRunning: true, - SqlThreadRunning: true, - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), + Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, }, TabletMap: map[string]*topodatapb.Tablet{ @@ -2514,19 +2515,19 @@ func TestGetShardReplicationPositions(t *testing.T) { PositionInfo: &vtctldatapb.ShardReplicationPositionsResponse{ ReplicationStatuses: map[string]*replicationdatapb.Status{ "zone1-001": { - IoThreadRunning: false, - SqlThreadRunning: false, - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateStopped), + Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, "zone1-002": { - IoThreadRunning: true, - SqlThreadRunning: true, - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), + Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, "zone1-003": { - IoThreadRunning: true, - SqlThreadRunning: true, - Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), + Position: "MySQL56/08d0dbbb-be29-11eb-9fea-0aafb9701138:1-109848265", }, }, TabletMap: map[string]*topodatapb.Tablet{ diff --git a/go/vt/vtctl/reparentutil/emergency_reparenter_test.go b/go/vt/vtctl/reparentutil/emergency_reparenter_test.go index 9055588bd44..746c3c70d88 100644 --- a/go/vt/vtctl/reparentutil/emergency_reparenter_test.go +++ b/go/vt/vtctl/reparentutil/emergency_reparenter_test.go @@ -2038,14 +2038,14 @@ func TestEmergencyReparenter_promoteNewPrimary(t *testing.T) { statusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { // forceStart = false Before: &replicationdatapb.Status{ - IoThreadRunning: false, - SqlThreadRunning: false, + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateStopped), }, }, "zone1-0000000102": { // forceStart = true Before: &replicationdatapb.Status{ - IoThreadRunning: true, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), }, }, }, @@ -2416,14 +2416,14 @@ func TestEmergencyReparenter_promoteNewPrimary(t *testing.T) { statusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { // forceStart = false Before: &replicationdatapb.Status{ - IoThreadRunning: false, - SqlThreadRunning: false, + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateStopped), }, }, "zone1-0000000102": { // forceStart = true Before: &replicationdatapb.Status{ - IoThreadRunning: true, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), }, }, }, @@ -3229,14 +3229,14 @@ func TestEmergencyReparenter_reparentReplicas(t *testing.T) { statusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { // forceStart = false Before: &replicationdatapb.Status{ - IoThreadRunning: false, - SqlThreadRunning: false, + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateStopped), }, }, "zone1-0000000102": { // forceStart = true Before: &replicationdatapb.Status{ - IoThreadRunning: true, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), }, }, }, @@ -3622,14 +3622,14 @@ func TestEmergencyReparenter_promoteIntermediateSource(t *testing.T) { statusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { // forceStart = false Before: &replicationdatapb.Status{ - IoThreadRunning: false, - SqlThreadRunning: false, + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateStopped), }, }, "zone1-0000000102": { // forceStart = true Before: &replicationdatapb.Status{ - IoThreadRunning: true, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), }, }, }, @@ -3896,14 +3896,14 @@ func TestEmergencyReparenter_promoteIntermediateSource(t *testing.T) { statusMap: map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { // forceStart = false Before: &replicationdatapb.Status{ - IoThreadRunning: false, - SqlThreadRunning: false, + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateStopped), }, }, "zone1-0000000102": { // forceStart = true Before: &replicationdatapb.Status{ - IoThreadRunning: true, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), }, }, }, @@ -4242,8 +4242,8 @@ func TestParentContextCancelled(t *testing.T) { statusMap := map[string]*replicationdatapb.StopReplicationStatus{ "zone1-0000000101": { Before: &replicationdatapb.Status{ - IoThreadRunning: true, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), }, }, } diff --git a/go/vt/vtctl/reparentutil/replication.go b/go/vt/vtctl/reparentutil/replication.go index ebba68b6a12..864bcd5af8a 100644 --- a/go/vt/vtctl/reparentutil/replication.go +++ b/go/vt/vtctl/reparentutil/replication.go @@ -148,7 +148,7 @@ func ReplicaWasRunning(stopStatus *replicationdatapb.StopReplicationStatus) (boo return false, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "could not determine Before state of StopReplicationStatus %v", stopStatus) } - return stopStatus.Before.IoThreadRunning || stopStatus.Before.SqlThreadRunning, nil + return stopStatus.Before.IoState == int32(mysql.ReplicationStateRunning) || stopStatus.Before.SqlState == int32(mysql.ReplicationStateRunning), nil } // replicationSnapshot stores the status maps and the tablets that were reachable diff --git a/go/vt/vtctl/reparentutil/replication_test.go b/go/vt/vtctl/reparentutil/replication_test.go index d50c0487769..13f25295599 100644 --- a/go/vt/vtctl/reparentutil/replication_test.go +++ b/go/vt/vtctl/reparentutil/replication_test.go @@ -1098,8 +1098,8 @@ func TestReplicaWasRunning(t *testing.T) { name: "io thread running", in: &replicationdatapb.StopReplicationStatus{ Before: &replicationdatapb.Status{ - IoThreadRunning: true, - SqlThreadRunning: false, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateStopped), }, }, expected: true, @@ -1109,8 +1109,8 @@ func TestReplicaWasRunning(t *testing.T) { name: "sql thread running", in: &replicationdatapb.StopReplicationStatus{ Before: &replicationdatapb.Status{ - IoThreadRunning: false, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateRunning), }, }, expected: true, @@ -1120,8 +1120,8 @@ func TestReplicaWasRunning(t *testing.T) { name: "io and sql threads running", in: &replicationdatapb.StopReplicationStatus{ Before: &replicationdatapb.Status{ - IoThreadRunning: true, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), }, }, expected: true, @@ -1131,8 +1131,8 @@ func TestReplicaWasRunning(t *testing.T) { name: "no replication threads running", in: &replicationdatapb.StopReplicationStatus{ Before: &replicationdatapb.Status{ - IoThreadRunning: false, - SqlThreadRunning: false, + IoState: int32(mysql.ReplicationStateStopped), + SqlState: int32(mysql.ReplicationStateStopped), }, }, expected: false, diff --git a/go/vt/vttablet/tabletmanager/replmanager.go b/go/vt/vttablet/tabletmanager/replmanager.go index c64bb5ebf05..698db2838cf 100644 --- a/go/vt/vttablet/tabletmanager/replmanager.go +++ b/go/vt/vttablet/tabletmanager/replmanager.go @@ -109,7 +109,7 @@ func (rm *replManager) checkActionLocked() { } else { // If only one of the threads is stopped, it's probably // intentional. So, we don't repair replication. - if status.SQLThreadRunning || status.IOThreadRunning { + if status.SQLHealthy() || status.IOHealthy() { return } } diff --git a/go/vt/vttablet/tabletmanager/rpc_replication.go b/go/vt/vttablet/tabletmanager/rpc_replication.go index 37462c3a2e4..579a2623c2d 100644 --- a/go/vt/vttablet/tabletmanager/rpc_replication.go +++ b/go/vt/vttablet/tabletmanager/rpc_replication.go @@ -643,7 +643,7 @@ func (tm *TabletManager) setReplicationSourceLocked(ctx context.Context, parentA // Abort on any other non-nil error. return err } - if status.IOThreadRunning || status.SQLThreadRunning { + if status.IOHealthy() || status.SQLHealthy() { wasReplicating = true shouldbeReplicating = true } @@ -756,7 +756,7 @@ func (tm *TabletManager) StopReplicationAndGetStatus(ctx context.Context, stopRe before := mysql.ReplicationStatusToProto(rs) if stopReplicationMode == replicationdatapb.StopReplicationMode_IOTHREADONLY { - if !rs.IOThreadRunning { + if !rs.IOHealthy() { return StopReplicationAndGetStatusResponse{ HybridStatus: before, Status: &replicationdatapb.StopReplicationStatus{ @@ -773,7 +773,7 @@ func (tm *TabletManager) StopReplicationAndGetStatus(ctx context.Context, stopRe }, vterrors.Wrap(err, "stop io thread failed") } } else { - if !rs.IOThreadRunning && !rs.SQLThreadRunning { + if !rs.Healthy() { // no replication is running, just return what we got return StopReplicationAndGetStatusResponse{ HybridStatus: before, @@ -935,7 +935,7 @@ func (tm *TabletManager) fixSemiSyncAndReplication(tabletType topodatapb.TabletT // Replication is not configured, nothing to do. return nil } - if !status.IOThreadRunning { + if !status.IOHealthy() { // IO thread is not running, nothing to do. return nil } diff --git a/go/vt/vttablet/tabletserver/repltracker/poller.go b/go/vt/vttablet/tabletserver/repltracker/poller.go index 5a9112be82b..ace01dffb2d 100644 --- a/go/vt/vttablet/tabletserver/repltracker/poller.go +++ b/go/vt/vttablet/tabletserver/repltracker/poller.go @@ -55,7 +55,7 @@ func (p *poller) Status() (time.Duration, error) { // but it hasn't yet reached the point where it can calculate the seconds_behind_master // value and it's thus NULL -- then we will estimate the lag ourselves using the last seen // value + the time elapsed since. - if !status.ReplicationRunning() || status.ReplicationLagUnknown { + if !status.Healthy() || status.ReplicationLagUnknown { if p.timeRecorded.IsZero() { return 0, vterrors.Errorf(vtrpcpb.Code_UNAVAILABLE, "replication is not running") } diff --git a/go/vt/vttablet/tmrpctest/test_tm_rpc.go b/go/vt/vttablet/tmrpctest/test_tm_rpc.go index a2eb6569c41..9e435f07543 100644 --- a/go/vt/vttablet/tmrpctest/test_tm_rpc.go +++ b/go/vt/vttablet/tmrpctest/test_tm_rpc.go @@ -29,6 +29,7 @@ import ( "google.golang.org/protobuf/proto" + "vitess.io/vitess/go/mysql" "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/vt/hook" "vitess.io/vitess/go/vt/logutil" @@ -684,8 +685,8 @@ func tmRPCTestExecuteFetchPanic(ctx context.Context, t *testing.T, client tmclie var testReplicationStatus = &replicationdatapb.Status{ Position: "MariaDB/1-345-789", - IoThreadRunning: true, - SqlThreadRunning: true, + IoState: int32(mysql.ReplicationStateRunning), + SqlState: int32(mysql.ReplicationStateRunning), ReplicationLagSeconds: 654, SourceHost: "source.host", SourcePort: 3366, diff --git a/proto/replicationdata.proto b/proto/replicationdata.proto index 9db68e9ce61..b6ef28ec119 100644 --- a/proto/replicationdata.proto +++ b/proto/replicationdata.proto @@ -25,8 +25,9 @@ package replicationdata; // flavor-specific command and parsed into a Position and fields. message Status { string position = 1; - bool io_thread_running = 2; - bool sql_thread_running = 3; + // These two fields were removed in Vitess 14 and replaced by the io_state and sql_state fields + reserved 2, 3; + reserved "io_thread_running", "sql_thread_running"; uint32 replication_lag_seconds = 4; string source_host = 5; int32 source_port = 6; @@ -37,6 +38,10 @@ message Status { string file_relay_log_position = 10; uint32 source_server_id = 11; string source_uuid = 12; + int32 io_state = 13; + string last_io_error = 14; + int32 sql_state = 15; + string last_sql_error = 16; } // StopReplicationStatus represents the replication status before calling StopReplication, and the replication status collected immediately after diff --git a/web/vtadmin/src/proto/vtadmin.d.ts b/web/vtadmin/src/proto/vtadmin.d.ts index c227af8f599..b2c963ce51b 100644 --- a/web/vtadmin/src/proto/vtadmin.d.ts +++ b/web/vtadmin/src/proto/vtadmin.d.ts @@ -20836,6 +20836,9 @@ export namespace query { /** QueryResult rows */ rows?: (query.IRow[]|null); + + /** QueryResult info */ + info?: (string|null); } /** Represents a QueryResult. */ @@ -20859,6 +20862,9 @@ export namespace query { /** QueryResult rows. */ public rows: query.IRow[]; + /** QueryResult info. */ + public info: string; + /** * Creates a new QueryResult instance using the specified properties. * @param [properties] Properties to set @@ -26748,12 +26754,6 @@ export namespace replicationdata { /** Status position */ position?: (string|null); - /** Status io_thread_running */ - io_thread_running?: (boolean|null); - - /** Status sql_thread_running */ - sql_thread_running?: (boolean|null); - /** Status replication_lag_seconds */ replication_lag_seconds?: (number|null); @@ -26780,6 +26780,18 @@ export namespace replicationdata { /** Status source_uuid */ source_uuid?: (string|null); + + /** Status io_state */ + io_state?: (number|null); + + /** Status last_io_error */ + last_io_error?: (string|null); + + /** Status sql_state */ + sql_state?: (number|null); + + /** Status last_sql_error */ + last_sql_error?: (string|null); } /** Represents a Status. */ @@ -26794,12 +26806,6 @@ export namespace replicationdata { /** Status position. */ public position: string; - /** Status io_thread_running. */ - public io_thread_running: boolean; - - /** Status sql_thread_running. */ - public sql_thread_running: boolean; - /** Status replication_lag_seconds. */ public replication_lag_seconds: number; @@ -26827,6 +26833,18 @@ export namespace replicationdata { /** Status source_uuid. */ public source_uuid: string; + /** Status io_state. */ + public io_state: number; + + /** Status last_io_error. */ + public last_io_error: string; + + /** Status sql_state. */ + public sql_state: number; + + /** Status last_sql_error. */ + public last_sql_error: string; + /** * Creates a new Status instance using the specified properties. * @param [properties] Properties to set @@ -31685,6 +31703,9 @@ export namespace vtctldata { /** DeleteKeyspaceRequest recursive */ recursive?: (boolean|null); + + /** DeleteKeyspaceRequest force */ + force?: (boolean|null); } /** Represents a DeleteKeyspaceRequest. */ @@ -31702,6 +31723,9 @@ export namespace vtctldata { /** DeleteKeyspaceRequest recursive. */ public recursive: boolean; + /** DeleteKeyspaceRequest force. */ + public force: boolean; + /** * Creates a new DeleteKeyspaceRequest instance using the specified properties. * @param [properties] Properties to set @@ -31868,6 +31892,9 @@ export namespace vtctldata { /** DeleteShardsRequest even_if_serving */ even_if_serving?: (boolean|null); + + /** DeleteShardsRequest force */ + force?: (boolean|null); } /** Represents a DeleteShardsRequest. */ @@ -31888,6 +31915,9 @@ export namespace vtctldata { /** DeleteShardsRequest even_if_serving. */ public even_if_serving: boolean; + /** DeleteShardsRequest force. */ + public force: boolean; + /** * Creates a new DeleteShardsRequest instance using the specified properties. * @param [properties] Properties to set @@ -35946,6 +35976,186 @@ export namespace vtctldata { public toJSON(): { [k: string]: any }; } + /** Properties of a GetVersionRequest. */ + interface IGetVersionRequest { + + /** GetVersionRequest tablet_alias */ + tablet_alias?: (topodata.ITabletAlias|null); + } + + /** Represents a GetVersionRequest. */ + class GetVersionRequest implements IGetVersionRequest { + + /** + * Constructs a new GetVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: vtctldata.IGetVersionRequest); + + /** GetVersionRequest tablet_alias. */ + public tablet_alias?: (topodata.ITabletAlias|null); + + /** + * Creates a new GetVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetVersionRequest instance + */ + public static create(properties?: vtctldata.IGetVersionRequest): vtctldata.GetVersionRequest; + + /** + * Encodes the specified GetVersionRequest message. Does not implicitly {@link vtctldata.GetVersionRequest.verify|verify} messages. + * @param message GetVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtctldata.IGetVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetVersionRequest message, length delimited. Does not implicitly {@link vtctldata.GetVersionRequest.verify|verify} messages. + * @param message GetVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtctldata.IGetVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtctldata.GetVersionRequest; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtctldata.GetVersionRequest; + + /** + * Verifies a GetVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetVersionRequest + */ + public static fromObject(object: { [k: string]: any }): vtctldata.GetVersionRequest; + + /** + * Creates a plain object from a GetVersionRequest message. Also converts values to other types if specified. + * @param message GetVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtctldata.GetVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetVersionResponse. */ + interface IGetVersionResponse { + + /** GetVersionResponse version */ + version?: (string|null); + } + + /** Represents a GetVersionResponse. */ + class GetVersionResponse implements IGetVersionResponse { + + /** + * Constructs a new GetVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: vtctldata.IGetVersionResponse); + + /** GetVersionResponse version. */ + public version: string; + + /** + * Creates a new GetVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GetVersionResponse instance + */ + public static create(properties?: vtctldata.IGetVersionResponse): vtctldata.GetVersionResponse; + + /** + * Encodes the specified GetVersionResponse message. Does not implicitly {@link vtctldata.GetVersionResponse.verify|verify} messages. + * @param message GetVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtctldata.IGetVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetVersionResponse message, length delimited. Does not implicitly {@link vtctldata.GetVersionResponse.verify|verify} messages. + * @param message GetVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtctldata.IGetVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtctldata.GetVersionResponse; + + /** + * Decodes a GetVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtctldata.GetVersionResponse; + + /** + * Verifies a GetVersionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetVersionResponse + */ + public static fromObject(object: { [k: string]: any }): vtctldata.GetVersionResponse; + + /** + * Creates a plain object from a GetVersionResponse message. Also converts values to other types if specified. + * @param message GetVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtctldata.GetVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetVersionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a GetVSchemaResponse. */ interface IGetVSchemaResponse { @@ -42137,6 +42347,210 @@ export namespace vtctldata { */ public toJSON(): { [k: string]: any }; } + + /** Properties of a ValidateVSchemaRequest. */ + interface IValidateVSchemaRequest { + + /** ValidateVSchemaRequest keyspace */ + keyspace?: (string|null); + + /** ValidateVSchemaRequest shards */ + shards?: (string[]|null); + + /** ValidateVSchemaRequest exclude_tables */ + exclude_tables?: (string[]|null); + + /** ValidateVSchemaRequest include_views */ + include_views?: (boolean|null); + } + + /** Represents a ValidateVSchemaRequest. */ + class ValidateVSchemaRequest implements IValidateVSchemaRequest { + + /** + * Constructs a new ValidateVSchemaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: vtctldata.IValidateVSchemaRequest); + + /** ValidateVSchemaRequest keyspace. */ + public keyspace: string; + + /** ValidateVSchemaRequest shards. */ + public shards: string[]; + + /** ValidateVSchemaRequest exclude_tables. */ + public exclude_tables: string[]; + + /** ValidateVSchemaRequest include_views. */ + public include_views: boolean; + + /** + * Creates a new ValidateVSchemaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ValidateVSchemaRequest instance + */ + public static create(properties?: vtctldata.IValidateVSchemaRequest): vtctldata.ValidateVSchemaRequest; + + /** + * Encodes the specified ValidateVSchemaRequest message. Does not implicitly {@link vtctldata.ValidateVSchemaRequest.verify|verify} messages. + * @param message ValidateVSchemaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtctldata.IValidateVSchemaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ValidateVSchemaRequest message, length delimited. Does not implicitly {@link vtctldata.ValidateVSchemaRequest.verify|verify} messages. + * @param message ValidateVSchemaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtctldata.IValidateVSchemaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValidateVSchemaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ValidateVSchemaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtctldata.ValidateVSchemaRequest; + + /** + * Decodes a ValidateVSchemaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ValidateVSchemaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtctldata.ValidateVSchemaRequest; + + /** + * Verifies a ValidateVSchemaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ValidateVSchemaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ValidateVSchemaRequest + */ + public static fromObject(object: { [k: string]: any }): vtctldata.ValidateVSchemaRequest; + + /** + * Creates a plain object from a ValidateVSchemaRequest message. Also converts values to other types if specified. + * @param message ValidateVSchemaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtctldata.ValidateVSchemaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ValidateVSchemaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ValidateVSchemaResponse. */ + interface IValidateVSchemaResponse { + + /** ValidateVSchemaResponse results */ + results?: (string[]|null); + + /** ValidateVSchemaResponse results_by_shard */ + results_by_shard?: ({ [k: string]: vtctldata.IValidateShardResponse }|null); + } + + /** Represents a ValidateVSchemaResponse. */ + class ValidateVSchemaResponse implements IValidateVSchemaResponse { + + /** + * Constructs a new ValidateVSchemaResponse. + * @param [properties] Properties to set + */ + constructor(properties?: vtctldata.IValidateVSchemaResponse); + + /** ValidateVSchemaResponse results. */ + public results: string[]; + + /** ValidateVSchemaResponse results_by_shard. */ + public results_by_shard: { [k: string]: vtctldata.IValidateShardResponse }; + + /** + * Creates a new ValidateVSchemaResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ValidateVSchemaResponse instance + */ + public static create(properties?: vtctldata.IValidateVSchemaResponse): vtctldata.ValidateVSchemaResponse; + + /** + * Encodes the specified ValidateVSchemaResponse message. Does not implicitly {@link vtctldata.ValidateVSchemaResponse.verify|verify} messages. + * @param message ValidateVSchemaResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: vtctldata.IValidateVSchemaResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ValidateVSchemaResponse message, length delimited. Does not implicitly {@link vtctldata.ValidateVSchemaResponse.verify|verify} messages. + * @param message ValidateVSchemaResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: vtctldata.IValidateVSchemaResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValidateVSchemaResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ValidateVSchemaResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): vtctldata.ValidateVSchemaResponse; + + /** + * Decodes a ValidateVSchemaResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ValidateVSchemaResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): vtctldata.ValidateVSchemaResponse; + + /** + * Verifies a ValidateVSchemaResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ValidateVSchemaResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ValidateVSchemaResponse + */ + public static fromObject(object: { [k: string]: any }): vtctldata.ValidateVSchemaResponse; + + /** + * Creates a plain object from a ValidateVSchemaResponse message. Also converts values to other types if specified. + * @param message ValidateVSchemaResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: vtctldata.ValidateVSchemaResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ValidateVSchemaResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } /** Namespace binlogdata. */ diff --git a/web/vtadmin/src/proto/vtadmin.js b/web/vtadmin/src/proto/vtadmin.js index ea65fdd12d3..dd31492c7e0 100644 --- a/web/vtadmin/src/proto/vtadmin.js +++ b/web/vtadmin/src/proto/vtadmin.js @@ -47906,6 +47906,7 @@ $root.query = (function() { * @property {number|Long|null} [rows_affected] QueryResult rows_affected * @property {number|Long|null} [insert_id] QueryResult insert_id * @property {Array.|null} [rows] QueryResult rows + * @property {string|null} [info] QueryResult info */ /** @@ -47957,6 +47958,14 @@ $root.query = (function() { */ QueryResult.prototype.rows = $util.emptyArray; + /** + * QueryResult info. + * @member {string} info + * @memberof query.QueryResult + * @instance + */ + QueryResult.prototype.info = ""; + /** * Creates a new QueryResult instance using the specified properties. * @function create @@ -47991,6 +48000,8 @@ $root.query = (function() { if (message.rows != null && message.rows.length) for (var i = 0; i < message.rows.length; ++i) $root.query.Row.encode(message.rows[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.info); return writer; }; @@ -48041,6 +48052,9 @@ $root.query = (function() { message.rows = []; message.rows.push($root.query.Row.decode(reader, reader.uint32())); break; + case 6: + message.info = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -48100,6 +48114,9 @@ $root.query = (function() { return "rows." + error; } } + if (message.info != null && message.hasOwnProperty("info")) + if (!$util.isString(message.info)) + return "info: string expected"; return null; }; @@ -48153,6 +48170,8 @@ $root.query = (function() { message.rows[i] = $root.query.Row.fromObject(object.rows[i]); } } + if (object.info != null) + message.info = String(object.info); return message; }; @@ -48184,6 +48203,7 @@ $root.query = (function() { object.insert_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.insert_id = options.longs === String ? "0" : 0; + object.info = ""; } if (message.fields && message.fields.length) { object.fields = []; @@ -48205,6 +48225,8 @@ $root.query = (function() { for (var j = 0; j < message.rows.length; ++j) object.rows[j] = $root.query.Row.toObject(message.rows[j], options); } + if (message.info != null && message.hasOwnProperty("info")) + object.info = message.info; return object; }; @@ -63001,8 +63023,6 @@ $root.replicationdata = (function() { * @memberof replicationdata * @interface IStatus * @property {string|null} [position] Status position - * @property {boolean|null} [io_thread_running] Status io_thread_running - * @property {boolean|null} [sql_thread_running] Status sql_thread_running * @property {number|null} [replication_lag_seconds] Status replication_lag_seconds * @property {string|null} [source_host] Status source_host * @property {number|null} [source_port] Status source_port @@ -63012,6 +63032,10 @@ $root.replicationdata = (function() { * @property {string|null} [file_relay_log_position] Status file_relay_log_position * @property {number|null} [source_server_id] Status source_server_id * @property {string|null} [source_uuid] Status source_uuid + * @property {number|null} [io_state] Status io_state + * @property {string|null} [last_io_error] Status last_io_error + * @property {number|null} [sql_state] Status sql_state + * @property {string|null} [last_sql_error] Status last_sql_error */ /** @@ -63037,22 +63061,6 @@ $root.replicationdata = (function() { */ Status.prototype.position = ""; - /** - * Status io_thread_running. - * @member {boolean} io_thread_running - * @memberof replicationdata.Status - * @instance - */ - Status.prototype.io_thread_running = false; - - /** - * Status sql_thread_running. - * @member {boolean} sql_thread_running - * @memberof replicationdata.Status - * @instance - */ - Status.prototype.sql_thread_running = false; - /** * Status replication_lag_seconds. * @member {number} replication_lag_seconds @@ -63125,6 +63133,38 @@ $root.replicationdata = (function() { */ Status.prototype.source_uuid = ""; + /** + * Status io_state. + * @member {number} io_state + * @memberof replicationdata.Status + * @instance + */ + Status.prototype.io_state = 0; + + /** + * Status last_io_error. + * @member {string} last_io_error + * @memberof replicationdata.Status + * @instance + */ + Status.prototype.last_io_error = ""; + + /** + * Status sql_state. + * @member {number} sql_state + * @memberof replicationdata.Status + * @instance + */ + Status.prototype.sql_state = 0; + + /** + * Status last_sql_error. + * @member {string} last_sql_error + * @memberof replicationdata.Status + * @instance + */ + Status.prototype.last_sql_error = ""; + /** * Creates a new Status instance using the specified properties. * @function create @@ -63151,10 +63191,6 @@ $root.replicationdata = (function() { writer = $Writer.create(); if (message.position != null && Object.hasOwnProperty.call(message, "position")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.position); - if (message.io_thread_running != null && Object.hasOwnProperty.call(message, "io_thread_running")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.io_thread_running); - if (message.sql_thread_running != null && Object.hasOwnProperty.call(message, "sql_thread_running")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.sql_thread_running); if (message.replication_lag_seconds != null && Object.hasOwnProperty.call(message, "replication_lag_seconds")) writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.replication_lag_seconds); if (message.source_host != null && Object.hasOwnProperty.call(message, "source_host")) @@ -63173,6 +63209,14 @@ $root.replicationdata = (function() { writer.uint32(/* id 11, wireType 0 =*/88).uint32(message.source_server_id); if (message.source_uuid != null && Object.hasOwnProperty.call(message, "source_uuid")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.source_uuid); + if (message.io_state != null && Object.hasOwnProperty.call(message, "io_state")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.io_state); + if (message.last_io_error != null && Object.hasOwnProperty.call(message, "last_io_error")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.last_io_error); + if (message.sql_state != null && Object.hasOwnProperty.call(message, "sql_state")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.sql_state); + if (message.last_sql_error != null && Object.hasOwnProperty.call(message, "last_sql_error")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.last_sql_error); return writer; }; @@ -63210,12 +63254,6 @@ $root.replicationdata = (function() { case 1: message.position = reader.string(); break; - case 2: - message.io_thread_running = reader.bool(); - break; - case 3: - message.sql_thread_running = reader.bool(); - break; case 4: message.replication_lag_seconds = reader.uint32(); break; @@ -63243,6 +63281,18 @@ $root.replicationdata = (function() { case 12: message.source_uuid = reader.string(); break; + case 13: + message.io_state = reader.int32(); + break; + case 14: + message.last_io_error = reader.string(); + break; + case 15: + message.sql_state = reader.int32(); + break; + case 16: + message.last_sql_error = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -63281,12 +63331,6 @@ $root.replicationdata = (function() { if (message.position != null && message.hasOwnProperty("position")) if (!$util.isString(message.position)) return "position: string expected"; - if (message.io_thread_running != null && message.hasOwnProperty("io_thread_running")) - if (typeof message.io_thread_running !== "boolean") - return "io_thread_running: boolean expected"; - if (message.sql_thread_running != null && message.hasOwnProperty("sql_thread_running")) - if (typeof message.sql_thread_running !== "boolean") - return "sql_thread_running: boolean expected"; if (message.replication_lag_seconds != null && message.hasOwnProperty("replication_lag_seconds")) if (!$util.isInteger(message.replication_lag_seconds)) return "replication_lag_seconds: integer expected"; @@ -63314,6 +63358,18 @@ $root.replicationdata = (function() { if (message.source_uuid != null && message.hasOwnProperty("source_uuid")) if (!$util.isString(message.source_uuid)) return "source_uuid: string expected"; + if (message.io_state != null && message.hasOwnProperty("io_state")) + if (!$util.isInteger(message.io_state)) + return "io_state: integer expected"; + if (message.last_io_error != null && message.hasOwnProperty("last_io_error")) + if (!$util.isString(message.last_io_error)) + return "last_io_error: string expected"; + if (message.sql_state != null && message.hasOwnProperty("sql_state")) + if (!$util.isInteger(message.sql_state)) + return "sql_state: integer expected"; + if (message.last_sql_error != null && message.hasOwnProperty("last_sql_error")) + if (!$util.isString(message.last_sql_error)) + return "last_sql_error: string expected"; return null; }; @@ -63331,10 +63387,6 @@ $root.replicationdata = (function() { var message = new $root.replicationdata.Status(); if (object.position != null) message.position = String(object.position); - if (object.io_thread_running != null) - message.io_thread_running = Boolean(object.io_thread_running); - if (object.sql_thread_running != null) - message.sql_thread_running = Boolean(object.sql_thread_running); if (object.replication_lag_seconds != null) message.replication_lag_seconds = object.replication_lag_seconds >>> 0; if (object.source_host != null) @@ -63353,6 +63405,14 @@ $root.replicationdata = (function() { message.source_server_id = object.source_server_id >>> 0; if (object.source_uuid != null) message.source_uuid = String(object.source_uuid); + if (object.io_state != null) + message.io_state = object.io_state | 0; + if (object.last_io_error != null) + message.last_io_error = String(object.last_io_error); + if (object.sql_state != null) + message.sql_state = object.sql_state | 0; + if (object.last_sql_error != null) + message.last_sql_error = String(object.last_sql_error); return message; }; @@ -63371,8 +63431,6 @@ $root.replicationdata = (function() { var object = {}; if (options.defaults) { object.position = ""; - object.io_thread_running = false; - object.sql_thread_running = false; object.replication_lag_seconds = 0; object.source_host = ""; object.source_port = 0; @@ -63382,13 +63440,13 @@ $root.replicationdata = (function() { object.file_relay_log_position = ""; object.source_server_id = 0; object.source_uuid = ""; + object.io_state = 0; + object.last_io_error = ""; + object.sql_state = 0; + object.last_sql_error = ""; } if (message.position != null && message.hasOwnProperty("position")) object.position = message.position; - if (message.io_thread_running != null && message.hasOwnProperty("io_thread_running")) - object.io_thread_running = message.io_thread_running; - if (message.sql_thread_running != null && message.hasOwnProperty("sql_thread_running")) - object.sql_thread_running = message.sql_thread_running; if (message.replication_lag_seconds != null && message.hasOwnProperty("replication_lag_seconds")) object.replication_lag_seconds = message.replication_lag_seconds; if (message.source_host != null && message.hasOwnProperty("source_host")) @@ -63407,6 +63465,14 @@ $root.replicationdata = (function() { object.source_server_id = message.source_server_id; if (message.source_uuid != null && message.hasOwnProperty("source_uuid")) object.source_uuid = message.source_uuid; + if (message.io_state != null && message.hasOwnProperty("io_state")) + object.io_state = message.io_state; + if (message.last_io_error != null && message.hasOwnProperty("last_io_error")) + object.last_io_error = message.last_io_error; + if (message.sql_state != null && message.hasOwnProperty("sql_state")) + object.sql_state = message.sql_state; + if (message.last_sql_error != null && message.hasOwnProperty("last_sql_error")) + object.last_sql_error = message.last_sql_error; return object; }; @@ -75486,6 +75552,7 @@ $root.vtctldata = (function() { * @interface IDeleteKeyspaceRequest * @property {string|null} [keyspace] DeleteKeyspaceRequest keyspace * @property {boolean|null} [recursive] DeleteKeyspaceRequest recursive + * @property {boolean|null} [force] DeleteKeyspaceRequest force */ /** @@ -75519,6 +75586,14 @@ $root.vtctldata = (function() { */ DeleteKeyspaceRequest.prototype.recursive = false; + /** + * DeleteKeyspaceRequest force. + * @member {boolean} force + * @memberof vtctldata.DeleteKeyspaceRequest + * @instance + */ + DeleteKeyspaceRequest.prototype.force = false; + /** * Creates a new DeleteKeyspaceRequest instance using the specified properties. * @function create @@ -75547,6 +75622,8 @@ $root.vtctldata = (function() { writer.uint32(/* id 1, wireType 2 =*/10).string(message.keyspace); if (message.recursive != null && Object.hasOwnProperty.call(message, "recursive")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.recursive); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.force); return writer; }; @@ -75587,6 +75664,9 @@ $root.vtctldata = (function() { case 2: message.recursive = reader.bool(); break; + case 3: + message.force = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -75628,6 +75708,9 @@ $root.vtctldata = (function() { if (message.recursive != null && message.hasOwnProperty("recursive")) if (typeof message.recursive !== "boolean") return "recursive: boolean expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; return null; }; @@ -75647,6 +75730,8 @@ $root.vtctldata = (function() { message.keyspace = String(object.keyspace); if (object.recursive != null) message.recursive = Boolean(object.recursive); + if (object.force != null) + message.force = Boolean(object.force); return message; }; @@ -75666,11 +75751,14 @@ $root.vtctldata = (function() { if (options.defaults) { object.keyspace = ""; object.recursive = false; + object.force = false; } if (message.keyspace != null && message.hasOwnProperty("keyspace")) object.keyspace = message.keyspace; if (message.recursive != null && message.hasOwnProperty("recursive")) object.recursive = message.recursive; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; return object; }; @@ -75857,6 +75945,7 @@ $root.vtctldata = (function() { * @property {Array.|null} [shards] DeleteShardsRequest shards * @property {boolean|null} [recursive] DeleteShardsRequest recursive * @property {boolean|null} [even_if_serving] DeleteShardsRequest even_if_serving + * @property {boolean|null} [force] DeleteShardsRequest force */ /** @@ -75899,6 +75988,14 @@ $root.vtctldata = (function() { */ DeleteShardsRequest.prototype.even_if_serving = false; + /** + * DeleteShardsRequest force. + * @member {boolean} force + * @memberof vtctldata.DeleteShardsRequest + * @instance + */ + DeleteShardsRequest.prototype.force = false; + /** * Creates a new DeleteShardsRequest instance using the specified properties. * @function create @@ -75930,6 +76027,8 @@ $root.vtctldata = (function() { writer.uint32(/* id 2, wireType 0 =*/16).bool(message.recursive); if (message.even_if_serving != null && Object.hasOwnProperty.call(message, "even_if_serving")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.even_if_serving); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.force); return writer; }; @@ -75975,6 +76074,9 @@ $root.vtctldata = (function() { case 4: message.even_if_serving = reader.bool(); break; + case 5: + message.force = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -76025,6 +76127,9 @@ $root.vtctldata = (function() { if (message.even_if_serving != null && message.hasOwnProperty("even_if_serving")) if (typeof message.even_if_serving !== "boolean") return "even_if_serving: boolean expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; return null; }; @@ -76054,6 +76159,8 @@ $root.vtctldata = (function() { message.recursive = Boolean(object.recursive); if (object.even_if_serving != null) message.even_if_serving = Boolean(object.even_if_serving); + if (object.force != null) + message.force = Boolean(object.force); return message; }; @@ -76075,6 +76182,7 @@ $root.vtctldata = (function() { if (options.defaults) { object.recursive = false; object.even_if_serving = false; + object.force = false; } if (message.shards && message.shards.length) { object.shards = []; @@ -76085,6 +76193,8 @@ $root.vtctldata = (function() { object.recursive = message.recursive; if (message.even_if_serving != null && message.hasOwnProperty("even_if_serving")) object.even_if_serving = message.even_if_serving; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; return object; }; @@ -85159,6 +85269,385 @@ $root.vtctldata = (function() { return GetVSchemaRequest; })(); + vtctldata.GetVersionRequest = (function() { + + /** + * Properties of a GetVersionRequest. + * @memberof vtctldata + * @interface IGetVersionRequest + * @property {topodata.ITabletAlias|null} [tablet_alias] GetVersionRequest tablet_alias + */ + + /** + * Constructs a new GetVersionRequest. + * @memberof vtctldata + * @classdesc Represents a GetVersionRequest. + * @implements IGetVersionRequest + * @constructor + * @param {vtctldata.IGetVersionRequest=} [properties] Properties to set + */ + function GetVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetVersionRequest tablet_alias. + * @member {topodata.ITabletAlias|null|undefined} tablet_alias + * @memberof vtctldata.GetVersionRequest + * @instance + */ + GetVersionRequest.prototype.tablet_alias = null; + + /** + * Creates a new GetVersionRequest instance using the specified properties. + * @function create + * @memberof vtctldata.GetVersionRequest + * @static + * @param {vtctldata.IGetVersionRequest=} [properties] Properties to set + * @returns {vtctldata.GetVersionRequest} GetVersionRequest instance + */ + GetVersionRequest.create = function create(properties) { + return new GetVersionRequest(properties); + }; + + /** + * Encodes the specified GetVersionRequest message. Does not implicitly {@link vtctldata.GetVersionRequest.verify|verify} messages. + * @function encode + * @memberof vtctldata.GetVersionRequest + * @static + * @param {vtctldata.IGetVersionRequest} message GetVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tablet_alias != null && Object.hasOwnProperty.call(message, "tablet_alias")) + $root.topodata.TabletAlias.encode(message.tablet_alias, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetVersionRequest message, length delimited. Does not implicitly {@link vtctldata.GetVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof vtctldata.GetVersionRequest + * @static + * @param {vtctldata.IGetVersionRequest} message GetVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof vtctldata.GetVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtctldata.GetVersionRequest} GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtctldata.GetVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tablet_alias = $root.topodata.TabletAlias.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtctldata.GetVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtctldata.GetVersionRequest} GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetVersionRequest message. + * @function verify + * @memberof vtctldata.GetVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tablet_alias != null && message.hasOwnProperty("tablet_alias")) { + var error = $root.topodata.TabletAlias.verify(message.tablet_alias); + if (error) + return "tablet_alias." + error; + } + return null; + }; + + /** + * Creates a GetVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtctldata.GetVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {vtctldata.GetVersionRequest} GetVersionRequest + */ + GetVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.vtctldata.GetVersionRequest) + return object; + var message = new $root.vtctldata.GetVersionRequest(); + if (object.tablet_alias != null) { + if (typeof object.tablet_alias !== "object") + throw TypeError(".vtctldata.GetVersionRequest.tablet_alias: object expected"); + message.tablet_alias = $root.topodata.TabletAlias.fromObject(object.tablet_alias); + } + return message; + }; + + /** + * Creates a plain object from a GetVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof vtctldata.GetVersionRequest + * @static + * @param {vtctldata.GetVersionRequest} message GetVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.tablet_alias = null; + if (message.tablet_alias != null && message.hasOwnProperty("tablet_alias")) + object.tablet_alias = $root.topodata.TabletAlias.toObject(message.tablet_alias, options); + return object; + }; + + /** + * Converts this GetVersionRequest to JSON. + * @function toJSON + * @memberof vtctldata.GetVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetVersionRequest; + })(); + + vtctldata.GetVersionResponse = (function() { + + /** + * Properties of a GetVersionResponse. + * @memberof vtctldata + * @interface IGetVersionResponse + * @property {string|null} [version] GetVersionResponse version + */ + + /** + * Constructs a new GetVersionResponse. + * @memberof vtctldata + * @classdesc Represents a GetVersionResponse. + * @implements IGetVersionResponse + * @constructor + * @param {vtctldata.IGetVersionResponse=} [properties] Properties to set + */ + function GetVersionResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetVersionResponse version. + * @member {string} version + * @memberof vtctldata.GetVersionResponse + * @instance + */ + GetVersionResponse.prototype.version = ""; + + /** + * Creates a new GetVersionResponse instance using the specified properties. + * @function create + * @memberof vtctldata.GetVersionResponse + * @static + * @param {vtctldata.IGetVersionResponse=} [properties] Properties to set + * @returns {vtctldata.GetVersionResponse} GetVersionResponse instance + */ + GetVersionResponse.create = function create(properties) { + return new GetVersionResponse(properties); + }; + + /** + * Encodes the specified GetVersionResponse message. Does not implicitly {@link vtctldata.GetVersionResponse.verify|verify} messages. + * @function encode + * @memberof vtctldata.GetVersionResponse + * @static + * @param {vtctldata.IGetVersionResponse} message GetVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + return writer; + }; + + /** + * Encodes the specified GetVersionResponse message, length delimited. Does not implicitly {@link vtctldata.GetVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof vtctldata.GetVersionResponse + * @static + * @param {vtctldata.IGetVersionResponse} message GetVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof vtctldata.GetVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtctldata.GetVersionResponse} GetVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtctldata.GetVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtctldata.GetVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtctldata.GetVersionResponse} GetVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetVersionResponse message. + * @function verify + * @memberof vtctldata.GetVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a GetVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtctldata.GetVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {vtctldata.GetVersionResponse} GetVersionResponse + */ + GetVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.vtctldata.GetVersionResponse) + return object; + var message = new $root.vtctldata.GetVersionResponse(); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a GetVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof vtctldata.GetVersionResponse + * @static + * @param {vtctldata.GetVersionResponse} message GetVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetVersionResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.version = ""; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this GetVersionResponse to JSON. + * @function toJSON + * @memberof vtctldata.GetVersionResponse + * @instance + * @returns {Object.} JSON object + */ + GetVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetVersionResponse; + })(); + vtctldata.GetVSchemaResponse = (function() { /** @@ -99373,6 +99862,562 @@ $root.vtctldata = (function() { return ValidateVersionKeyspaceResponse; })(); + vtctldata.ValidateVSchemaRequest = (function() { + + /** + * Properties of a ValidateVSchemaRequest. + * @memberof vtctldata + * @interface IValidateVSchemaRequest + * @property {string|null} [keyspace] ValidateVSchemaRequest keyspace + * @property {Array.|null} [shards] ValidateVSchemaRequest shards + * @property {Array.|null} [exclude_tables] ValidateVSchemaRequest exclude_tables + * @property {boolean|null} [include_views] ValidateVSchemaRequest include_views + */ + + /** + * Constructs a new ValidateVSchemaRequest. + * @memberof vtctldata + * @classdesc Represents a ValidateVSchemaRequest. + * @implements IValidateVSchemaRequest + * @constructor + * @param {vtctldata.IValidateVSchemaRequest=} [properties] Properties to set + */ + function ValidateVSchemaRequest(properties) { + this.shards = []; + this.exclude_tables = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidateVSchemaRequest keyspace. + * @member {string} keyspace + * @memberof vtctldata.ValidateVSchemaRequest + * @instance + */ + ValidateVSchemaRequest.prototype.keyspace = ""; + + /** + * ValidateVSchemaRequest shards. + * @member {Array.} shards + * @memberof vtctldata.ValidateVSchemaRequest + * @instance + */ + ValidateVSchemaRequest.prototype.shards = $util.emptyArray; + + /** + * ValidateVSchemaRequest exclude_tables. + * @member {Array.} exclude_tables + * @memberof vtctldata.ValidateVSchemaRequest + * @instance + */ + ValidateVSchemaRequest.prototype.exclude_tables = $util.emptyArray; + + /** + * ValidateVSchemaRequest include_views. + * @member {boolean} include_views + * @memberof vtctldata.ValidateVSchemaRequest + * @instance + */ + ValidateVSchemaRequest.prototype.include_views = false; + + /** + * Creates a new ValidateVSchemaRequest instance using the specified properties. + * @function create + * @memberof vtctldata.ValidateVSchemaRequest + * @static + * @param {vtctldata.IValidateVSchemaRequest=} [properties] Properties to set + * @returns {vtctldata.ValidateVSchemaRequest} ValidateVSchemaRequest instance + */ + ValidateVSchemaRequest.create = function create(properties) { + return new ValidateVSchemaRequest(properties); + }; + + /** + * Encodes the specified ValidateVSchemaRequest message. Does not implicitly {@link vtctldata.ValidateVSchemaRequest.verify|verify} messages. + * @function encode + * @memberof vtctldata.ValidateVSchemaRequest + * @static + * @param {vtctldata.IValidateVSchemaRequest} message ValidateVSchemaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidateVSchemaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyspace != null && Object.hasOwnProperty.call(message, "keyspace")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.keyspace); + if (message.shards != null && message.shards.length) + for (var i = 0; i < message.shards.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.shards[i]); + if (message.exclude_tables != null && message.exclude_tables.length) + for (var i = 0; i < message.exclude_tables.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.exclude_tables[i]); + if (message.include_views != null && Object.hasOwnProperty.call(message, "include_views")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.include_views); + return writer; + }; + + /** + * Encodes the specified ValidateVSchemaRequest message, length delimited. Does not implicitly {@link vtctldata.ValidateVSchemaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof vtctldata.ValidateVSchemaRequest + * @static + * @param {vtctldata.IValidateVSchemaRequest} message ValidateVSchemaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidateVSchemaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidateVSchemaRequest message from the specified reader or buffer. + * @function decode + * @memberof vtctldata.ValidateVSchemaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtctldata.ValidateVSchemaRequest} ValidateVSchemaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidateVSchemaRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtctldata.ValidateVSchemaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyspace = reader.string(); + break; + case 2: + if (!(message.shards && message.shards.length)) + message.shards = []; + message.shards.push(reader.string()); + break; + case 3: + if (!(message.exclude_tables && message.exclude_tables.length)) + message.exclude_tables = []; + message.exclude_tables.push(reader.string()); + break; + case 4: + message.include_views = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidateVSchemaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtctldata.ValidateVSchemaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtctldata.ValidateVSchemaRequest} ValidateVSchemaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidateVSchemaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidateVSchemaRequest message. + * @function verify + * @memberof vtctldata.ValidateVSchemaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidateVSchemaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyspace != null && message.hasOwnProperty("keyspace")) + if (!$util.isString(message.keyspace)) + return "keyspace: string expected"; + if (message.shards != null && message.hasOwnProperty("shards")) { + if (!Array.isArray(message.shards)) + return "shards: array expected"; + for (var i = 0; i < message.shards.length; ++i) + if (!$util.isString(message.shards[i])) + return "shards: string[] expected"; + } + if (message.exclude_tables != null && message.hasOwnProperty("exclude_tables")) { + if (!Array.isArray(message.exclude_tables)) + return "exclude_tables: array expected"; + for (var i = 0; i < message.exclude_tables.length; ++i) + if (!$util.isString(message.exclude_tables[i])) + return "exclude_tables: string[] expected"; + } + if (message.include_views != null && message.hasOwnProperty("include_views")) + if (typeof message.include_views !== "boolean") + return "include_views: boolean expected"; + return null; + }; + + /** + * Creates a ValidateVSchemaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtctldata.ValidateVSchemaRequest + * @static + * @param {Object.} object Plain object + * @returns {vtctldata.ValidateVSchemaRequest} ValidateVSchemaRequest + */ + ValidateVSchemaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.vtctldata.ValidateVSchemaRequest) + return object; + var message = new $root.vtctldata.ValidateVSchemaRequest(); + if (object.keyspace != null) + message.keyspace = String(object.keyspace); + if (object.shards) { + if (!Array.isArray(object.shards)) + throw TypeError(".vtctldata.ValidateVSchemaRequest.shards: array expected"); + message.shards = []; + for (var i = 0; i < object.shards.length; ++i) + message.shards[i] = String(object.shards[i]); + } + if (object.exclude_tables) { + if (!Array.isArray(object.exclude_tables)) + throw TypeError(".vtctldata.ValidateVSchemaRequest.exclude_tables: array expected"); + message.exclude_tables = []; + for (var i = 0; i < object.exclude_tables.length; ++i) + message.exclude_tables[i] = String(object.exclude_tables[i]); + } + if (object.include_views != null) + message.include_views = Boolean(object.include_views); + return message; + }; + + /** + * Creates a plain object from a ValidateVSchemaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof vtctldata.ValidateVSchemaRequest + * @static + * @param {vtctldata.ValidateVSchemaRequest} message ValidateVSchemaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidateVSchemaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.shards = []; + object.exclude_tables = []; + } + if (options.defaults) { + object.keyspace = ""; + object.include_views = false; + } + if (message.keyspace != null && message.hasOwnProperty("keyspace")) + object.keyspace = message.keyspace; + if (message.shards && message.shards.length) { + object.shards = []; + for (var j = 0; j < message.shards.length; ++j) + object.shards[j] = message.shards[j]; + } + if (message.exclude_tables && message.exclude_tables.length) { + object.exclude_tables = []; + for (var j = 0; j < message.exclude_tables.length; ++j) + object.exclude_tables[j] = message.exclude_tables[j]; + } + if (message.include_views != null && message.hasOwnProperty("include_views")) + object.include_views = message.include_views; + return object; + }; + + /** + * Converts this ValidateVSchemaRequest to JSON. + * @function toJSON + * @memberof vtctldata.ValidateVSchemaRequest + * @instance + * @returns {Object.} JSON object + */ + ValidateVSchemaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidateVSchemaRequest; + })(); + + vtctldata.ValidateVSchemaResponse = (function() { + + /** + * Properties of a ValidateVSchemaResponse. + * @memberof vtctldata + * @interface IValidateVSchemaResponse + * @property {Array.|null} [results] ValidateVSchemaResponse results + * @property {Object.|null} [results_by_shard] ValidateVSchemaResponse results_by_shard + */ + + /** + * Constructs a new ValidateVSchemaResponse. + * @memberof vtctldata + * @classdesc Represents a ValidateVSchemaResponse. + * @implements IValidateVSchemaResponse + * @constructor + * @param {vtctldata.IValidateVSchemaResponse=} [properties] Properties to set + */ + function ValidateVSchemaResponse(properties) { + this.results = []; + this.results_by_shard = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidateVSchemaResponse results. + * @member {Array.} results + * @memberof vtctldata.ValidateVSchemaResponse + * @instance + */ + ValidateVSchemaResponse.prototype.results = $util.emptyArray; + + /** + * ValidateVSchemaResponse results_by_shard. + * @member {Object.} results_by_shard + * @memberof vtctldata.ValidateVSchemaResponse + * @instance + */ + ValidateVSchemaResponse.prototype.results_by_shard = $util.emptyObject; + + /** + * Creates a new ValidateVSchemaResponse instance using the specified properties. + * @function create + * @memberof vtctldata.ValidateVSchemaResponse + * @static + * @param {vtctldata.IValidateVSchemaResponse=} [properties] Properties to set + * @returns {vtctldata.ValidateVSchemaResponse} ValidateVSchemaResponse instance + */ + ValidateVSchemaResponse.create = function create(properties) { + return new ValidateVSchemaResponse(properties); + }; + + /** + * Encodes the specified ValidateVSchemaResponse message. Does not implicitly {@link vtctldata.ValidateVSchemaResponse.verify|verify} messages. + * @function encode + * @memberof vtctldata.ValidateVSchemaResponse + * @static + * @param {vtctldata.IValidateVSchemaResponse} message ValidateVSchemaResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidateVSchemaResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.results[i]); + if (message.results_by_shard != null && Object.hasOwnProperty.call(message, "results_by_shard")) + for (var keys = Object.keys(message.results_by_shard), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.vtctldata.ValidateShardResponse.encode(message.results_by_shard[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ValidateVSchemaResponse message, length delimited. Does not implicitly {@link vtctldata.ValidateVSchemaResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof vtctldata.ValidateVSchemaResponse + * @static + * @param {vtctldata.IValidateVSchemaResponse} message ValidateVSchemaResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidateVSchemaResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidateVSchemaResponse message from the specified reader or buffer. + * @function decode + * @memberof vtctldata.ValidateVSchemaResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vtctldata.ValidateVSchemaResponse} ValidateVSchemaResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidateVSchemaResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vtctldata.ValidateVSchemaResponse(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.results && message.results.length)) + message.results = []; + message.results.push(reader.string()); + break; + case 2: + if (message.results_by_shard === $util.emptyObject) + message.results_by_shard = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.vtctldata.ValidateShardResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.results_by_shard[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidateVSchemaResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vtctldata.ValidateVSchemaResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vtctldata.ValidateVSchemaResponse} ValidateVSchemaResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidateVSchemaResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidateVSchemaResponse message. + * @function verify + * @memberof vtctldata.ValidateVSchemaResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidateVSchemaResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) + if (!$util.isString(message.results[i])) + return "results: string[] expected"; + } + if (message.results_by_shard != null && message.hasOwnProperty("results_by_shard")) { + if (!$util.isObject(message.results_by_shard)) + return "results_by_shard: object expected"; + var key = Object.keys(message.results_by_shard); + for (var i = 0; i < key.length; ++i) { + var error = $root.vtctldata.ValidateShardResponse.verify(message.results_by_shard[key[i]]); + if (error) + return "results_by_shard." + error; + } + } + return null; + }; + + /** + * Creates a ValidateVSchemaResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vtctldata.ValidateVSchemaResponse + * @static + * @param {Object.} object Plain object + * @returns {vtctldata.ValidateVSchemaResponse} ValidateVSchemaResponse + */ + ValidateVSchemaResponse.fromObject = function fromObject(object) { + if (object instanceof $root.vtctldata.ValidateVSchemaResponse) + return object; + var message = new $root.vtctldata.ValidateVSchemaResponse(); + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".vtctldata.ValidateVSchemaResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) + message.results[i] = String(object.results[i]); + } + if (object.results_by_shard) { + if (typeof object.results_by_shard !== "object") + throw TypeError(".vtctldata.ValidateVSchemaResponse.results_by_shard: object expected"); + message.results_by_shard = {}; + for (var keys = Object.keys(object.results_by_shard), i = 0; i < keys.length; ++i) { + if (typeof object.results_by_shard[keys[i]] !== "object") + throw TypeError(".vtctldata.ValidateVSchemaResponse.results_by_shard: object expected"); + message.results_by_shard[keys[i]] = $root.vtctldata.ValidateShardResponse.fromObject(object.results_by_shard[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a ValidateVSchemaResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof vtctldata.ValidateVSchemaResponse + * @static + * @param {vtctldata.ValidateVSchemaResponse} message ValidateVSchemaResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidateVSchemaResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.results = []; + if (options.objects || options.defaults) + object.results_by_shard = {}; + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = message.results[j]; + } + var keys2; + if (message.results_by_shard && (keys2 = Object.keys(message.results_by_shard)).length) { + object.results_by_shard = {}; + for (var j = 0; j < keys2.length; ++j) + object.results_by_shard[keys2[j]] = $root.vtctldata.ValidateShardResponse.toObject(message.results_by_shard[keys2[j]], options); + } + return object; + }; + + /** + * Converts this ValidateVSchemaResponse to JSON. + * @function toJSON + * @memberof vtctldata.ValidateVSchemaResponse + * @instance + * @returns {Object.} JSON object + */ + ValidateVSchemaResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ValidateVSchemaResponse; + })(); + return vtctldata; })();