github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/proto/dmmaster.proto (about) 1 syntax = "proto3"; 2 3 package pb; 4 5 import "dmworker.proto"; // refine if needed 6 import "google/api/annotations.proto"; 7 import "google/protobuf/empty.proto"; 8 9 service Master { 10 rpc StartTask (StartTaskRequest) returns (StartTaskResponse) { 11 option (google.api.http) = { 12 post: "/apis/v1alpha1/tasks" 13 body: "*" 14 }; 15 } 16 17 rpc OperateTask (OperateTaskRequest) returns (OperateTaskResponse) { 18 option (google.api.http) = { 19 put: "/apis/v1alpha1/tasks/{name}" 20 body: "*" 21 }; 22 } 23 rpc UpdateTask (UpdateTaskRequest) returns (UpdateTaskResponse) {} 24 25 rpc QueryStatus (QueryStatusListRequest) returns (QueryStatusListResponse) { 26 option (google.api.http) = { 27 get: "/apis/v1alpha1/status/{name}" 28 }; 29 } 30 31 // show un-resolved DDL locks 32 rpc ShowDDLLocks (ShowDDLLocksRequest) returns (ShowDDLLocksResponse) {} 33 // used by dmctl to manually unlock DDL lock 34 rpc UnlockDDLLock (UnlockDDLLockRequest) returns (UnlockDDLLockResponse) {} 35 36 // OperateWorkerRelayTask requests some dm-workers to operate relay unit 37 rpc OperateWorkerRelayTask (OperateWorkerRelayRequest) returns (OperateWorkerRelayResponse) {} 38 39 // PurgeWorkerRelay purges relay log files for some dm-workers 40 rpc PurgeWorkerRelay(PurgeWorkerRelayRequest) returns (PurgeWorkerRelayResponse) {} 41 42 // CheckTask checks legality of task configuration 43 rpc CheckTask(CheckTaskRequest) returns (CheckTaskResponse) {} 44 45 // Operate an upstream MySQL source. 46 rpc OperateSource(OperateSourceRequest) returns (OperateSourceResponse) { 47 option (google.api.http) = { 48 put: "/apis/v1alpha1/sources" 49 body: "*" 50 }; 51 } 52 53 // RegisterWorker register the dm-workers. 54 rpc RegisterWorker(RegisterWorkerRequest) returns(RegisterWorkerResponse) {} 55 56 // OfflineMember offline the dm cluster's members (master/worker). 57 rpc OfflineMember(OfflineMemberRequest) returns(OfflineMemberResponse) { 58 option (google.api.http) = { 59 delete: "/apis/v1alpha1/members/{type}/{name}" 60 }; 61 } 62 63 // OperateLeader do some operate on master: 64 // - evict leader: make the master resign if it is leader, and will not campaign the leader again 65 // - cancel evict leader: the master can campaign leader again. 66 rpc OperateLeader(OperateLeaderRequest) returns(OperateLeaderResponse) { 67 option (google.api.http) = { 68 put: "/apis/v1alpha1/leader/{op}" 69 body: "*" 70 }; 71 } 72 73 // ListMember list member information 74 rpc ListMember(ListMemberRequest) returns(ListMemberResponse) { 75 option (google.api.http) = { 76 get: "/apis/v1alpha1/members" 77 }; 78 } 79 80 rpc OperateSchema(OperateSchemaRequest) returns(OperateSchemaResponse) { 81 option (google.api.http) = { 82 put: "/apis/v1alpha1/schema" 83 body: "*" 84 }; 85 } 86 87 rpc GetSubTaskCfg(GetSubTaskCfgRequest) returns(GetSubTaskCfgResponse) { 88 option (google.api.http) = { 89 get: "/apis/v1alpha1/subtasks/{name}" 90 }; 91 } 92 93 // GetCfg get config 94 rpc GetCfg(GetCfgRequest) returns(GetCfgResponse) { 95 option (google.api.http) = { 96 get: "/apis/v1alpha1/tasks/{name}" 97 }; 98 } 99 100 rpc HandleError(HandleErrorRequest) returns(HandleErrorResponse) { 101 option (google.api.http) = { 102 put: "/apis/v1alpha1/errors" 103 body: "*" 104 }; 105 } 106 107 rpc GetMasterCfg(GetMasterCfgRequest) returns(GetMasterCfgResponse) {} 108 109 rpc TransferSource(TransferSourceRequest) returns(TransferSourceResponse) {} 110 111 rpc OperateRelay(OperateRelayRequest) returns(OperateRelayResponse) {} 112 113 rpc StartValidation(StartValidationRequest) returns(StartValidationResponse) {} 114 115 rpc StopValidation(StopValidationRequest) returns(StopValidationResponse) {} 116 117 rpc GetValidationStatus(GetValidationStatusRequest) returns(GetValidationStatusResponse) {} 118 119 rpc GetValidationError(GetValidationErrorRequest) returns(GetValidationErrorResponse) {} 120 121 rpc OperateValidationError(OperateValidationErrorRequest) returns(OperateValidationErrorResponse) {} 122 123 rpc UpdateValidation(UpdateValidationRequest) returns(UpdateValidationResponse) {} 124 125 // Encrypt encrypts the plaintext using the secret key of dm-master 126 rpc Encrypt(EncryptRequest) returns(EncryptResponse) {} 127 128 rpc ListTaskConfigs(google.protobuf.Empty) returns(ListTaskConfigsResponse) {} 129 130 rpc ListSourceConfigs(google.protobuf.Empty) returns(ListSourceConfigsResponse) {} 131 } 132 133 message StartTaskRequest { 134 string task = 1; // task's configuration, yaml format 135 repeated string sources = 2; // mysql source need to do start task, empty for all sources defined in the task config 136 bool removeMeta = 3; // whether to remove meta data for this task or not 137 string startTime = 4; // a highest priority field to specify starting of binlog replication 138 } 139 140 message StartTaskResponse { 141 bool result = 1; 142 string msg = 2; 143 repeated CommonWorkerResponse sources = 3; 144 string checkResult = 4; 145 } 146 147 message OperateTaskRequest { 148 TaskOp op = 1; // Stop / Pause / Resume 149 string name = 2; // task's name 150 repeated string sources = 3; // sources need to do operation, empty for matched sources in processing the task 151 } 152 153 message OperateTaskResponse { 154 TaskOp op = 1; 155 bool result = 2; 156 string msg = 3; 157 repeated CommonWorkerResponse sources = 4; 158 } 159 160 161 // UpdateTaskRequest used to update task after it has beed started 162 // task: task's configuration, yaml format 163 // now, only support to update config for routes, filters, column-mappings, block-allow-list 164 // support update partial config for syncer, loader, etc later 165 // sources need to do update, empty for all sources in processing the task 166 message UpdateTaskRequest { 167 string task = 1; 168 repeated string sources = 2; 169 } 170 171 message UpdateTaskResponse { 172 bool result = 1; 173 string msg = 2; 174 repeated CommonWorkerResponse sources = 3; 175 string checkResult = 4; 176 } 177 178 179 message QueryStatusListRequest { 180 string name = 1; // task's name, empty for all tasks 181 repeated string sources = 2; // sources need to query, empty for all sources 182 } 183 184 message QueryStatusListResponse { 185 bool result = 1; 186 string msg = 2; 187 repeated QueryStatusResponse sources = 3; 188 } 189 190 // ShowDDLLocksRequest used to query DDL locks which are un-resolved 191 // task: task's name, empty for all tasks 192 // sources: source need to query, empty for all sources 193 // any DDL lock in which the source is synced or unsynced will return 194 // if specify task and sources both, and sources not doing the task , it will return empty DDL locks 195 message ShowDDLLocksRequest { 196 string task = 1; 197 repeated string sources = 2; // sources need to query, empty for all sources 198 } 199 200 // DDLLock represents a DDL lock info (I known the name confused with DDLLockInfo, any suggestion?) 201 // it been sent from dm-master to dmctl 202 // ID: DDL lock generated ID 203 // task: lock's corresponding task name 204 // mode: the shard DDL mode, `pessimistic` or `optimistic`. 205 // owner: lock's owner, a dm-worker 206 // DDL: DDL statement 207 // synced: already synced dm-workers 208 // unsynced: pending to sync dm-workers 209 message DDLLock { 210 string ID = 1; 211 string task = 2; 212 string mode = 3; 213 string owner = 4; 214 repeated string DDLs = 5; 215 repeated string synced = 6; 216 repeated string unsynced = 7; 217 } 218 219 message ShowDDLLocksResponse { 220 bool result = 1; 221 string msg = 2; 222 repeated DDLLock locks = 3; // all un-resolved DDL locks 223 } 224 225 enum UnlockDDLLockOp { 226 InvalidLockOp = 0; 227 SkipLock = 1; 228 ExecLock = 2; 229 } 230 231 // UnlockDDLLockRequest used to unlock (resolve) DDL lock manually 232 // ID: DDL lock ID 233 // replaceOwner: dm-worker used to replace the original DDL lock's owner 234 // forceRemove: force to remove the DDL lock even fail to execute the DDL for the owner. 235 message UnlockDDLLockRequest { 236 string ID = 1; 237 string replaceOwner = 2; 238 bool forceRemove = 3; 239 UnlockDDLLockOp op = 4; 240 repeated string sources = 5; // source ID list 241 string database = 6; // database name 242 string table = 7; // table name 243 } 244 245 message UnlockDDLLockResponse { 246 bool result = 1; 247 string msg = 2; 248 } 249 250 // OperateWorkerRelayRequest represents a request for some dm-workers to operate relay unit 251 message OperateWorkerRelayRequest { 252 RelayOp op = 1; // Stop / Pause / Resume 253 repeated string sources = 2; 254 } 255 256 message OperateWorkerRelayResponse { 257 RelayOp op = 1; 258 bool result = 2; 259 string msg = 3; 260 repeated CommonWorkerResponse sources = 4; 261 } 262 263 // PurgeWorkerRelayRequest represents a request to purge relay log files for some dm-workers 264 // workers: dm-workers need to purge relay log files 265 // inactive: whether purge inactive relay log files 266 // time: whether purge relay log files before this time, the number of seconds elapsed since January 1, 1970 UTC 267 // filename: whether purge relay log files before this filename 268 // subDir: specify relay sub directory for @filename 269 message PurgeWorkerRelayRequest { 270 repeated string sources = 1; 271 bool inactive = 2; 272 int64 time = 3; 273 string filename = 4; 274 string subDir = 5; 275 } 276 277 message PurgeWorkerRelayResponse { 278 bool result = 1; 279 string msg = 2; 280 repeated CommonWorkerResponse sources = 3; 281 } 282 283 message CheckTaskRequest { 284 string task = 1; // task's configuration, yaml format 285 int64 errCnt = 2; // max error count to display 286 int64 warnCnt = 3; // max warn count to display 287 string startTime = 4; // a highest priority field to specify starting of binlog replication 288 } 289 290 message CheckTaskResponse { 291 bool result = 1; 292 string msg = 2; 293 } 294 295 enum SourceOp { 296 InvalidSourceOp = 0; 297 StartSource = 1; 298 UpdateSource = 2; 299 StopSource = 3; 300 ShowSource = 4; 301 } 302 303 message OperateSourceRequest { 304 SourceOp op = 1; 305 repeated string config = 2; 306 repeated string sourceID = 3; 307 string workerName = 4; 308 } 309 310 message OperateSourceResponse { 311 bool result = 1; 312 string msg = 2; 313 repeated CommonWorkerResponse sources = 3; 314 } 315 316 message RegisterWorkerRequest { 317 string name = 1; 318 string address = 2; 319 } 320 321 message RegisterWorkerResponse { 322 bool result = 1; 323 string msg = 2; 324 bytes secretKey = 3; 325 } 326 327 message OfflineMemberRequest { 328 string type = 1; 329 string name = 2; 330 } 331 332 message OfflineMemberResponse { 333 bool result = 1; 334 string msg = 2; 335 } 336 337 enum LeaderOp { 338 InvalidLeaderOp = 0; 339 EvictLeaderOp = 1; 340 CancelEvictLeaderOp = 2; 341 } 342 343 message OperateLeaderRequest { 344 LeaderOp op = 1; 345 } 346 347 message OperateLeaderResponse { 348 bool result = 1; 349 string msg = 2; 350 } 351 352 message MasterInfo { 353 string name = 1; 354 uint64 memberID = 2; 355 bool alive = 3; 356 repeated string peerURLs = 4; 357 repeated string clientURLs = 5; 358 } 359 360 message WorkerInfo { 361 string name = 1; 362 string addr = 2; 363 string stage = 3; 364 string source = 4; 365 } 366 367 message ListLeaderMember { 368 string msg = 1; 369 string name = 2; 370 string addr = 3; 371 } 372 373 message ListMasterMember { 374 string msg = 1; 375 repeated MasterInfo masters = 2; 376 } 377 378 message ListWorkerMember { 379 string msg = 1; 380 repeated WorkerInfo workers = 2; 381 } 382 383 message Members { 384 oneof member { 385 ListLeaderMember leader = 1; 386 ListMasterMember master = 2; 387 ListWorkerMember worker = 3; 388 } 389 } 390 391 message ListMemberRequest { 392 bool leader = 1; 393 bool master = 2; 394 bool worker = 3; 395 repeated string names = 4; 396 } 397 398 message ListMemberResponse { 399 bool result = 1; 400 string msg = 2; 401 repeated Members members = 3; 402 } 403 404 message OperateSchemaRequest { 405 SchemaOp op = 1; // operation type 406 string task = 2; // task name 407 repeated string sources = 3; // source ID list 408 string database = 4; // database name 409 string table = 5; // table name 410 string schema = 6; // schema content, a `CREATE TABLE` statement 411 bool flush = 7; // flush table info and checkpoint 412 bool sync = 8; // sync the table info to master 413 bool fromSource = 9; // update schema from source schema 414 bool fromTarget = 10; // update schema from target schema 415 } 416 417 message OperateSchemaResponse { 418 bool result = 1; 419 string msg = 2; 420 repeated CommonWorkerResponse sources = 3; 421 } 422 423 message GetSubTaskCfgRequest { 424 // the task name 425 string name = 1; 426 } 427 428 message GetSubTaskCfgResponse { 429 bool result = 1; 430 string msg = 2; 431 repeated string cfgs = 3; 432 } 433 434 enum CfgType { 435 InvalidType = 0; 436 TaskType = 1; 437 MasterType = 2; 438 WorkerType = 3; 439 SourceType = 4; 440 TaskTemplateType = 5; 441 } 442 443 message GetCfgRequest { 444 CfgType type = 1; // the config type 445 string name = 2; // the config name 446 } 447 448 message GetCfgResponse { 449 bool result = 1; 450 string msg = 2; 451 string cfg = 3; 452 } 453 454 message GetMasterCfgRequest { 455 } 456 457 message GetMasterCfgResponse { 458 string cfg = 1; 459 } 460 461 message HandleErrorRequest { 462 ErrorOp op = 1; // operation type 463 string task = 2; // the task name 464 repeated string sources = 3; // source ID list 465 string binlogPos = 4; // binlog-pos (that's file:pos format) 466 repeated string sqls = 5; // sqls (use for replace) 467 } 468 469 message HandleErrorResponse { 470 bool result = 1; 471 string msg = 2; 472 repeated CommonWorkerResponse sources = 3; 473 } 474 475 message TransferSourceRequest { 476 string source = 1; 477 string worker = 2; 478 } 479 480 message TransferSourceResponse { 481 bool result = 1; 482 string msg = 2; 483 } 484 485 message OperateRelayRequest { 486 RelayOpV2 op = 1; 487 string source = 2; 488 repeated string worker = 3; 489 } 490 491 message OperateRelayResponse { 492 bool result = 1; 493 string msg = 2; 494 repeated CommonWorkerResponse sources = 3; 495 } 496 497 enum RelayOpV2 { 498 InvalidRelayOpV2 = 0; 499 StartRelayV2 = 1; 500 StopRelayV2 = 2; 501 } 502 503 message StartValidationRequest { 504 // proto3 support optional, but need to upgrade protoc-gen-gogofaster, not do it in this pr 505 // see https://github.com/protocolbuffers/protobuf/issues/1606 506 oneof mode{string mode_value = 1;} 507 oneof startTime{string start_time_value = 2;} 508 repeated string sources = 3; 509 string taskName = 4; 510 } 511 512 message StartValidationResponse { 513 bool result = 1; 514 string msg = 2; 515 repeated CommonWorkerResponse sources = 3; 516 } 517 518 message StopValidationRequest { 519 repeated string sources = 1; 520 string taskName = 2; 521 } 522 523 message StopValidationResponse { 524 bool result = 1; 525 string msg = 2; 526 repeated CommonWorkerResponse sources = 3; 527 } 528 529 message UpdateValidationRequest { 530 string taskName = 1; 531 repeated string sources = 2; 532 string binlogPos = 3; // binlog-pos (that's file:pos format) 533 string binlogGTID = 4; 534 } 535 536 message UpdateValidationResponse { 537 bool result = 1; 538 string msg = 2; 539 repeated CommonWorkerResponse sources = 3; 540 } 541 542 message EncryptRequest { 543 string plaintext = 1; 544 } 545 546 message EncryptResponse { 547 bool result = 1; 548 string msg = 2; 549 string ciphertext = 3; 550 } 551 552 message ListTaskConfigsResponse { 553 bool result = 1; 554 string msg = 2; 555 map<string, string> taskConfigs = 3; 556 } 557 558 message ListSourceConfigsResponse { 559 bool result = 1; 560 string msg = 2; 561 map<string, string> sourceConfigs = 3; 562 }