在其他程序封装 dumpling 时候发现在 Go 1.22 下 dumpling 直接备份 MySQL 5.7 会报错,而备份TiDB 或者 MySQL 8.0 则不会报错,估计是跟 TLS 1.0 被废弃有关系,报错内容如下:
Release version: v8.4.0-alpha-293-g9435af1b6c-dev
Git commit hash: 9435af1b6c82fbc6e19abfd116352b55d6ae93b7
Git branch: master
Build timestamp: 2024-09-27 10:15:06Z
Go version: go version go1.23.1 darwin/arm64
[2024/09/27 18:25:36.639 +08:00] [INFO] [versions.go:54] ["Welcome to dumpling"] ["Release Version"=v8.4.0-alpha-293-g9435af1b6c-dev] ["Git Commit Hash"=9435af1b6c82fbc6e19abfd116352b55d6ae93b7] ["Git Branch"=master] ["Build timestamp"="2024-09-27 10:15:06"] ["Go Version"="go version go1.23.1 darwin/arm64"]
[2024/09/27 18:25:36.650 +08:00] [WARN] [version.go:350] ["select tidb_version() failed, will fallback to 'select version();'"] [error="remote error: tls: handshake failure"]
create dumper failed: sql: SELECT version();: remote error: tls: handshake failure
涉及的代码在 tidb/dumpling/export/config.go at master · pingcap/tidb · GitHub ,
我手动将这块代码删掉是可以备份成功的。