vitess.io/vitess@v0.16.2/proto/tabletmanagerdata.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 file contains all the types and servers necessary to make
    18  // RPC calls to VtTablet for the management API.
    19  
    20  syntax = "proto3";
    21  option go_package = "vitess.io/vitess/go/vt/proto/tabletmanagerdata";
    22  
    23  package tabletmanagerdata;
    24  
    25  import "query.proto";
    26  import "topodata.proto";
    27  import "replicationdata.proto";
    28  import "logutil.proto";
    29  import "vttime.proto";
    30  import "vtrpc.proto";
    31  
    32  //
    33  // Data structures
    34  //
    35  
    36  message TableDefinition {
    37    // the table name
    38    string name = 1;
    39  
    40    // the SQL to run to create the table
    41    string schema = 2;
    42  
    43    // the columns in the order that will be used to dump and load the data
    44    repeated string columns = 3;
    45  
    46    // the primary key columns in the primary key order
    47    repeated string primary_key_columns = 4;
    48  
    49    // type is either mysqlctl.TableBaseTable or mysqlctl.TableView
    50    string type = 5;
    51  
    52    // how much space the data file takes.
    53    uint64 data_length = 6;
    54  
    55    // approximate number of rows
    56    uint64 row_count = 7;
    57  
    58    // column names along with their types.
    59    // NOTE: this is a superset of columns.
    60    repeated query.Field fields = 8;
    61  }
    62  
    63  message SchemaDefinition {
    64    string database_schema = 1;
    65    repeated TableDefinition table_definitions = 2;
    66    string version = 3;
    67  }
    68  
    69  message SchemaChangeResult {
    70    // before_schema holds the schema before each change.
    71    SchemaDefinition before_schema = 1;
    72    // after_schema holds the schema after each change.
    73    SchemaDefinition after_schema = 2;
    74  }
    75  
    76  // UserPermission describes a single row in the mysql.user table
    77  // Primary key is Host+User
    78  // PasswordChecksum is the crc64 of the password, for security reasons
    79  message UserPermission {
    80    string host = 1;
    81    string user = 2;
    82    uint64 password_checksum = 3;
    83    map<string, string> privileges = 4;
    84  }
    85  
    86  // DbPermission describes a single row in the mysql.db table
    87  // Primary key is Host+Db+User
    88  message DbPermission {
    89    string host = 1;
    90    string db = 2;
    91    string user = 3;
    92    map<string, string> privileges = 4;
    93  }
    94  
    95  // Permissions have all the rows in mysql.{user,db} tables,
    96  // (all rows are sorted by primary key)
    97  message Permissions {
    98    repeated UserPermission user_permissions = 1;
    99    repeated DbPermission db_permissions = 2;
   100  }
   101  
   102  //
   103  // RPC payloads
   104  //
   105  
   106  message PingRequest {
   107    string payload = 1;
   108  }
   109  
   110  message PingResponse {
   111    string payload = 1;
   112  }
   113  
   114  message SleepRequest {
   115    // duration is in nanoseconds
   116    int64 duration = 1;
   117  }
   118  
   119  message SleepResponse {
   120  }
   121  
   122  message ExecuteHookRequest {
   123    string name = 1;
   124    repeated string parameters = 2;
   125    map<string, string> extra_env = 3;
   126  }
   127  
   128  message ExecuteHookResponse {
   129    int64 exit_status = 1;
   130    string stdout = 2;
   131    string stderr = 3;
   132  }
   133  
   134  message GetSchemaRequest {
   135    repeated string tables = 1;
   136    bool include_views = 2;
   137    repeated string exclude_tables = 3;
   138    // TableSchemaOnly specifies whether to limit the results to just table/view
   139    // schema definition (CREATE TABLE/VIEW statements) and skip column/field information
   140    bool table_schema_only = 4;
   141  }
   142  
   143  message GetSchemaResponse {
   144    SchemaDefinition schema_definition = 1;
   145  }
   146  
   147  message GetPermissionsRequest {
   148  }
   149  
   150  message GetPermissionsResponse {
   151    Permissions permissions = 1;
   152  }
   153  
   154  message SetReadOnlyRequest {
   155  }
   156  
   157  message SetReadOnlyResponse {
   158  }
   159  
   160  message SetReadWriteRequest {
   161  }
   162  
   163  message SetReadWriteResponse {
   164  }
   165  
   166  message ChangeTypeRequest {
   167    topodata.TabletType tablet_type = 1;
   168    bool semiSync = 2;
   169  }
   170  
   171  message ChangeTypeResponse {
   172  }
   173  
   174  message RefreshStateRequest {
   175  }
   176  
   177  message RefreshStateResponse {
   178  }
   179  
   180  message RunHealthCheckRequest {
   181  }
   182  
   183  message RunHealthCheckResponse {
   184  }
   185  
   186  message ReloadSchemaRequest {
   187    // wait_position allows scheduling a schema reload to occur after a
   188    // given DDL has replicated to this server, by specifying a replication
   189    // position to wait for. Leave empty to trigger the reload immediately.
   190    string wait_position = 1;
   191  }
   192  
   193  message ReloadSchemaResponse {
   194  }
   195  
   196  message PreflightSchemaRequest {
   197    repeated string changes = 1;
   198  }
   199  
   200  message PreflightSchemaResponse {
   201    // change_results has for each change the schema before and after it.
   202    // The number of elements is identical to the length of "changes" in the request.
   203    repeated SchemaChangeResult change_results = 1;
   204  }
   205  
   206  message ApplySchemaRequest {
   207    string sql = 1;
   208    bool force = 2;
   209    bool allow_replication = 3;
   210    SchemaDefinition before_schema = 4;
   211    SchemaDefinition after_schema = 5;
   212    string sql_mode = 6;
   213  }
   214  
   215  message ApplySchemaResponse {
   216    SchemaDefinition before_schema = 1;
   217    SchemaDefinition after_schema = 2;
   218  }
   219  
   220  message LockTablesRequest {
   221  }
   222  
   223  message LockTablesResponse {
   224  }
   225  
   226  message UnlockTablesRequest {
   227  }
   228  
   229  message UnlockTablesResponse {
   230  }
   231  
   232  message ExecuteQueryRequest {
   233    bytes query = 1;
   234    string db_name = 2;
   235    uint64 max_rows = 3;
   236    // caller_id identifies the caller. This is the effective caller ID,
   237    // set by the application to further identify the caller.
   238    vtrpc.CallerID caller_id = 4;
   239  }
   240  
   241  message ExecuteQueryResponse {
   242    query.QueryResult result = 1;
   243  }
   244  
   245  message ExecuteFetchAsDbaRequest {
   246    bytes query = 1;
   247    string db_name = 2;
   248    uint64 max_rows = 3;
   249    bool disable_binlogs = 4;
   250    bool reload_schema = 5;
   251  }
   252  
   253  message ExecuteFetchAsDbaResponse {
   254    query.QueryResult result = 1;
   255  }
   256  
   257  message ExecuteFetchAsAllPrivsRequest {
   258    bytes query = 1;
   259    string db_name = 2;
   260    uint64 max_rows = 3;
   261    bool reload_schema = 4;
   262  }
   263  
   264  message ExecuteFetchAsAllPrivsResponse {
   265    query.QueryResult result = 1;
   266  }
   267  
   268  message ExecuteFetchAsAppRequest {
   269    bytes query = 1;
   270    uint64 max_rows = 2;
   271  }
   272  
   273  message ExecuteFetchAsAppResponse {
   274    query.QueryResult result = 1;
   275  }
   276  
   277  message ReplicationStatusRequest {
   278  }
   279  
   280  message ReplicationStatusResponse {
   281    replicationdata.Status status = 1;
   282  }
   283  
   284  message PrimaryStatusRequest {
   285  }
   286  
   287  message PrimaryStatusResponse {
   288    replicationdata.PrimaryStatus status = 1;
   289  }
   290  
   291  message PrimaryPositionRequest {
   292  }
   293  
   294  message PrimaryPositionResponse {
   295    string position = 1;
   296  }
   297  
   298  message WaitForPositionRequest {
   299    string position = 1;
   300  }
   301  
   302  message WaitForPositionResponse {
   303  }
   304  
   305  message StopReplicationRequest {
   306  }
   307  
   308  message StopReplicationResponse {
   309  }
   310  
   311  message StopReplicationMinimumRequest {
   312    string position = 1;
   313    int64 wait_timeout = 2;
   314  }
   315  
   316  message StopReplicationMinimumResponse {
   317    string position = 1;
   318  }
   319  
   320  message StartReplicationRequest {
   321    bool semiSync = 1;
   322  }
   323  
   324  message StartReplicationResponse {
   325  }
   326  
   327  message StartReplicationUntilAfterRequest {
   328    string position = 1;
   329    int64 wait_timeout = 2;
   330  }
   331  
   332  message StartReplicationUntilAfterResponse {
   333  }
   334  
   335  message GetReplicasRequest {
   336  }
   337  
   338  message GetReplicasResponse {
   339    repeated string addrs = 1;
   340  }
   341  
   342  message ResetReplicationRequest {
   343  }
   344  
   345  message ResetReplicationResponse {
   346  }
   347  
   348  message VReplicationExecRequest {
   349    string query = 1;
   350  }
   351  
   352  message VReplicationExecResponse {
   353    query.QueryResult result = 1;
   354  }
   355  
   356  message VReplicationWaitForPosRequest {
   357    int64 id = 1;
   358    string position = 2;
   359  }
   360  
   361  message VReplicationWaitForPosResponse {
   362  }
   363  
   364  message InitPrimaryRequest {
   365    bool semiSync = 1;
   366  }
   367  
   368  message InitPrimaryResponse {
   369    string position = 1;
   370  }
   371  
   372  message PopulateReparentJournalRequest {
   373    int64 time_created_ns = 1;
   374    string action_name = 2;
   375    topodata.TabletAlias primary_alias = 3;
   376    string replication_position = 4;
   377  }
   378  
   379  message PopulateReparentJournalResponse {
   380  }
   381  
   382  message InitReplicaRequest {
   383    topodata.TabletAlias parent = 1;
   384    string replication_position = 2;
   385    int64 time_created_ns = 3;
   386    bool semiSync = 4;
   387  }
   388  
   389  message InitReplicaResponse {
   390  }
   391  
   392  message DemotePrimaryRequest {
   393  }
   394  
   395  message DemotePrimaryResponse {
   396    // Position is deprecated, and is a string representation of a demoted primaries executed position.
   397    //string deprecated_position = 1 [deprecated = true];
   398    reserved 1;
   399  
   400    // PrimaryStatus represents the response from calling `SHOW MASTER STATUS` on a primary that has been demoted.
   401    replicationdata.PrimaryStatus primary_status = 2;
   402  }
   403  
   404  message UndoDemotePrimaryRequest {
   405    bool semiSync = 1;
   406  }
   407  
   408  message UndoDemotePrimaryResponse {
   409  }
   410  
   411  message ReplicaWasPromotedRequest {
   412  }
   413  
   414  message ReplicaWasPromotedResponse {
   415  }
   416  
   417  message ResetReplicationParametersRequest {
   418  }
   419  
   420  message ResetReplicationParametersResponse {
   421  }
   422  
   423  message FullStatusRequest {
   424  }
   425  
   426  message FullStatusResponse {
   427    replicationdata.FullStatus status = 1;
   428  }
   429  
   430  message SetReplicationSourceRequest {
   431    topodata.TabletAlias parent = 1;
   432    int64 time_created_ns = 2;
   433    bool force_start_replication = 3;
   434    string wait_position = 4;
   435    bool semiSync = 5;
   436  }
   437  
   438  message SetReplicationSourceResponse {
   439  }
   440  
   441  message ReplicaWasRestartedRequest {
   442    // the parent alias the tablet should have
   443    topodata.TabletAlias parent = 1;
   444  }
   445  
   446  message ReplicaWasRestartedResponse {
   447  }
   448  
   449  message StopReplicationAndGetStatusRequest {
   450    replicationdata.StopReplicationMode stop_replication_mode = 1;
   451  }
   452  
   453  message StopReplicationAndGetStatusResponse {
   454    // HybridStatus is deprecated. It currently represents a hybrid struct where all data represents the before state,
   455    // except for all position related data which comes from the after state. Please use status instead, which holds
   456    // discrete replication status calls before and after stopping the replica, or stopping the replica's io_thread.
   457    //replicationdata.Status hybrid_status = 1 [deprecated = true];
   458    reserved 1;
   459  
   460    // Status represents the replication status call right before, and right after telling the replica to stop.
   461    replicationdata.StopReplicationStatus status = 2;
   462  }
   463  
   464  message PromoteReplicaRequest {
   465    bool semiSync = 1;
   466  }
   467  
   468  message PromoteReplicaResponse {
   469    string position = 1;
   470  }
   471  
   472  // Backup / Restore related messages
   473  
   474  message BackupRequest {
   475    int64 concurrency = 1;
   476    bool allow_primary = 2;
   477    // IncrementalFromPos indicates a position of a previous backup. When this value is non-empty
   478    // then the backup becomes incremental and applies as of given position.
   479    string incremental_from_pos = 3;
   480  }
   481  
   482  message BackupResponse {
   483    logutil.Event event = 1;
   484  }
   485  
   486  message RestoreFromBackupRequest {
   487    vttime.Time backup_time = 1;
   488    // RestoreToPos indicates a position for a point-in-time recovery. The recovery
   489    // is expected to utilize one full backup, followed by zero or more incremental backups,
   490    // that reach the precise desired position
   491    string restore_to_pos = 2;
   492    // Dry run does not actually performs the restore, but validates the steps and availability of backups
   493    bool dry_run = 3;
   494  }
   495  
   496  message RestoreFromBackupResponse {
   497    logutil.Event event = 1;
   498  }
   499  
   500  message VExecRequest {
   501    string query = 1;
   502    string workflow = 2;
   503    string keyspace = 3;
   504  }
   505  
   506  message VExecResponse {
   507    query.QueryResult result = 1;
   508  }
   509  
   510  message VDiffRequest {
   511    string keyspace = 1;
   512    string workflow = 2;
   513    string action = 3;
   514    string action_arg = 4;
   515    string vdiff_uuid = 5;
   516    VDiffOptions options = 6;
   517  }
   518  
   519  message VDiffResponse {
   520    int64 id = 1;
   521    query.QueryResult output = 2;
   522    string vdiff_uuid = 3;
   523  }
   524  
   525  // options that influence the tablet selected by the picker for streaming data from
   526  message VDiffPickerOptions {
   527    string tablet_types = 1;
   528    string source_cell = 2;
   529    string target_cell = 3;
   530  }
   531  
   532  // options that only influence how vdiff differences are reported
   533  message VDiffReportOptions {
   534    bool only_pks = 1;
   535    bool debug_query = 2;
   536    string format = 3;
   537  }
   538  
   539  message VDiffCoreOptions {
   540    string tables = 1;
   541    bool auto_retry = 2;
   542    int64  max_rows = 3;
   543    bool checksum = 4;
   544    int64 sample_pct = 5;
   545    int64 timeout_seconds = 6;
   546    int64 max_extra_rows_to_compare = 7;
   547  }
   548  
   549  message VDiffOptions {
   550    VDiffPickerOptions picker_options = 1;
   551    VDiffCoreOptions core_options = 2;
   552    VDiffReportOptions report_options = 3;
   553  }