使用 Sqoop 从 Hive 导出数据到 TiDB 报错:Information schema is changed

为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:

【概述】:场景 + 问题概述
使用sqoop从hive导出数据到tidb
【背景】:做过哪些操作
设置 tidb_max_delta_schema_count = 16384
【现象】:业务和数据库现象

【问题】:当前遇到的问题
sqoop export
-Dmapreduce.job.queuename=hive
–connect “jdbc:mysql://xxx/processed_data?useUnicode=true&characterEncoding=utf-8”
–username xxx
–password xxx
–table ads_fans_count
-m 1
–export-dir /warehouse/douyin/ads/ads_fans_count
–input-fields-terminated-by “\t”
–update-mode allowinsert
–update-key “uid,dt”
–input-null-string ‘\N’
–input-null-non-string ‘\N’
–batch
使用sqoop 从hive导出到tidb 报错
org.apache.sqoop.mapreduce.AsyncSqlOutputFormat: Got exception in update thread: java.sql.SQLException: Information schema is changed during the execution of the statement(for example, table definition may be updated by other DDL ran in parallel). If you see this error often, try increasing tidb_max_delta_schema_count. [try again later]
【业务影响】:
导出失败
【TiDB 版本】:
5.0
【日志】:
log.txt (219.2 KB)logs.zip (31.4 KB)

1 个赞

麻烦看一下 TiDB log 也上传一下哈,多谢拉

这个是哪个 TiDB Server ?

通过负载均衡连接三个tidb实例

[2021/06/17 03:30:38.861 +08:00] [Warn] [session.go:564] ["commit failed"] [conn=173557] ["finished txn"="Txn{state=invalid}"] [error="[domain:8028]Information schema is changed during the execution of the statement(for example, table definition may be updated by other DDL ran in parallel). If you see this error often, try increasing `tidb_max_delta_schema_count`. [try again later]"]

可以尝试调大一下 tidb_max_delta_schema_count 参数,看一下是否还会出现类似问题,
https://docs.pingcap.com/zh/tidb/stable/sql-faq#触发-information-schema-is-changed-错误的原因

已经把tidb_max_delta_schema_count 设置成最大值16384 了,这些日志是调后 报的

可以先把 DDL 和 DML 拆开么 ?先减少 DDL 对 DML 的影响,保证数据导入以后,再做 DDL 操作。或者先把 DDL 操作完成以后,再做插入动作。

现在只有我自己写入数据, 只有insert 和update 操作,还是有这个报错。没有写入表的ddl操作,
ADMIN SHOW DDL JOBS 也就10左右,没有插入表的ddl操作。

我减少了数据量,从千万变成百万就不报错。还是想不明白为什么,会有DDL操作?

可以通过 DDL history 确认一下,在做数据导入时候是否有 DDL 操作和导入操作重合。

https://asktug.com/t/topic/33166,可以看看这个报错原因

查看ddl history 的命令是?

%E5%9B%BE%E7%89%87
看不了哦:joy:

Get all TiDB DDL job history information.

curl http://{TiDBIP}:10080/ddl/history
Get count {number} TiDB DDL job history information.

curl http://{TiDBIP}:10080/ddl/history?limit={number}
Note: If you request a tidb that is not ddl owner, the response will be This node is not a ddl owner, can't be resigned.

这个是 TiDB 的一些 api 可以参考一下
https://github.com/pingcap/tidb/blob/master/docs/tidb_http_api.md

请问你找到原因了吗?我也遇到了同样的问题,不明白为什么会有DDL操作