lightning导入报错

【 TiDB 使用环境】生产环境 /测试/ Poc
【 TiDB 版本】V7.5.1
【复现路径】做过哪些操作出现的问题 用dumpling从MySQL导出数据,用lightning导入tidb
【遇到的问题:问题现象及影响】
需要将从MySQL A库中导出的表导入到B库中,表名不变,库名变了,现在在配置文件中配置了routes,执行导入脚本时报错。
【资源配置】进入到 TiDB Dashboard -集群信息 (Cluster Info) -主机(Hosts) 截图此页面
【附件:截图/日志/监控】
cat nohup.out
[Lightning:Config:ErrParseConfigFile]cannot parse config file ‘lightning0.toml’: toml: line 31 (last key “routes”): expected a top-level item to end with a newline, comment, or EOF, but got ‘\u3000’ instead

看看[[routes]]那一行最后是不是有个空格

\u3000 表示的是空格,应该还是哪里格式不对导致的

看了下,是[[routes]]下面每行末尾都有空格,删除就可以了。

一看就是格式问题。

刚才看错了,现在是能导,但是没有导入到test0库中,还是导入到test库中了,没达到更换库名的效果。

不应该吧,你test0库存在嘛

不存在,要先创建么?

你创建下,它不会自动帮你创建的

创建了test0库,还是一样,导入到test库里面去了。

哪里的格式不对

你看下这个帖子 dumpling导出的文件用lightning导入,但是导出的表名和导入的表名不同,lightning能实现么 - #7,来自 TiDBer_jYQINSnf

配置文件中没看出来,哪里不对

测试了下,在tidb上有A库A表,导出来,然后用上面的配置文件,是可以导入到B库A表,现在在生产上存在B库A表,导出的数据是MySQL导出来的,导出来的时候是A库A表,用上面的配置文件,导入到生产就是A库A表了,没想通这是为啥?

现在在生产上导入B库A表,又报列不匹配。
[2024/05/17 15:53:32.510 +08:00] [ERROR] [import.go:561] [“run failed”] [step=4] [error=“[Lightning:Restore:ErrEncodeKV]encode kv error in file pagoda_customer.store_goods_order.0000000020000.sql:0 at offset 350: column count mismatch, expected 23, got 21”]
[2024/05/17 15:53:32.510 +08:00] [INFO] [import.go:1266] [“everything imported, stopping periodic actions”]
[2024/05/17 15:53:32.510 +08:00] [ERROR] [import.go:571] [“the whole procedure failed”] [takeTime=96.23788ms] [error=“[Lightning:Restore:ErrEncodeKV]encode kv error in file pagoda_customer.store_goods_order.0000000020000.sql:0 at offset 350: column count mismatch, expected 23, got 21”]
[2024/05/17 15:53:32.511 +08:00] [ERROR] [import.go:170] [“tables failed to be imported”] [count=1]
[2024/05/17 15:53:32.511 +08:00] [ERROR] [import.go:172] [-] [table=pagoda_customer0.store_goods_order] [status=written] [error=“[Lightning:Restore:ErrEncodeKV]encode kv error in file XXXXXXX.0000000020000.sql:0 at offset 350: column count mismatch, expected 23, got 21”]
[2024/05/17 15:53:32.511 +08:00] [ERROR] [main.go:103] [“tidb lightning encountered error stack info”] [error=“[Lightning:Restore:ErrEncodeKV]encode kv error in file XXXXXXX.0000000020000.sql:0 at offset 350: column count mismatch, expected 23, got 21”]

应该是格式问题

怎么还列数不匹配了?

上下游的数据模型不同吗,还是加字段了

格式问题吧

上游是MySQL,下游是tidb,没加字段,都没有变更,只是tidb中存在B库A表,MySQL导出来是A库A表,导入过程中有个路由过程。