vitess.io/vitess@v0.16.2/proto/vtctldata.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 the data structures for a service allowing 18 // you to use vtctld as a server for vt commands. 19 20 syntax = "proto3"; 21 option go_package = "vitess.io/vitess/go/vt/proto/vtctldata"; 22 23 package vtctldata; 24 25 import "binlogdata.proto"; 26 import "logutil.proto"; 27 import "mysqlctl.proto"; 28 import "query.proto"; 29 import "replicationdata.proto"; 30 import "tabletmanagerdata.proto"; 31 import "topodata.proto"; 32 import "vschema.proto"; 33 import "vtrpc.proto"; 34 import "vttime.proto"; 35 36 // ExecuteVtctlCommandRequest is the payload for ExecuteVtctlCommand. 37 // timeouts are in nanoseconds. 38 message ExecuteVtctlCommandRequest { 39 repeated string args = 1; 40 int64 action_timeout = 2; 41 } 42 43 // ExecuteVtctlCommandResponse is streamed back by ExecuteVtctlCommand. 44 message ExecuteVtctlCommandResponse { 45 logutil.Event event = 1; 46 } 47 48 // MaterializationIntent describes the reason for creating the Materialize flow 49 enum MaterializationIntent { 50 // CUSTOM is the default value 51 CUSTOM = 0; 52 53 // MOVETABLES is when we are creating a MoveTables flow 54 MOVETABLES = 1; 55 56 // CREATELOOKUPINDEX is when we are creating a CreateLookupIndex flow 57 CREATELOOKUPINDEX = 2; 58 } 59 60 // TableMaterializeSttings contains the settings for one table. 61 message TableMaterializeSettings { 62 string target_table = 1; 63 // source_expression is a select statement. 64 string source_expression = 2; 65 // create_ddl contains the DDL to create the target table. 66 // If empty, the target table must already exist. 67 // if "copy", the target table DDL is the same as the source table. 68 string create_ddl = 3; 69 } 70 71 // MaterializeSettings contains the settings for the Materialize command. 72 message MaterializeSettings { 73 // workflow is the name of the workflow. 74 string workflow = 1; 75 string source_keyspace = 2; 76 string target_keyspace = 3; 77 // stop_after_copy specifies if vreplication should be stopped after copying. 78 bool stop_after_copy = 4; 79 repeated TableMaterializeSettings table_settings = 5; 80 // optional parameters. 81 string cell = 6; 82 string tablet_types = 7; 83 // ExternalCluster is the name of the mounted cluster which has the source keyspace/db for this workflow 84 // it is of the type <cluster_type.cluster_name> 85 string external_cluster = 8; 86 // MaterializationIntent is used to identify the reason behind the materialization workflow: eg. MoveTables, CreateLookupVindex 87 MaterializationIntent materialization_intent = 9; 88 // SourceTimeZone is the time zone in which datetimes on the source were stored, provided as an option in MoveTable 89 string source_time_zone =10; 90 // TargetTimeZone is not currently specifiable by the user, defaults to UTC for the forward workflows 91 // and to the SourceTimeZone in reverse workflows 92 string target_time_zone = 11; 93 repeated string source_shards = 12; 94 // OnDdl specifies the action to be taken when a DDL is encountered. 95 string on_ddl = 13; 96 // DeferSecondaryKeys specifies if secondary keys should be created in one shot after table copy finishes. 97 bool defer_secondary_keys = 14; 98 } 99 100 /* Data types for VtctldServer */ 101 102 message Keyspace { 103 string name = 1; 104 topodata.Keyspace keyspace = 2; 105 } 106 107 message Shard { 108 string keyspace = 1; 109 string name = 2; 110 topodata.Shard shard = 3; 111 } 112 113 // TODO: comment the hell out of this. 114 message Workflow { 115 string name = 1; 116 ReplicationLocation source = 2; 117 ReplicationLocation target = 3; 118 int64 max_v_replication_lag = 4; 119 map<string, ShardStream> shard_streams = 5; 120 string workflow_type = 6; 121 string workflow_sub_type = 7; 122 123 message ReplicationLocation { 124 string keyspace = 1; 125 repeated string shards = 2; 126 } 127 128 message ShardStream { 129 repeated Stream streams = 1; 130 repeated topodata.Shard.TabletControl tablet_controls = 2; 131 bool is_primary_serving = 3; 132 } 133 134 message Stream { 135 int64 id = 1; 136 string shard = 2; 137 topodata.TabletAlias tablet = 3; 138 binlogdata.BinlogSource binlog_source = 4; 139 string position = 5; 140 string stop_position = 6; 141 string state = 7; 142 string db_name = 8; 143 vttime.Time transaction_timestamp = 9; 144 vttime.Time time_updated = 10; 145 string message = 11; 146 repeated CopyState copy_states = 12; 147 repeated Log logs = 13; 148 // LogFetchError is set if we fail to fetch some logs for this stream. We 149 // will never fail to fetch workflows because we cannot fetch the logs, but 150 // we will still forward log-fetch errors to the caller, should that be 151 // relevant to the context in which they are fetching workflows. 152 // 153 // Note that this field being set does not necessarily mean that Logs is nil; 154 // if there are N logs that exist for the stream, and we fail to fetch the 155 // ith log, we will still return logs in [0, i) + (i, N]. 156 string log_fetch_error = 14; 157 repeated string tags = 15; 158 159 message CopyState { 160 string table = 1; 161 string last_pk = 2; 162 } 163 164 message Log { 165 int64 id = 1; 166 int64 stream_id = 2; 167 string type = 3; 168 string state = 4; 169 vttime.Time created_at = 5; 170 vttime.Time updated_at = 6; 171 string message = 7; 172 int64 count = 8; 173 } 174 } 175 } 176 177 /* Request/response types for VtctldServer */ 178 179 180 message AddCellInfoRequest { 181 string name = 1; 182 topodata.CellInfo cell_info = 2; 183 } 184 185 message AddCellInfoResponse { 186 } 187 188 message AddCellsAliasRequest { 189 string name = 1; 190 repeated string cells = 2; 191 } 192 193 message AddCellsAliasResponse { 194 } 195 196 message ApplyRoutingRulesRequest { 197 vschema.RoutingRules routing_rules = 1; 198 // SkipRebuild, if set, will cause ApplyRoutingRules to skip rebuilding the 199 // SrvVSchema objects in each cell in RebuildCells. 200 bool skip_rebuild = 2; 201 // RebuildCells limits the SrvVSchema rebuild to the specified cells. If not 202 // provided the SrvVSchema will be rebuilt in every cell in the topology. 203 // 204 // Ignored if SkipRebuild is set. 205 repeated string rebuild_cells = 3; 206 } 207 208 message ApplyRoutingRulesResponse { 209 } 210 211 message ApplyShardRoutingRulesRequest { 212 vschema.ShardRoutingRules shard_routing_rules = 1; 213 // SkipRebuild, if set, will cause ApplyShardRoutingRules to skip rebuilding the 214 // SrvVSchema objects in each cell in RebuildCells. 215 bool skip_rebuild = 2; 216 // RebuildCells limits the SrvVSchema rebuild to the specified cells. If not 217 // provided the SrvVSchema will be rebuilt in every cell in the topology. 218 // 219 // Ignored if SkipRebuild is set. 220 repeated string rebuild_cells = 3; 221 } 222 223 message ApplyShardRoutingRulesResponse { 224 } 225 226 message ApplySchemaRequest { 227 string keyspace = 1; 228 // Allow large schema changes which incur a longer unavailability of the database. 229 bool allow_long_unavailability = 2; 230 // SQL commands to run. 231 repeated string sql = 3; 232 // Online DDL strategy, compatible with @@ddl_strategy session variable (examples: 'gh-ost', 'pt-osc', 'gh-ost --max-load=Threads_running=100'") 233 string ddl_strategy = 4; 234 // Optional: explicit UUIDs for migration. 235 // If given, must match number of DDL changes 236 repeated string uuid_list = 5; 237 // For Online DDL, optionally supply a custom unique string used as context for the migration(s) in this command. 238 // By default a unique context is auto-generated by Vitess 239 string migration_context = 6; 240 // WaitReplicasTimeout is the duration of time to wait for replicas to catch 241 // up in reparenting. 242 vttime.Duration wait_replicas_timeout = 7; 243 // Skip pre-apply schema checks, and directly forward schema change query to shards 244 bool skip_preflight = 8; 245 // caller_id identifies the caller. This is the effective caller ID, 246 // set by the application to further identify the caller. 247 vtrpc.CallerID caller_id = 9; 248 } 249 250 message ApplySchemaResponse { 251 repeated string uuid_list = 1; 252 } 253 254 message ApplyVSchemaRequest { 255 string keyspace = 1; 256 bool skip_rebuild = 2; 257 bool dry_run = 3; 258 repeated string cells = 4; 259 vschema.Keyspace v_schema = 5; 260 string sql = 6; 261 } 262 263 message ApplyVSchemaResponse { 264 vschema.Keyspace v_schema = 1; 265 } 266 267 message BackupRequest { 268 topodata.TabletAlias tablet_alias = 1; 269 // AllowPrimary allows the backup to proceed if TabletAlias is a PRIMARY. 270 // 271 // WARNING: If using the builtin backup engine, this will shutdown mysqld on 272 // the primary for the duration of the backup, and no writes will be possible. 273 bool allow_primary = 2; 274 // Concurrency specifies the number of compression/checksum jobs to run 275 // simultaneously. 276 uint64 concurrency = 3; 277 // IncrementalFromPos indicates a position of a previous backup. When this value is non-empty 278 // then the backup becomes incremental and applies as of given position. 279 string incremental_from_pos = 4; 280 } 281 282 message BackupResponse { 283 // TabletAlias is the alias being used for the backup. 284 topodata.TabletAlias tablet_alias = 1; 285 string keyspace = 2; 286 string shard = 3; 287 logutil.Event event = 4; 288 } 289 290 message BackupShardRequest { 291 string keyspace = 1; 292 string shard = 2; 293 // AllowPrimary allows the backup to occur on a PRIMARY tablet. See 294 // BackupRequest.AllowPrimary for warnings and caveats. 295 bool allow_primary = 3; 296 // Concurrency specifies the number of compression/checksum jobs to run 297 // simultaneously. 298 uint64 concurrency = 4; 299 } 300 301 message ChangeTabletTypeRequest { 302 topodata.TabletAlias tablet_alias = 1; 303 topodata.TabletType db_type = 2; 304 bool dry_run = 3; 305 } 306 307 message ChangeTabletTypeResponse { 308 topodata.Tablet before_tablet = 1; 309 topodata.Tablet after_tablet = 2; 310 bool was_dry_run = 3; 311 } 312 313 message CreateKeyspaceRequest { 314 // Name is the name of the keyspace. 315 string name = 1; 316 // Force proceeds with the request even if the keyspace already exists. 317 bool force = 2; 318 // AllowEmptyVSchema allows a keyspace to be created with no vschema. 319 bool allow_empty_v_schema = 3; 320 321 // OBSOLETE string sharding_column_name = 4; 322 reserved 4; 323 324 // OBSOLETE topodata.KeyspaceIdType sharding_column_type = 5; 325 reserved 5; 326 327 // ServedFroms specifies a set of db_type:keyspace pairs used to serve 328 // traffic for the keyspace. 329 repeated topodata.Keyspace.ServedFrom served_froms = 6; 330 331 // Type is the type of the keyspace to create. 332 topodata.KeyspaceType type = 7; 333 // BaseKeyspace specifies the base keyspace for SNAPSHOT keyspaces. It is 334 // required to create a SNAPSHOT keyspace. 335 string base_keyspace = 8; 336 // SnapshotTime specifies the snapshot time for this keyspace. It is required 337 // to create a SNAPSHOT keyspace. 338 vttime.Time snapshot_time = 9; 339 // DurabilityPolicy is the durability policy to be 340 // used for this keyspace. 341 string durability_policy = 10; 342 } 343 344 message CreateKeyspaceResponse { 345 // Keyspace is the newly-created keyspace. 346 Keyspace keyspace = 1; 347 } 348 349 message CreateShardRequest { 350 // Keyspace is the name of the keyspace to create the shard in. 351 string keyspace = 1; 352 // ShardName is the name of the shard to create. E.g. "-" or "-80". 353 string shard_name = 2; 354 // Force treats an attempt to create a shard that already exists as a 355 // non-error. 356 bool force = 3; 357 // IncludeParent creates the parent keyspace as an empty BASE keyspace, if it 358 // doesn't already exist. 359 bool include_parent = 4; 360 } 361 362 message CreateShardResponse { 363 // Keyspace is the created keyspace. It is set only if IncludeParent was 364 // specified in the request and the parent keyspace needed to be created. 365 Keyspace keyspace = 1; 366 // Shard is the newly-created shard object. 367 Shard shard = 2; 368 // ShardAlreadyExists is set if Force was specified in the request and the 369 // shard already existed. 370 bool shard_already_exists = 3; 371 } 372 373 message DeleteCellInfoRequest { 374 string name = 1; 375 bool force = 2; 376 } 377 378 message DeleteCellInfoResponse { 379 } 380 381 message DeleteCellsAliasRequest { 382 string name = 1; 383 } 384 385 message DeleteCellsAliasResponse { 386 } 387 388 message DeleteKeyspaceRequest { 389 // Keyspace is the name of the keyspace to delete. 390 string keyspace = 1; 391 // Recursive causes all shards in the keyspace to be recursively deleted 392 // before deleting the keyspace. It is an error to call DeleteKeyspace on a 393 // non-empty keyspace without also specifying Recursive. 394 bool recursive = 2; 395 // Force allows a keyspace to be deleted even if the keyspace lock cannot be 396 // obtained. This should only be used to force-clean a keyspace. 397 bool force = 3; 398 } 399 400 message DeleteKeyspaceResponse { 401 } 402 403 message DeleteShardsRequest { 404 // Shards is the list of shards to delete. The nested topodatapb.Shard field 405 // is not required for DeleteShard, but the Keyspace and Shard fields are. 406 repeated Shard shards = 1; 407 // Recursive also deletes all tablets belonging to the shard(s). It is an 408 // error to call DeleteShard on a non-empty shard without also specificying 409 // Recursive. 410 bool recursive = 2; 411 // EvenIfServing allows a shard to be deleted even if it is serving, which is 412 // normally an error. Use with caution. 413 bool even_if_serving = 4; 414 // Force allows a shard to be deleted even if the shard lock cannot be 415 // obtained. This should only be used to force-clean a shard. 416 bool force = 5; 417 } 418 419 message DeleteShardsResponse { 420 } 421 422 message DeleteSrvVSchemaRequest { 423 string cell = 1; 424 } 425 426 message DeleteSrvVSchemaResponse { 427 } 428 429 message DeleteTabletsRequest { 430 // TabletAliases is the list of tablets to delete. 431 repeated topodata.TabletAlias tablet_aliases = 1; 432 // AllowPrimary allows for the primary tablet of a shard to be deleted. 433 // Use with caution. 434 bool allow_primary = 2; 435 } 436 437 message DeleteTabletsResponse { 438 } 439 440 message EmergencyReparentShardRequest { 441 // Keyspace is the name of the keyspace to perform the Emergency Reparent in. 442 string keyspace = 1; 443 // Shard is the name of the shard to perform the Emergency Reparent in. 444 string shard = 2; 445 // Optional alias of a tablet that should become the new shard primary. If not 446 // not specified, the vtctld will select the most up-to-date canditate to 447 // promote. 448 topodata.TabletAlias new_primary = 3; 449 // List of replica aliases to ignore during the Emergency Reparent. The vtctld 450 // will not attempt to stop replication on these tablets, nor attempt to 451 // demote any that may think they are the shard primary. 452 repeated topodata.TabletAlias ignore_replicas = 4; 453 // WaitReplicasTimeout is the duration of time to wait for replicas to catch 454 // up in reparenting. 455 vttime.Duration wait_replicas_timeout = 5; 456 // PreventCrossCellPromotion is used to only promote the new primary from the same cell 457 // as the failed primary. 458 bool prevent_cross_cell_promotion = 6; 459 } 460 461 message EmergencyReparentShardResponse { 462 // Keyspace is the name of the keyspace the Emergency Reparent took place in. 463 string keyspace = 1; 464 // Shard is the name of the shard the Emergency Reparent took place in. 465 string shard = 2; 466 // PromotedPrimary is the alias of the tablet that was promoted to shard 467 // primary. If NewPrimary was set in the request, then this will be the same 468 // alias. Otherwise, it will be the alias of the tablet found to be most 469 // up-to-date. 470 topodata.TabletAlias promoted_primary = 3; 471 repeated logutil.Event events = 4; 472 } 473 474 message ExecuteFetchAsAppRequest { 475 topodata.TabletAlias tablet_alias = 1; 476 string query = 2; 477 // MaxRows is an optional parameter to limit the number of rows read into the 478 // QueryResult. Note that this does not apply a LIMIT to the query, just how 479 // many rows are read from the MySQL server on the tablet side. 480 // 481 // This field is optional. Specifying a non-positive value will use whatever 482 // default is configured in the VtctldService. 483 int64 max_rows = 3; 484 // UsePool causes the query to be run with a pooled connection to the tablet. 485 bool use_pool = 4; 486 } 487 488 message ExecuteFetchAsAppResponse { 489 query.QueryResult result = 1; 490 } 491 492 message ExecuteFetchAsDBARequest { 493 topodata.TabletAlias tablet_alias = 1; 494 string query = 2; 495 // MaxRows is an optional parameter to limit the number of rows read into the 496 // QueryResult. Note that this does not apply a LIMIT to the query, just how 497 // many rows are read from the MySQL server on the tablet side. 498 // 499 // This field is optional. Specifying a non-positive value will use whatever 500 // default is configured in the VtctldService. 501 int64 max_rows = 3; 502 // DisableBinlogs instructs the tablet not to use binary logging when 503 // executing the query. 504 bool disable_binlogs = 4; 505 // ReloadSchema instructs the tablet to reload its schema after executing the 506 // query. 507 bool reload_schema = 5; 508 } 509 510 message ExecuteFetchAsDBAResponse { 511 query.QueryResult result = 1; 512 } 513 514 message ExecuteHookRequest { 515 topodata.TabletAlias tablet_alias = 1; 516 tabletmanagerdata.ExecuteHookRequest tablet_hook_request = 2; 517 } 518 519 message ExecuteHookResponse { 520 tabletmanagerdata.ExecuteHookResponse hook_result = 1; 521 } 522 523 message FindAllShardsInKeyspaceRequest { 524 string keyspace = 1; 525 } 526 527 message FindAllShardsInKeyspaceResponse { 528 map<string, Shard> shards = 1; 529 } 530 531 message GetBackupsRequest { 532 string keyspace = 1; 533 string shard = 2; 534 // Limit, if nonzero, will return only the most N recent backups. 535 uint32 limit = 3; 536 // Detailed indicates whether to use the backupengine, if supported, to 537 // populate additional fields, such as Engine and Status, on BackupInfo 538 // objects in the response. If not set, or if the backupengine does not 539 // support populating these fields, Engine will always be empty, and Status 540 // will always be UNKNOWN. 541 bool detailed = 4; 542 // DetailedLimit, if nonzero, will only populate additional fields (see Detailed) 543 // on the N most recent backups. The Limit field still dictates the total 544 // number of backup info objects returned, so, in reality, min(Limit, DetailedLimit) 545 // backup infos will have additional fields set, and any remaining backups 546 // will not. 547 uint32 detailed_limit = 5; 548 } 549 550 message GetBackupsResponse { 551 repeated mysqlctl.BackupInfo backups = 1; 552 } 553 554 message GetCellInfoRequest { 555 string cell = 1; 556 } 557 558 message GetCellInfoResponse { 559 topodata.CellInfo cell_info = 1; 560 } 561 562 message GetCellInfoNamesRequest { 563 } 564 565 message GetCellInfoNamesResponse { 566 repeated string names = 1; 567 } 568 569 message GetCellsAliasesRequest { 570 } 571 572 message GetCellsAliasesResponse { 573 map<string, topodata.CellsAlias> aliases = 1; 574 } 575 576 message GetFullStatusRequest { 577 topodata.TabletAlias tablet_alias = 1; 578 } 579 580 message GetFullStatusResponse { 581 replicationdata.FullStatus status = 1; 582 } 583 584 message GetKeyspacesRequest { 585 } 586 587 message GetKeyspacesResponse { 588 repeated Keyspace keyspaces = 1; 589 } 590 591 message GetKeyspaceRequest { 592 string keyspace = 1; 593 } 594 595 message GetKeyspaceResponse { 596 Keyspace keyspace = 1; 597 } 598 599 message GetPermissionsRequest { 600 topodata.TabletAlias tablet_alias = 1; 601 } 602 603 message GetPermissionsResponse { 604 tabletmanagerdata.Permissions permissions = 1; 605 } 606 607 message GetRoutingRulesRequest { 608 } 609 610 message GetRoutingRulesResponse { 611 vschema.RoutingRules routing_rules = 1; 612 } 613 614 message GetSchemaRequest { 615 topodata.TabletAlias tablet_alias = 1; 616 // Tables is a list of tables for which we should gather information. Each is 617 // either an exact match, or a regular expression of the form /regexp/. 618 repeated string tables = 2; 619 // ExcludeTables is a list of tables to exclude from the result. Each is 620 // either an exact match, or a regular expression of the form /regexp/. 621 repeated string exclude_tables = 3; 622 // IncludeViews specifies whether to include views in the result. 623 bool include_views = 4; 624 // TableNamesOnly specifies whether to limit the results to just table names, 625 // rather than full schema information for each table. 626 bool table_names_only = 5; 627 // TableSizesOnly specifies whether to limit the results to just table sizes, 628 // rather than full schema information for each table. It is ignored if 629 // TableNamesOnly is set to true. 630 bool table_sizes_only = 6; 631 // TableSchemaOnly specifies whether to limit the results to just table/view 632 // schema definition (CREATE TABLE/VIEW statements) and skip column/field information 633 bool table_schema_only = 7; 634 } 635 636 message GetSchemaResponse { 637 tabletmanagerdata.SchemaDefinition schema = 1; 638 } 639 640 message GetShardRequest { 641 string keyspace = 1; 642 string shard_name = 2; 643 } 644 645 message GetShardResponse { 646 Shard shard = 1; 647 } 648 649 message GetShardRoutingRulesRequest { 650 } 651 652 message GetShardRoutingRulesResponse { 653 vschema.ShardRoutingRules shard_routing_rules = 1; 654 } 655 656 message GetSrvKeyspaceNamesRequest { 657 repeated string cells = 1; 658 } 659 660 message GetSrvKeyspaceNamesResponse { 661 // Names is a mapping of cell name to a list of SrvKeyspace names. 662 map<string, NameList> names = 1; 663 664 message NameList { 665 repeated string names = 1; 666 } 667 } 668 669 message GetSrvKeyspacesRequest { 670 string keyspace = 1; 671 // Cells is a list of cells to lookup a SrvKeyspace for. Leaving this empty is 672 // equivalent to specifying all cells in the topo. 673 repeated string cells = 2; 674 } 675 676 message GetSrvKeyspacesResponse { 677 // SrvKeyspaces is a mapping of cell name to SrvKeyspace. 678 map<string, topodata.SrvKeyspace> srv_keyspaces = 1; 679 } 680 681 message UpdateThrottlerConfigRequest { 682 string keyspace = 1; 683 // Enable instructs to enable the throttler 684 bool enable = 2; 685 // Disable instructs to disable the throttler 686 bool disable = 3; 687 // Threshold for throttler (with no custom query, ie using default query, only positive values are considered) 688 double threshold = 4; 689 // CustomQuery replaces the default replication lag query 690 string custom_query = 5; 691 // CustomQuerySet indicates that the value of CustomQuery has changed 692 bool custom_query_set = 6; 693 // CheckAsCheckSelf instructs the throttler to respond to /check requests by checking the tablet's own health 694 bool check_as_check_self=7; 695 // CheckAsCheckShard instructs the throttler to respond to /check requests by checking the shard's health (this is the default behavior) 696 bool check_as_check_shard=8; 697 } 698 699 message UpdateThrottlerConfigResponse { 700 } 701 702 message GetSrvVSchemaRequest { 703 string cell = 1; 704 } 705 706 message GetSrvVSchemaResponse { 707 vschema.SrvVSchema srv_v_schema = 1; 708 } 709 710 message GetSrvVSchemasRequest { 711 repeated string cells = 2; 712 } 713 714 message GetSrvVSchemasResponse { 715 // SrvVSchemas is a mapping of cell name to SrvVSchema 716 map<string, vschema.SrvVSchema> srv_v_schemas = 1; 717 } 718 719 message GetTabletRequest { 720 topodata.TabletAlias tablet_alias = 1; 721 } 722 723 message GetTabletResponse { 724 topodata.Tablet tablet = 1; 725 } 726 727 message GetTabletsRequest { 728 // Keyspace is the name of the keyspace to return tablets for. Omit to return 729 // tablets from all keyspaces. 730 string keyspace = 1; 731 // Shard is the name of the shard to return tablets for. This field is ignored 732 // if Keyspace is not set. 733 string shard = 2; 734 // Cells is an optional set of cells to return tablets for. 735 repeated string cells = 3; 736 // Strict specifies how the server should treat failures from individual 737 // cells. 738 // 739 // When false (the default), GetTablets will return data from any cells that 740 // return successfully, but will fail the request if all cells fail. When 741 // true, any individual cell can fail the full request. 742 bool strict = 4; 743 // TabletAliases is an optional list of tablet aliases to fetch Tablet objects 744 // for. If specified, Keyspace, Shard, and Cells are ignored, and tablets are 745 // looked up by their respective aliases' Cells directly. 746 repeated topodata.TabletAlias tablet_aliases = 5; 747 // tablet_type specifies the type of tablets to return. Omit to return all 748 // tablet types. 749 topodata.TabletType tablet_type = 6; 750 } 751 752 message GetTabletsResponse { 753 repeated topodata.Tablet tablets = 1; 754 } 755 756 message GetTopologyPathRequest { 757 string path = 1; 758 } 759 760 message GetTopologyPathResponse { 761 TopologyCell cell = 1; 762 } 763 764 message TopologyCell { 765 string name = 1; 766 string path = 2; 767 // Data is the file contents of the cell located at path. 768 // It is only populated if the cell is a terminal node. 769 string data = 3; 770 repeated string children = 4; 771 } 772 773 message GetVSchemaRequest { 774 string keyspace = 1; 775 } 776 777 message GetVersionRequest { 778 topodata.TabletAlias tablet_alias = 1; 779 } 780 781 message GetVersionResponse { 782 string version = 1; 783 } 784 785 message GetVSchemaResponse { 786 vschema.Keyspace v_schema = 1; 787 } 788 789 message GetWorkflowsRequest { 790 string keyspace = 1; 791 bool active_only = 2; 792 } 793 794 message GetWorkflowsResponse { 795 repeated Workflow workflows = 1; 796 } 797 798 message InitShardPrimaryRequest { 799 string keyspace = 1; 800 string shard = 2; 801 topodata.TabletAlias primary_elect_tablet_alias = 3; 802 bool force = 4; 803 vttime.Duration wait_replicas_timeout = 5; 804 } 805 806 message InitShardPrimaryResponse { 807 repeated logutil.Event events = 1; 808 } 809 810 message PingTabletRequest { 811 topodata.TabletAlias tablet_alias = 1; 812 } 813 814 message PingTabletResponse { 815 } 816 817 message PlannedReparentShardRequest { 818 // Keyspace is the name of the keyspace to perform the Planned Reparent in. 819 string keyspace = 1; 820 // Shard is the name of the shard to perform teh Planned Reparent in. 821 string shard = 2; 822 // NewPrimary is the alias of the tablet to promote to shard primary. If not 823 // specified, the vtctld will select the most up-to-date candidate to promote. 824 // 825 // It is an error to set NewPrimary and AvoidPrimary to the same alias. 826 topodata.TabletAlias new_primary = 3; 827 // AvoidPrimary is the alias of the tablet to demote. In other words, 828 // specifying an AvoidPrimary alias tells the vtctld to promote any replica 829 // other than this one. A shard whose current primary is not this one is then 830 // a no-op. 831 // 832 // It is an error to set NewPrimary and AvoidPrimary to the same alias. 833 topodata.TabletAlias avoid_primary = 4; 834 // WaitReplicasTimeout is the duration of time to wait for replicas to catch 835 // up in replication both before and after the reparent. The timeout is not 836 // cumulative across both wait periods, meaning that the replicas have 837 // WaitReplicasTimeout time to catch up before the reparent, and an additional 838 // WaitReplicasTimeout time to catch up after the reparent. 839 vttime.Duration wait_replicas_timeout = 5; 840 } 841 842 message PlannedReparentShardResponse { 843 // Keyspace is the name of the keyspace the Planned Reparent took place in. 844 string keyspace = 1; 845 // Shard is the name of the shard the Planned Reparent took place in. 846 string shard = 2; 847 // PromotedPrimary is the alias of the tablet that was promoted to shard 848 // primary. If NewPrimary was set in the request, then this will be the same 849 // alias. Otherwise, it will be the alias of the tablet found to be most 850 // up-to-date. 851 topodata.TabletAlias promoted_primary = 3; 852 repeated logutil.Event events = 4; 853 } 854 855 message RebuildKeyspaceGraphRequest { 856 string keyspace = 1; 857 repeated string cells = 2; 858 // AllowPartial, when set, allows a SNAPSHOT keyspace to serve with an 859 // incomplete set of shards. It is ignored for all other keyspace types. 860 bool allow_partial = 3; 861 } 862 863 message RebuildKeyspaceGraphResponse { 864 } 865 866 message RebuildVSchemaGraphRequest { 867 // Cells specifies the cells to rebuild the SrvVSchema objects for. If empty, 868 // RebuildVSchemaGraph rebuilds the SrvVSchema for every cell in the topo. 869 repeated string cells = 1; 870 } 871 872 message RebuildVSchemaGraphResponse { 873 } 874 875 message RefreshStateRequest { 876 topodata.TabletAlias tablet_alias = 1; 877 } 878 879 message RefreshStateResponse { 880 } 881 882 message RefreshStateByShardRequest { 883 string keyspace = 1; 884 string shard = 2; 885 repeated string cells = 3; 886 } 887 888 message RefreshStateByShardResponse { 889 bool is_partial_refresh = 1; 890 // This explains why we had a partial refresh (if we did) 891 string partial_refresh_details = 2; 892 } 893 894 message ReloadSchemaRequest { 895 topodata.TabletAlias tablet_alias = 1; 896 } 897 898 message ReloadSchemaResponse { 899 } 900 901 message ReloadSchemaKeyspaceRequest { 902 string keyspace = 1; 903 string wait_position = 2; 904 bool include_primary = 3; 905 // Concurrency is the global concurrency across all shards in the keyspace 906 // (so, at most this many tablets will be reloaded across the keyspace at any 907 // given point). 908 uint32 concurrency = 4; 909 } 910 911 message ReloadSchemaKeyspaceResponse { 912 repeated logutil.Event events = 1; 913 } 914 915 message ReloadSchemaShardRequest { 916 string keyspace = 1; 917 string shard = 2; 918 string wait_position = 3; 919 bool include_primary = 4; 920 // Concurrency is the maximum number of tablets to reload at one time. 921 uint32 concurrency = 5; 922 } 923 924 message ReloadSchemaShardResponse { 925 repeated logutil.Event events = 2; 926 } 927 928 message RemoveBackupRequest { 929 string keyspace = 1; 930 string shard = 2; 931 string name = 3; 932 } 933 934 message RemoveBackupResponse { 935 } 936 937 message RemoveKeyspaceCellRequest { 938 string keyspace = 1; 939 string cell = 2; 940 // Force proceeds even if the cell's topology server cannot be reached. This 941 // should only be set if a cell has been shut down entirely, and the global 942 // topology data just needs to be updated. 943 bool force = 3; 944 // Recursive also deletes all tablets in that cell belonging to the specified 945 // keyspace. 946 bool recursive = 4; 947 } 948 949 message RemoveKeyspaceCellResponse { 950 // (TODO:@amason) Consider including the deleted SrvKeyspace object and any 951 // deleted Tablet objects here. 952 } 953 954 message RemoveShardCellRequest { 955 string keyspace = 1; 956 string shard_name = 2; 957 string cell = 3; 958 // Force proceeds even if the cell's topology server cannot be reached. This 959 // should only be set if a cell has been shut down entirely, and the global 960 // topology data just needs to be updated. 961 bool force = 4; 962 // Recursive also deletes all tablets in that cell belonging to the specified 963 // keyspace and shard. 964 bool recursive = 5; 965 } 966 967 message RemoveShardCellResponse { 968 // (TODO:@amason) Consider including the deleted SrvKeyspacePartitions objects 969 // and any deleted Tablet objects here. 970 } 971 972 message ReparentTabletRequest { 973 // Tablet is the alias of the tablet that should be reparented under the 974 // current shard primary. 975 topodata.TabletAlias tablet = 1; 976 } 977 978 message ReparentTabletResponse { 979 // Keyspace is the name of the keyspace the tablet was reparented in. 980 string keyspace = 1; 981 // Shard is the name of the shard the tablet was reparented in. 982 string shard = 2; 983 // Primary is the alias of the tablet that the tablet was reparented under. 984 topodata.TabletAlias primary = 3; 985 } 986 987 message RestoreFromBackupRequest { 988 topodata.TabletAlias tablet_alias = 1; 989 // BackupTime, if set, will use the backup taken most closely at or before 990 // this time. If nil, the latest backup will be restored on the tablet. 991 vttime.Time backup_time = 2; 992 // RestoreToPos indicates a position for a point-in-time recovery. The recovery 993 // is expected to utilize one full backup, followed by zero or more incremental backups, 994 // that reach the precise desired position 995 string restore_to_pos = 3; 996 // Dry run does not actually performs the restore, but validates the steps and availability of backups 997 bool dry_run = 4; 998 } 999 1000 message RestoreFromBackupResponse { 1001 // TabletAlias is the alias of the tablet doing the restore. 1002 topodata.TabletAlias tablet_alias = 1; 1003 string keyspace = 2; 1004 string shard = 3; 1005 logutil.Event event = 4; 1006 } 1007 1008 message RunHealthCheckRequest { 1009 topodata.TabletAlias tablet_alias = 1; 1010 } 1011 1012 message RunHealthCheckResponse { 1013 } 1014 1015 message SetKeyspaceDurabilityPolicyRequest { 1016 string keyspace = 1; 1017 string durability_policy = 2; 1018 } 1019 1020 message SetKeyspaceDurabilityPolicyResponse { 1021 // Keyspace is the updated keyspace record. 1022 topodata.Keyspace keyspace = 1; 1023 } 1024 1025 message SetKeyspaceServedFromRequest { 1026 string keyspace = 1; 1027 topodata.TabletType tablet_type = 2; 1028 repeated string cells = 3; 1029 bool remove = 4; 1030 string source_keyspace = 5; 1031 } 1032 1033 message SetKeyspaceServedFromResponse { 1034 // Keyspace is the updated keyspace record. 1035 topodata.Keyspace keyspace = 1; 1036 } 1037 1038 message SetKeyspaceShardingInfoRequest { 1039 string keyspace = 1; 1040 // OBSOLETE string column_name = 2; 1041 reserved 2; 1042 // OBSOLETE topodata.KeyspaceIdType column_type = 3; 1043 reserved 3; 1044 bool force = 4; 1045 } 1046 1047 message SetKeyspaceShardingInfoResponse { 1048 // Keyspace is the updated keyspace record. 1049 topodata.Keyspace keyspace = 1; 1050 } 1051 1052 message SetShardIsPrimaryServingRequest { 1053 string keyspace = 1; 1054 string shard = 2; 1055 bool is_serving = 3; 1056 } 1057 1058 message SetShardIsPrimaryServingResponse { 1059 // Shard is the updated shard record. 1060 topodata.Shard shard = 1; 1061 } 1062 1063 message SetShardTabletControlRequest { 1064 string keyspace = 1; 1065 string shard = 2; 1066 topodata.TabletType tablet_type = 3; 1067 repeated string cells = 4; 1068 // DeniedTables updates the list of denied tables the shard will serve for 1069 // the given tablet type. This is useful to fix tables that are being blocked 1070 // after a MoveTables operation. 1071 // 1072 // NOTE: Setting this field will cause DisableQueryService to be ignored. 1073 repeated string denied_tables = 5; 1074 // DisableQueryService instructs whether to enable the query service on 1075 // tablets of the given type in the shard. This is useful to fix Reshard 1076 // operations gone awry. 1077 // 1078 // NOTE: this is ignored if DeniedTables is not empty. 1079 bool disable_query_service = 6; 1080 // Remove removes the ShardTabletControl record entirely. If set, this takes 1081 // precedence over DeniedTables and DisableQueryService fields, and is useful 1082 // to manually remove serving restrictions after a completed MoveTables 1083 // operation. 1084 bool remove = 7; 1085 } 1086 1087 message SetShardTabletControlResponse { 1088 // Shard is the updated shard record. 1089 topodata.Shard shard = 1; 1090 } 1091 1092 message SetWritableRequest { 1093 topodata.TabletAlias tablet_alias = 1; 1094 bool writable = 2; 1095 } 1096 1097 message SetWritableResponse { 1098 } 1099 1100 message ShardReplicationAddRequest { 1101 string keyspace = 1; 1102 string shard = 2; 1103 topodata.TabletAlias tablet_alias = 3; 1104 } 1105 1106 message ShardReplicationAddResponse { 1107 } 1108 1109 message ShardReplicationFixRequest { 1110 string keyspace = 1; 1111 string shard = 2; 1112 string cell = 3; 1113 } 1114 1115 message ShardReplicationFixResponse { 1116 // Error contains information about the error fixed by a 1117 // ShardReplicationFix RPC. If there were no errors to fix (i.e. all nodes 1118 // in the replication graph are valid), this field is nil. 1119 topodata.ShardReplicationError error = 1; 1120 } 1121 1122 message ShardReplicationPositionsRequest { 1123 string keyspace = 1; 1124 string shard = 2; 1125 } 1126 1127 message ShardReplicationPositionsResponse { 1128 // ReplicationStatuses is a mapping of tablet alias string to replication 1129 // status for that tablet. 1130 map<string, replicationdata.Status> replication_statuses = 1; 1131 // TabletMap is the set of tablets whose replication statuses were queried, 1132 // keyed by tablet alias. 1133 map<string, topodata.Tablet> tablet_map = 2; 1134 } 1135 1136 message ShardReplicationRemoveRequest { 1137 string keyspace = 1; 1138 string shard = 2; 1139 topodata.TabletAlias tablet_alias = 3; 1140 } 1141 1142 message ShardReplicationRemoveResponse { 1143 } 1144 1145 message SleepTabletRequest { 1146 topodata.TabletAlias tablet_alias = 1; 1147 vttime.Duration duration = 2; 1148 } 1149 1150 message SleepTabletResponse { 1151 } 1152 1153 message SourceShardAddRequest { 1154 string keyspace = 1; 1155 string shard = 2; 1156 uint32 uid = 3; 1157 string source_keyspace = 4; 1158 string source_shard = 5; 1159 // KeyRange identifies the key range to use for the SourceShard. This field is 1160 // optional. 1161 topodata.KeyRange key_range = 6; 1162 // Tables is a list of tables replicate (for MoveTables). Each "table" can be 1163 // either an exact match or a regular expression of the form "/regexp/". 1164 repeated string tables = 7; 1165 } 1166 1167 message SourceShardAddResponse { 1168 // Shard is the updated shard record. 1169 topodata.Shard shard = 1; 1170 } 1171 1172 message SourceShardDeleteRequest { 1173 string keyspace = 1; 1174 string shard = 2; 1175 uint32 uid = 3; 1176 } 1177 1178 message SourceShardDeleteResponse { 1179 // Shard is the updated shard record. 1180 topodata.Shard shard = 1; 1181 } 1182 1183 message StartReplicationRequest { 1184 topodata.TabletAlias tablet_alias = 1; 1185 } 1186 1187 message StartReplicationResponse { 1188 } 1189 1190 message StopReplicationRequest { 1191 topodata.TabletAlias tablet_alias = 1; 1192 } 1193 1194 message StopReplicationResponse { 1195 } 1196 1197 message TabletExternallyReparentedRequest { 1198 // Tablet is the alias of the tablet that was promoted externally and should 1199 // be updated to the shard primary in the topo. 1200 topodata.TabletAlias tablet = 1; 1201 } 1202 1203 message TabletExternallyReparentedResponse { 1204 string keyspace = 1; 1205 string shard = 2; 1206 topodata.TabletAlias new_primary = 3; 1207 topodata.TabletAlias old_primary = 4; 1208 } 1209 1210 message UpdateCellInfoRequest { 1211 string name = 1; 1212 topodata.CellInfo cell_info = 2; 1213 } 1214 1215 message UpdateCellInfoResponse { 1216 string name = 1; 1217 topodata.CellInfo cell_info = 2; 1218 } 1219 1220 message UpdateCellsAliasRequest { 1221 string name = 1; 1222 topodata.CellsAlias cells_alias = 2; 1223 } 1224 1225 message UpdateCellsAliasResponse { 1226 string name = 1; 1227 topodata.CellsAlias cells_alias = 2; 1228 } 1229 1230 message ValidateRequest { 1231 bool ping_tablets = 1; 1232 } 1233 1234 message ValidateResponse { 1235 repeated string results = 1; 1236 map<string, ValidateKeyspaceResponse> results_by_keyspace = 2; 1237 } 1238 1239 message ValidateKeyspaceRequest { 1240 string keyspace = 1; 1241 bool ping_tablets = 2; 1242 } 1243 1244 message ValidateKeyspaceResponse { 1245 repeated string results = 1; 1246 map<string, ValidateShardResponse> results_by_shard = 2; 1247 } 1248 1249 message ValidateSchemaKeyspaceRequest { 1250 string keyspace = 1; 1251 repeated string exclude_tables = 2; 1252 bool include_views = 3; 1253 bool skip_no_primary = 4; 1254 bool include_vschema = 5; 1255 } 1256 1257 message ValidateSchemaKeyspaceResponse { 1258 repeated string results = 1; 1259 map<string, ValidateShardResponse> results_by_shard = 2; 1260 } 1261 1262 message ValidateShardRequest { 1263 string keyspace = 1; 1264 string shard = 2; 1265 bool ping_tablets = 3; 1266 } 1267 1268 message ValidateShardResponse { 1269 repeated string results = 1; 1270 } 1271 1272 message ValidateVersionKeyspaceRequest { 1273 string keyspace = 1; 1274 } 1275 1276 message ValidateVersionKeyspaceResponse { 1277 repeated string results = 1; 1278 map<string, ValidateShardResponse> results_by_shard = 2; 1279 } 1280 1281 message ValidateVersionShardRequest { 1282 string keyspace = 1; 1283 string shard = 2; 1284 } 1285 1286 message ValidateVersionShardResponse { 1287 repeated string results = 1; 1288 } 1289 1290 message ValidateVSchemaRequest { 1291 string keyspace = 1; 1292 repeated string shards = 2; 1293 repeated string exclude_tables = 3; 1294 bool include_views = 4; 1295 } 1296 1297 message ValidateVSchemaResponse { 1298 repeated string results = 1; 1299 map<string, ValidateShardResponse> results_by_shard = 2; 1300 }