2017-05-06 02:21:12 +03:00
|
|
|
/*
|
2019-10-21 12:35:53 +03:00
|
|
|
Copyright 2019 The Vitess Authors.
|
2017-05-06 02:21:12 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
2019-10-21 12:35:53 +03:00
|
|
|
Unless required by applicable law or agreed to in writing, software
|
2017-05-06 02:21:12 +03:00
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2015-06-10 19:32:15 +03:00
|
|
|
// This file contains the service definition for making management API
|
|
|
|
// calls to VtTablet.
|
|
|
|
|
|
|
|
syntax = "proto3";
|
2018-06-08 06:00:15 +03:00
|
|
|
option go_package = "vitess.io/vitess/go/vt/proto/tabletmanagerservice";
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
package tabletmanagerservice;
|
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
import "tabletmanagerdata.proto";
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
// TabletManager is a service definition for tabletmanagerdata.TabletManager.
|
2015-06-10 19:32:15 +03:00
|
|
|
service TabletManager {
|
|
|
|
//
|
|
|
|
// Various read-only methods
|
|
|
|
//
|
|
|
|
|
|
|
|
// Ping returns the input payload
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc Ping(tabletmanagerdata.PingRequest) returns (tabletmanagerdata.PingResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// Sleep sleeps for the provided duration
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc Sleep(tabletmanagerdata.SleepRequest) returns (tabletmanagerdata.SleepResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// ExecuteHook executes the hook remotely
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc ExecuteHook(tabletmanagerdata.ExecuteHookRequest) returns (tabletmanagerdata.ExecuteHookResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// GetSchema asks the tablet for its schema
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc GetSchema(tabletmanagerdata.GetSchemaRequest) returns (tabletmanagerdata.GetSchemaResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// GetPermissions asks the tablet for its permissions
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc GetPermissions(tabletmanagerdata.GetPermissionsRequest) returns (tabletmanagerdata.GetPermissionsResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// Various read-write methods
|
|
|
|
//
|
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc SetReadOnly(tabletmanagerdata.SetReadOnlyRequest) returns (tabletmanagerdata.SetReadOnlyResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc SetReadWrite(tabletmanagerdata.SetReadWriteRequest) returns (tabletmanagerdata.SetReadWriteResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// ChangeType asks the remote tablet to change its type
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc ChangeType(tabletmanagerdata.ChangeTypeRequest) returns (tabletmanagerdata.ChangeTypeResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc RefreshState(tabletmanagerdata.RefreshStateRequest) returns (tabletmanagerdata.RefreshStateResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc RunHealthCheck(tabletmanagerdata.RunHealthCheckRequest) returns (tabletmanagerdata.RunHealthCheckResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2016-03-05 12:52:23 +03:00
|
|
|
rpc IgnoreHealthError(tabletmanagerdata.IgnoreHealthErrorRequest) returns (tabletmanagerdata.IgnoreHealthErrorResponse) {};
|
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc ReloadSchema(tabletmanagerdata.ReloadSchemaRequest) returns (tabletmanagerdata.ReloadSchemaResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc PreflightSchema(tabletmanagerdata.PreflightSchemaRequest) returns (tabletmanagerdata.PreflightSchemaResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc ApplySchema(tabletmanagerdata.ApplySchemaRequest) returns (tabletmanagerdata.ApplySchemaResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2019-01-18 18:26:25 +03:00
|
|
|
rpc LockTables(tabletmanagerdata.LockTablesRequest) returns (tabletmanagerdata.LockTablesResponse) {};
|
|
|
|
|
|
|
|
rpc UnlockTables(tabletmanagerdata.UnlockTablesRequest) returns (tabletmanagerdata.UnlockTablesResponse) {};
|
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc ExecuteFetchAsDba(tabletmanagerdata.ExecuteFetchAsDbaRequest) returns (tabletmanagerdata.ExecuteFetchAsDbaResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2016-09-22 01:33:48 +03:00
|
|
|
rpc ExecuteFetchAsAllPrivs(tabletmanagerdata.ExecuteFetchAsAllPrivsRequest) returns (tabletmanagerdata.ExecuteFetchAsAllPrivsResponse) {};
|
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc ExecuteFetchAsApp(tabletmanagerdata.ExecuteFetchAsAppRequest) returns (tabletmanagerdata.ExecuteFetchAsAppResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// Replication related methods
|
|
|
|
//
|
|
|
|
|
|
|
|
// SlaveStatus returns the current slave status.
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc SlaveStatus(tabletmanagerdata.SlaveStatusRequest) returns (tabletmanagerdata.SlaveStatusResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// MasterPosition returns the current master position
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc MasterPosition(tabletmanagerdata.MasterPositionRequest) returns (tabletmanagerdata.MasterPositionResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// StopSlave makes mysql stop its replication
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc StopSlave(tabletmanagerdata.StopSlaveRequest) returns (tabletmanagerdata.StopSlaveResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// StopSlaveMinimum stops the mysql replication after it reaches
|
|
|
|
// the provided minimum point
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc StopSlaveMinimum(tabletmanagerdata.StopSlaveMinimumRequest) returns (tabletmanagerdata.StopSlaveMinimumResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// StartSlave starts the mysql replication
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc StartSlave(tabletmanagerdata.StartSlaveRequest) returns (tabletmanagerdata.StartSlaveResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2019-01-18 18:26:25 +03:00
|
|
|
// StartSlave starts the mysql replication until and including
|
|
|
|
// the provided position
|
|
|
|
rpc StartSlaveUntilAfter(tabletmanagerdata.StartSlaveUntilAfterRequest) returns (tabletmanagerdata.StartSlaveUntilAfterResponse) {};
|
|
|
|
|
2015-06-10 19:32:15 +03:00
|
|
|
// TabletExternallyReparented tells a tablet that its underlying MySQL is
|
2015-06-19 18:20:58 +03:00
|
|
|
// currently the master. It is only used in environments (tabletmanagerdata.such as Vitess+MoB)
|
2015-06-10 19:32:15 +03:00
|
|
|
// in which MySQL is reparented by some agent external to Vitess, and then
|
|
|
|
// that agent simply notifies Vitess.
|
|
|
|
//
|
|
|
|
// This call is idempotent with respect to a single target tablet.
|
|
|
|
// However, the tablet assumes there is a cooling-off period following the
|
|
|
|
// initial external reparent from A to B, before this call is repeated on any
|
|
|
|
// tablet other than B. This assumption is configurable with the vttablet flag
|
|
|
|
// "finalize_external_reparent_timeout".
|
|
|
|
//
|
|
|
|
// For more information, see the design doc at go/vt-fast-failover.
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc TabletExternallyReparented(tabletmanagerdata.TabletExternallyReparentedRequest) returns (tabletmanagerdata.TabletExternallyReparentedResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// TabletExternallyElected is an notification that may be sent in
|
|
|
|
// anticipation of potentially later sending TabletExternallyReparented.
|
|
|
|
// The tablet can use this extra lead time to prepare to react quickly if
|
|
|
|
// TabletExternallyReparented does follow.
|
|
|
|
//
|
|
|
|
// This call is effectively a no-op if it is not followed by a call to
|
|
|
|
// TabletExternallyReparented, so the external agent doing the reparent can
|
|
|
|
// still change its mind.
|
|
|
|
//
|
|
|
|
// The agent does not need to wait for this call or cancel it before calling
|
|
|
|
// TabletExternallyReparented if the external reparent operation finishes
|
|
|
|
// before TabletExternallyElected returns.
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc TabletExternallyElected(tabletmanagerdata.TabletExternallyElectedRequest) returns (tabletmanagerdata.TabletExternallyElectedResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// GetSlaves asks for the list of mysql slaves
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc GetSlaves(tabletmanagerdata.GetSlavesRequest) returns (tabletmanagerdata.GetSlavesResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2018-06-23 19:29:32 +03:00
|
|
|
// VReplication API
|
|
|
|
rpc VReplicationExec(tabletmanagerdata.VReplicationExecRequest) returns(tabletmanagerdata.VReplicationExecResponse) {};
|
2018-06-30 01:01:37 +03:00
|
|
|
rpc VReplicationWaitForPos(tabletmanagerdata.VReplicationWaitForPosRequest) returns(tabletmanagerdata.VReplicationWaitForPosResponse) {};
|
2018-06-22 06:47:20 +03:00
|
|
|
|
2015-06-10 19:32:15 +03:00
|
|
|
//
|
|
|
|
// Reparenting related functions
|
|
|
|
//
|
|
|
|
|
|
|
|
// ResetReplication makes the target not replicating
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc ResetReplication(tabletmanagerdata.ResetReplicationRequest) returns (tabletmanagerdata.ResetReplicationResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// InitMaster initializes the tablet as a master
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc InitMaster(tabletmanagerdata.InitMasterRequest) returns (tabletmanagerdata.InitMasterResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// PopulateReparentJournal tells the tablet to add an entry to its
|
|
|
|
// reparent journal
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc PopulateReparentJournal(tabletmanagerdata.PopulateReparentJournalRequest) returns (tabletmanagerdata.PopulateReparentJournalResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2019-08-26 06:23:07 +03:00
|
|
|
// InitSlave tells the tablet to reparent to the master unconditionally
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc InitSlave(tabletmanagerdata.InitSlaveRequest) returns (tabletmanagerdata.InitSlaveResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// DemoteMaster tells the soon-to-be-former master it's gonna change
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc DemoteMaster(tabletmanagerdata.DemoteMasterRequest) returns (tabletmanagerdata.DemoteMasterResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
2019-01-25 04:08:13 +03:00
|
|
|
// UndoDemoteMaster reverts all changes made by DemoteMaster
|
|
|
|
rpc UndoDemoteMaster(tabletmanagerdata.UndoDemoteMasterRequest) returns (tabletmanagerdata.UndoDemoteMasterResponse) {};
|
|
|
|
|
2015-06-10 19:32:15 +03:00
|
|
|
// PromoteSlaveWhenCaughtUp tells the remote tablet to catch up,
|
|
|
|
// and then be the master
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc PromoteSlaveWhenCaughtUp(tabletmanagerdata.PromoteSlaveWhenCaughtUpRequest) returns (tabletmanagerdata.PromoteSlaveWhenCaughtUpResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// SlaveWasPromoted tells the remote tablet it is now the master
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc SlaveWasPromoted(tabletmanagerdata.SlaveWasPromotedRequest) returns (tabletmanagerdata.SlaveWasPromotedResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// SetMaster tells the slave to reparent
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc SetMaster(tabletmanagerdata.SetMasterRequest) returns (tabletmanagerdata.SetMasterResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// SlaveWasRestarted tells the remote tablet its master has changed
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc SlaveWasRestarted(tabletmanagerdata.SlaveWasRestartedRequest) returns (tabletmanagerdata.SlaveWasRestartedResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// StopReplicationAndGetStatus stops MySQL replication, and returns the
|
|
|
|
// replication status
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc StopReplicationAndGetStatus(tabletmanagerdata.StopReplicationAndGetStatusRequest) returns (tabletmanagerdata.StopReplicationAndGetStatusResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
// PromoteSlave makes the slave the new master
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc PromoteSlave(tabletmanagerdata.PromoteSlaveRequest) returns (tabletmanagerdata.PromoteSlaveResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// Backup related methods
|
|
|
|
//
|
|
|
|
|
2015-06-19 18:20:58 +03:00
|
|
|
rpc Backup(tabletmanagerdata.BackupRequest) returns (stream tabletmanagerdata.BackupResponse) {};
|
2016-06-28 01:24:08 +03:00
|
|
|
|
|
|
|
// RestoreFromBackup deletes all local data and restores it from the latest backup.
|
|
|
|
rpc RestoreFromBackup(tabletmanagerdata.RestoreFromBackupRequest) returns (stream tabletmanagerdata.RestoreFromBackupResponse) {};
|
2015-06-10 19:32:15 +03:00
|
|
|
}
|