hanchuanchuan / goInception

一个集审核、执行、备份及生成回滚语句于一身的MySQL运维工具
https://hanchuanchuan.github.io/goInception/
GNU General Public License v3.0
1.62k stars 553 forks source link

goInception 使用 gh-ost 二进制文件异常 #620

Closed Jacklli closed 9 months ago

Jacklli commented 11 months ago

描述 对问题简单清晰的描述 通过 goInception 的 gh-ost 二进制文件执行 mysql 表加字段语句时,gh-ost 给 goInception 返回异常。

goInception日志报错如下: time="2023/11/02 16:11:16.947" level=info msg="con:2 use binary gh-ost: alter table sbtest1\n\tadd column name1 varchar(255) not null default 'kkkl' " file=session_inception.go func=executeRemoteStatement line=1442 time="2023/11/02 16:11:16.952" level=error msg="sh [-c gh-ost --alter \"ADD COLUMN \name1\\ VARCHAR(255) NOT NULL DEFAULT 'kkkl' " --verbose --assume-master-host= --exact-rowcount=false --concurrent-rowcount=true --allow-on-master=true --allow-master-master=true --allow-nullable-unique-key=false --approve-renamed-columns=true --tungsten=false --discard-foreign-keys=false --skip-foreign-key-checks=false --aliyun-rds=false --gcp=false --ok-to-drop-table=false --initially-drop-old-table=false --initially-drop-ghost-table=false --cut-over=atomic --force-named-cut-over=false --assume-rbr=true --cut-over-exponential-backoff=false --exponential-backoff-max-interval=64 --chunk-size=1000 --dml-batch-size=21 --default-retries=60 --cut-over-lock-timeout-seconds=3 --nice-ratio=0.200000 --max-lag-millis=1500 --replication-lag-query=show slave status --heartbeat-interval-millis=500 --throttle-flag-file= --throttle-additional-flag-file=inception-all-stop --postpone-cut-over-flag-file= --initially-drop-socket-file=false --serve-socket-file=/tmp/gh-ost.xxx.3306.sbtest0.sbtest1.sock --panic-flag-file=/tmp/gh-ost.xxx.3306.sbtest0.sbtest1.panic --replica-server-id=2000100002 --critical-load-interval-millis=0 --critical-load-hibernate-seconds=0 --force-table-names=testindexname --critical-load='Threads_running=200,threads_connected=1500' --max-load='Threads_running=100,threads_connected=1000' --execute --user=\"xxx\" --password='xxx' --host=xxx --port=3306 --database='sbtest0' --table='sbtest1']" file=osc.go func=execCommand line=902 time="2023/11/02 16:11:16.952" level=error msg="exit status 1" file=osc.go func=execCommand line=903 time="2023/11/02 16:11:16.952" level=info msg="con:2 close connection" file=server.go func=func1 line=321

将 goInception 日志中的 gh-ost 命令提取出来单独执行,报错如下: ./gh-ost --alter "ADD COLUMN name1 VARCHAR(255) NOT NULL DEFAULT 'kkkl' " --verbose --assume-master-host= --exact-rowcount=false --concurrent-rowcount=true --allow-on-master=true --allow-master-master=true --allow-nullable-unique-key=false --approve-renamed-columns=true --tungsten=false --discard-foreign-keys=false --skip-foreign-key-checks=false --aliyun-rds=false --gcp=false --ok-to-drop-table=false --initially-drop-old-table=false --initially-drop-ghost-table=false --cut-over=atomic --force-named-cut-over=false --assume-rbr=true --cut-over-exponential-backoff=false --exponential-backoff-max-interval=64 --chunk-size=1000 --dml-batch-size=21 --default-retries=60 --cut-over-lock-timeout-seconds=3 --nice-ratio=0.200000 --max-lag-millis=1500 --replication-lag-query=show slave status --heartbeat-interval-millis=500 --throttle-flag-file= --throttle-additional-flag-file=inception-all-stop --postpone-cut-over-flag-file= --initially-drop-socket-file=false --serve-socket-file=/tmp/gh-ost.xxx.3306.sbtest0.sbtest1.sock --panic-flag-file=/tmp/gh-ost.xxx.3306.sbtest0.sbtest1.panic --replica-server-id=2000100002 --critical-load-interval-millis=0 --critical-load-hibernate-seconds=0 --force-table-names=testindexname --critical-load='Threads_running=200,threads_connected=1500' --max-load='Threads_running=100,threads_connected=1000' --execute --user=\"xxx\" --password='xxx' --host=xxx --port=3306 --database='sbtest0' --table='sbtest1' 2023-11-02 16:14:53 FATAL --database must be provided and database name must not be empty, or --alter must specify database name

重现 模拟重现的步骤 参考以上错误描述,问题是必现。

环境

参数 可能与问题相关的设置参数 设置了 goInception 的 ghost_bin_dir 参数

hanchuanchuan commented 10 months ago

问题已确认, 由于参数--replication-lag-query的问题导致的. 其包含了空格, 但未使用引号

hanchuanchuan commented 10 months ago

请升级到v1.3.0-83版本后重试.

Jacklli commented 10 months ago

测试了 v1.3.0-84 二进制文件可以正常运行。 但是, v1.3.0 tag 的源代码貌似没有发新的版本。 是否可以给 v1.3.0 版本的源代码也发最新的版本呢?

hanchuanchuan commented 10 months ago

commit在的 1e87b376fca866ec06c9fd19da48939ed65c7d80