vitess.io/vitess@v0.16.2/proto/vtctlservice.proto (about) 1 /* 2 Copyright 2019 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 // This package contains a service allowing you to use vtctld as a 18 // proxy for vt commands. 19 20 syntax = "proto3"; 21 option go_package = "vitess.io/vitess/go/vt/proto/vtctlservice"; 22 23 package vtctlservice; 24 25 import "vtctldata.proto"; 26 27 // Service Vtctl allows you to call vt commands through gRPC. 28 service Vtctl { 29 rpc ExecuteVtctlCommand (vtctldata.ExecuteVtctlCommandRequest) returns (stream vtctldata.ExecuteVtctlCommandResponse) {}; 30 } 31 32 // Service Vtctld exposes gRPC endpoints for each vt command. 33 service Vtctld { 34 // AddCellInfo registers a local topology service in a new cell by creating 35 // the CellInfo with the provided parameters. 36 rpc AddCellInfo(vtctldata.AddCellInfoRequest) returns (vtctldata.AddCellInfoResponse) {}; 37 // AddCellsAlias defines a group of cells that can be referenced by a single 38 // name (the alias). 39 // 40 // When routing query traffic, replica/rdonly traffic can be routed across 41 // cells within the group (alias). Only primary traffic can be routed across 42 // cells not in the same group (alias). 43 rpc AddCellsAlias(vtctldata.AddCellsAliasRequest) returns (vtctldata.AddCellsAliasResponse) {}; 44 // ApplyRoutingRules applies the VSchema routing rules. 45 rpc ApplyRoutingRules(vtctldata.ApplyRoutingRulesRequest) returns (vtctldata.ApplyRoutingRulesResponse) {}; 46 // ApplySchema applies a schema to a keyspace. 47 rpc ApplySchema(vtctldata.ApplySchemaRequest) returns (vtctldata.ApplySchemaResponse) {}; 48 // ApplyShardRoutingRules applies the VSchema shard routing rules. 49 rpc ApplyShardRoutingRules(vtctldata.ApplyShardRoutingRulesRequest) returns (vtctldata.ApplyShardRoutingRulesResponse) {}; 50 // ApplyVSchema applies a vschema to a keyspace. 51 rpc ApplyVSchema(vtctldata.ApplyVSchemaRequest) returns (vtctldata.ApplyVSchemaResponse) {}; 52 // Backup uses the BackupEngine and BackupStorage services on the specified 53 // tablet to create and store a new backup. 54 rpc Backup(vtctldata.BackupRequest) returns (stream vtctldata.BackupResponse) {}; 55 // BackupShard chooses a tablet in the shard and uses it to create a backup. 56 rpc BackupShard(vtctldata.BackupShardRequest) returns (stream vtctldata.BackupResponse) {}; 57 // ChangeTabletType changes the db type for the specified tablet, if possible. 58 // This is used primarily to arrange replicas, and it will not convert a 59 // primary. For that, use InitShardPrimary. 60 // 61 // NOTE: This command automatically updates the serving graph. 62 rpc ChangeTabletType(vtctldata.ChangeTabletTypeRequest) returns (vtctldata.ChangeTabletTypeResponse) {}; 63 // CreateKeyspace creates the specified keyspace in the topology. For a 64 // SNAPSHOT keyspace, the request must specify the name of a base keyspace, 65 // as well as a snapshot time. 66 rpc CreateKeyspace(vtctldata.CreateKeyspaceRequest) returns (vtctldata.CreateKeyspaceResponse) {}; 67 // CreateShard creates the specified shard in the topology. 68 rpc CreateShard(vtctldata.CreateShardRequest) returns (vtctldata.CreateShardResponse) {}; 69 // DeleteCellInfo deletes the CellInfo for the provided cell. The cell cannot 70 // be referenced by any Shard record in the topology. 71 rpc DeleteCellInfo(vtctldata.DeleteCellInfoRequest) returns (vtctldata.DeleteCellInfoResponse) {}; 72 // DeleteCellsAlias deletes the CellsAlias for the provided alias. 73 rpc DeleteCellsAlias(vtctldata.DeleteCellsAliasRequest) returns (vtctldata.DeleteCellsAliasResponse) {}; 74 // DeleteKeyspace deletes the specified keyspace from the topology. In 75 // recursive mode, it also recursively deletes all shards in the keyspace. 76 // Otherwise, the keyspace must be empty (have no shards), or DeleteKeyspace 77 // returns an error. 78 rpc DeleteKeyspace(vtctldata.DeleteKeyspaceRequest) returns (vtctldata.DeleteKeyspaceResponse) {}; 79 // DeleteShards deletes the specified shards from the topology. In recursive 80 // mode, it also deletes all tablets belonging to the shard. Otherwise, the 81 // shard must be empty (have no tablets) or DeleteShards returns an error for 82 // that shard. 83 rpc DeleteShards(vtctldata.DeleteShardsRequest) returns (vtctldata.DeleteShardsResponse) {}; 84 // DeleteSrvVSchema deletes the SrvVSchema object in the specified cell. 85 rpc DeleteSrvVSchema(vtctldata.DeleteSrvVSchemaRequest) returns (vtctldata.DeleteSrvVSchemaResponse) {}; 86 // DeleteTablets deletes one or more tablets from the topology. 87 rpc DeleteTablets(vtctldata.DeleteTabletsRequest) returns (vtctldata.DeleteTabletsResponse) {}; 88 // EmergencyReparentShard reparents the shard to the new primary. It assumes 89 // the old primary is dead or otherwise not responding. 90 rpc EmergencyReparentShard(vtctldata.EmergencyReparentShardRequest) returns (vtctldata.EmergencyReparentShardResponse) {}; 91 // ExecuteFetchAsApp executes a SQL query on the remote tablet as the App user. 92 rpc ExecuteFetchAsApp(vtctldata.ExecuteFetchAsAppRequest) returns (vtctldata.ExecuteFetchAsAppResponse) {}; 93 // ExecuteFetchAsDBA executes a SQL query on the remote tablet as the DBA user. 94 rpc ExecuteFetchAsDBA(vtctldata.ExecuteFetchAsDBARequest) returns (vtctldata.ExecuteFetchAsDBAResponse) {}; 95 // ExecuteHook runs the hook on the tablet. 96 rpc ExecuteHook(vtctldata.ExecuteHookRequest) returns (vtctldata.ExecuteHookResponse); 97 // FindAllShardsInKeyspace returns a map of shard names to shard references 98 // for a given keyspace. 99 rpc FindAllShardsInKeyspace(vtctldata.FindAllShardsInKeyspaceRequest) returns (vtctldata.FindAllShardsInKeyspaceResponse) {}; 100 // GetBackups returns all the backups for a shard. 101 rpc GetBackups(vtctldata.GetBackupsRequest) returns (vtctldata.GetBackupsResponse) {}; 102 // GetCellInfo returns the information for a cell. 103 rpc GetCellInfo(vtctldata.GetCellInfoRequest) returns (vtctldata.GetCellInfoResponse) {}; 104 // GetCellInfoNames returns all the cells for which we have a CellInfo object, 105 // meaning we have a topology service registered. 106 rpc GetCellInfoNames(vtctldata.GetCellInfoNamesRequest) returns (vtctldata.GetCellInfoNamesResponse) {}; 107 // GetCellsAliases returns a mapping of cell alias to cells identified by that 108 // alias. 109 rpc GetCellsAliases(vtctldata.GetCellsAliasesRequest) returns (vtctldata.GetCellsAliasesResponse) {}; 110 // GetFullStatus returns the full status of MySQL including the replication information, semi-sync information, GTID information among others 111 rpc GetFullStatus(vtctldata.GetFullStatusRequest) returns (vtctldata.GetFullStatusResponse) {}; 112 // GetKeyspace reads the given keyspace from the topo and returns it. 113 rpc GetKeyspace(vtctldata.GetKeyspaceRequest) returns (vtctldata.GetKeyspaceResponse) {}; 114 // GetKeyspaces returns the keyspace struct of all keyspaces in the topo. 115 rpc GetKeyspaces(vtctldata.GetKeyspacesRequest) returns (vtctldata.GetKeyspacesResponse) {}; 116 // GetPermissions returns the permissions set on the remote tablet. 117 rpc GetPermissions(vtctldata.GetPermissionsRequest) returns (vtctldata.GetPermissionsResponse) {}; 118 // GetRoutingRules returns the VSchema routing rules. 119 rpc GetRoutingRules(vtctldata.GetRoutingRulesRequest) returns (vtctldata.GetRoutingRulesResponse) {}; 120 // GetSchema returns the schema for a tablet, or just the schema for the 121 // specified tables in that tablet. 122 rpc GetSchema(vtctldata.GetSchemaRequest) returns (vtctldata.GetSchemaResponse) {}; 123 // GetShard returns information about a shard in the topology. 124 rpc GetShard(vtctldata.GetShardRequest) returns (vtctldata.GetShardResponse) {}; 125 // GetShardRoutingRules returns the VSchema shard routing rules. 126 rpc GetShardRoutingRules(vtctldata.GetShardRoutingRulesRequest) returns (vtctldata.GetShardRoutingRulesResponse) {}; 127 // GetSrvKeyspaceNames returns a mapping of cell name to the keyspaces served 128 // in that cell. 129 rpc GetSrvKeyspaceNames(vtctldata.GetSrvKeyspaceNamesRequest) returns (vtctldata.GetSrvKeyspaceNamesResponse) {}; 130 // GetSrvKeyspaces returns the SrvKeyspaces for a keyspace in one or more 131 // cells. 132 rpc GetSrvKeyspaces (vtctldata.GetSrvKeyspacesRequest) returns (vtctldata.GetSrvKeyspacesResponse) {}; 133 // UpdateThrottlerConfig updates the tablet throttler configuration 134 rpc UpdateThrottlerConfig(vtctldata.UpdateThrottlerConfigRequest) returns (vtctldata.UpdateThrottlerConfigResponse) {}; 135 // GetSrvVSchema returns the SrvVSchema for a cell. 136 rpc GetSrvVSchema(vtctldata.GetSrvVSchemaRequest) returns (vtctldata.GetSrvVSchemaResponse) {}; 137 // GetSrvVSchemas returns a mapping from cell name to SrvVSchema for all cells, 138 // optionally filtered by cell name. 139 rpc GetSrvVSchemas(vtctldata.GetSrvVSchemasRequest) returns (vtctldata.GetSrvVSchemasResponse) {}; 140 // GetTablet returns information about a tablet. 141 rpc GetTablet(vtctldata.GetTabletRequest) returns (vtctldata.GetTabletResponse) {}; 142 // GetTablets returns tablets, optionally filtered by keyspace and shard. 143 rpc GetTablets(vtctldata.GetTabletsRequest) returns (vtctldata.GetTabletsResponse) {}; 144 // GetTopologyPath returns the topology cell at a given path. 145 rpc GetTopologyPath(vtctldata.GetTopologyPathRequest) returns (vtctldata.GetTopologyPathResponse) {}; 146 // GetVersion returns the version of a tablet from its debug vars. 147 rpc GetVersion(vtctldata.GetVersionRequest) returns (vtctldata.GetVersionResponse) {}; 148 // GetVSchema returns the vschema for a keyspace. 149 rpc GetVSchema(vtctldata.GetVSchemaRequest) returns (vtctldata.GetVSchemaResponse) {}; 150 // GetWorkflows returns a list of workflows for the given keyspace. 151 rpc GetWorkflows(vtctldata.GetWorkflowsRequest) returns (vtctldata.GetWorkflowsResponse) {}; 152 // InitShardPrimary sets the initial primary for a shard. Will make all other 153 // tablets in the shard replicas of the provided primary. 154 // 155 // WARNING: This could cause data loss on an already replicating shard. 156 // PlannedReparentShard or EmergencyReparentShard should be used in those 157 // cases instead. 158 rpc InitShardPrimary(vtctldata.InitShardPrimaryRequest) returns (vtctldata.InitShardPrimaryResponse) {}; 159 // PingTablet checks that the specified tablet is awake and responding to RPCs. 160 // This command can be blocked by other in-flight operations. 161 rpc PingTablet(vtctldata.PingTabletRequest) returns (vtctldata.PingTabletResponse) {}; 162 // PlannedReparentShard reparents the shard to the new primary, or away from 163 // an old primary. Both the old and new primaries need to be reachable and 164 // running. 165 // 166 // **NOTE**: The vtctld will not consider any replicas outside the cell the 167 // current shard primary is in for promotion unless NewPrimary is explicitly 168 // provided in the request. 169 rpc PlannedReparentShard(vtctldata.PlannedReparentShardRequest) returns (vtctldata.PlannedReparentShardResponse) {}; 170 // RebuildKeyspaceGraph rebuilds the serving data for a keyspace. 171 // 172 // This may trigger an update to all connected clients. 173 rpc RebuildKeyspaceGraph(vtctldata.RebuildKeyspaceGraphRequest) returns (vtctldata.RebuildKeyspaceGraphResponse) {}; 174 // RebuildVSchemaGraph rebuilds the per-cell SrvVSchema from the global 175 // VSchema objects in the provided cells (or all cells in the topo none 176 // provided). 177 rpc RebuildVSchemaGraph(vtctldata.RebuildVSchemaGraphRequest) returns (vtctldata.RebuildVSchemaGraphResponse) {}; 178 // RefreshState reloads the tablet record on the specified tablet. 179 rpc RefreshState(vtctldata.RefreshStateRequest) returns (vtctldata.RefreshStateResponse) {}; 180 // RefreshStateByShard calls RefreshState on all the tablets in the given shard. 181 rpc RefreshStateByShard(vtctldata.RefreshStateByShardRequest) returns (vtctldata.RefreshStateByShardResponse) {}; 182 // ReloadSchema instructs the remote tablet to reload its schema. 183 rpc ReloadSchema(vtctldata.ReloadSchemaRequest) returns (vtctldata.ReloadSchemaResponse) {}; 184 // ReloadSchemaKeyspace reloads the schema on all tablets in a keyspace. 185 rpc ReloadSchemaKeyspace(vtctldata.ReloadSchemaKeyspaceRequest) returns (vtctldata.ReloadSchemaKeyspaceResponse) {}; 186 // ReloadSchemaShard reloads the schema on all tablets in a shard. 187 // 188 // In general, we don't always expect all replicas to be ready to reload, and 189 // the periodic schema reload makes them self-healing anyway. So, we do this 190 // on a best-effort basis, and log warnings for any tablets that fail to 191 // reload within the context deadline. 192 rpc ReloadSchemaShard(vtctldata.ReloadSchemaShardRequest) returns (vtctldata.ReloadSchemaShardResponse) {}; 193 // RemoveBackup removes a backup from the BackupStorage used by vtctld. 194 rpc RemoveBackup(vtctldata.RemoveBackupRequest) returns (vtctldata.RemoveBackupResponse) {}; 195 // RemoveKeyspaceCell removes the specified cell from the Cells list for all 196 // shards in the specified keyspace (by calling RemoveShardCell on every 197 // shard). It also removes the SrvKeyspace for that keyspace in that cell. 198 rpc RemoveKeyspaceCell(vtctldata.RemoveKeyspaceCellRequest) returns (vtctldata.RemoveKeyspaceCellResponse) {}; 199 // RemoveShardCell removes the specified cell from the specified shard's Cells 200 // list. 201 rpc RemoveShardCell(vtctldata.RemoveShardCellRequest) returns (vtctldata.RemoveShardCellResponse) {}; 202 // ReparentTablet reparents a tablet to the current primary in the shard. This 203 // only works if the current replica position matches the last known reparent 204 // action. 205 rpc ReparentTablet(vtctldata.ReparentTabletRequest) returns (vtctldata.ReparentTabletResponse) {}; 206 // RestoreFromBackup stops mysqld for the given tablet and restores a backup. 207 rpc RestoreFromBackup(vtctldata.RestoreFromBackupRequest) returns (stream vtctldata.RestoreFromBackupResponse) {}; 208 // RunHealthCheck runs a healthcheck on the remote tablet. 209 rpc RunHealthCheck(vtctldata.RunHealthCheckRequest) returns (vtctldata.RunHealthCheckResponse) {}; 210 // SetKeyspaceDurabilityPolicy updates the DurabilityPolicy for a keyspace. 211 rpc SetKeyspaceDurabilityPolicy(vtctldata.SetKeyspaceDurabilityPolicyRequest) returns (vtctldata.SetKeyspaceDurabilityPolicyResponse) {}; 212 // SetShardIsPrimaryServing adds or removes a shard from serving. 213 // 214 // This is meant as an emergency function. It does not rebuild any serving 215 // graph (i.e. it does not run RebuildKeyspaceGraph). 216 rpc SetShardIsPrimaryServing(vtctldata.SetShardIsPrimaryServingRequest) returns (vtctldata.SetShardIsPrimaryServingResponse) {}; 217 // SetShardTabletControl updates the TabletControl topo record for a shard and 218 // tablet type. 219 // 220 // This should only be used for an emergency fix, or after a finished 221 // Reshard. See the documentation on SetShardTabletControlRequest for more 222 // information about the different update modes. 223 rpc SetShardTabletControl(vtctldata.SetShardTabletControlRequest) returns (vtctldata.SetShardTabletControlResponse) {}; 224 // SetWritable sets a tablet as read-write (writable=true) or read-only (writable=false). 225 rpc SetWritable(vtctldata.SetWritableRequest) returns (vtctldata.SetWritableResponse) {}; 226 // ShardReplicationAdd adds an entry to a topodata.ShardReplication object. 227 // 228 // It is a low-level function and should generally not be called. 229 rpc ShardReplicationAdd(vtctldata.ShardReplicationAddRequest) returns (vtctldata.ShardReplicationAddResponse) {}; 230 // ShardReplicationFix walks the replication graph for a shard in a cell and 231 // attempts to fix the first problem encountered, returning information about 232 // the problem fixed, if any. 233 rpc ShardReplicationFix(vtctldata.ShardReplicationFixRequest) returns (vtctldata.ShardReplicationFixResponse) {}; 234 // ShardReplicationPositions returns the replication position of each tablet 235 // in a shard. This RPC makes a best-effort to return partial results. For 236 // example, if one tablet in the shard graph is unreachable, then 237 // ShardReplicationPositions will return non-error, and include valid results 238 // for the reachable tablets. 239 rpc ShardReplicationPositions(vtctldata.ShardReplicationPositionsRequest) returns (vtctldata.ShardReplicationPositionsResponse) {}; 240 // ShardReplicationRemove removes an entry from a topodata.ShardReplication 241 // object. 242 // 243 // It is a low-level function and should generally not be called. 244 rpc ShardReplicationRemove(vtctldata.ShardReplicationRemoveRequest) returns (vtctldata.ShardReplicationRemoveResponse) {}; 245 // SleepTablet blocks the aciton queue on the specified tablet for the 246 // specified duration. 247 // 248 // This is typically used for testing. 249 rpc SleepTablet(vtctldata.SleepTabletRequest) returns (vtctldata.SleepTabletResponse) {}; 250 // SourceShardAdd adds the SourceShard record with the provided index. This 251 // should be used only as an emergency function. 252 // 253 // It does not call RefreshState for the shard primary. 254 rpc SourceShardAdd(vtctldata.SourceShardAddRequest) returns (vtctldata.SourceShardAddResponse) {}; 255 // SourceShardDelete deletes the SourceShard record with the provided index. 256 // This should be used only as an emergency cleanup function. 257 // 258 // It does not call RefreshState for the shard primary. 259 rpc SourceShardDelete(vtctldata.SourceShardDeleteRequest) returns (vtctldata.SourceShardDeleteResponse) {}; 260 // StartReplication starts replication on the specified tablet. 261 rpc StartReplication(vtctldata.StartReplicationRequest) returns (vtctldata.StartReplicationResponse) {}; 262 // StopReplication stops replication on the specified tablet. 263 rpc StopReplication(vtctldata.StopReplicationRequest) returns (vtctldata.StopReplicationResponse) {}; 264 // TabletExternallyReparented changes metadata in the topology server to 265 // acknowledge a shard primary change performed by an external tool (e.g. 266 // orchestrator). 267 // 268 // See the Reparenting guide for more information: 269 // https://vitess.io/docs/user-guides/configuration-advanced/reparenting/#external-reparenting. 270 rpc TabletExternallyReparented(vtctldata.TabletExternallyReparentedRequest) returns (vtctldata.TabletExternallyReparentedResponse) {}; 271 // UpdateCellInfo updates the content of a CellInfo with the provided 272 // parameters. Empty values are ignored. If the cell does not exist, the 273 // CellInfo will be created. 274 rpc UpdateCellInfo(vtctldata.UpdateCellInfoRequest) returns (vtctldata.UpdateCellInfoResponse) {}; 275 // UpdateCellsAlias updates the content of a CellsAlias with the provided 276 // parameters. Empty values are ignored. If the alias does not exist, the 277 // CellsAlias will be created. 278 rpc UpdateCellsAlias(vtctldata.UpdateCellsAliasRequest) returns (vtctldata.UpdateCellsAliasResponse) {}; 279 // Validate validates that all nodes from the global replication graph are 280 // reachable, and that all tablets in discoverable cells are consistent. 281 rpc Validate(vtctldata.ValidateRequest) returns (vtctldata.ValidateResponse) {}; 282 // ValidateKeyspace validates that all nodes reachable from the specified 283 // keyspace are consistent. 284 rpc ValidateKeyspace(vtctldata.ValidateKeyspaceRequest) returns (vtctldata.ValidateKeyspaceResponse) {}; 285 // ValidateSchemaKeyspace validates that the schema on the primary tablet for shard 0 matches the schema on all of the other tablets in the keyspace. 286 rpc ValidateSchemaKeyspace(vtctldata.ValidateSchemaKeyspaceRequest) returns (vtctldata.ValidateSchemaKeyspaceResponse) {}; 287 // ValidateShard validates that all nodes reachable from the specified shard 288 // are consistent. 289 rpc ValidateShard(vtctldata.ValidateShardRequest) returns (vtctldata.ValidateShardResponse) {}; 290 // ValidateVersionKeyspace validates that the version on the primary of shard 0 matches all of the other tablets in the keyspace. 291 rpc ValidateVersionKeyspace(vtctldata.ValidateVersionKeyspaceRequest) returns (vtctldata.ValidateVersionKeyspaceResponse) {}; 292 // ValidateVersionShard validates that the version on the primary matches all of the replicas. 293 rpc ValidateVersionShard(vtctldata.ValidateVersionShardRequest) returns (vtctldata.ValidateVersionShardResponse) {}; 294 // ValidateVSchema compares the schema of each primary tablet in "keyspace/shards..." to the vschema and errs if there are differences. 295 rpc ValidateVSchema(vtctldata.ValidateVSchemaRequest) returns (vtctldata.ValidateVSchemaResponse) {}; 296 }