github.com/whtcorpsinc/MilevaDB-Prod@v0.0.0-20211104133533-f57f4be3b597/schemareplicant/tables.go (about) 1 // Copyright 2020 WHTCORPS INC, 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 package schemareplicant 15 16 import ( 17 "context" 18 "encoding/json" 19 "fmt" 20 "io/ioutil" 21 "net/http" 22 "sort" 23 "strconv" 24 "strings" 25 26 "github.com/whtcorpsinc/BerolinaSQL/allegrosql" 27 "github.com/whtcorpsinc/BerolinaSQL/charset" 28 "github.com/whtcorpsinc/BerolinaSQL/perceptron" 29 "github.com/whtcorpsinc/BerolinaSQL/terror" 30 "github.com/whtcorpsinc/ekvproto/pkg/spacetimepb" 31 "github.com/whtcorpsinc/errors" 32 "github.com/whtcorpsinc/failpoint" 33 "github.com/whtcorpsinc/milevadb/causet" 34 "github.com/whtcorpsinc/milevadb/causetstore/einsteindb" 35 "github.com/whtcorpsinc/milevadb/config" 36 "github.com/whtcorpsinc/milevadb/ekv" 37 "github.com/whtcorpsinc/milevadb/petri/infosync" 38 "github.com/whtcorpsinc/milevadb/soliton" 39 "github.com/whtcorpsinc/milevadb/soliton/FIDelapi" 40 "github.com/whtcorpsinc/milevadb/soliton/execdetails" 41 "github.com/whtcorpsinc/milevadb/spacetime/autoid" 42 "github.com/whtcorpsinc/milevadb/stochastikctx" 43 "github.com/whtcorpsinc/milevadb/stochastikctx/variable" 44 "github.com/whtcorpsinc/milevadb/types" 45 ) 46 47 const ( 48 // BlockSchemata is the string constant of schemareplicant causet. 49 BlockSchemata = "SCHEMATA" 50 // BlockBlocks is the string constant of schemareplicant causet. 51 BlockBlocks = "TABLES" 52 // BlockDeferredCausets is the string constant of schemareplicant causet 53 BlockDeferredCausets = "COLUMNS" 54 blockDeferredCausetStatistics = "COLUMN_STATISTICS" 55 // BlockStatistics is the string constant of schemareplicant causet 56 BlockStatistics = "STATISTICS" 57 // BlockCharacterSets is the string constant of schemareplicant charactersets memory causet 58 BlockCharacterSets = "CHARACTER_SETS" 59 // BlockDefCauslations is the string constant of schemareplicant defCauslations memory causet. 60 BlockDefCauslations = "COLLATIONS" 61 blockFiles = "FILES" 62 // CatalogVal is the string constant of TABLE_CATALOG. 63 CatalogVal = "def" 64 // BlockProfiling is the string constant of schemareplicant causet. 65 BlockProfiling = "PROFILING" 66 // BlockPartitions is the string constant of schemareplicant causet. 67 BlockPartitions = "PARTITIONS" 68 // BlockKeyDeferredCauset is the string constant of KEY_COLUMN_USAGE. 69 BlockKeyDeferredCauset = "KEY_COLUMN_USAGE" 70 blockReferConst = "REFERENTIAL_CONSTRAINTS" 71 // BlockStochastikVar is the string constant of SESSION_VARIABLES. 72 BlockStochastikVar = "SESSION_VARIABLES" 73 blockPlugins = "PLUGINS" 74 // BlockConstraints is the string constant of TABLE_CONSTRAINTS. 75 BlockConstraints = "TABLE_CONSTRAINTS" 76 blockTriggers = "TRIGGERS" 77 // BlockUserPrivileges is the string constant of schemareplicant user privilege causet. 78 BlockUserPrivileges = "USER_PRIVILEGES" 79 blockSchemaPrivileges = "SCHEMA_PRIVILEGES" 80 blockBlockPrivileges = "TABLE_PRIVILEGES" 81 blockDeferredCausetPrivileges = "COLUMN_PRIVILEGES" 82 // BlockEngines is the string constant of schemareplicant causet. 83 BlockEngines = "ENGINES" 84 // BlockViews is the string constant of schemareplicant causet. 85 BlockViews = "VIEWS" 86 blockRoutines = "ROUTINES" 87 blockParameters = "PARAMETERS" 88 blockEvents = "EVENTS" 89 blockGlobalStatus = "GLOBAL_STATUS" 90 blockGlobalVariables = "GLOBAL_VARIABLES" 91 blockStochastikStatus = "SESSION_STATUS" 92 blockOptimizerTrace = "OPTIMIZER_TRACE" 93 blockBlockSpaces = "TABLESPACES" 94 // BlockDefCauslationCharacterSetApplicability is the string constant of schemareplicant memory causet. 95 BlockDefCauslationCharacterSetApplicability = "COLLATION_CHARACTER_SET_APPLICABILITY" 96 // BlockProcesslist is the string constant of schemareplicant causet. 97 BlockProcesslist = "PROCESSLIST" 98 // BlockMilevaDBIndexes is the string constant of schemareplicant causet 99 BlockMilevaDBIndexes = "MilevaDB_INDEXES" 100 // BlockMilevaDBHotRegions is the string constant of schemareplicant causet 101 BlockMilevaDBHotRegions = "MilevaDB_HOT_REGIONS" 102 // BlockEinsteinDBStoreStatus is the string constant of schemareplicant causet 103 BlockEinsteinDBStoreStatus = "EinsteinDB_STORE_STATUS" 104 // BlockAnalyzeStatus is the string constant of Analyze Status 105 BlockAnalyzeStatus = "ANALYZE_STATUS" 106 // BlockEinsteinDBRegionStatus is the string constant of schemareplicant causet 107 BlockEinsteinDBRegionStatus = "EinsteinDB_REGION_STATUS" 108 // BlockEinsteinDBRegionPeers is the string constant of schemareplicant causet 109 BlockEinsteinDBRegionPeers = "EinsteinDB_REGION_PEERS" 110 // BlockMilevaDBServersInfo is the string constant of MilevaDB server information causet. 111 BlockMilevaDBServersInfo = "MilevaDB_SERVERS_INFO" 112 // BlockSlowQuery is the string constant of slow query memory causet. 113 BlockSlowQuery = "SLOW_QUERY" 114 // BlockClusterInfo is the string constant of cluster info memory causet. 115 BlockClusterInfo = "CLUSTER_INFO" 116 // BlockClusterConfig is the string constant of cluster configuration memory causet. 117 BlockClusterConfig = "CLUSTER_CONFIG" 118 // BlockClusterLog is the string constant of cluster log memory causet. 119 BlockClusterLog = "CLUSTER_LOG" 120 // BlockClusterLoad is the string constant of cluster load memory causet. 121 BlockClusterLoad = "CLUSTER_LOAD" 122 // BlockClusterHardware is the string constant of cluster hardware causet. 123 BlockClusterHardware = "CLUSTER_HARDWARE" 124 // BlockClusterSystemInfo is the string constant of cluster system info causet. 125 BlockClusterSystemInfo = "CLUSTER_SYSTEMINFO" 126 // BlockTiFlashReplica is the string constant of tiflash replica causet. 127 BlockTiFlashReplica = "TIFLASH_REPLICA" 128 // BlockInspectionResult is the string constant of inspection result causet. 129 BlockInspectionResult = "INSPECTION_RESULT" 130 // BlockMetricBlocks is a causet that contains all metrics causet definition. 131 BlockMetricBlocks = "METRICS_TABLES" 132 // BlockMetricSummary is a summary causet that contains all metrics. 133 BlockMetricSummary = "METRICS_SUMMARY" 134 // BlockMetricSummaryByLabel is a metric causet that contains all metrics that group by label info. 135 BlockMetricSummaryByLabel = "METRICS_SUMMARY_BY_LABEL" 136 // BlockInspectionSummary is the string constant of inspection summary causet. 137 BlockInspectionSummary = "INSPECTION_SUMMARY" 138 // BlockInspectionMemrules is the string constant of currently implemented inspection and summary rules. 139 BlockInspectionMemrules = "INSPECTION_RULES" 140 // BlockDBSJobs is the string constant of DBS job causet. 141 BlockDBSJobs = "DBS_JOBS" 142 // BlockSequences is the string constant of all sequences created by user. 143 BlockSequences = "SEQUENCES" 144 // BlockStatementsSummary is the string constant of memex summary causet. 145 BlockStatementsSummary = "STATEMENTS_SUMMARY" 146 // BlockStatementsSummaryHistory is the string constant of memexs summary history causet. 147 BlockStatementsSummaryHistory = "STATEMENTS_SUMMARY_HISTORY" 148 // BlockStorageStats is a causet that contains all blocks disk usage 149 BlockStorageStats = "TABLE_STORAGE_STATS" 150 // BlockTiFlashBlocks is the string constant of tiflash blocks causet. 151 BlockTiFlashBlocks = "TIFLASH_TABLES" 152 // BlockTiFlashSegments is the string constant of tiflash segments causet. 153 BlockTiFlashSegments = "TIFLASH_SEGMENTS" 154 ) 155 156 var blockIDMap = map[string]int64{ 157 BlockSchemata: autoid.InformationSchemaDBID + 1, 158 BlockBlocks: autoid.InformationSchemaDBID + 2, 159 BlockDeferredCausets: autoid.InformationSchemaDBID + 3, 160 blockDeferredCausetStatistics: autoid.InformationSchemaDBID + 4, 161 BlockStatistics: autoid.InformationSchemaDBID + 5, 162 BlockCharacterSets: autoid.InformationSchemaDBID + 6, 163 BlockDefCauslations: autoid.InformationSchemaDBID + 7, 164 blockFiles: autoid.InformationSchemaDBID + 8, 165 CatalogVal: autoid.InformationSchemaDBID + 9, 166 BlockProfiling: autoid.InformationSchemaDBID + 10, 167 BlockPartitions: autoid.InformationSchemaDBID + 11, 168 BlockKeyDeferredCauset: autoid.InformationSchemaDBID + 12, 169 blockReferConst: autoid.InformationSchemaDBID + 13, 170 BlockStochastikVar: autoid.InformationSchemaDBID + 14, 171 blockPlugins: autoid.InformationSchemaDBID + 15, 172 BlockConstraints: autoid.InformationSchemaDBID + 16, 173 blockTriggers: autoid.InformationSchemaDBID + 17, 174 BlockUserPrivileges: autoid.InformationSchemaDBID + 18, 175 blockSchemaPrivileges: autoid.InformationSchemaDBID + 19, 176 blockBlockPrivileges: autoid.InformationSchemaDBID + 20, 177 blockDeferredCausetPrivileges: autoid.InformationSchemaDBID + 21, 178 BlockEngines: autoid.InformationSchemaDBID + 22, 179 BlockViews: autoid.InformationSchemaDBID + 23, 180 blockRoutines: autoid.InformationSchemaDBID + 24, 181 blockParameters: autoid.InformationSchemaDBID + 25, 182 blockEvents: autoid.InformationSchemaDBID + 26, 183 blockGlobalStatus: autoid.InformationSchemaDBID + 27, 184 blockGlobalVariables: autoid.InformationSchemaDBID + 28, 185 blockStochastikStatus: autoid.InformationSchemaDBID + 29, 186 blockOptimizerTrace: autoid.InformationSchemaDBID + 30, 187 blockBlockSpaces: autoid.InformationSchemaDBID + 31, 188 BlockDefCauslationCharacterSetApplicability: autoid.InformationSchemaDBID + 32, 189 BlockProcesslist: autoid.InformationSchemaDBID + 33, 190 BlockMilevaDBIndexes: autoid.InformationSchemaDBID + 34, 191 BlockSlowQuery: autoid.InformationSchemaDBID + 35, 192 BlockMilevaDBHotRegions: autoid.InformationSchemaDBID + 36, 193 BlockEinsteinDBStoreStatus: autoid.InformationSchemaDBID + 37, 194 BlockAnalyzeStatus: autoid.InformationSchemaDBID + 38, 195 BlockEinsteinDBRegionStatus: autoid.InformationSchemaDBID + 39, 196 BlockEinsteinDBRegionPeers: autoid.InformationSchemaDBID + 40, 197 BlockMilevaDBServersInfo: autoid.InformationSchemaDBID + 41, 198 BlockClusterInfo: autoid.InformationSchemaDBID + 42, 199 BlockClusterConfig: autoid.InformationSchemaDBID + 43, 200 BlockClusterLoad: autoid.InformationSchemaDBID + 44, 201 BlockTiFlashReplica: autoid.InformationSchemaDBID + 45, 202 ClusterBlockSlowLog: autoid.InformationSchemaDBID + 46, 203 ClusterBlockProcesslist: autoid.InformationSchemaDBID + 47, 204 BlockClusterLog: autoid.InformationSchemaDBID + 48, 205 BlockClusterHardware: autoid.InformationSchemaDBID + 49, 206 BlockClusterSystemInfo: autoid.InformationSchemaDBID + 50, 207 BlockInspectionResult: autoid.InformationSchemaDBID + 51, 208 BlockMetricSummary: autoid.InformationSchemaDBID + 52, 209 BlockMetricSummaryByLabel: autoid.InformationSchemaDBID + 53, 210 BlockMetricBlocks: autoid.InformationSchemaDBID + 54, 211 BlockInspectionSummary: autoid.InformationSchemaDBID + 55, 212 BlockInspectionMemrules: autoid.InformationSchemaDBID + 56, 213 BlockDBSJobs: autoid.InformationSchemaDBID + 57, 214 BlockSequences: autoid.InformationSchemaDBID + 58, 215 BlockStatementsSummary: autoid.InformationSchemaDBID + 59, 216 BlockStatementsSummaryHistory: autoid.InformationSchemaDBID + 60, 217 ClusterBlockStatementsSummary: autoid.InformationSchemaDBID + 61, 218 ClusterBlockStatementsSummaryHistory: autoid.InformationSchemaDBID + 62, 219 BlockStorageStats: autoid.InformationSchemaDBID + 63, 220 BlockTiFlashBlocks: autoid.InformationSchemaDBID + 64, 221 BlockTiFlashSegments: autoid.InformationSchemaDBID + 65, 222 } 223 224 type defCausumnInfo struct { 225 name string 226 tp byte 227 size int 228 decimal int 229 flag uint 230 deflt interface{} 231 comment string 232 } 233 234 func buildDeferredCausetInfo(defCaus defCausumnInfo) *perceptron.DeferredCausetInfo { 235 mCharset := charset.CharsetBin 236 mDefCauslation := charset.CharsetBin 237 if defCaus.tp == allegrosql.TypeVarchar || defCaus.tp == allegrosql.TypeBlob || defCaus.tp == allegrosql.TypeLongBlob { 238 mCharset = charset.CharsetUTF8MB4 239 mDefCauslation = charset.DefCauslationUTF8MB4 240 } 241 fieldType := types.FieldType{ 242 Charset: mCharset, 243 DefCauslate: mDefCauslation, 244 Tp: defCaus.tp, 245 Flen: defCaus.size, 246 Decimal: defCaus.decimal, 247 Flag: defCaus.flag, 248 } 249 return &perceptron.DeferredCausetInfo{ 250 Name: perceptron.NewCIStr(defCaus.name), 251 FieldType: fieldType, 252 State: perceptron.StatePublic, 253 DefaultValue: defCaus.deflt, 254 Comment: defCaus.comment, 255 } 256 } 257 258 func buildBlockMeta(blockName string, cs []defCausumnInfo) *perceptron.BlockInfo { 259 defcaus := make([]*perceptron.DeferredCausetInfo, 0, len(cs)) 260 for _, c := range cs { 261 defcaus = append(defcaus, buildDeferredCausetInfo(c)) 262 } 263 for i, defCaus := range defcaus { 264 defCaus.Offset = i 265 } 266 return &perceptron.BlockInfo{ 267 Name: perceptron.NewCIStr(blockName), 268 DeferredCausets: defcaus, 269 State: perceptron.StatePublic, 270 Charset: allegrosql.DefaultCharset, 271 DefCauslate: allegrosql.DefaultDefCauslationName, 272 } 273 } 274 275 var schemataDefCauss = []defCausumnInfo{ 276 {name: "CATALOG_NAME", tp: allegrosql.TypeVarchar, size: 512}, 277 {name: "SCHEMA_NAME", tp: allegrosql.TypeVarchar, size: 64}, 278 {name: "DEFAULT_CHARACTER_SET_NAME", tp: allegrosql.TypeVarchar, size: 64}, 279 {name: "DEFAULT_COLLATION_NAME", tp: allegrosql.TypeVarchar, size: 32}, 280 {name: "ALLEGROSQL_PATH", tp: allegrosql.TypeVarchar, size: 512}, 281 } 282 283 var blocksDefCauss = []defCausumnInfo{ 284 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512}, 285 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 286 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 287 {name: "TABLE_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 288 {name: "ENGINE", tp: allegrosql.TypeVarchar, size: 64}, 289 {name: "VERSION", tp: allegrosql.TypeLonglong, size: 21}, 290 {name: "ROW_FORMAT", tp: allegrosql.TypeVarchar, size: 10}, 291 {name: "TABLE_ROWS", tp: allegrosql.TypeLonglong, size: 21}, 292 {name: "AVG_ROW_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 293 {name: "DATA_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 294 {name: "MAX_DATA_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 295 {name: "INDEX_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 296 {name: "DATA_FREE", tp: allegrosql.TypeLonglong, size: 21}, 297 {name: "AUTO_INCREMENT", tp: allegrosql.TypeLonglong, size: 21}, 298 {name: "CREATE_TIME", tp: allegrosql.TypeDatetime, size: 19}, 299 {name: "UFIDelATE_TIME", tp: allegrosql.TypeDatetime, size: 19}, 300 {name: "CHECK_TIME", tp: allegrosql.TypeDatetime, size: 19}, 301 {name: "TABLE_COLLATION", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag, deflt: "utf8_bin"}, 302 {name: "CHECKSUM", tp: allegrosql.TypeLonglong, size: 21}, 303 {name: "CREATE_OPTIONS", tp: allegrosql.TypeVarchar, size: 255}, 304 {name: "TABLE_COMMENT", tp: allegrosql.TypeVarchar, size: 2048}, 305 {name: "MilevaDB_TABLE_ID", tp: allegrosql.TypeLonglong, size: 21}, 306 {name: "MilevaDB_ROW_ID_SHARDING_INFO", tp: allegrosql.TypeVarchar, size: 255}, 307 {name: "MilevaDB_PK_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 308 } 309 310 // See: http://dev.allegrosql.com/doc/refman/5.7/en/defCausumns-causet.html 311 var defCausumnsDefCauss = []defCausumnInfo{ 312 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512}, 313 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 314 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 315 {name: "COLUMN_NAME", tp: allegrosql.TypeVarchar, size: 64}, 316 {name: "ORDINAL_POSITION", tp: allegrosql.TypeLonglong, size: 64}, 317 {name: "COLUMN_DEFAULT", tp: allegrosql.TypeBlob, size: 196606}, 318 {name: "IS_NULLABLE", tp: allegrosql.TypeVarchar, size: 3}, 319 {name: "DATA_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 320 {name: "CHARACTER_MAXIMUM_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 321 {name: "CHARACTER_OCTET_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 322 {name: "NUMERIC_PRECISION", tp: allegrosql.TypeLonglong, size: 21}, 323 {name: "NUMERIC_SCALE", tp: allegrosql.TypeLonglong, size: 21}, 324 {name: "DATETIME_PRECISION", tp: allegrosql.TypeLonglong, size: 21}, 325 {name: "CHARACTER_SET_NAME", tp: allegrosql.TypeVarchar, size: 32}, 326 {name: "COLLATION_NAME", tp: allegrosql.TypeVarchar, size: 32}, 327 {name: "COLUMN_TYPE", tp: allegrosql.TypeBlob, size: 196606}, 328 {name: "COLUMN_KEY", tp: allegrosql.TypeVarchar, size: 3}, 329 {name: "EXTRA", tp: allegrosql.TypeVarchar, size: 30}, 330 {name: "PRIVILEGES", tp: allegrosql.TypeVarchar, size: 80}, 331 {name: "COLUMN_COMMENT", tp: allegrosql.TypeVarchar, size: 1024}, 332 {name: "GENERATION_EXPRESSION", tp: allegrosql.TypeBlob, size: 589779, flag: allegrosql.NotNullFlag}, 333 } 334 335 var defCausumnStatisticsDefCauss = []defCausumnInfo{ 336 {name: "SCHEMA_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 337 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 338 {name: "COLUMN_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 339 {name: "HISTOGRAM", tp: allegrosql.TypeJSON, size: 51}, 340 } 341 342 var statisticsDefCauss = []defCausumnInfo{ 343 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512}, 344 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 345 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 346 {name: "NON_UNIQUE", tp: allegrosql.TypeVarchar, size: 1}, 347 {name: "INDEX_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 348 {name: "INDEX_NAME", tp: allegrosql.TypeVarchar, size: 64}, 349 {name: "SEQ_IN_INDEX", tp: allegrosql.TypeLonglong, size: 2}, 350 {name: "COLUMN_NAME", tp: allegrosql.TypeVarchar, size: 21}, 351 {name: "COLLATION", tp: allegrosql.TypeVarchar, size: 1}, 352 {name: "CARDINALITY", tp: allegrosql.TypeLonglong, size: 21}, 353 {name: "SUB_PART", tp: allegrosql.TypeLonglong, size: 3}, 354 {name: "PACKED", tp: allegrosql.TypeVarchar, size: 10}, 355 {name: "NULLABLE", tp: allegrosql.TypeVarchar, size: 3}, 356 {name: "INDEX_TYPE", tp: allegrosql.TypeVarchar, size: 16}, 357 {name: "COMMENT", tp: allegrosql.TypeVarchar, size: 16}, 358 {name: "INDEX_COMMENT", tp: allegrosql.TypeVarchar, size: 1024}, 359 {name: "IS_VISIBLE", tp: allegrosql.TypeVarchar, size: 3}, 360 {name: "Expression", tp: allegrosql.TypeVarchar, size: 64}, 361 } 362 363 var profilingDefCauss = []defCausumnInfo{ 364 {name: "QUERY_ID", tp: allegrosql.TypeLong, size: 20}, 365 {name: "SEQ", tp: allegrosql.TypeLong, size: 20}, 366 {name: "STATE", tp: allegrosql.TypeVarchar, size: 30}, 367 {name: "DURATION", tp: allegrosql.TypeNewDecimal, size: 9}, 368 {name: "CPU_USER", tp: allegrosql.TypeNewDecimal, size: 9}, 369 {name: "CPU_SYSTEM", tp: allegrosql.TypeNewDecimal, size: 9}, 370 {name: "CONTEXT_VOLUNTARY", tp: allegrosql.TypeLong, size: 20}, 371 {name: "CONTEXT_INVOLUNTARY", tp: allegrosql.TypeLong, size: 20}, 372 {name: "BLOCK_OPS_IN", tp: allegrosql.TypeLong, size: 20}, 373 {name: "BLOCK_OPS_OUT", tp: allegrosql.TypeLong, size: 20}, 374 {name: "MESSAGES_SENT", tp: allegrosql.TypeLong, size: 20}, 375 {name: "MESSAGES_RECEIVED", tp: allegrosql.TypeLong, size: 20}, 376 {name: "PAGE_FAULTS_MAJOR", tp: allegrosql.TypeLong, size: 20}, 377 {name: "PAGE_FAULTS_MINOR", tp: allegrosql.TypeLong, size: 20}, 378 {name: "SWAPS", tp: allegrosql.TypeLong, size: 20}, 379 {name: "SOURCE_FUNCTION", tp: allegrosql.TypeVarchar, size: 30}, 380 {name: "SOURCE_FILE", tp: allegrosql.TypeVarchar, size: 20}, 381 {name: "SOURCE_LINE", tp: allegrosql.TypeLong, size: 20}, 382 } 383 384 var charsetDefCauss = []defCausumnInfo{ 385 {name: "CHARACTER_SET_NAME", tp: allegrosql.TypeVarchar, size: 32}, 386 {name: "DEFAULT_COLLATE_NAME", tp: allegrosql.TypeVarchar, size: 32}, 387 {name: "DESCRIPTION", tp: allegrosql.TypeVarchar, size: 60}, 388 {name: "MAXLEN", tp: allegrosql.TypeLonglong, size: 3}, 389 } 390 391 var defCauslationsDefCauss = []defCausumnInfo{ 392 {name: "COLLATION_NAME", tp: allegrosql.TypeVarchar, size: 32}, 393 {name: "CHARACTER_SET_NAME", tp: allegrosql.TypeVarchar, size: 32}, 394 {name: "ID", tp: allegrosql.TypeLonglong, size: 11}, 395 {name: "IS_DEFAULT", tp: allegrosql.TypeVarchar, size: 3}, 396 {name: "IS_COMPILED", tp: allegrosql.TypeVarchar, size: 3}, 397 {name: "SORTLEN", tp: allegrosql.TypeLonglong, size: 3}, 398 } 399 400 var keyDeferredCausetUsageDefCauss = []defCausumnInfo{ 401 {name: "CONSTRAINT_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 402 {name: "CONSTRAINT_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 403 {name: "CONSTRAINT_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 404 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 405 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 406 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 407 {name: "COLUMN_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 408 {name: "ORDINAL_POSITION", tp: allegrosql.TypeLonglong, size: 10, flag: allegrosql.NotNullFlag}, 409 {name: "POSITION_IN_UNIQUE_CONSTRAINT", tp: allegrosql.TypeLonglong, size: 10}, 410 {name: "REFERENCED_TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 411 {name: "REFERENCED_TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 412 {name: "REFERENCED_COLUMN_NAME", tp: allegrosql.TypeVarchar, size: 64}, 413 } 414 415 // See http://dev.allegrosql.com/doc/refman/5.7/en/referential-constraints-causet.html 416 var referConstDefCauss = []defCausumnInfo{ 417 {name: "CONSTRAINT_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 418 {name: "CONSTRAINT_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 419 {name: "CONSTRAINT_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 420 {name: "UNIQUE_CONSTRAINT_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 421 {name: "UNIQUE_CONSTRAINT_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 422 {name: "UNIQUE_CONSTRAINT_NAME", tp: allegrosql.TypeVarchar, size: 64}, 423 {name: "MATCH_OPTION", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 424 {name: "UFIDelATE_RULE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 425 {name: "DELETE_RULE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 426 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 427 {name: "REFERENCED_TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 428 } 429 430 // See http://dev.allegrosql.com/doc/refman/5.7/en/variables-causet.html 431 var stochastikVarDefCauss = []defCausumnInfo{ 432 {name: "VARIABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 433 {name: "VARIABLE_VALUE", tp: allegrosql.TypeVarchar, size: 1024}, 434 } 435 436 // See https://dev.allegrosql.com/doc/refman/5.7/en/plugins-causet.html 437 var pluginsDefCauss = []defCausumnInfo{ 438 {name: "PLUGIN_NAME", tp: allegrosql.TypeVarchar, size: 64}, 439 {name: "PLUGIN_VERSION", tp: allegrosql.TypeVarchar, size: 20}, 440 {name: "PLUGIN_STATUS", tp: allegrosql.TypeVarchar, size: 10}, 441 {name: "PLUGIN_TYPE", tp: allegrosql.TypeVarchar, size: 80}, 442 {name: "PLUGIN_TYPE_VERSION", tp: allegrosql.TypeVarchar, size: 20}, 443 {name: "PLUGIN_LIBRARY", tp: allegrosql.TypeVarchar, size: 64}, 444 {name: "PLUGIN_LIBRARY_VERSION", tp: allegrosql.TypeVarchar, size: 20}, 445 {name: "PLUGIN_AUTHOR", tp: allegrosql.TypeVarchar, size: 64}, 446 {name: "PLUGIN_DESCRIPTION", tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 447 {name: "PLUGIN_LICENSE", tp: allegrosql.TypeVarchar, size: 80}, 448 {name: "LOAD_OPTION", tp: allegrosql.TypeVarchar, size: 64}, 449 } 450 451 // See https://dev.allegrosql.com/doc/refman/5.7/en/partitions-causet.html 452 var partitionsDefCauss = []defCausumnInfo{ 453 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512}, 454 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 455 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 456 {name: "PARTITION_NAME", tp: allegrosql.TypeVarchar, size: 64}, 457 {name: "SUBPARTITION_NAME", tp: allegrosql.TypeVarchar, size: 64}, 458 {name: "PARTITION_ORDINAL_POSITION", tp: allegrosql.TypeLonglong, size: 21}, 459 {name: "SUBPARTITION_ORDINAL_POSITION", tp: allegrosql.TypeLonglong, size: 21}, 460 {name: "PARTITION_METHOD", tp: allegrosql.TypeVarchar, size: 18}, 461 {name: "SUBPARTITION_METHOD", tp: allegrosql.TypeVarchar, size: 12}, 462 {name: "PARTITION_EXPRESSION", tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 463 {name: "SUBPARTITION_EXPRESSION", tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 464 {name: "PARTITION_DESCRIPTION", tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 465 {name: "TABLE_ROWS", tp: allegrosql.TypeLonglong, size: 21}, 466 {name: "AVG_ROW_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 467 {name: "DATA_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 468 {name: "MAX_DATA_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 469 {name: "INDEX_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 470 {name: "DATA_FREE", tp: allegrosql.TypeLonglong, size: 21}, 471 {name: "CREATE_TIME", tp: allegrosql.TypeDatetime}, 472 {name: "UFIDelATE_TIME", tp: allegrosql.TypeDatetime}, 473 {name: "CHECK_TIME", tp: allegrosql.TypeDatetime}, 474 {name: "CHECKSUM", tp: allegrosql.TypeLonglong, size: 21}, 475 {name: "PARTITION_COMMENT", tp: allegrosql.TypeVarchar, size: 80}, 476 {name: "NODEGROUP", tp: allegrosql.TypeVarchar, size: 12}, 477 {name: "TABLESPACE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 478 } 479 480 var blockConstraintsDefCauss = []defCausumnInfo{ 481 {name: "CONSTRAINT_CATALOG", tp: allegrosql.TypeVarchar, size: 512}, 482 {name: "CONSTRAINT_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 483 {name: "CONSTRAINT_NAME", tp: allegrosql.TypeVarchar, size: 64}, 484 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 485 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 486 {name: "CONSTRAINT_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 487 } 488 489 var blockTriggersDefCauss = []defCausumnInfo{ 490 {name: "TRIGGER_CATALOG", tp: allegrosql.TypeVarchar, size: 512}, 491 {name: "TRIGGER_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 492 {name: "TRIGGER_NAME", tp: allegrosql.TypeVarchar, size: 64}, 493 {name: "EVENT_MANIPULATION", tp: allegrosql.TypeVarchar, size: 6}, 494 {name: "EVENT_OBJECT_CATALOG", tp: allegrosql.TypeVarchar, size: 512}, 495 {name: "EVENT_OBJECT_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 496 {name: "EVENT_OBJECT_TABLE", tp: allegrosql.TypeVarchar, size: 64}, 497 {name: "ACTION_ORDER", tp: allegrosql.TypeLonglong, size: 4}, 498 {name: "ACTION_CONDITION", tp: allegrosql.TypeBlob, size: -1}, 499 {name: "ACTION_STATEMENT", tp: allegrosql.TypeBlob, size: -1}, 500 {name: "ACTION_ORIENTATION", tp: allegrosql.TypeVarchar, size: 9}, 501 {name: "ACTION_TIMING", tp: allegrosql.TypeVarchar, size: 6}, 502 {name: "ACTION_REFERENCE_OLD_TABLE", tp: allegrosql.TypeVarchar, size: 64}, 503 {name: "ACTION_REFERENCE_NEW_TABLE", tp: allegrosql.TypeVarchar, size: 64}, 504 {name: "ACTION_REFERENCE_OLD_ROW", tp: allegrosql.TypeVarchar, size: 3}, 505 {name: "ACTION_REFERENCE_NEW_ROW", tp: allegrosql.TypeVarchar, size: 3}, 506 {name: "CREATED", tp: allegrosql.TypeDatetime, size: 2}, 507 {name: "ALLEGROSQL_MODE", tp: allegrosql.TypeVarchar, size: 8192}, 508 {name: "DEFINER", tp: allegrosql.TypeVarchar, size: 77}, 509 {name: "CHARACTER_SET_CLIENT", tp: allegrosql.TypeVarchar, size: 32}, 510 {name: "COLLATION_CONNECTION", tp: allegrosql.TypeVarchar, size: 32}, 511 {name: "DATABASE_COLLATION", tp: allegrosql.TypeVarchar, size: 32}, 512 } 513 514 var blockUserPrivilegesDefCauss = []defCausumnInfo{ 515 {name: "GRANTEE", tp: allegrosql.TypeVarchar, size: 81}, 516 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512}, 517 {name: "PRIVILEGE_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 518 {name: "IS_GRANTABLE", tp: allegrosql.TypeVarchar, size: 3}, 519 } 520 521 var blockSchemaPrivilegesDefCauss = []defCausumnInfo{ 522 {name: "GRANTEE", tp: allegrosql.TypeVarchar, size: 81, flag: allegrosql.NotNullFlag}, 523 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 524 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 525 {name: "PRIVILEGE_TYPE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 526 {name: "IS_GRANTABLE", tp: allegrosql.TypeVarchar, size: 3, flag: allegrosql.NotNullFlag}, 527 } 528 529 var blockBlockPrivilegesDefCauss = []defCausumnInfo{ 530 {name: "GRANTEE", tp: allegrosql.TypeVarchar, size: 81, flag: allegrosql.NotNullFlag}, 531 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 532 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 533 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 534 {name: "PRIVILEGE_TYPE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 535 {name: "IS_GRANTABLE", tp: allegrosql.TypeVarchar, size: 3, flag: allegrosql.NotNullFlag}, 536 } 537 538 var blockDeferredCausetPrivilegesDefCauss = []defCausumnInfo{ 539 {name: "GRANTEE", tp: allegrosql.TypeVarchar, size: 81, flag: allegrosql.NotNullFlag}, 540 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 541 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 542 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 543 {name: "COLUMN_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 544 {name: "PRIVILEGE_TYPE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 545 {name: "IS_GRANTABLE", tp: allegrosql.TypeVarchar, size: 3, flag: allegrosql.NotNullFlag}, 546 } 547 548 var blockEnginesDefCauss = []defCausumnInfo{ 549 {name: "ENGINE", tp: allegrosql.TypeVarchar, size: 64}, 550 {name: "SUPPORT", tp: allegrosql.TypeVarchar, size: 8}, 551 {name: "COMMENT", tp: allegrosql.TypeVarchar, size: 80}, 552 {name: "TRANSACTIONS", tp: allegrosql.TypeVarchar, size: 3}, 553 {name: "XA", tp: allegrosql.TypeVarchar, size: 3}, 554 {name: "SAVEPOINTS", tp: allegrosql.TypeVarchar, size: 3}, 555 } 556 557 var blockViewsDefCauss = []defCausumnInfo{ 558 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 559 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 560 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 561 {name: "VIEW_DEFINITION", tp: allegrosql.TypeLongBlob, flag: allegrosql.NotNullFlag}, 562 {name: "CHECK_OPTION", tp: allegrosql.TypeVarchar, size: 8, flag: allegrosql.NotNullFlag}, 563 {name: "IS_UFIDelATABLE", tp: allegrosql.TypeVarchar, size: 3, flag: allegrosql.NotNullFlag}, 564 {name: "DEFINER", tp: allegrosql.TypeVarchar, size: 77, flag: allegrosql.NotNullFlag}, 565 {name: "SECURITY_TYPE", tp: allegrosql.TypeVarchar, size: 7, flag: allegrosql.NotNullFlag}, 566 {name: "CHARACTER_SET_CLIENT", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 567 {name: "COLLATION_CONNECTION", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 568 } 569 570 var blockRoutinesDefCauss = []defCausumnInfo{ 571 {name: "SPECIFIC_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 572 {name: "ROUTINE_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 573 {name: "ROUTINE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 574 {name: "ROUTINE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 575 {name: "ROUTINE_TYPE", tp: allegrosql.TypeVarchar, size: 9, flag: allegrosql.NotNullFlag}, 576 {name: "DATA_TYPE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 577 {name: "CHARACTER_MAXIMUM_LENGTH", tp: allegrosql.TypeLong, size: 21}, 578 {name: "CHARACTER_OCTET_LENGTH", tp: allegrosql.TypeLong, size: 21}, 579 {name: "NUMERIC_PRECISION", tp: allegrosql.TypeLonglong, size: 21}, 580 {name: "NUMERIC_SCALE", tp: allegrosql.TypeLong, size: 21}, 581 {name: "DATETIME_PRECISION", tp: allegrosql.TypeLonglong, size: 21}, 582 {name: "CHARACTER_SET_NAME", tp: allegrosql.TypeVarchar, size: 64}, 583 {name: "COLLATION_NAME", tp: allegrosql.TypeVarchar, size: 64}, 584 {name: "DTD_IDENTIFIER", tp: allegrosql.TypeLongBlob}, 585 {name: "ROUTINE_BODY", tp: allegrosql.TypeVarchar, size: 8, flag: allegrosql.NotNullFlag}, 586 {name: "ROUTINE_DEFINITION", tp: allegrosql.TypeLongBlob}, 587 {name: "EXTERNAL_NAME", tp: allegrosql.TypeVarchar, size: 64}, 588 {name: "EXTERNAL_LANGUAGE", tp: allegrosql.TypeVarchar, size: 64}, 589 {name: "PARAMETER_STYLE", tp: allegrosql.TypeVarchar, size: 8, flag: allegrosql.NotNullFlag}, 590 {name: "IS_DETERMINISTIC", tp: allegrosql.TypeVarchar, size: 3, flag: allegrosql.NotNullFlag}, 591 {name: "ALLEGROSQL_DATA_ACCESS", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 592 {name: "ALLEGROSQL_PATH", tp: allegrosql.TypeVarchar, size: 64}, 593 {name: "SECURITY_TYPE", tp: allegrosql.TypeVarchar, size: 7, flag: allegrosql.NotNullFlag}, 594 {name: "CREATED", tp: allegrosql.TypeDatetime, flag: allegrosql.NotNullFlag, deflt: "0000-00-00 00:00:00"}, 595 {name: "LAST_ALTERED", tp: allegrosql.TypeDatetime, flag: allegrosql.NotNullFlag, deflt: "0000-00-00 00:00:00"}, 596 {name: "ALLEGROSQL_MODE", tp: allegrosql.TypeVarchar, size: 8192, flag: allegrosql.NotNullFlag}, 597 {name: "ROUTINE_COMMENT", tp: allegrosql.TypeLongBlob}, 598 {name: "DEFINER", tp: allegrosql.TypeVarchar, size: 77, flag: allegrosql.NotNullFlag}, 599 {name: "CHARACTER_SET_CLIENT", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 600 {name: "COLLATION_CONNECTION", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 601 {name: "DATABASE_COLLATION", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 602 } 603 604 var blockParametersDefCauss = []defCausumnInfo{ 605 {name: "SPECIFIC_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 606 {name: "SPECIFIC_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 607 {name: "SPECIFIC_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 608 {name: "ORDINAL_POSITION", tp: allegrosql.TypeVarchar, size: 21, flag: allegrosql.NotNullFlag}, 609 {name: "PARAMETER_MODE", tp: allegrosql.TypeVarchar, size: 5}, 610 {name: "PARAMETER_NAME", tp: allegrosql.TypeVarchar, size: 64}, 611 {name: "DATA_TYPE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 612 {name: "CHARACTER_MAXIMUM_LENGTH", tp: allegrosql.TypeVarchar, size: 21}, 613 {name: "CHARACTER_OCTET_LENGTH", tp: allegrosql.TypeVarchar, size: 21}, 614 {name: "NUMERIC_PRECISION", tp: allegrosql.TypeVarchar, size: 21}, 615 {name: "NUMERIC_SCALE", tp: allegrosql.TypeVarchar, size: 21}, 616 {name: "DATETIME_PRECISION", tp: allegrosql.TypeVarchar, size: 21}, 617 {name: "CHARACTER_SET_NAME", tp: allegrosql.TypeVarchar, size: 64}, 618 {name: "COLLATION_NAME", tp: allegrosql.TypeVarchar, size: 64}, 619 {name: "DTD_IDENTIFIER", tp: allegrosql.TypeLongBlob, flag: allegrosql.NotNullFlag}, 620 {name: "ROUTINE_TYPE", tp: allegrosql.TypeVarchar, size: 9, flag: allegrosql.NotNullFlag}, 621 } 622 623 var blockEventsDefCauss = []defCausumnInfo{ 624 {name: "EVENT_CATALOG", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 625 {name: "EVENT_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 626 {name: "EVENT_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 627 {name: "DEFINER", tp: allegrosql.TypeVarchar, size: 77, flag: allegrosql.NotNullFlag}, 628 {name: "TIME_ZONE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 629 {name: "EVENT_BODY", tp: allegrosql.TypeVarchar, size: 8, flag: allegrosql.NotNullFlag}, 630 {name: "EVENT_DEFINITION", tp: allegrosql.TypeLongBlob}, 631 {name: "EVENT_TYPE", tp: allegrosql.TypeVarchar, size: 9, flag: allegrosql.NotNullFlag}, 632 {name: "EXECUTE_AT", tp: allegrosql.TypeDatetime}, 633 {name: "INTERVAL_VALUE", tp: allegrosql.TypeVarchar, size: 256}, 634 {name: "INTERVAL_FIELD", tp: allegrosql.TypeVarchar, size: 18}, 635 {name: "ALLEGROSQL_MODE", tp: allegrosql.TypeVarchar, size: 8192, flag: allegrosql.NotNullFlag}, 636 {name: "STARTS", tp: allegrosql.TypeDatetime}, 637 {name: "ENDS", tp: allegrosql.TypeDatetime}, 638 {name: "STATUS", tp: allegrosql.TypeVarchar, size: 18, flag: allegrosql.NotNullFlag}, 639 {name: "ON_COMPLETION", tp: allegrosql.TypeVarchar, size: 12, flag: allegrosql.NotNullFlag}, 640 {name: "CREATED", tp: allegrosql.TypeDatetime, flag: allegrosql.NotNullFlag, deflt: "0000-00-00 00:00:00"}, 641 {name: "LAST_ALTERED", tp: allegrosql.TypeDatetime, flag: allegrosql.NotNullFlag, deflt: "0000-00-00 00:00:00"}, 642 {name: "LAST_EXECUTED", tp: allegrosql.TypeDatetime}, 643 {name: "EVENT_COMMENT", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 644 {name: "ORIGINATOR", tp: allegrosql.TypeLong, size: 10, flag: allegrosql.NotNullFlag, deflt: 0}, 645 {name: "CHARACTER_SET_CLIENT", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 646 {name: "COLLATION_CONNECTION", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 647 {name: "DATABASE_COLLATION", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 648 } 649 650 var blockGlobalStatusDefCauss = []defCausumnInfo{ 651 {name: "VARIABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 652 {name: "VARIABLE_VALUE", tp: allegrosql.TypeVarchar, size: 1024}, 653 } 654 655 var blockGlobalVariablesDefCauss = []defCausumnInfo{ 656 {name: "VARIABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 657 {name: "VARIABLE_VALUE", tp: allegrosql.TypeVarchar, size: 1024}, 658 } 659 660 var blockStochastikStatusDefCauss = []defCausumnInfo{ 661 {name: "VARIABLE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 662 {name: "VARIABLE_VALUE", tp: allegrosql.TypeVarchar, size: 1024}, 663 } 664 665 var blockOptimizerTraceDefCauss = []defCausumnInfo{ 666 {name: "QUERY", tp: allegrosql.TypeLongBlob, flag: allegrosql.NotNullFlag, deflt: ""}, 667 {name: "TRACE", tp: allegrosql.TypeLongBlob, flag: allegrosql.NotNullFlag, deflt: ""}, 668 {name: "MISSING_BYTES_BEYOND_MAX_MEM_SIZE", tp: allegrosql.TypeShort, size: 20, flag: allegrosql.NotNullFlag, deflt: 0}, 669 {name: "INSUFFICIENT_PRIVILEGES", tp: allegrosql.TypeTiny, size: 1, flag: allegrosql.NotNullFlag, deflt: 0}, 670 } 671 672 var blockBlockSpacesDefCauss = []defCausumnInfo{ 673 {name: "TABLESPACE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag, deflt: ""}, 674 {name: "ENGINE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag, deflt: ""}, 675 {name: "TABLESPACE_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 676 {name: "LOGFILE_GROUP_NAME", tp: allegrosql.TypeVarchar, size: 64}, 677 {name: "EXTENT_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 678 {name: "AUTOEXTEND_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 679 {name: "MAXIMUM_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 680 {name: "NODEGROUP_ID", tp: allegrosql.TypeLonglong, size: 21}, 681 {name: "TABLESPACE_COMMENT", tp: allegrosql.TypeVarchar, size: 2048}, 682 } 683 684 var blockDefCauslationCharacterSetApplicabilityDefCauss = []defCausumnInfo{ 685 {name: "COLLATION_NAME", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 686 {name: "CHARACTER_SET_NAME", tp: allegrosql.TypeVarchar, size: 32, flag: allegrosql.NotNullFlag}, 687 } 688 689 var blockProcesslistDefCauss = []defCausumnInfo{ 690 {name: "ID", tp: allegrosql.TypeLonglong, size: 21, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, deflt: 0}, 691 {name: "USER", tp: allegrosql.TypeVarchar, size: 16, flag: allegrosql.NotNullFlag, deflt: ""}, 692 {name: "HOST", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag, deflt: ""}, 693 {name: "EDB", tp: allegrosql.TypeVarchar, size: 64}, 694 {name: "COMMAND", tp: allegrosql.TypeVarchar, size: 16, flag: allegrosql.NotNullFlag, deflt: ""}, 695 {name: "TIME", tp: allegrosql.TypeLong, size: 7, flag: allegrosql.NotNullFlag, deflt: 0}, 696 {name: "STATE", tp: allegrosql.TypeVarchar, size: 7}, 697 {name: "INFO", tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 698 {name: "DIGEST", tp: allegrosql.TypeVarchar, size: 64, deflt: ""}, 699 {name: "MEM", tp: allegrosql.TypeLonglong, size: 21, flag: allegrosql.UnsignedFlag}, 700 {name: "TxnStart", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag, deflt: ""}, 701 } 702 703 var blockMilevaDBIndexesDefCauss = []defCausumnInfo{ 704 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 705 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 706 {name: "NON_UNIQUE", tp: allegrosql.TypeLonglong, size: 21}, 707 {name: "KEY_NAME", tp: allegrosql.TypeVarchar, size: 64}, 708 {name: "SEQ_IN_INDEX", tp: allegrosql.TypeLonglong, size: 21}, 709 {name: "COLUMN_NAME", tp: allegrosql.TypeVarchar, size: 64}, 710 {name: "SUB_PART", tp: allegrosql.TypeLonglong, size: 21}, 711 {name: "INDEX_COMMENT", tp: allegrosql.TypeVarchar, size: 2048}, 712 {name: "Expression", tp: allegrosql.TypeVarchar, size: 64}, 713 {name: "INDEX_ID", tp: allegrosql.TypeLonglong, size: 21}, 714 {name: "IS_VISIBLE", tp: allegrosql.TypeVarchar, size: 64}, 715 } 716 717 var slowQueryDefCauss = []defCausumnInfo{ 718 {name: variable.SlowLogTimeStr, tp: allegrosql.TypeTimestamp, size: 26, decimal: 6}, 719 {name: variable.SlowLogTxnStartTSStr, tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.UnsignedFlag}, 720 {name: variable.SlowLogUserStr, tp: allegrosql.TypeVarchar, size: 64}, 721 {name: variable.SlowLogHostStr, tp: allegrosql.TypeVarchar, size: 64}, 722 {name: variable.SlowLogConnIDStr, tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.UnsignedFlag}, 723 {name: variable.SlowLogInterDircRetryCount, tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.UnsignedFlag}, 724 {name: variable.SlowLogInterDircRetryTime, tp: allegrosql.TypeDouble, size: 22}, 725 {name: variable.SlowLogQueryTimeStr, tp: allegrosql.TypeDouble, size: 22}, 726 {name: variable.SlowLogParseTimeStr, tp: allegrosql.TypeDouble, size: 22}, 727 {name: variable.SlowLogCompileTimeStr, tp: allegrosql.TypeDouble, size: 22}, 728 {name: variable.SlowLogRewriteTimeStr, tp: allegrosql.TypeDouble, size: 22}, 729 {name: variable.SlowLogPreprocSubQueriesStr, tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.UnsignedFlag}, 730 {name: variable.SlowLogPreProcSubQueryTimeStr, tp: allegrosql.TypeDouble, size: 22}, 731 {name: variable.SlowLogOptimizeTimeStr, tp: allegrosql.TypeDouble, size: 22}, 732 {name: variable.SlowLogWaitTSTimeStr, tp: allegrosql.TypeDouble, size: 22}, 733 {name: execdetails.PreWriteTimeStr, tp: allegrosql.TypeDouble, size: 22}, 734 {name: execdetails.WaitPrewriteBinlogTimeStr, tp: allegrosql.TypeDouble, size: 22}, 735 {name: execdetails.CommitTimeStr, tp: allegrosql.TypeDouble, size: 22}, 736 {name: execdetails.GetCommitTSTimeStr, tp: allegrosql.TypeDouble, size: 22}, 737 {name: execdetails.CommitBackoffTimeStr, tp: allegrosql.TypeDouble, size: 22}, 738 {name: execdetails.BackoffTypesStr, tp: allegrosql.TypeVarchar, size: 64}, 739 {name: execdetails.ResolveLockTimeStr, tp: allegrosql.TypeDouble, size: 22}, 740 {name: execdetails.LocalLatchWaitTimeStr, tp: allegrosql.TypeDouble, size: 22}, 741 {name: execdetails.WriteKeysStr, tp: allegrosql.TypeLonglong, size: 22}, 742 {name: execdetails.WriteSizeStr, tp: allegrosql.TypeLonglong, size: 22}, 743 {name: execdetails.PrewriteRegionStr, tp: allegrosql.TypeLonglong, size: 22}, 744 {name: execdetails.TxnRetryStr, tp: allegrosql.TypeLonglong, size: 22}, 745 {name: execdetails.CopTimeStr, tp: allegrosql.TypeDouble, size: 22}, 746 {name: execdetails.ProcessTimeStr, tp: allegrosql.TypeDouble, size: 22}, 747 {name: execdetails.WaitTimeStr, tp: allegrosql.TypeDouble, size: 22}, 748 {name: execdetails.BackoffTimeStr, tp: allegrosql.TypeDouble, size: 22}, 749 {name: execdetails.LockKeysTimeStr, tp: allegrosql.TypeDouble, size: 22}, 750 {name: execdetails.RequestCountStr, tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.UnsignedFlag}, 751 {name: execdetails.TotalKeysStr, tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.UnsignedFlag}, 752 {name: execdetails.ProcessKeysStr, tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.UnsignedFlag}, 753 {name: variable.SlowLogDBStr, tp: allegrosql.TypeVarchar, size: 64}, 754 {name: variable.SlowLogIndexNamesStr, tp: allegrosql.TypeVarchar, size: 100}, 755 {name: variable.SlowLogIsInternalStr, tp: allegrosql.TypeTiny, size: 1}, 756 {name: variable.SlowLogDigestStr, tp: allegrosql.TypeVarchar, size: 64}, 757 {name: variable.SlowLogStatsInfoStr, tp: allegrosql.TypeVarchar, size: 512}, 758 {name: variable.SlowLogCopProcAvg, tp: allegrosql.TypeDouble, size: 22}, 759 {name: variable.SlowLogCopProcP90, tp: allegrosql.TypeDouble, size: 22}, 760 {name: variable.SlowLogCopProcMax, tp: allegrosql.TypeDouble, size: 22}, 761 {name: variable.SlowLogCopProcAddr, tp: allegrosql.TypeVarchar, size: 64}, 762 {name: variable.SlowLogCopWaitAvg, tp: allegrosql.TypeDouble, size: 22}, 763 {name: variable.SlowLogCopWaitP90, tp: allegrosql.TypeDouble, size: 22}, 764 {name: variable.SlowLogCopWaitMax, tp: allegrosql.TypeDouble, size: 22}, 765 {name: variable.SlowLogCopWaitAddr, tp: allegrosql.TypeVarchar, size: 64}, 766 {name: variable.SlowLogMemMax, tp: allegrosql.TypeLonglong, size: 20}, 767 {name: variable.SlowLogDiskMax, tp: allegrosql.TypeLonglong, size: 20}, 768 {name: variable.SlowLogSucc, tp: allegrosql.TypeTiny, size: 1}, 769 {name: variable.SlowLogCausetFromCache, tp: allegrosql.TypeTiny, size: 1}, 770 {name: variable.SlowLogCauset, tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 771 {name: variable.SlowLogCausetDigest, tp: allegrosql.TypeVarchar, size: 128}, 772 {name: variable.SlowLogPrevStmt, tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 773 {name: variable.SlowLogQueryALLEGROSQLStr, tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 774 } 775 776 // BlockMilevaDBHotRegionsDefCauss is MilevaDB hot region mem causet defCausumns. 777 var BlockMilevaDBHotRegionsDefCauss = []defCausumnInfo{ 778 {name: "TABLE_ID", tp: allegrosql.TypeLonglong, size: 21}, 779 {name: "INDEX_ID", tp: allegrosql.TypeLonglong, size: 21}, 780 {name: "DB_NAME", tp: allegrosql.TypeVarchar, size: 64}, 781 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 782 {name: "INDEX_NAME", tp: allegrosql.TypeVarchar, size: 64}, 783 {name: "REGION_ID", tp: allegrosql.TypeLonglong, size: 21}, 784 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 785 {name: "MAX_HOT_DEGREE", tp: allegrosql.TypeLonglong, size: 21}, 786 {name: "REGION_COUNT", tp: allegrosql.TypeLonglong, size: 21}, 787 {name: "FLOW_BYTES", tp: allegrosql.TypeLonglong, size: 21}, 788 } 789 790 // BlockEinsteinDBStoreStatusDefCauss is MilevaDB ekv causetstore status defCausumns. 791 var BlockEinsteinDBStoreStatusDefCauss = []defCausumnInfo{ 792 {name: "STORE_ID", tp: allegrosql.TypeLonglong, size: 21}, 793 {name: "ADDRESS", tp: allegrosql.TypeVarchar, size: 64}, 794 {name: "STORE_STATE", tp: allegrosql.TypeLonglong, size: 21}, 795 {name: "STORE_STATE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 796 {name: "LABEL", tp: allegrosql.TypeJSON, size: 51}, 797 {name: "VERSION", tp: allegrosql.TypeVarchar, size: 64}, 798 {name: "CAPACITY", tp: allegrosql.TypeVarchar, size: 64}, 799 {name: "AVAILABLE", tp: allegrosql.TypeVarchar, size: 64}, 800 {name: "LEADER_COUNT", tp: allegrosql.TypeLonglong, size: 21}, 801 {name: "LEADER_WEIGHT", tp: allegrosql.TypeDouble, size: 22}, 802 {name: "LEADER_SCORE", tp: allegrosql.TypeDouble, size: 22}, 803 {name: "LEADER_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 804 {name: "REGION_COUNT", tp: allegrosql.TypeLonglong, size: 21}, 805 {name: "REGION_WEIGHT", tp: allegrosql.TypeDouble, size: 22}, 806 {name: "REGION_SCORE", tp: allegrosql.TypeDouble, size: 22}, 807 {name: "REGION_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 808 {name: "START_TS", tp: allegrosql.TypeDatetime}, 809 {name: "LAST_HEARTBEAT_TS", tp: allegrosql.TypeDatetime}, 810 {name: "UPTIME", tp: allegrosql.TypeVarchar, size: 64}, 811 } 812 813 var blockAnalyzeStatusDefCauss = []defCausumnInfo{ 814 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 815 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 816 {name: "PARTITION_NAME", tp: allegrosql.TypeVarchar, size: 64}, 817 {name: "JOB_INFO", tp: allegrosql.TypeVarchar, size: 64}, 818 {name: "PROCESSED_ROWS", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.UnsignedFlag}, 819 {name: "START_TIME", tp: allegrosql.TypeDatetime}, 820 {name: "STATE", tp: allegrosql.TypeVarchar, size: 64}, 821 } 822 823 // BlockEinsteinDBRegionStatusDefCauss is EinsteinDB region status mem causet defCausumns. 824 var BlockEinsteinDBRegionStatusDefCauss = []defCausumnInfo{ 825 {name: "REGION_ID", tp: allegrosql.TypeLonglong, size: 21}, 826 {name: "START_KEY", tp: allegrosql.TypeBlob, size: types.UnspecifiedLength}, 827 {name: "END_KEY", tp: allegrosql.TypeBlob, size: types.UnspecifiedLength}, 828 {name: "TABLE_ID", tp: allegrosql.TypeLonglong, size: 21}, 829 {name: "DB_NAME", tp: allegrosql.TypeVarchar, size: 64}, 830 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 831 {name: "IS_INDEX", tp: allegrosql.TypeTiny, size: 1, flag: allegrosql.NotNullFlag, deflt: 0}, 832 {name: "INDEX_ID", tp: allegrosql.TypeLonglong, size: 21}, 833 {name: "INDEX_NAME", tp: allegrosql.TypeVarchar, size: 64}, 834 {name: "EPOCH_CONF_VER", tp: allegrosql.TypeLonglong, size: 21}, 835 {name: "EPOCH_VERSION", tp: allegrosql.TypeLonglong, size: 21}, 836 {name: "WRITTEN_BYTES", tp: allegrosql.TypeLonglong, size: 21}, 837 {name: "READ_BYTES", tp: allegrosql.TypeLonglong, size: 21}, 838 {name: "APPROXIMATE_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 839 {name: "APPROXIMATE_KEYS", tp: allegrosql.TypeLonglong, size: 21}, 840 {name: "REPLICATIONSTATUS_STATE", tp: allegrosql.TypeVarchar, size: 64}, 841 {name: "REPLICATIONSTATUS_STATEID", tp: allegrosql.TypeLonglong, size: 21}, 842 } 843 844 // BlockEinsteinDBRegionPeersDefCauss is EinsteinDB region peers mem causet defCausumns. 845 var BlockEinsteinDBRegionPeersDefCauss = []defCausumnInfo{ 846 {name: "REGION_ID", tp: allegrosql.TypeLonglong, size: 21}, 847 {name: "PEER_ID", tp: allegrosql.TypeLonglong, size: 21}, 848 {name: "STORE_ID", tp: allegrosql.TypeLonglong, size: 21}, 849 {name: "IS_LEARNER", tp: allegrosql.TypeTiny, size: 1, flag: allegrosql.NotNullFlag, deflt: 0}, 850 {name: "IS_LEADER", tp: allegrosql.TypeTiny, size: 1, flag: allegrosql.NotNullFlag, deflt: 0}, 851 {name: "STATUS", tp: allegrosql.TypeVarchar, size: 10, deflt: 0}, 852 {name: "DOWN_SECONDS", tp: allegrosql.TypeLonglong, size: 21, deflt: 0}, 853 } 854 855 var blockMilevaDBServersInfoDefCauss = []defCausumnInfo{ 856 {name: "DBS_ID", tp: allegrosql.TypeVarchar, size: 64}, 857 {name: "IP", tp: allegrosql.TypeVarchar, size: 64}, 858 {name: "PORT", tp: allegrosql.TypeLonglong, size: 21}, 859 {name: "STATUS_PORT", tp: allegrosql.TypeLonglong, size: 21}, 860 {name: "LEASE", tp: allegrosql.TypeVarchar, size: 64}, 861 {name: "VERSION", tp: allegrosql.TypeVarchar, size: 64}, 862 {name: "GIT_HASH", tp: allegrosql.TypeVarchar, size: 64}, 863 {name: "BINLOG_STATUS", tp: allegrosql.TypeVarchar, size: 64}, 864 {name: "LABELS", tp: allegrosql.TypeVarchar, size: 128}, 865 } 866 867 var blockClusterConfigDefCauss = []defCausumnInfo{ 868 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 869 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 870 {name: "KEY", tp: allegrosql.TypeVarchar, size: 256}, 871 {name: "VALUE", tp: allegrosql.TypeVarchar, size: 128}, 872 } 873 874 var blockClusterLogDefCauss = []defCausumnInfo{ 875 {name: "TIME", tp: allegrosql.TypeVarchar, size: 32}, 876 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 877 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 878 {name: "LEVEL", tp: allegrosql.TypeVarchar, size: 8}, 879 {name: "MESSAGE", tp: allegrosql.TypeLongBlob, size: types.UnspecifiedLength}, 880 } 881 882 var blockClusterLoadDefCauss = []defCausumnInfo{ 883 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 884 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 885 {name: "DEVICE_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 886 {name: "DEVICE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 887 {name: "NAME", tp: allegrosql.TypeVarchar, size: 256}, 888 {name: "VALUE", tp: allegrosql.TypeVarchar, size: 128}, 889 } 890 891 var blockClusterHardwareDefCauss = []defCausumnInfo{ 892 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 893 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 894 {name: "DEVICE_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 895 {name: "DEVICE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 896 {name: "NAME", tp: allegrosql.TypeVarchar, size: 256}, 897 {name: "VALUE", tp: allegrosql.TypeVarchar, size: 128}, 898 } 899 900 var blockClusterSystemInfoDefCauss = []defCausumnInfo{ 901 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 902 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 903 {name: "SYSTEM_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 904 {name: "SYSTEM_NAME", tp: allegrosql.TypeVarchar, size: 64}, 905 {name: "NAME", tp: allegrosql.TypeVarchar, size: 256}, 906 {name: "VALUE", tp: allegrosql.TypeVarchar, size: 128}, 907 } 908 909 var filesDefCauss = []defCausumnInfo{ 910 {name: "FILE_ID", tp: allegrosql.TypeLonglong, size: 4}, 911 {name: "FILE_NAME", tp: allegrosql.TypeVarchar, size: 4000}, 912 {name: "FILE_TYPE", tp: allegrosql.TypeVarchar, size: 20}, 913 {name: "TABLESPACE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 914 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 64}, 915 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 916 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 917 {name: "LOGFILE_GROUP_NAME", tp: allegrosql.TypeVarchar, size: 64}, 918 {name: "LOGFILE_GROUP_NUMBER", tp: allegrosql.TypeLonglong, size: 32}, 919 {name: "ENGINE", tp: allegrosql.TypeVarchar, size: 64}, 920 {name: "FULLTEXT_KEYS", tp: allegrosql.TypeVarchar, size: 64}, 921 {name: "DELETED_ROWS", tp: allegrosql.TypeLonglong, size: 4}, 922 {name: "UFIDelATE_COUNT", tp: allegrosql.TypeLonglong, size: 4}, 923 {name: "FREE_EXTENTS", tp: allegrosql.TypeLonglong, size: 4}, 924 {name: "TOTAL_EXTENTS", tp: allegrosql.TypeLonglong, size: 4}, 925 {name: "EXTENT_SIZE", tp: allegrosql.TypeLonglong, size: 4}, 926 {name: "INITIAL_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 927 {name: "MAXIMUM_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 928 {name: "AUTOEXTEND_SIZE", tp: allegrosql.TypeLonglong, size: 21}, 929 {name: "CREATION_TIME", tp: allegrosql.TypeDatetime, size: -1}, 930 {name: "LAST_UFIDelATE_TIME", tp: allegrosql.TypeDatetime, size: -1}, 931 {name: "LAST_ACCESS_TIME", tp: allegrosql.TypeDatetime, size: -1}, 932 {name: "RECOVER_TIME", tp: allegrosql.TypeLonglong, size: 4}, 933 {name: "TRANSACTION_COUNTER", tp: allegrosql.TypeLonglong, size: 4}, 934 {name: "VERSION", tp: allegrosql.TypeLonglong, size: 21}, 935 {name: "ROW_FORMAT", tp: allegrosql.TypeVarchar, size: 10}, 936 {name: "TABLE_ROWS", tp: allegrosql.TypeLonglong, size: 21}, 937 {name: "AVG_ROW_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 938 {name: "DATA_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 939 {name: "MAX_DATA_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 940 {name: "INDEX_LENGTH", tp: allegrosql.TypeLonglong, size: 21}, 941 {name: "DATA_FREE", tp: allegrosql.TypeLonglong, size: 21}, 942 {name: "CREATE_TIME", tp: allegrosql.TypeDatetime, size: -1}, 943 {name: "UFIDelATE_TIME", tp: allegrosql.TypeDatetime, size: -1}, 944 {name: "CHECK_TIME", tp: allegrosql.TypeDatetime, size: -1}, 945 {name: "CHECKSUM", tp: allegrosql.TypeLonglong, size: 21}, 946 {name: "STATUS", tp: allegrosql.TypeVarchar, size: 20}, 947 {name: "EXTRA", tp: allegrosql.TypeVarchar, size: 255}, 948 } 949 950 var blockClusterInfoDefCauss = []defCausumnInfo{ 951 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 952 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 953 {name: "STATUS_ADDRESS", tp: allegrosql.TypeVarchar, size: 64}, 954 {name: "VERSION", tp: allegrosql.TypeVarchar, size: 64}, 955 {name: "GIT_HASH", tp: allegrosql.TypeVarchar, size: 64}, 956 {name: "START_TIME", tp: allegrosql.TypeVarchar, size: 32}, 957 {name: "UPTIME", tp: allegrosql.TypeVarchar, size: 32}, 958 } 959 960 var blockBlockTiFlashReplicaDefCauss = []defCausumnInfo{ 961 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 962 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 963 {name: "TABLE_ID", tp: allegrosql.TypeLonglong, size: 21}, 964 {name: "REPLICA_COUNT", tp: allegrosql.TypeLonglong, size: 64}, 965 {name: "LOCATION_LABELS", tp: allegrosql.TypeVarchar, size: 64}, 966 {name: "AVAILABLE", tp: allegrosql.TypeTiny, size: 1}, 967 {name: "PROGRESS", tp: allegrosql.TypeDouble, size: 22}, 968 } 969 970 var blockInspectionResultDefCauss = []defCausumnInfo{ 971 {name: "RULE", tp: allegrosql.TypeVarchar, size: 64}, 972 {name: "ITEM", tp: allegrosql.TypeVarchar, size: 64}, 973 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 974 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 975 {name: "STATUS_ADDRESS", tp: allegrosql.TypeVarchar, size: 64}, 976 {name: "VALUE", tp: allegrosql.TypeVarchar, size: 64}, 977 {name: "REFERENCE", tp: allegrosql.TypeVarchar, size: 64}, 978 {name: "SEVERITY", tp: allegrosql.TypeVarchar, size: 64}, 979 {name: "DETAILS", tp: allegrosql.TypeVarchar, size: 256}, 980 } 981 982 var blockInspectionSummaryDefCauss = []defCausumnInfo{ 983 {name: "RULE", tp: allegrosql.TypeVarchar, size: 64}, 984 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 985 {name: "METRICS_NAME", tp: allegrosql.TypeVarchar, size: 64}, 986 {name: "LABEL", tp: allegrosql.TypeVarchar, size: 64}, 987 {name: "QUANTILE", tp: allegrosql.TypeDouble, size: 22}, 988 {name: "AVG_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 989 {name: "MIN_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 990 {name: "MAX_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 991 {name: "COMMENT", tp: allegrosql.TypeVarchar, size: 256}, 992 } 993 994 var blockInspectionMemrulesDefCauss = []defCausumnInfo{ 995 {name: "NAME", tp: allegrosql.TypeVarchar, size: 64}, 996 {name: "TYPE", tp: allegrosql.TypeVarchar, size: 64}, 997 {name: "COMMENT", tp: allegrosql.TypeVarchar, size: 256}, 998 } 999 1000 var blockMetricBlocksDefCauss = []defCausumnInfo{ 1001 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 1002 {name: "PROMQL", tp: allegrosql.TypeVarchar, size: 64}, 1003 {name: "LABELS", tp: allegrosql.TypeVarchar, size: 64}, 1004 {name: "QUANTILE", tp: allegrosql.TypeDouble, size: 22}, 1005 {name: "COMMENT", tp: allegrosql.TypeVarchar, size: 256}, 1006 } 1007 1008 var blockMetricSummaryDefCauss = []defCausumnInfo{ 1009 {name: "METRICS_NAME", tp: allegrosql.TypeVarchar, size: 64}, 1010 {name: "QUANTILE", tp: allegrosql.TypeDouble, size: 22}, 1011 {name: "SUM_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 1012 {name: "AVG_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 1013 {name: "MIN_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 1014 {name: "MAX_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 1015 {name: "COMMENT", tp: allegrosql.TypeVarchar, size: 256}, 1016 } 1017 1018 var blockMetricSummaryByLabelDefCauss = []defCausumnInfo{ 1019 {name: "INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 1020 {name: "METRICS_NAME", tp: allegrosql.TypeVarchar, size: 64}, 1021 {name: "LABEL", tp: allegrosql.TypeVarchar, size: 64}, 1022 {name: "QUANTILE", tp: allegrosql.TypeDouble, size: 22}, 1023 {name: "SUM_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 1024 {name: "AVG_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 1025 {name: "MIN_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 1026 {name: "MAX_VALUE", tp: allegrosql.TypeDouble, size: 22, decimal: 6}, 1027 {name: "COMMENT", tp: allegrosql.TypeVarchar, size: 256}, 1028 } 1029 1030 var blockDBSJobsDefCauss = []defCausumnInfo{ 1031 {name: "JOB_ID", tp: allegrosql.TypeLonglong, size: 21}, 1032 {name: "DB_NAME", tp: allegrosql.TypeVarchar, size: 64}, 1033 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 1034 {name: "JOB_TYPE", tp: allegrosql.TypeVarchar, size: 64}, 1035 {name: "SCHEMA_STATE", tp: allegrosql.TypeVarchar, size: 64}, 1036 {name: "SCHEMA_ID", tp: allegrosql.TypeLonglong, size: 21}, 1037 {name: "TABLE_ID", tp: allegrosql.TypeLonglong, size: 21}, 1038 {name: "ROW_COUNT", tp: allegrosql.TypeLonglong, size: 21}, 1039 {name: "START_TIME", tp: allegrosql.TypeDatetime, size: 19}, 1040 {name: "END_TIME", tp: allegrosql.TypeDatetime, size: 19}, 1041 {name: "STATE", tp: allegrosql.TypeVarchar, size: 64}, 1042 {name: "QUERY", tp: allegrosql.TypeVarchar, size: 64}, 1043 } 1044 1045 var blockSequencesDefCauss = []defCausumnInfo{ 1046 {name: "TABLE_CATALOG", tp: allegrosql.TypeVarchar, size: 512, flag: allegrosql.NotNullFlag}, 1047 {name: "SEQUENCE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 1048 {name: "SEQUENCE_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 1049 {name: "CACHE", tp: allegrosql.TypeTiny, flag: allegrosql.NotNullFlag}, 1050 {name: "CACHE_VALUE", tp: allegrosql.TypeLonglong, size: 21}, 1051 {name: "CYCLE", tp: allegrosql.TypeTiny, flag: allegrosql.NotNullFlag}, 1052 {name: "INCREMENT", tp: allegrosql.TypeLonglong, size: 21, flag: allegrosql.NotNullFlag}, 1053 {name: "MAX_VALUE", tp: allegrosql.TypeLonglong, size: 21}, 1054 {name: "MIN_VALUE", tp: allegrosql.TypeLonglong, size: 21}, 1055 {name: "START", tp: allegrosql.TypeLonglong, size: 21}, 1056 {name: "COMMENT", tp: allegrosql.TypeVarchar, size: 64}, 1057 } 1058 1059 var blockStatementsSummaryDefCauss = []defCausumnInfo{ 1060 {name: "SUMMARY_BEGIN_TIME", tp: allegrosql.TypeTimestamp, size: 26, flag: allegrosql.NotNullFlag, comment: "Begin time of this summary"}, 1061 {name: "SUMMARY_END_TIME", tp: allegrosql.TypeTimestamp, size: 26, flag: allegrosql.NotNullFlag, comment: "End time of this summary"}, 1062 {name: "STMT_TYPE", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag, comment: "Statement type"}, 1063 {name: "SCHEMA_NAME", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag, comment: "Current schemaReplicant"}, 1064 {name: "DIGEST", tp: allegrosql.TypeVarchar, size: 64, flag: allegrosql.NotNullFlag}, 1065 {name: "DIGEST_TEXT", tp: allegrosql.TypeBlob, size: types.UnspecifiedLength, flag: allegrosql.NotNullFlag, comment: "Normalized memex"}, 1066 {name: "TABLE_NAMES", tp: allegrosql.TypeBlob, size: types.UnspecifiedLength, comment: "Involved blocks"}, 1067 {name: "INDEX_NAMES", tp: allegrosql.TypeBlob, size: types.UnspecifiedLength, comment: "Used indices"}, 1068 {name: "SAMPLE_USER", tp: allegrosql.TypeVarchar, size: 64, comment: "Sampled user who executed these memexs"}, 1069 {name: "EXEC_COUNT", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Count of executions"}, 1070 {name: "SUM_ERRORS", tp: allegrosql.TypeLong, size: 11, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Sum of errors"}, 1071 {name: "SUM_WARNINGS", tp: allegrosql.TypeLong, size: 11, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Sum of warnings"}, 1072 {name: "SUM_LATENCY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Sum latency of these memexs"}, 1073 {name: "MAX_LATENCY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max latency of these memexs"}, 1074 {name: "MIN_LATENCY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Min latency of these memexs"}, 1075 {name: "AVG_LATENCY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average latency of these memexs"}, 1076 {name: "AVG_PARSE_LATENCY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average latency of parsing"}, 1077 {name: "MAX_PARSE_LATENCY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max latency of parsing"}, 1078 {name: "AVG_COMPILE_LATENCY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average latency of compiling"}, 1079 {name: "MAX_COMPILE_LATENCY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max latency of compiling"}, 1080 {name: "SUM_COP_TASK_NUM", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Total number of CausetTasks"}, 1081 {name: "MAX_COP_PROCESS_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max processing time of CausetTasks"}, 1082 {name: "MAX_COP_PROCESS_ADDRESS", tp: allegrosql.TypeVarchar, size: 256, comment: "Address of the CopTask with max processing time"}, 1083 {name: "MAX_COP_WAIT_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max waiting time of CausetTasks"}, 1084 {name: "MAX_COP_WAIT_ADDRESS", tp: allegrosql.TypeVarchar, size: 256, comment: "Address of the CopTask with max waiting time"}, 1085 {name: "AVG_PROCESS_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average processing time in EinsteinDB"}, 1086 {name: "MAX_PROCESS_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max processing time in EinsteinDB"}, 1087 {name: "AVG_WAIT_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average waiting time in EinsteinDB"}, 1088 {name: "MAX_WAIT_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max waiting time in EinsteinDB"}, 1089 {name: "AVG_BACKOFF_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average waiting time before retry"}, 1090 {name: "MAX_BACKOFF_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max waiting time before retry"}, 1091 {name: "AVG_TOTAL_KEYS", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average number of scanned keys"}, 1092 {name: "MAX_TOTAL_KEYS", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max number of scanned keys"}, 1093 {name: "AVG_PROCESSED_KEYS", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average number of processed keys"}, 1094 {name: "MAX_PROCESSED_KEYS", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max number of processed keys"}, 1095 {name: "AVG_PREWRITE_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average time of prewrite phase"}, 1096 {name: "MAX_PREWRITE_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max time of prewrite phase"}, 1097 {name: "AVG_COMMIT_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average time of commit phase"}, 1098 {name: "MAX_COMMIT_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max time of commit phase"}, 1099 {name: "AVG_GET_COMMIT_TS_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average time of getting commit_ts"}, 1100 {name: "MAX_GET_COMMIT_TS_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max time of getting commit_ts"}, 1101 {name: "AVG_COMMIT_BACKOFF_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average time before retry during commit phase"}, 1102 {name: "MAX_COMMIT_BACKOFF_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max time before retry during commit phase"}, 1103 {name: "AVG_RESOLVE_LOCK_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average time for resolving locks"}, 1104 {name: "MAX_RESOLVE_LOCK_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max time for resolving locks"}, 1105 {name: "AVG_LOCAL_LATCH_WAIT_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average waiting time of local transaction"}, 1106 {name: "MAX_LOCAL_LATCH_WAIT_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max waiting time of local transaction"}, 1107 {name: "AVG_WRITE_KEYS", tp: allegrosql.TypeDouble, size: 22, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average count of written keys"}, 1108 {name: "MAX_WRITE_KEYS", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max count of written keys"}, 1109 {name: "AVG_WRITE_SIZE", tp: allegrosql.TypeDouble, size: 22, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average amount of written bytes"}, 1110 {name: "MAX_WRITE_SIZE", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max amount of written bytes"}, 1111 {name: "AVG_PREWRITE_REGIONS", tp: allegrosql.TypeDouble, size: 22, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average number of involved regions in prewrite phase"}, 1112 {name: "MAX_PREWRITE_REGIONS", tp: allegrosql.TypeLong, size: 11, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max number of involved regions in prewrite phase"}, 1113 {name: "AVG_TXN_RETRY", tp: allegrosql.TypeDouble, size: 22, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average number of transaction retries"}, 1114 {name: "MAX_TXN_RETRY", tp: allegrosql.TypeLong, size: 11, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max number of transaction retries"}, 1115 {name: "SUM_EXEC_RETRY", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Sum number of execution retries in pessimistic transactions"}, 1116 {name: "SUM_EXEC_RETRY_TIME", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Sum time of execution retries in pessimistic transactions"}, 1117 {name: "SUM_BACKOFF_TIMES", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Sum of retries"}, 1118 {name: "BACKOFF_TYPES", tp: allegrosql.TypeVarchar, size: 1024, comment: "Types of errors and the number of retries for each type"}, 1119 {name: "AVG_MEM", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average memory(byte) used"}, 1120 {name: "MAX_MEM", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max memory(byte) used"}, 1121 {name: "AVG_DISK", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average disk space(byte) used"}, 1122 {name: "MAX_DISK", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Max disk space(byte) used"}, 1123 {name: "AVG_AFFECTED_ROWS", tp: allegrosql.TypeDouble, size: 22, flag: allegrosql.NotNullFlag | allegrosql.UnsignedFlag, comment: "Average number of rows affected"}, 1124 {name: "FIRST_SEEN", tp: allegrosql.TypeTimestamp, size: 26, flag: allegrosql.NotNullFlag, comment: "The time these memexs are seen for the first time"}, 1125 {name: "LAST_SEEN", tp: allegrosql.TypeTimestamp, size: 26, flag: allegrosql.NotNullFlag, comment: "The time these memexs are seen for the last time"}, 1126 {name: "PLAN_IN_CACHE", tp: allegrosql.TypeTiny, size: 1, flag: allegrosql.NotNullFlag, comment: "Whether the last memex hit plan cache"}, 1127 {name: "PLAN_CACHE_HITS", tp: allegrosql.TypeLonglong, size: 20, flag: allegrosql.NotNullFlag, comment: "The number of times these memexs hit plan cache"}, 1128 {name: "QUERY_SAMPLE_TEXT", tp: allegrosql.TypeBlob, size: types.UnspecifiedLength, comment: "Sampled original memex"}, 1129 {name: "PREV_SAMPLE_TEXT", tp: allegrosql.TypeBlob, size: types.UnspecifiedLength, comment: "The previous memex before commit"}, 1130 {name: "PLAN_DIGEST", tp: allegrosql.TypeVarchar, size: 64, comment: "Digest of its execution plan"}, 1131 {name: "PLAN", tp: allegrosql.TypeBlob, size: types.UnspecifiedLength, comment: "Sampled execution plan"}, 1132 } 1133 1134 var blockStorageStatsDefCauss = []defCausumnInfo{ 1135 {name: "TABLE_SCHEMA", tp: allegrosql.TypeVarchar, size: 64}, 1136 {name: "TABLE_NAME", tp: allegrosql.TypeVarchar, size: 64}, 1137 {name: "TABLE_ID", tp: allegrosql.TypeLonglong, size: 21}, 1138 {name: "PEER_COUNT", tp: allegrosql.TypeLonglong, size: 21}, 1139 {name: "REGION_COUNT", tp: allegrosql.TypeLonglong, size: 21, comment: "The region count of single replica of the causet"}, 1140 {name: "EMPTY_REGION_COUNT", tp: allegrosql.TypeLonglong, size: 21, comment: "The region count of single replica of the causet"}, 1141 {name: "TABLE_SIZE", tp: allegrosql.TypeLonglong, size: 64, comment: "The disk usage(MB) of single replica of the causet, if the causet size is empty or less than 1MB, it would show 1MB "}, 1142 {name: "TABLE_KEYS", tp: allegrosql.TypeLonglong, size: 64, comment: "The count of keys of single replica of the causet"}, 1143 } 1144 1145 var blockBlockTiFlashBlocksDefCauss = []defCausumnInfo{ 1146 {name: "DATABASE", tp: allegrosql.TypeVarchar, size: 64}, 1147 {name: "TABLE", tp: allegrosql.TypeVarchar, size: 64}, 1148 {name: "MilevaDB_DATABASE", tp: allegrosql.TypeVarchar, size: 64}, 1149 {name: "MilevaDB_TABLE", tp: allegrosql.TypeVarchar, size: 64}, 1150 {name: "TABLE_ID", tp: allegrosql.TypeLonglong, size: 64}, 1151 {name: "IS_TOMBSTONE", tp: allegrosql.TypeLonglong, size: 64}, 1152 {name: "SEGMENT_COUNT", tp: allegrosql.TypeLonglong, size: 64}, 1153 {name: "TOTAL_ROWS", tp: allegrosql.TypeLonglong, size: 64}, 1154 {name: "TOTAL_SIZE", tp: allegrosql.TypeLonglong, size: 64}, 1155 {name: "TOTAL_DELETE_RANGES", tp: allegrosql.TypeLonglong, size: 64}, 1156 {name: "DELTA_RATE_ROWS", tp: allegrosql.TypeDouble, size: 64}, 1157 {name: "DELTA_RATE_SEGMENTS", tp: allegrosql.TypeDouble, size: 64}, 1158 {name: "DELTA_PLACED_RATE", tp: allegrosql.TypeDouble, size: 64}, 1159 {name: "DELTA_CACHE_SIZE", tp: allegrosql.TypeLonglong, size: 64}, 1160 {name: "DELTA_CACHE_RATE", tp: allegrosql.TypeDouble, size: 64}, 1161 {name: "DELTA_CACHE_WASTED_RATE", tp: allegrosql.TypeDouble, size: 64}, 1162 {name: "DELTA_INDEX_SIZE", tp: allegrosql.TypeLonglong, size: 64}, 1163 {name: "AVG_SEGMENT_ROWS", tp: allegrosql.TypeDouble, size: 64}, 1164 {name: "AVG_SEGMENT_SIZE", tp: allegrosql.TypeDouble, size: 64}, 1165 {name: "DELTA_COUNT", tp: allegrosql.TypeLonglong, size: 64}, 1166 {name: "TOTAL_DELTA_ROWS", tp: allegrosql.TypeLonglong, size: 64}, 1167 {name: "TOTAL_DELTA_SIZE", tp: allegrosql.TypeLonglong, size: 64}, 1168 {name: "AVG_DELTA_ROWS", tp: allegrosql.TypeDouble, size: 64}, 1169 {name: "AVG_DELTA_SIZE", tp: allegrosql.TypeDouble, size: 64}, 1170 {name: "AVG_DELTA_DELETE_RANGES", tp: allegrosql.TypeDouble, size: 64}, 1171 {name: "STABLE_COUNT", tp: allegrosql.TypeLonglong, size: 64}, 1172 {name: "TOTAL_STABLE_ROWS", tp: allegrosql.TypeLonglong, size: 64}, 1173 {name: "TOTAL_STABLE_SIZE", tp: allegrosql.TypeLonglong, size: 64}, 1174 {name: "TOTAL_STABLE_SIZE_ON_DISK", tp: allegrosql.TypeLonglong, size: 64}, 1175 {name: "AVG_STABLE_ROWS", tp: allegrosql.TypeDouble, size: 64}, 1176 {name: "AVG_STABLE_SIZE", tp: allegrosql.TypeDouble, size: 64}, 1177 {name: "TOTAL_PACK_COUNT_IN_DELTA", tp: allegrosql.TypeLonglong, size: 64}, 1178 {name: "AVG_PACK_COUNT_IN_DELTA", tp: allegrosql.TypeDouble, size: 64}, 1179 {name: "AVG_PACK_ROWS_IN_DELTA", tp: allegrosql.TypeDouble, size: 64}, 1180 {name: "AVG_PACK_SIZE_IN_DELTA", tp: allegrosql.TypeDouble, size: 64}, 1181 {name: "TOTAL_PACK_COUNT_IN_STABLE", tp: allegrosql.TypeLonglong, size: 64}, 1182 {name: "AVG_PACK_COUNT_IN_STABLE", tp: allegrosql.TypeDouble, size: 64}, 1183 {name: "AVG_PACK_ROWS_IN_STABLE", tp: allegrosql.TypeDouble, size: 64}, 1184 {name: "AVG_PACK_SIZE_IN_STABLE", tp: allegrosql.TypeDouble, size: 64}, 1185 {name: "STORAGE_STABLE_NUM_SNAPSHOTS", tp: allegrosql.TypeLonglong, size: 64}, 1186 {name: "STORAGE_STABLE_NUM_PAGES", tp: allegrosql.TypeLonglong, size: 64}, 1187 {name: "STORAGE_STABLE_NUM_NORMAL_PAGES", tp: allegrosql.TypeLonglong, size: 64}, 1188 {name: "STORAGE_STABLE_MAX_PAGE_ID", tp: allegrosql.TypeLonglong, size: 64}, 1189 {name: "STORAGE_DELTA_NUM_SNAPSHOTS", tp: allegrosql.TypeLonglong, size: 64}, 1190 {name: "STORAGE_DELTA_NUM_PAGES", tp: allegrosql.TypeLonglong, size: 64}, 1191 {name: "STORAGE_DELTA_NUM_NORMAL_PAGES", tp: allegrosql.TypeLonglong, size: 64}, 1192 {name: "STORAGE_DELTA_MAX_PAGE_ID", tp: allegrosql.TypeLonglong, size: 64}, 1193 {name: "STORAGE_META_NUM_SNAPSHOTS", tp: allegrosql.TypeLonglong, size: 64}, 1194 {name: "STORAGE_META_NUM_PAGES", tp: allegrosql.TypeLonglong, size: 64}, 1195 {name: "STORAGE_META_NUM_NORMAL_PAGES", tp: allegrosql.TypeLonglong, size: 64}, 1196 {name: "STORAGE_META_MAX_PAGE_ID", tp: allegrosql.TypeLonglong, size: 64}, 1197 {name: "BACKGROUND_TASKS_LENGTH", tp: allegrosql.TypeLonglong, size: 64}, 1198 {name: "TIFLASH_INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 1199 } 1200 1201 var blockBlockTiFlashSegmentsDefCauss = []defCausumnInfo{ 1202 {name: "DATABASE", tp: allegrosql.TypeVarchar, size: 64}, 1203 {name: "TABLE", tp: allegrosql.TypeVarchar, size: 64}, 1204 {name: "MilevaDB_DATABASE", tp: allegrosql.TypeVarchar, size: 64}, 1205 {name: "MilevaDB_TABLE", tp: allegrosql.TypeVarchar, size: 64}, 1206 {name: "TABLE_ID", tp: allegrosql.TypeLonglong, size: 64}, 1207 {name: "IS_TOMBSTONE", tp: allegrosql.TypeLonglong, size: 64}, 1208 {name: "SEGMENT_ID", tp: allegrosql.TypeLonglong, size: 64}, 1209 {name: "RANGE", tp: allegrosql.TypeVarchar, size: 64}, 1210 {name: "ROWS", tp: allegrosql.TypeLonglong, size: 64}, 1211 {name: "SIZE", tp: allegrosql.TypeLonglong, size: 64}, 1212 {name: "DELETE_RANGES", tp: allegrosql.TypeLonglong, size: 64}, 1213 {name: "STABLE_SIZE_ON_DISK", tp: allegrosql.TypeLonglong, size: 64}, 1214 {name: "DELTA_PACK_COUNT", tp: allegrosql.TypeLonglong, size: 64}, 1215 {name: "STABLE_PACK_COUNT", tp: allegrosql.TypeLonglong, size: 64}, 1216 {name: "AVG_DELTA_PACK_ROWS", tp: allegrosql.TypeDouble, size: 64}, 1217 {name: "AVG_STABLE_PACK_ROWS", tp: allegrosql.TypeDouble, size: 64}, 1218 {name: "DELTA_RATE", tp: allegrosql.TypeDouble, size: 64}, 1219 {name: "DELTA_CACHE_SIZE", tp: allegrosql.TypeLonglong, size: 64}, 1220 {name: "DELTA_INDEX_SIZE", tp: allegrosql.TypeLonglong, size: 64}, 1221 {name: "TIFLASH_INSTANCE", tp: allegrosql.TypeVarchar, size: 64}, 1222 } 1223 1224 // GetShardingInfo returns a nil or description string for the sharding information of given BlockInfo. 1225 // The returned description string may be: 1226 // - "NOT_SHARDED": for blocks that SHARD_ROW_ID_BITS is not specified. 1227 // - "NOT_SHARDED(PK_IS_HANDLE)": for blocks of which primary key is event id. 1228 // - "PK_AUTO_RANDOM_BITS={bit_number}": for blocks of which primary key is sharded event id. 1229 // - "SHARD_BITS={bit_number}": for blocks that with SHARD_ROW_ID_BITS. 1230 // The returned nil indicates that sharding information is not suiblock for the causet(for example, when the causet is a View). 1231 // This function is exported for unit test. 1232 func GetShardingInfo(dbInfo *perceptron.DBInfo, blockInfo *perceptron.BlockInfo) interface{} { 1233 if dbInfo == nil || blockInfo == nil || blockInfo.IsView() || soliton.IsMemOrSysDB(dbInfo.Name.L) { 1234 return nil 1235 } 1236 shardingInfo := "NOT_SHARDED" 1237 if blockInfo.PKIsHandle { 1238 if blockInfo.ContainsAutoRandomBits() { 1239 shardingInfo = "PK_AUTO_RANDOM_BITS=" + strconv.Itoa(int(blockInfo.AutoRandomBits)) 1240 } else { 1241 shardingInfo = "NOT_SHARDED(PK_IS_HANDLE)" 1242 } 1243 } else if blockInfo.ShardEventIDBits > 0 { 1244 shardingInfo = "SHARD_BITS=" + strconv.Itoa(int(blockInfo.ShardEventIDBits)) 1245 } 1246 return shardingInfo 1247 } 1248 1249 const ( 1250 // PrimaryKeyType is the string constant of PRIMARY KEY. 1251 PrimaryKeyType = "PRIMARY KEY" 1252 // PrimaryConstraint is the string constant of PRIMARY. 1253 PrimaryConstraint = "PRIMARY" 1254 // UniqueKeyType is the string constant of UNIQUE. 1255 UniqueKeyType = "UNIQUE" 1256 ) 1257 1258 // ServerInfo represents the basic server information of single cluster component 1259 type ServerInfo struct { 1260 ServerType string 1261 Address string 1262 StatusAddr string 1263 Version string 1264 GitHash string 1265 StartTimestamp int64 1266 } 1267 1268 // GetClusterServerInfo returns all components information of cluster 1269 func GetClusterServerInfo(ctx stochastikctx.Context) ([]ServerInfo, error) { 1270 failpoint.Inject("mockClusterInfo", func(val failpoint.Value) { 1271 // The cluster topology is injected by `failpoint` memex and 1272 // there is no extra checks for it. (let the test fail if the memex invalid) 1273 if s := val.(string); len(s) > 0 { 1274 var servers []ServerInfo 1275 for _, server := range strings.Split(s, ";") { 1276 parts := strings.Split(server, ",") 1277 servers = append(servers, ServerInfo{ 1278 ServerType: parts[0], 1279 Address: parts[1], 1280 StatusAddr: parts[2], 1281 Version: parts[3], 1282 GitHash: parts[4], 1283 }) 1284 } 1285 failpoint.Return(servers, nil) 1286 } 1287 }) 1288 1289 type retriever func(ctx stochastikctx.Context) ([]ServerInfo, error) 1290 var servers []ServerInfo 1291 for _, r := range []retriever{GetMilevaDBServerInfo, GetFIDelServerInfo, GetStoreServerInfo} { 1292 nodes, err := r(ctx) 1293 if err != nil { 1294 return nil, err 1295 } 1296 servers = append(servers, nodes...) 1297 } 1298 return servers, nil 1299 } 1300 1301 // GetMilevaDBServerInfo returns all MilevaDB nodes information of cluster 1302 func GetMilevaDBServerInfo(ctx stochastikctx.Context) ([]ServerInfo, error) { 1303 // Get MilevaDB servers info. 1304 milevadbNodes, err := infosync.GetAllServerInfo(context.Background()) 1305 if err != nil { 1306 return nil, errors.Trace(err) 1307 } 1308 var servers []ServerInfo 1309 var isDefaultVersion bool 1310 if len(config.GetGlobalConfig().ServerVersion) == 0 { 1311 isDefaultVersion = true 1312 } 1313 for _, node := range milevadbNodes { 1314 servers = append(servers, ServerInfo{ 1315 ServerType: "milevadb", 1316 Address: fmt.Sprintf("%s:%d", node.IP, node.Port), 1317 StatusAddr: fmt.Sprintf("%s:%d", node.IP, node.StatusPort), 1318 Version: FormatVersion(node.Version, isDefaultVersion), 1319 GitHash: node.GitHash, 1320 StartTimestamp: node.StartTimestamp, 1321 }) 1322 } 1323 return servers, nil 1324 } 1325 1326 // FormatVersion make MilevaDBVersion consistent to EinsteinDB and FIDel. 1327 // The default MilevaDBVersion is 5.7.25-MilevaDB-${MilevaDBReleaseVersion}. 1328 func FormatVersion(MilevaDBVersion string, isDefaultVersion bool) string { 1329 var version, nodeVersion string 1330 1331 // The user hasn't set the config 'ServerVersion'. 1332 if isDefaultVersion { 1333 nodeVersion = MilevaDBVersion[strings.LastIndex(MilevaDBVersion, "MilevaDB-")+len("MilevaDB-"):] 1334 if nodeVersion[0] == 'v' { 1335 nodeVersion = nodeVersion[1:] 1336 } 1337 nodeVersions := strings.Split(nodeVersion, "-") 1338 if len(nodeVersions) == 1 { 1339 version = nodeVersions[0] 1340 } else if len(nodeVersions) >= 2 { 1341 version = fmt.Sprintf("%s-%s", nodeVersions[0], nodeVersions[1]) 1342 } 1343 } else { // The user has already set the config 'ServerVersion',it would be a complex scene, so just use the 'ServerVersion' as version. 1344 version = MilevaDBVersion 1345 } 1346 1347 return version 1348 } 1349 1350 // GetFIDelServerInfo returns all FIDel nodes information of cluster 1351 func GetFIDelServerInfo(ctx stochastikctx.Context) ([]ServerInfo, error) { 1352 // Get FIDel servers info. 1353 causetstore := ctx.GetStore() 1354 etcd, ok := causetstore.(einsteindb.EtcdBackend) 1355 if !ok { 1356 return nil, errors.Errorf("%T not an etcd backend", causetstore) 1357 } 1358 var servers []ServerInfo 1359 members, err := etcd.EtcdAddrs() 1360 if err != nil { 1361 return nil, errors.Trace(err) 1362 } 1363 for _, addr := range members { 1364 // Get FIDel version 1365 url := fmt.Sprintf("%s://%s%s", soliton.InternalHTTPSchema(), addr, FIDelapi.ClusterVersion) 1366 req, err := http.NewRequest(http.MethodGet, url, nil) 1367 if err != nil { 1368 return nil, errors.Trace(err) 1369 } 1370 req.Header.Add("FIDel-Allow-follower-handle", "true") 1371 resp, err := soliton.InternalHTTPClient().Do(req) 1372 if err != nil { 1373 return nil, errors.Trace(err) 1374 } 1375 FIDelVersion, err := ioutil.ReadAll(resp.Body) 1376 terror.Log(resp.Body.Close()) 1377 if err != nil { 1378 return nil, errors.Trace(err) 1379 } 1380 version := strings.Trim(strings.Trim(string(FIDelVersion), "\n"), "\"") 1381 1382 // Get FIDel git_hash 1383 url = fmt.Sprintf("%s://%s%s", soliton.InternalHTTPSchema(), addr, FIDelapi.Status) 1384 req, err = http.NewRequest(http.MethodGet, url, nil) 1385 if err != nil { 1386 return nil, errors.Trace(err) 1387 } 1388 req.Header.Add("FIDel-Allow-follower-handle", "true") 1389 resp, err = soliton.InternalHTTPClient().Do(req) 1390 if err != nil { 1391 return nil, errors.Trace(err) 1392 } 1393 var content = struct { 1394 GitHash string `json:"git_hash"` 1395 StartTimestamp int64 `json:"start_timestamp"` 1396 }{} 1397 err = json.NewCausetDecoder(resp.Body).Decode(&content) 1398 terror.Log(resp.Body.Close()) 1399 if err != nil { 1400 return nil, errors.Trace(err) 1401 } 1402 1403 servers = append(servers, ServerInfo{ 1404 ServerType: "fidel", 1405 Address: addr, 1406 StatusAddr: addr, 1407 Version: version, 1408 GitHash: content.GitHash, 1409 StartTimestamp: content.StartTimestamp, 1410 }) 1411 } 1412 return servers, nil 1413 } 1414 1415 const tiflashLabel = "tiflash" 1416 1417 // GetStoreServerInfo returns all causetstore nodes(EinsteinDB or TiFlash) cluster information 1418 func GetStoreServerInfo(ctx stochastikctx.Context) ([]ServerInfo, error) { 1419 isTiFlashStore := func(causetstore *spacetimepb.CausetStore) bool { 1420 isTiFlash := false 1421 for _, label := range causetstore.Labels { 1422 if label.GetKey() == "engine" && label.GetValue() == tiflashLabel { 1423 isTiFlash = true 1424 } 1425 } 1426 return isTiFlash 1427 } 1428 1429 causetstore := ctx.GetStore() 1430 // Get EinsteinDB servers info. 1431 einsteindbStore, ok := causetstore.(einsteindb.CausetStorage) 1432 if !ok { 1433 return nil, errors.Errorf("%T is not an EinsteinDB or TiFlash causetstore instance", causetstore) 1434 } 1435 FIDelClient := einsteindbStore.GetRegionCache().FIDelClient() 1436 if FIDelClient == nil { 1437 return nil, errors.New("fidel unavailable") 1438 } 1439 stores, err := FIDelClient.GetAllStores(context.Background()) 1440 if err != nil { 1441 return nil, errors.Trace(err) 1442 } 1443 var servers []ServerInfo 1444 for _, causetstore := range stores { 1445 failpoint.Inject("mockStoreTombstone", func(val failpoint.Value) { 1446 if val.(bool) { 1447 causetstore.State = spacetimepb.StoreState_Tombstone 1448 } 1449 }) 1450 1451 if causetstore.GetState() == spacetimepb.StoreState_Tombstone { 1452 continue 1453 } 1454 var tp string 1455 if isTiFlashStore(causetstore) { 1456 tp = tiflashLabel 1457 } else { 1458 tp = einsteindb.GetStoreTypeByMeta(causetstore).Name() 1459 } 1460 servers = append(servers, ServerInfo{ 1461 ServerType: tp, 1462 Address: causetstore.Address, 1463 StatusAddr: causetstore.StatusAddress, 1464 Version: causetstore.Version, 1465 GitHash: causetstore.GitHash, 1466 StartTimestamp: causetstore.StartTimestamp, 1467 }) 1468 } 1469 return servers, nil 1470 } 1471 1472 // GetTiFlashStoreCount returns the count of tiflash server. 1473 func GetTiFlashStoreCount(ctx stochastikctx.Context) (cnt uint64, err error) { 1474 failpoint.Inject("mockTiFlashStoreCount", func(val failpoint.Value) { 1475 if val.(bool) { 1476 failpoint.Return(uint64(10), nil) 1477 } 1478 }) 1479 1480 stores, err := GetStoreServerInfo(ctx) 1481 if err != nil { 1482 return cnt, err 1483 } 1484 for _, causetstore := range stores { 1485 if causetstore.ServerType == tiflashLabel { 1486 cnt++ 1487 } 1488 } 1489 return cnt, nil 1490 } 1491 1492 var blockNameToDeferredCausets = map[string][]defCausumnInfo{ 1493 BlockSchemata: schemataDefCauss, 1494 BlockBlocks: blocksDefCauss, 1495 BlockDeferredCausets: defCausumnsDefCauss, 1496 blockDeferredCausetStatistics: defCausumnStatisticsDefCauss, 1497 BlockStatistics: statisticsDefCauss, 1498 BlockCharacterSets: charsetDefCauss, 1499 BlockDefCauslations: defCauslationsDefCauss, 1500 blockFiles: filesDefCauss, 1501 BlockProfiling: profilingDefCauss, 1502 BlockPartitions: partitionsDefCauss, 1503 BlockKeyDeferredCauset: keyDeferredCausetUsageDefCauss, 1504 blockReferConst: referConstDefCauss, 1505 BlockStochastikVar: stochastikVarDefCauss, 1506 blockPlugins: pluginsDefCauss, 1507 BlockConstraints: blockConstraintsDefCauss, 1508 blockTriggers: blockTriggersDefCauss, 1509 BlockUserPrivileges: blockUserPrivilegesDefCauss, 1510 blockSchemaPrivileges: blockSchemaPrivilegesDefCauss, 1511 blockBlockPrivileges: blockBlockPrivilegesDefCauss, 1512 blockDeferredCausetPrivileges: blockDeferredCausetPrivilegesDefCauss, 1513 BlockEngines: blockEnginesDefCauss, 1514 BlockViews: blockViewsDefCauss, 1515 blockRoutines: blockRoutinesDefCauss, 1516 blockParameters: blockParametersDefCauss, 1517 blockEvents: blockEventsDefCauss, 1518 blockGlobalStatus: blockGlobalStatusDefCauss, 1519 blockGlobalVariables: blockGlobalVariablesDefCauss, 1520 blockStochastikStatus: blockStochastikStatusDefCauss, 1521 blockOptimizerTrace: blockOptimizerTraceDefCauss, 1522 blockBlockSpaces: blockBlockSpacesDefCauss, 1523 BlockDefCauslationCharacterSetApplicability: blockDefCauslationCharacterSetApplicabilityDefCauss, 1524 BlockProcesslist: blockProcesslistDefCauss, 1525 BlockMilevaDBIndexes: blockMilevaDBIndexesDefCauss, 1526 BlockSlowQuery: slowQueryDefCauss, 1527 BlockMilevaDBHotRegions: BlockMilevaDBHotRegionsDefCauss, 1528 BlockEinsteinDBStoreStatus: BlockEinsteinDBStoreStatusDefCauss, 1529 BlockAnalyzeStatus: blockAnalyzeStatusDefCauss, 1530 BlockEinsteinDBRegionStatus: BlockEinsteinDBRegionStatusDefCauss, 1531 BlockEinsteinDBRegionPeers: BlockEinsteinDBRegionPeersDefCauss, 1532 BlockMilevaDBServersInfo: blockMilevaDBServersInfoDefCauss, 1533 BlockClusterInfo: blockClusterInfoDefCauss, 1534 BlockClusterConfig: blockClusterConfigDefCauss, 1535 BlockClusterLog: blockClusterLogDefCauss, 1536 BlockClusterLoad: blockClusterLoadDefCauss, 1537 BlockTiFlashReplica: blockBlockTiFlashReplicaDefCauss, 1538 BlockClusterHardware: blockClusterHardwareDefCauss, 1539 BlockClusterSystemInfo: blockClusterSystemInfoDefCauss, 1540 BlockInspectionResult: blockInspectionResultDefCauss, 1541 BlockMetricSummary: blockMetricSummaryDefCauss, 1542 BlockMetricSummaryByLabel: blockMetricSummaryByLabelDefCauss, 1543 BlockMetricBlocks: blockMetricBlocksDefCauss, 1544 BlockInspectionSummary: blockInspectionSummaryDefCauss, 1545 BlockInspectionMemrules: blockInspectionMemrulesDefCauss, 1546 BlockDBSJobs: blockDBSJobsDefCauss, 1547 BlockSequences: blockSequencesDefCauss, 1548 BlockStatementsSummary: blockStatementsSummaryDefCauss, 1549 BlockStatementsSummaryHistory: blockStatementsSummaryDefCauss, 1550 BlockStorageStats: blockStorageStatsDefCauss, 1551 BlockTiFlashBlocks: blockBlockTiFlashBlocksDefCauss, 1552 BlockTiFlashSegments: blockBlockTiFlashSegmentsDefCauss, 1553 } 1554 1555 func createSchemaReplicantBlock(_ autoid.SlabPredictors, spacetime *perceptron.BlockInfo) (causet.Block, error) { 1556 defCausumns := make([]*causet.DeferredCauset, len(spacetime.DeferredCausets)) 1557 for i, defCaus := range spacetime.DeferredCausets { 1558 defCausumns[i] = causet.ToDeferredCauset(defCaus) 1559 } 1560 tp := causet.VirtualBlock 1561 if isClusterBlockByName(soliton.InformationSchemaName.O, spacetime.Name.O) { 1562 tp = causet.ClusterBlock 1563 } 1564 return &schemareplicantBlock{spacetime: spacetime, defcaus: defCausumns, tp: tp}, nil 1565 } 1566 1567 type schemareplicantBlock struct { 1568 spacetime *perceptron.BlockInfo 1569 defcaus []*causet.DeferredCauset 1570 tp causet.Type 1571 } 1572 1573 // SchemasSorter implements the sort.Interface interface, sorts DBInfo by name. 1574 type SchemasSorter []*perceptron.DBInfo 1575 1576 func (s SchemasSorter) Len() int { 1577 return len(s) 1578 } 1579 1580 func (s SchemasSorter) Swap(i, j int) { 1581 s[i], s[j] = s[j], s[i] 1582 } 1583 1584 func (s SchemasSorter) Less(i, j int) bool { 1585 return s[i].Name.L < s[j].Name.L 1586 } 1587 1588 func (it *schemareplicantBlock) getEvents(ctx stochastikctx.Context, defcaus []*causet.DeferredCauset) (fullEvents [][]types.Causet, err error) { 1589 is := GetSchemaReplicant(ctx) 1590 dbs := is.AllSchemas() 1591 sort.Sort(SchemasSorter(dbs)) 1592 switch it.spacetime.Name.O { 1593 case blockFiles: 1594 case blockReferConst: 1595 case blockPlugins, blockTriggers: 1596 case blockRoutines: 1597 // TODO: Fill the following blocks. 1598 case blockSchemaPrivileges: 1599 case blockBlockPrivileges: 1600 case blockDeferredCausetPrivileges: 1601 case blockParameters: 1602 case blockEvents: 1603 case blockGlobalStatus: 1604 case blockGlobalVariables: 1605 case blockStochastikStatus: 1606 case blockOptimizerTrace: 1607 case blockBlockSpaces: 1608 } 1609 if err != nil { 1610 return nil, err 1611 } 1612 if len(defcaus) == len(it.defcaus) { 1613 return 1614 } 1615 rows := make([][]types.Causet, len(fullEvents)) 1616 for i, fullEvent := range fullEvents { 1617 event := make([]types.Causet, len(defcaus)) 1618 for j, defCaus := range defcaus { 1619 event[j] = fullEvent[defCaus.Offset] 1620 } 1621 rows[i] = event 1622 } 1623 return rows, nil 1624 } 1625 1626 // IterRecords implements causet.Block IterRecords interface. 1627 func (it *schemareplicantBlock) IterRecords(ctx stochastikctx.Context, startKey ekv.Key, defcaus []*causet.DeferredCauset, 1628 fn causet.RecordIterFunc) error { 1629 if len(startKey) != 0 { 1630 return causet.ErrUnsupportedOp 1631 } 1632 rows, err := it.getEvents(ctx, defcaus) 1633 if err != nil { 1634 return err 1635 } 1636 for i, event := range rows { 1637 more, err := fn(ekv.IntHandle(i), event, defcaus) 1638 if err != nil { 1639 return err 1640 } 1641 if !more { 1642 break 1643 } 1644 } 1645 return nil 1646 } 1647 1648 // EventWithDefCauss implements causet.Block EventWithDefCauss interface. 1649 func (it *schemareplicantBlock) EventWithDefCauss(ctx stochastikctx.Context, h ekv.Handle, defcaus []*causet.DeferredCauset) ([]types.Causet, error) { 1650 return nil, causet.ErrUnsupportedOp 1651 } 1652 1653 // Event implements causet.Block Event interface. 1654 func (it *schemareplicantBlock) Event(ctx stochastikctx.Context, h ekv.Handle) ([]types.Causet, error) { 1655 return nil, causet.ErrUnsupportedOp 1656 } 1657 1658 // DefCauss implements causet.Block DefCauss interface. 1659 func (it *schemareplicantBlock) DefCauss() []*causet.DeferredCauset { 1660 return it.defcaus 1661 } 1662 1663 // VisibleDefCauss implements causet.Block VisibleDefCauss interface. 1664 func (it *schemareplicantBlock) VisibleDefCauss() []*causet.DeferredCauset { 1665 return it.defcaus 1666 } 1667 1668 // HiddenDefCauss implements causet.Block HiddenDefCauss interface. 1669 func (it *schemareplicantBlock) HiddenDefCauss() []*causet.DeferredCauset { 1670 return nil 1671 } 1672 1673 // WriblockDefCauss implements causet.Block WriblockDefCauss interface. 1674 func (it *schemareplicantBlock) WriblockDefCauss() []*causet.DeferredCauset { 1675 return it.defcaus 1676 } 1677 1678 // FullHiddenDefCaussAndVisibleDefCauss implements causet FullHiddenDefCaussAndVisibleDefCauss interface. 1679 func (it *schemareplicantBlock) FullHiddenDefCaussAndVisibleDefCauss() []*causet.DeferredCauset { 1680 return it.defcaus 1681 } 1682 1683 // Indices implements causet.Block Indices interface. 1684 func (it *schemareplicantBlock) Indices() []causet.Index { 1685 return nil 1686 } 1687 1688 // WriblockIndices implements causet.Block WriblockIndices interface. 1689 func (it *schemareplicantBlock) WriblockIndices() []causet.Index { 1690 return nil 1691 } 1692 1693 // DeleblockIndices implements causet.Block DeleblockIndices interface. 1694 func (it *schemareplicantBlock) DeleblockIndices() []causet.Index { 1695 return nil 1696 } 1697 1698 // RecordPrefix implements causet.Block RecordPrefix interface. 1699 func (it *schemareplicantBlock) RecordPrefix() ekv.Key { 1700 return nil 1701 } 1702 1703 // IndexPrefix implements causet.Block IndexPrefix interface. 1704 func (it *schemareplicantBlock) IndexPrefix() ekv.Key { 1705 return nil 1706 } 1707 1708 // FirstKey implements causet.Block FirstKey interface. 1709 func (it *schemareplicantBlock) FirstKey() ekv.Key { 1710 return nil 1711 } 1712 1713 // RecordKey implements causet.Block RecordKey interface. 1714 func (it *schemareplicantBlock) RecordKey(h ekv.Handle) ekv.Key { 1715 return nil 1716 } 1717 1718 // AddRecord implements causet.Block AddRecord interface. 1719 func (it *schemareplicantBlock) AddRecord(ctx stochastikctx.Context, r []types.Causet, opts ...causet.AddRecordOption) (recordID ekv.Handle, err error) { 1720 return nil, causet.ErrUnsupportedOp 1721 } 1722 1723 // RemoveRecord implements causet.Block RemoveRecord interface. 1724 func (it *schemareplicantBlock) RemoveRecord(ctx stochastikctx.Context, h ekv.Handle, r []types.Causet) error { 1725 return causet.ErrUnsupportedOp 1726 } 1727 1728 // UFIDelateRecord implements causet.Block UFIDelateRecord interface. 1729 func (it *schemareplicantBlock) UFIDelateRecord(gctx context.Context, ctx stochastikctx.Context, h ekv.Handle, oldData, newData []types.Causet, touched []bool) error { 1730 return causet.ErrUnsupportedOp 1731 } 1732 1733 // SlabPredictors implements causet.Block SlabPredictors interface. 1734 func (it *schemareplicantBlock) SlabPredictors(_ stochastikctx.Context) autoid.SlabPredictors { 1735 return nil 1736 } 1737 1738 // RebaseAutoID implements causet.Block RebaseAutoID interface. 1739 func (it *schemareplicantBlock) RebaseAutoID(ctx stochastikctx.Context, newBase int64, isSetStep bool, tp autoid.SlabPredictorType) error { 1740 return causet.ErrUnsupportedOp 1741 } 1742 1743 // Meta implements causet.Block Meta interface. 1744 func (it *schemareplicantBlock) Meta() *perceptron.BlockInfo { 1745 return it.spacetime 1746 } 1747 1748 // GetPhysicalID implements causet.Block GetPhysicalID interface. 1749 func (it *schemareplicantBlock) GetPhysicalID() int64 { 1750 return it.spacetime.ID 1751 } 1752 1753 // Seek implements causet.Block Seek interface. 1754 func (it *schemareplicantBlock) Seek(ctx stochastikctx.Context, h ekv.Handle) (ekv.Handle, bool, error) { 1755 return nil, false, causet.ErrUnsupportedOp 1756 } 1757 1758 // Type implements causet.Block Type interface. 1759 func (it *schemareplicantBlock) Type() causet.Type { 1760 return it.tp 1761 } 1762 1763 // VirtualBlock is a dummy causet.Block implementation. 1764 type VirtualBlock struct{} 1765 1766 // IterRecords implements causet.Block IterRecords interface. 1767 func (vt *VirtualBlock) IterRecords(ctx stochastikctx.Context, startKey ekv.Key, defcaus []*causet.DeferredCauset, 1768 _ causet.RecordIterFunc) error { 1769 if len(startKey) != 0 { 1770 return causet.ErrUnsupportedOp 1771 } 1772 return nil 1773 } 1774 1775 // EventWithDefCauss implements causet.Block EventWithDefCauss interface. 1776 func (vt *VirtualBlock) EventWithDefCauss(ctx stochastikctx.Context, h ekv.Handle, defcaus []*causet.DeferredCauset) ([]types.Causet, error) { 1777 return nil, causet.ErrUnsupportedOp 1778 } 1779 1780 // Event implements causet.Block Event interface. 1781 func (vt *VirtualBlock) Event(ctx stochastikctx.Context, h ekv.Handle) ([]types.Causet, error) { 1782 return nil, causet.ErrUnsupportedOp 1783 } 1784 1785 // DefCauss implements causet.Block DefCauss interface. 1786 func (vt *VirtualBlock) DefCauss() []*causet.DeferredCauset { 1787 return nil 1788 } 1789 1790 // VisibleDefCauss implements causet.Block VisibleDefCauss interface. 1791 func (vt *VirtualBlock) VisibleDefCauss() []*causet.DeferredCauset { 1792 return nil 1793 } 1794 1795 // HiddenDefCauss implements causet.Block HiddenDefCauss interface. 1796 func (vt *VirtualBlock) HiddenDefCauss() []*causet.DeferredCauset { 1797 return nil 1798 } 1799 1800 // WriblockDefCauss implements causet.Block WriblockDefCauss interface. 1801 func (vt *VirtualBlock) WriblockDefCauss() []*causet.DeferredCauset { 1802 return nil 1803 } 1804 1805 // FullHiddenDefCaussAndVisibleDefCauss implements causet FullHiddenDefCaussAndVisibleDefCauss interface. 1806 func (vt *VirtualBlock) FullHiddenDefCaussAndVisibleDefCauss() []*causet.DeferredCauset { 1807 return nil 1808 } 1809 1810 // Indices implements causet.Block Indices interface. 1811 func (vt *VirtualBlock) Indices() []causet.Index { 1812 return nil 1813 } 1814 1815 // WriblockIndices implements causet.Block WriblockIndices interface. 1816 func (vt *VirtualBlock) WriblockIndices() []causet.Index { 1817 return nil 1818 } 1819 1820 // DeleblockIndices implements causet.Block DeleblockIndices interface. 1821 func (vt *VirtualBlock) DeleblockIndices() []causet.Index { 1822 return nil 1823 } 1824 1825 // RecordPrefix implements causet.Block RecordPrefix interface. 1826 func (vt *VirtualBlock) RecordPrefix() ekv.Key { 1827 return nil 1828 } 1829 1830 // IndexPrefix implements causet.Block IndexPrefix interface. 1831 func (vt *VirtualBlock) IndexPrefix() ekv.Key { 1832 return nil 1833 } 1834 1835 // FirstKey implements causet.Block FirstKey interface. 1836 func (vt *VirtualBlock) FirstKey() ekv.Key { 1837 return nil 1838 } 1839 1840 // RecordKey implements causet.Block RecordKey interface. 1841 func (vt *VirtualBlock) RecordKey(h ekv.Handle) ekv.Key { 1842 return nil 1843 } 1844 1845 // AddRecord implements causet.Block AddRecord interface. 1846 func (vt *VirtualBlock) AddRecord(ctx stochastikctx.Context, r []types.Causet, opts ...causet.AddRecordOption) (recordID ekv.Handle, err error) { 1847 return nil, causet.ErrUnsupportedOp 1848 } 1849 1850 // RemoveRecord implements causet.Block RemoveRecord interface. 1851 func (vt *VirtualBlock) RemoveRecord(ctx stochastikctx.Context, h ekv.Handle, r []types.Causet) error { 1852 return causet.ErrUnsupportedOp 1853 } 1854 1855 // UFIDelateRecord implements causet.Block UFIDelateRecord interface. 1856 func (vt *VirtualBlock) UFIDelateRecord(ctx context.Context, sctx stochastikctx.Context, h ekv.Handle, oldData, newData []types.Causet, touched []bool) error { 1857 return causet.ErrUnsupportedOp 1858 } 1859 1860 // SlabPredictors implements causet.Block SlabPredictors interface. 1861 func (vt *VirtualBlock) SlabPredictors(_ stochastikctx.Context) autoid.SlabPredictors { 1862 return nil 1863 } 1864 1865 // RebaseAutoID implements causet.Block RebaseAutoID interface. 1866 func (vt *VirtualBlock) RebaseAutoID(ctx stochastikctx.Context, newBase int64, isSetStep bool, tp autoid.SlabPredictorType) error { 1867 return causet.ErrUnsupportedOp 1868 } 1869 1870 // Meta implements causet.Block Meta interface. 1871 func (vt *VirtualBlock) Meta() *perceptron.BlockInfo { 1872 return nil 1873 } 1874 1875 // GetPhysicalID implements causet.Block GetPhysicalID interface. 1876 func (vt *VirtualBlock) GetPhysicalID() int64 { 1877 return 0 1878 } 1879 1880 // Seek implements causet.Block Seek interface. 1881 func (vt *VirtualBlock) Seek(ctx stochastikctx.Context, h ekv.Handle) (ekv.Handle, bool, error) { 1882 return nil, false, causet.ErrUnsupportedOp 1883 } 1884 1885 // Type implements causet.Block Type interface. 1886 func (vt *VirtualBlock) Type() causet.Type { 1887 return causet.VirtualBlock 1888 }