本文为您介绍数据迁移项目预检查报服务器内部错误的原因和解决方法。
适用版本
适用于 OceanBase 迁移服务(OceanBase Migration Service,OMS)V4.1.0 之前版本。
问题描述
使用 OMS 新建迁移对象较多(8500+)的数据迁移项目时,预检查报服务器内部错误。

问题原因
进入 OMS 容器查看如下日志。
# docker exec -it oms bash -c 'ls -lth /home/admin/logs/ghana/Ghana/common-default.log'
-rw-r--r-- 1 root root 880K Jun 27 16:41 /home/admin/logs/ghana/Ghana/common-default.log
您可以将该日志同步给 OMS 技术支持人员。
# docker cp oms:/home/admin/logs/ghana/Ghana/common-default.log .
通过查看日志文件,发现是由于 meta_cluster (metadb) 中 oms_meta 租户的 max_allowed_packet 默认值 4194304 较小导致该问题。
2023-06-27 16:10:30.925 [http-nio-8090-exec-7] ERROR c.a.o.c.a.OmsControllerAop 158 - [cea2ec77-026b-454c-a7cf-62e7caca68db] Occur unknown exception when calling method OmsApiReturnResult com.alipay.oms.v3.controller.TransferLinkController.submitPreCheck(SubmitPreCheckRequest)
org.springframework.dao.TransientDataAccessResourceException:
### Error updating database. Cause: java.sql.SQLTransientConnectionException: (conn=1809072) query size (4194304) is >= to max_allowed_packet (4194304)
### The error may exist in com/alipay/oms/common/dal/mapper/common/OmsTaskMapper.java (best guess)
### The error may involve com.alipay.oms.common.dal.mapper.common.OmsTaskMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO oms_task ( id, task_type, task_param, task_status, task_result, extra_info ) VALUES ( ?, ?, ?, ?, ?, ? )
### Cause: java.sql.SQLTransientConnectionException: (conn=1809072) query size (4194304) is >= to max_allowed_packet (4194304)
; (conn=1809072) query size (4194304) is >= to max_allowed_packet (4194304); nested exception is java.sql.SQLTransientConnectionException: (conn=1809072) query size (4194304) is >= to max_allowed_packet (4194304)
解决方法
方法一:通过 OCP 修改参数
在 OCP 上将
meta_cluster(metadb) 中oms_meta租户的max_allowed_packet参数调整为67108864或允许的最大值1073741824。由于参数需要重新连接才生效,您可以考虑在 OMS 本机通过如下命令重新启动 OMS 等方式强制重新连接。
docker restart oms方法二:通过命令行修改参数
确认是在 metadb 本机。
# docker ps|grep -E 'oms|metadb' 6859xxxxbc4d reg.docker.alibaba-inc.com/oboms/oms-all-in-one:feature_4.0.2-bp1 "/bin/sh -c '/usr/bi…" 2 weeks ago Up 2 weeks oms 9ddxxxxd01d6 reg.docker.alibaba-inc.com/antman/ob-docker:OB2277_OBP329_x86_20230330 "/root/init.sh" 3 weeks ago Up 3 weeks metadb在 metadb 本机执行如下命令,例如,oms meta 租户名不一样,改成相应的租户名即可。
# obclient -h127.0.0.1 -P2881 -uroot@oms_meta -pxxx Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 3221606251 Server version: 5.7.25 OceanBase 2.2.77 (r116010032023022813-4f4fbb6de5d7xxxxx500c21c) (Built Feb 28 2023 13:48:43) Copyright (c) 2000, 2018, xxx, xxxxx. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]> show databases; +--------------------+ | Database | +--------------------+ | oceanbase | | information_schema | | mysql | | test | | oms_cm | | oms_rm | | oms_cm_heartbeat | +--------------------+ 7 rows in set (0.00 sec) MySQL [(none)]> SHOW VARIABLES LIKE '%max_allowed_packet%'; +--------------------+---------+ | Variable_name | Value | +--------------------+---------+ | max_allowed_packet | 4194304 | +--------------------+---------+ 1 row in set (0.01 sec) MySQL [(none)]> SET GLOBAL max_allowed_packet=67108864; Query OK, 0 rows affected (0.022 sec)由于参数需要重新连接才生效,您可以考虑在 OMS 本机通过如下命令重新启动 OMS 等方式强制重新连接。
docker restart oms