Dumpling export of a specific table in MySQL is stuck and unresponsive

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: dumpling导出mysql中某张表一直卡住没反应了

| username: putianhui

I have 10,003 rows in this table, and it’s 1680MB in size, but it keeps getting stuck at
[2022/09/02 10:32:54.290 +08:00] [INFO] [config.go:617] ["detect server version"] [version=5.7.39-log]

Below is my dumpling export statement:

[root@k8s-node23 my_database]# tiup dumpling:v4.0.9 -h 192.168.xxx.xx -P 3306 -u xxx -p xxx -t 8 -r 200000 -F 256MB -T gdelt.news_webpages -o /data/my_database/
Starting component `dumpling`: /root/.tiup/components/dumpling/v4.0.9/dumpling -h -P 3306 -u root -p CNdsdis123 -t 8 -r 200000 -F 256MB -T gdelt.news_webpages -o /data/my_database/
Release version: v4.0.9
Git commit hash: 11d8d5dad31210a1ec6afef9d3c16b397f2fc9fb
Git branch:      heads/refs/tags/v4.0.9
Build timestamp: 2020-12-19 04:53:02Z
Go version:      go version go1.13 linux/amd64

[2022/09/02 10:32:54.290 +08:00] [INFO] [config.go:598] ["detect server type"] [type=MySQL]
[2022/09/02 10:32:54.290 +08:00] [INFO] [config.go:617] ["detect server version"] [version=5.7.39-log]
# It keeps getting stuck here with no further information

Seeking help from everyone.
When I switched the dumpling version to 6.2.0, I saw an error in the logs: ["select tidb_version() failed, will fallback to 'select version();'"] [error="Error 1046: No database selected"]

Below are the logs for version 6.2.0, which show that it gets stuck after displaying that information.

base/ --loglevel debug
Release version: v6.2.0
Git commit hash: daf2b17cdfe30c02ce282361009fb5bdb05f2b0e
Git branch:      heads/refs/tags/v6.2.0
Build timestamp: 2022-08-22 01:40:02Z
Go version:      go version go1.18.5 linux/amd64

[2022/09/02 12:28:10.616 +08:00] [INFO] [versions.go:54] ["Welcome to dumpling"] ["Release Version"=v6.2.0] ["Git Commit Hash"=daf2b17cdfe30c02ce282361009fb5bdb05f2b0e] ["Git Branch"=heads/refs/tags/v6.2.0] ["Build timestamp"="2022-08-22 01:40:02"] ["Go Version"="go version go1.18.5 linux/amd64"]
[2022/09/02 12:28:10.618 +08:00] [WARN] [version.go:299] ["select tidb_version() failed, will fallback to 'select version();'"] [error="Error 1046: No database selected"]
[2022/09/02 12:28:10.618 +08:00] [INFO] [version.go:397] ["detect server version"] [type=MySQL] [version=5.7.39-log]
[2022/09/02 12:28:10.620 +08:00] [INFO] [dump.go:127] ["begin to run Dump"] [conf="{\"s3\":{\"endpoint\":\"\",\"region\":\"\",\"storage-class\":\"\",\"sse\":\"\",\"sse-kms-key-id\":\"\",\"acl\":\"\",\"access-key\":\"\",\"secret-access-key\":\"\",\"provider\":\"\",\"force-path-style\":true,\"use-accelerate-endpoint\":false},\"gcs\":{\"endpoint\":\"\",\"storage-class\":\"\",\"predefined-acl\":\"\",\"credentials-file\":\"\"},\"azblob\":{\"endpoint\":\"\",\"account-name\":\"\",\"account-key\":\"\",\"access-tier\":\"\"},\"AllowCleartextPasswords\":false,\"SortByPk\":true,\"NoViews\":true,\"NoSequences\":true,\"NoHeader\":false,\"NoSchemas\":false,\"NoData\":false,\"CompleteInsert\":false,\"TransactionalConsistency\":true,\"EscapeBackslash\":true,\"DumpEmptyDatabase\":true,\"PosAfterConnect\":false,\"CompressType\":0,\"Host\":\"\",\"Port\":3306,\"Threads\":8,\"User\":\"root\",\"Security\":{\"CAPath\":\"\",\"CertPath\":\"\",\"KeyPath\":\"\"},\"LogLevel\":\"debug\",\"LogFile\":\"\",\"LogFormat\":\"text\",\"OutputDirPath\":\"/data/my_database/\",\"StatusAddr\":\":8281\",\"Snapshot\":\"\",\"Consistency\":\"flush\",\"CsvNullValue\":\"\\\\N\",\"SQL\":\"\",\"CsvSeparator\":\",\",\"CsvDelimiter\":\"\\\"\",\"Databases\":[],\"Where\":\"\",\"FileType\":\"sql\",\"ServerInfo\":{\"ServerType\":1,\"ServerVersion\":\"5.7.39-log\",\"HasTiKV\":false},\"Rows\":200000,\"ReadTimeout\":900000000000,\"TiDBMemQuotaQuery\":0,\"FileSize\":268435456,\"StatementSize\":1000000,\"SessionParams\":{},\"Tables\":{\"gdelt\":[{\"Name\":\"news_webpages\",\"AvgRowLength\":0,\"Type\":0}]},\"CollationCompatible\":\"loose\"}"]
| username: songxuecheng | Original post link

Use the corresponding version of Dumpling to connect to TiDB. Are you connecting through a proxy?

| username: putianhui | Original post link

I am not connecting to TiDB, I am connecting to MySQL. I want to export the data from MySQL and then migrate it to the TiDB database.

| username: songxuecheng | Original post link

Dumpling does not support MySQL, use MySQL’s export or MyDumper.

| username: putianhui | Original post link

Okay, bro, my current requirement is to migrate our MySQL data to TiDB. According to the official documentation, the process involves exporting MySQL data using Dumpling and then importing the exported MySQL data into TiDB using Lightning.

Here is the documentation link: https://docs.pingcap.com/zh/tidb/stable/migrate-large-mysql-to-tidb

So, should I use Mydumper to export MySQL data and then use Lightning to import it into TiDB?

| username: buchuitoudegou | Original post link

Dumpling supports MySQL export. The log report you mentioned above shows that the error in select tidb_version() is a warning; after this error, it will automatically switch to select version(), and it will also automatically get the MySQL version.

Dumpling getting stuck might be due to acquiring locks. You can check the source database.

| username: alfred | Original post link

“Does ‘[error=“Error 1046: No database selected”]’ mean that a database needs to be specified?”