Statement 1: CREATE TABLE - [blocker] ddl.table.name.keyword.forbid: table name "select" is a reserved keyword - [blocker] ddl.table.engine.allowlist: engine MyISAM is not in allowlist [InnoDB] - [blocker] ddl.table.charset.allowlist: charset latin1 is not in allowlist [utf8mb4] - [blocker] ddl.table.foreign_key.forbid: foreign keys are forbidden - [blocker] ddl.table.primary_key.not_null.require: primary key column "bad_varchar" is nullable - [blocker] ddl.column.name.keyword.forbid: column name "select" is a reserved keyword - [blocker] ddl.column.name.max_length: column name exceeds 64 characters - [blocker] ddl.column.charset.allowlist: column charset latin1 is not in allowlist [utf8mb4] - [blocker] ddl.column.varchar.max_length: VARCHAR(32) exceeds max length limit - [warning] ddl.column.blob_text.forbid: TEXT type is forbidden - [warning] ddl.column.json.forbid: JSON type is forbidden - [warning] ddl.column.bit.forbid: BIT type is forbidden - [warning] ddl.column.timestamp.forbid: TIMESTAMP type is forbidden - [warning] ddl.column.float_double.forbid: DOUBLE type is forbidden - [warning] ddl.column.comment.require: column must have a comment - [warning] ddl.column.default.require: column "no_default" should define a default value - [warning] ddl.table.audit_columns.require: missing audit columns (created_at, updated_at) - [warning] ddl.table.comment.max_length: table comment exceeds max length limit - [warning] ddl.index.duplicate.forbid: index "baddup" duplicates "badleft" on (bad_varchar) - [warning] ddl.index.redundant_left_prefix.forbid: index is left-prefix redundant - [warning] ddl.constraint.primary_key.name.prefix.require: constraint "badpk" missing prefix "pk_"
resources/bin/orchestrator-client -c graceful-master-takeover-auto -alias orc_prod_infra_broker -d 172.20.0.14:3306 -b 'superuser:superpass' Desginated instance 172.20.0.14:3306 cannot take over all of its siblings. Error: 2022-09-0215:33:27 ERROR Relocating 2 replicas of 172.20.0.10:3306 below 172.20.0.14:3306 turns to be too complex; please do it manually
// RegroupReplicasGTID will choose a candidate replica of a given instance, and take its siblings using GTID funcRegroupReplicasGTID( masterKey *InstanceKey, // 实参传进来的是 挂掉的旧主库 returnReplicaEvenOnFailureToRegroup bool, // 实参传进来的是 true startReplicationOnCandidate bool, // 实参传进来的是 false onCandidateReplicaChosen func(*Instance), // 实参传进来的是 nil postponedFunctionsContainer *PostponedFunctionsContainer, postponeAllMatchOperations func(*Instance, bool)bool, // 实参传进来的是 promotedReplicaIsIdeal 函数 )
RegroupReplicasGTID will choose a candidate replica of a given instance, and take its siblings using GTID 英文简简单单一句话, 中文不知道咋翻译.. 我理解就是RegroupReplicasGTID会从目标实例(即DeadMaster)的从库中选出一个candidate出来, 然后提升他为新主库, 并接管所有的从库
while getopts "c:i:d:s:a:D:U:o:r:u:R:t:l:H:P:q:b:e:n:S:h" OPTION do case $OPTIONin h) command="help" ;; c) command="$OPTARG" ;; i) instance="$OPTARG" ;;
可以看出-i 的值给了instance变量. 在main行数中会先处理instance
1 2 3 4 5 6 7 8 9
function main { check_requirements detect_leader_api
Skeema is a tool for managing MySQL tables and schema changes in a declarative fashion using pure SQL. It provides a CLI tool allowing you to:
Export CREATE TABLE statements to the filesystem, for tracking in a repo (git, hg, svn, etc)
Diff changes in the schema repo against live DBs to automatically generate DDL
Manage multiple environments (e.g. dev, staging, prod) and keep them in sync with ease
Configure use of online schema change tools, such as pt-online-schema-change, for performing ALTERs
Convert non-online migrations from frameworks like Rails or Django into online schema changes in production
Skeema supports a pull-request-based workflow for schema change submission, review, and execution. This permits your team to manage schema changes in exactly the same way as you manage code changes. Our new companion Cloud Linter for GitHub repos provides automatic linting of schema change commits and pull requests.