github.com/matrixorigin/matrixone@v1.2.0/proto/query.proto (about) 1 /* 2 * Copyright 2021 - 2023 Matrix Origin 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 syntax = "proto3"; 18 package query; 19 option go_package = "github.com/matrixorigin/matrixone/pkg/pb/query"; 20 21 import "status.proto"; 22 import "lock.proto"; 23 import "txn.proto"; 24 import "timestamp.proto"; 25 import "statsinfo.proto"; 26 import "github.com/gogo/protobuf/gogoproto/gogo.proto"; 27 import "google/protobuf/timestamp.proto"; 28 29 enum CmdMethod { 30 // Query is the common query command. 31 Query = 0; 32 // ShowProcessList represents the show process list query. 33 ShowProcessList = 1; 34 // AlterAccount represent set account status as restricted 35 AlterAccount = 2; 36 // KillConn represents the kill connection request. 37 KillConn = 3; 38 // ProcessTraceSpan process the trace span cmd transferred from 39 // other cn 40 TraceSpan = 4; 41 // GetLockInfo gets the lock info from the cn 42 GetLockInfo = 5; 43 // GetTxnInfo gets the txn info from the cn 44 GetTxnInfo = 6; 45 // GetCacheInfo gets the cache info from the cn,tn 46 GetCacheInfo = 7; 47 // SyncCommit when we turn on Push, some BVT tests use multiple Sessions in multi-CN scenarios. To 48 // ensure data visibility, we need to synchronize CommitTS between multiple CNs so that the whole 49 // cluster can see the latest writes from other CNs. 50 SyncCommit = 8; 51 // GetCommit get latest commit timestamp of cn. 52 GetCommit = 9; 53 54 GetProtocolVersion = 10; 55 SetProtocolVersion = 11; 56 57 CoreDumpConfig = 12; 58 RunTask = 13; 59 60 // RemoveRemoteLockTable remove remote lock table on all cn 61 RemoveRemoteLockTable = 14; 62 GetLatestBind = 15; 63 // UnsubscribeTable unsubscribes a table in logtail client. 64 UnsubscribeTable = 16; 65 // GetCacheData is the method to get cached data from fileservice in remote node. 66 GetCacheData = 17; 67 // GetStatsInfo is the method to get stats info from remote node. 68 GetStatsInfo = 18; 69 // GetPipelineInfo is the method to get pipeline info from CN 70 GetPipelineInfo = 19; 71 // MigrateConnFrom get session info from the previous cn node. 72 MigrateConnFrom = 20; 73 // MigrateConnTo migrate the session info to the new cn node. 74 MigrateConnTo = 21; 75 } 76 77 // QueryRequest is the common query request. It contains the query 78 // statement that need to be executed on the specified CN node. 79 message QueryRequest { 80 // Query is the query statement. 81 string Query = 1; 82 } 83 84 // ShowProcessListRequest is the "show process list" query request. 85 message ShowProcessListRequest { 86 // Tenant is the tenant which the processes belong to. 87 string Tenant = 1; 88 // SysTenet is true if the tenant is a system tenant. 89 bool SysTenant = 2; 90 } 91 92 // SyncCommitRequest sync commit timestamp request 93 message SyncCommitRequest { 94 // LatestCommitTS update latest commit ts. 95 timestamp.Timestamp LatestCommitTS = 1 [(gogoproto.nullable) = false]; 96 } 97 98 // SyncCommitResponse sync commit timestamp response 99 message SyncCommitResponse { 100 // CurrentCommitTS current commit timestamp after sync 101 timestamp.Timestamp CurrentCommitTS = 1 [(gogoproto.nullable) = false]; 102 } 103 104 // GetCommitRequest get commit timestamp request 105 message GetCommitRequest { 106 } 107 108 // GetCommitResponse get commit timestamp response 109 message GetCommitResponse { 110 // CurrentCommitTS current commit timestamp after sync 111 timestamp.Timestamp CurrentCommitTS = 1 [(gogoproto.nullable) = false]; 112 } 113 114 message CoreDumpConfigRequest { 115 // enable or disable 116 string Action = 1; 117 } 118 119 message CoreDumpConfigResponse { 120 } 121 122 message GetProtocolVersionRequest { 123 } 124 125 message GetProtocolVersionResponse { 126 // ProtocolVersion is the version of the protocol 127 int64 Version = 1; 128 } 129 130 message SetProtocolVersionRequest { 131 // ProtocolVersion is the version of the protocol 132 int64 Version = 1; 133 } 134 135 message SetProtocolVersionResponse { 136 // ProtocolVersion is the version of the protocol 137 int64 Version = 1; 138 } 139 140 message RunTaskRequest { 141 int32 TaskCode = 1; 142 } 143 144 message RunTaskResponse { 145 string Result = 1; 146 } 147 148 149 message GetPipelineInfoRequest { 150 } 151 152 message GetPipelineInfoResponse { 153 // Count is the total pipelines running in the server 154 int64 Count = 1; 155 } 156 157 // Request is the query request. 158 message Request { 159 // RequestID is the request ID. 160 uint64 RequestID = 1; 161 // CmdMethod is the type of command. 162 CmdMethod CmdMethod = 2; 163 // QueryRequest is the common query request. 164 QueryRequest QueryRequest = 3; 165 // ShowProcessListRequest is the request for show process list. 166 ShowProcessListRequest ShowProcessListRequest = 4; 167 // AlterAccountRequest is the request for alter account restricted 168 AlterAccountRequest AlterAccountRequest = 5; 169 // KillConnRequest is the request which kills the connections. 170 KillConnRequest KillConnRequest = 6; 171 // TraceSpanRequest is the request for transferred span cmd 172 TraceSpanRequest TraceSpanRequest = 7; 173 // GetLockInfoRequest is the request for getting the lock from the cn 174 GetLockInfoRequest GetLockInfoRequest = 8; 175 // GetTxnInfoRequest is the request for getting the txn info from the cn 176 GetTxnInfoRequest GetTxnInfoRequest = 9; 177 // GetCacheInfoRequest is the request for getting the cache info from the cn,tn 178 GetCacheInfoRequest GetCacheInfoRequest = 10; 179 180 SyncCommitRequest SycnCommit = 11; 181 GetCommitRequest GetCommit = 12; 182 183 GetProtocolVersionRequest GetProtocolVersion = 13; 184 SetProtocolVersionRequest SetProtocolVersion = 14; 185 186 CoreDumpConfigRequest CoreDumpConfig = 15; 187 RunTaskRequest RunTask = 16; 188 189 RemoveRemoteLockTableRequest RemoveRemoteLockTable = 17; 190 GetLatestBindRequest GetLatestBind = 18; 191 UnsubscribeTableRequest UnsubscribeTable = 19; 192 // GetCacheDataRequest is the request of getting cache data from remote fileservice. 193 GetCacheDataRequest GetCacheDataRequest = 20; 194 // GetStatsInfoRequest is the request of getting stats info from remote cn node. 195 GetStatsInfoRequest GetStatsInfoRequest = 21; 196 GetPipelineInfoRequest GetPipelineInfoRequest = 22; 197 MigrateConnFromRequest MigrateConnFromRequest = 23; 198 MigrateConnToRequest MigrateConnToRequest = 24; 199 } 200 201 // ShowProcessListResponse is the response of command ShowProcessList. 202 message ShowProcessListResponse { 203 repeated status.Session Sessions = 1; 204 } 205 206 // Response is the response to query request. 207 message Response { 208 // RequestID is the request ID. 209 uint64 RequestID = 1; 210 // CmdMethod is the type of command. 211 CmdMethod CmdMethod = 2; 212 // Error is used to return moerr. Set 213 bytes Error = 3; 214 // ShowProcessListResponse is the response of ShowProcessListRequest. 215 ShowProcessListResponse ShowProcessListResponse = 4; 216 // AlterAccountResponse is the response of AlterAccount. 217 AlterAccountResponse AlterAccountResponse = 5; 218 // KillConnResponse is the response of KillConnRequest. 219 KillConnResponse KillConnResponse = 6; 220 // TraceSpanResponse is the response of TraceSpanRequest 221 TraceSpanResponse TraceSpanResponse = 7; 222 // GetLockInfoResponse is the response of GetLockInfo 223 GetLockInfoResponse GetLockInfoResponse = 8; 224 // GetTxnInfoResponse is the response to GetTxnInfo 225 GetTxnInfoResponse GetTxnInfoResponse = 9; 226 // GetCacheInfoResponse is the response to GetCacheInfo 227 GetCacheInfoResponse GetCacheInfoResponse = 10; 228 229 SyncCommitResponse SyncCommit = 11; 230 GetCommitResponse GetCommit = 12; 231 232 GetProtocolVersionResponse GetProtocolVersion = 13; 233 SetProtocolVersionResponse SetProtocolVersion = 14; 234 235 CoreDumpConfigResponse CoreDumpConfig = 15; 236 RunTaskResponse RunTask = 16; 237 238 RemoveRemoteLockTableResponse RemoveRemoteLockTable = 17; 239 GetLatestBindResponse GetLatestBind = 18; 240 UnsubscribeTableResponse UnsubscribeTable = 19; 241 // GetCacheDataResponse is the response of GetCacheDataRequest. 242 GetCacheDataResponse GetCacheDataResponse = 20; 243 // GetStatsInfoResponse is the response of GetStatsInfoRequest. 244 GetStatsInfoResponse GetStatsInfoResponse = 21; 245 GetPipelineInfoResponse GetPipelineInfoResponse = 22; 246 MigrateConnFromResponse MigrateConnFromResponse = 23; 247 MigrateConnToResponse MigrateConnToResponse = 24; 248 } 249 250 // AlterAccountRequest is the "alter account restricted" query request. 251 message AlterAccountRequest { 252 // Tenant is the tenant which to alter. 253 int64 TenantId = 1; 254 // Status is the tenant which will be alter to. 255 string Status = 3; 256 } 257 258 // AlterAccountResponse is the response of command AlterAccount. 259 message AlterAccountResponse { 260 bool alterSuccess = 1; 261 } 262 263 // KillConnRequest is the request that kill the connections belongs 264 // to the account. 265 message KillConnRequest { 266 int64 AccountID = 1; 267 uint64 Version = 2; 268 } 269 270 // KillConnResponse is the response to the kill connection request. 271 message KillConnResponse { 272 bool Success = 1; 273 } 274 275 message TraceSpanRequest { 276 string Cmd = 1; 277 string Spans = 2; 278 int64 Threshold = 3; 279 } 280 281 message TraceSpanResponse { 282 string Resp = 1; 283 } 284 285 message GetLockInfoRequest{ 286 } 287 288 message LockInfo{ 289 uint64 TableId = 1; 290 repeated bytes Keys = 2; 291 lock.LockMode LockMode = 3; 292 bool isRangeLock = 4; 293 repeated lock.WaitTxn Holders = 5; 294 repeated lock.WaitTxn Waiters = 6; 295 } 296 297 message GetLockInfoResponse{ 298 string CnId = 1; 299 repeated LockInfo LockInfoList = 2; 300 } 301 302 message GetTxnInfoRequest{} 303 304 message TxnLockInfo{ 305 // TableId is the id of the table 306 uint64 TableId = 1; 307 // Rows 308 // - point/row lock : all point lock keys 309 // - rang lock : start,end,start,end 310 repeated bytes Rows = 2; 311 // Options 312 // - type : point or range 313 // - mode : shared or exclusive 314 lock.LockOptions Options = 3; 315 } 316 317 message TxnInfo{ 318 // CreateAt is the create time of the txn 319 google.protobuf.Timestamp CreateAt = 1 320 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; 321 txn.TxnMeta Meta= 2; 322 // UserTxn denotes it is the user txn or not 323 bool UserTxn = 3; 324 // WaitLocks denotes the locks that the txn is waiting on 325 repeated TxnLockInfo WaitLocks = 4; 326 } 327 328 message GetTxnInfoResponse{ 329 string CnId = 1; 330 repeated TxnInfo TxnInfoList = 2; 331 } 332 333 message GetCacheInfoRequest{} 334 335 message CacheInfo{ 336 // NodeType is the type of the node. cn, tn 337 string NodeType = 1; 338 // NodeId is the uuid of the node. 339 string NodeId = 2; 340 // CacheType is the type of the cache. memory, disk 341 string CacheType = 3; 342 // Used is the used bytes of the cache for memory cache 343 uint64 Used = 4; 344 // Free is the free bytes of the cache for memory cache 345 uint64 Free = 5; 346 // HitRatio is the hit ratio of the cache. 347 float HitRatio = 6; 348 } 349 350 message GetCacheInfoResponse{ 351 repeated CacheInfo CacheInfoList = 1; 352 } 353 354 message RemoveRemoteLockTableRequest { 355 uint32 GroupID = 1; 356 uint64 TableID = 2; 357 uint64 Version = 3; 358 } 359 360 message RemoveRemoteLockTableResponse { 361 int32 Count = 1; 362 } 363 364 message GetLatestBindRequest { 365 uint32 GroupID = 1; 366 uint64 TableID = 2; 367 } 368 369 message GetLatestBindResponse { 370 string Bind = 1; 371 } 372 373 // UnsubscribeTableRequest is the request that unsubscribe a table from 374 // logtail client. 375 message UnsubscribeTableRequest { 376 // DatabaseID is the ID of the database. 377 uint64 DatabaseID = 1; 378 // TableID is the ID of the table. 379 uint64 TableID = 2; 380 } 381 382 // UnsubscribeTableResponse is the response of unsubscribe table request. 383 message UnsubscribeTableResponse { 384 bool Success = 1; 385 } 386 387 message CacheKey { 388 string Path = 1; 389 int64 Offset = 2; 390 int64 Sz = 3; 391 } 392 393 message CacheKeys { 394 repeated CacheKey keys = 1 [(gogoproto.nullable) = false]; 395 } 396 397 message RequestCacheKey { 398 int32 Index = 1; 399 CacheKey CacheKey = 2; 400 } 401 402 // GetCacheDataRequest is the request that try to get cache from remote node. 403 message GetCacheDataRequest { 404 // RequestCacheKey is the requested cache key. 405 repeated RequestCacheKey RequestCacheKey = 1; 406 } 407 408 // ResponseCacheData is the response of cached data. 409 message ResponseCacheData { 410 int32 Index = 1; 411 bool Hit = 2; 412 bytes Data = 3; 413 } 414 415 // GetCacheDataResponse is the response of get cache data. 416 message GetCacheDataResponse { 417 repeated ResponseCacheData ResponseCacheData = 1; 418 } 419 420 message GetStatsInfoRequest { 421 statsinfo.StatsInfoKey StatsInfoKey = 1; 422 } 423 424 message GetStatsInfoResponse { 425 statsinfo.StatsInfo StatsInfo = 1; 426 } 427 428 message PrepareStmt { 429 string Name = 1; 430 string SQL = 2; 431 bytes ParamTypes = 3; 432 } 433 434 message MigrateConnFromRequest { 435 uint32 ConnID = 1; 436 } 437 438 message MigrateConnFromResponse { 439 string DB = 1; 440 repeated PrepareStmt PrepareStmts = 2; 441 } 442 443 message MigrateConnToRequest { 444 uint32 ConnID = 1; 445 string DB = 2; 446 repeated string SetVarStmts = 3; 447 repeated PrepareStmt PrepareStmts = 4; 448 } 449 450 message MigrateConnToResponse { 451 bool Success = 1; 452 }