使用dumping备份表报错given slice is too small to serialize the message

【 TiDB 使用环境】生产\测试环境\ POC
【 TiDB 版本】tidb5.2.3
【遇到的问题】
使用dumping备份表报错given slice is too small to serialize the message

WHERE id>=221924767 and id<225506177 ORDER BY id: Error 1105: other err or: [src/coprocessor/dag/mod.rs:131]: IoError(Custom { kind: Other, error: “given slice is too small to serialize the message” })
/mod.rs:131]: IoError(Custom { kind: Other, error: “given slice is too small to serialize the message” })

【复现路径】做过哪些操作出现的问题
./dumpling -u root -P 4000 -h 192.168.1.12 -proot --filetype csv -t 2 -o /data/bak12/ -r 2000000 -F 3GiB --filter “assets_database.sy_cs_mm_cn_risk_detail_tmp”

【问题现象及影响】
【附件】

  • 相关日志、配置文件、Grafana 监控(https://metricstool.pingcap.com/)
  • TiUP Cluster Display 信息
  • TiUP CLuster Edit config 信息
  • TiDB-Overview 监控
  • 对应模块的 Grafana 监控(如有 BR、TiDB-binlog、TiCDC 等)
  • 对应模块日志(包含问题前后 1 小时日志)

若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。

https://github.com/tikv/tikv/issues/11994
TiKV copr resp size may exceed 4GB #11994

不太明白怎么解决这个问题

这应该是一个 BUG,暂时无法在 dumpling 中使用 issue 提供的 workaround。
建议尝试一下 -F 设置小一些,比如

-F 256MiB

使用select into outfile 导出数据 也是报Error querying database. Cause: java.sql.SQLException: other error: [src/coprocessor/dag/mod.rs:131]: IoError(Custom { kind: Other, error: “given slice is too small to serialize the message” })

这种方法可以尝试下 set tidb_enable_chunk_rpc = off,然后再 select into outfile。

设置了一下这个参数,还是没有解决

请问有没有好的解决办法?

得看官方修复了

你这里 dumpling 参数用了 -r 200w,也就是说一个文件保存 200w 条以内的记录。

当 dumpling 设置 -r 参数时候,dumpling 会通过 int类型的主键或者唯一索引来预估数据范围,通过并发读取加快导出数据速度。

看 dumpling 报错日志为 WHERE id >=221924767 and id <225506177,这个时候导致了问题,应该就是预估这个范围有 200w 条记录,导致 copr 实际记录过多导致出现问题。

所以你可以试下将 -r 参数调小,减少 where id 的范围,是的 copr 达不到 4G:

dumpling -r 10w …

能否把 copr 达到 4G的范围调大到16G

不可以,grpc 限制。

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。