github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/cdc/scheduler/schedulepb/table_schedule.proto (about)

     1  // Copyright 2022 PingCAP, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  syntax = "proto3";
    15  package pingcap.tiflow.cdc.scheduler.schedulepb;
    16  option go_package = "github.com/pingcap/tiflow/cdc/scheduler/schedulepb";
    17  
    18  import "gogoproto/gogo.proto";
    19  import "processor/tablepb/table.proto";
    20  
    21  option(gogoproto.goproto_enum_prefix_all) = false;
    22  
    23  // TODO rename XXTableRequest to XXTableSpanRequest respectively.
    24  // TODO rename XXTableResponse to XXTableSpanResponse respectively.
    25  
    26  message AddTableRequest {
    27      int64 table_id = 1 [
    28          (gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/model.TableID",
    29          (gogoproto.customname) = "TableID"
    30      ];
    31  
    32      processor.tablepb.Span span = 4 [(gogoproto.nullable) = false];
    33  
    34      bool is_secondary = 2;
    35      processor.tablepb.Checkpoint checkpoint = 3 [(gogoproto.nullable) = false];
    36  }
    37  
    38  message RemoveTableRequest {
    39      int64 table_id = 1 [
    40          (gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/model.TableID",
    41          (gogoproto.customname) = "TableID"
    42      ];
    43  
    44      processor.tablepb.Span span = 2 [(gogoproto.nullable) = false];
    45  }
    46  
    47  message DispatchTableRequest {
    48      oneof request {
    49          AddTableRequest add_table = 1;
    50          RemoveTableRequest remove_table = 2;
    51      }
    52  }
    53  
    54  message AddTableResponse {
    55      processor.tablepb.TableStatus status = 1;
    56      processor.tablepb.Checkpoint checkpoint = 2 [(gogoproto.nullable) = false];
    57  }
    58  
    59  message RemoveTableResponse {
    60      processor.tablepb.TableStatus status = 1;
    61      processor.tablepb.Checkpoint checkpoint = 2 [(gogoproto.nullable) = false];
    62  }
    63  
    64  message DispatchTableResponse {
    65      oneof response {
    66          AddTableResponse add_table = 1;
    67          RemoveTableResponse remove_table = 2;
    68      }
    69  }
    70  
    71  message TableBarrier {
    72      int64 table_id = 1 [
    73          (gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/model.TableID",
    74          (gogoproto.customname) = "TableID"
    75      ];
    76      // The barrier timestamp of the table.
    77      uint64 barrier_ts = 2 [
    78          (gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/processor/tablepb.Ts"];
    79  }
    80  
    81  // Barrier contains the barrierTs of those tables that have
    82  // ddl jobs that need to be replicated. The Scheduler will
    83  // broadcast the barrierTs to all captures through the Heartbeat.
    84  message Barrier {
    85      repeated TableBarrier table_barriers = 1;
    86      uint64  global_barrier_ts = 2 [
    87          (gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/processor/tablepb.Ts"];
    88  }
    89  
    90  message Heartbeat {
    91      repeated int64 table_ids = 1 [
    92          (gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/model.TableID",
    93          (gogoproto.customname) = "TableIDs"
    94      ];
    95  
    96      bool is_stopping = 2;
    97      repeated processor.tablepb.Span spans = 3 [(gogoproto.nullable) = false];
    98      bool collect_stats = 4;
    99      Barrier barrier = 5;
   100  }
   101  
   102  message HeartbeatResponse {
   103      repeated processor.tablepb.TableStatus tables = 1 [(gogoproto.nullable) = false];
   104      int32 liveness = 2 [(gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/model.Liveness"];
   105  }
   106  
   107  enum MessageType {
   108      MsgUnknown = 0 [(gogoproto.enumvalue_customname) = "MsgUnknown"];
   109      MsgDispatchTableRequest = 1 [(gogoproto.enumvalue_customname) = "MsgDispatchTableRequest"];
   110      MsgDispatchTableResponse = 2 [(gogoproto.enumvalue_customname) = "MsgDispatchTableResponse"];
   111      MsgHeartbeat = 3 [(gogoproto.enumvalue_customname) = "MsgHeartbeat"];
   112      MsgHeartbeatResponse = 4 [(gogoproto.enumvalue_customname) = "MsgHeartbeatResponse"];
   113  }
   114  
   115  message OwnerRevision { int64 revision = 1; }
   116  
   117  message ProcessorEpoch { string epoch = 1; }
   118  
   119  message ChangefeedEpoch { uint64 epoch = 1; }
   120  
   121  message Message {
   122      message Header {
   123          // The semantic version of the node that sent this message.
   124          string version = 1;
   125          OwnerRevision owner_revision = 2 [(gogoproto.nullable) = false];
   126          ProcessorEpoch processor_epoch = 3 [(gogoproto.nullable) = false];
   127          ChangefeedEpoch changefeed_epoch = 4 [(gogoproto.nullable) = false];
   128      }
   129      Header header = 1;
   130      MessageType msg_type = 2;
   131      string from = 3 [(gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/model.CaptureID"];
   132      string to = 4 [(gogoproto.casttype) = "github.com/pingcap/tiflow/cdc/model.CaptureID"];
   133      DispatchTableRequest dispatch_table_request = 5;
   134      DispatchTableResponse dispatch_table_response = 6;
   135      Heartbeat heartbeat = 7;
   136      HeartbeatResponse heartbeat_response = 8;
   137  }