This issue requires an assignee. Since you haven't specified one, we've assigned TestManager as the default assignee for this issue.


Welcome To openGauss Community
Hey @superlchf , thanks for your contribution to the community.
Bot Usage Manual
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
Contact Guide
If you have any questions, please contact the SIG: Plugin ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @wofanzheng, @ywzq1161327784 ,
and any of the committers: @dreamalloc, @huyinghao, @libiao2024, @wangfeihuo, @wmy_ld, @wuyuechuan, @xiong_xjun, @zhangxubo, @zhaojunv3z810 .


回归结论:通过
回归版本:7.0.0-LTS b0023
回归截图:




测试类型
SQL功能
测试版本
7.0.0-RC3
问题描述
mysql客户端发送大包报错
操作系统和硬件信息
Linux oepnGauss177 6.6.0-95.0.0.99.oe2403sp164kb.aarch64 #1 SMP Mon Jun 9 11:44:02 CST 2025 aarch64 aarch64 aarch64 GNU/Linu
测试环境
企业版单机
被测功能
预置条件
操作步骤
1. 安装客户端
系统没有 MySQL CLI 时,可以安装 PyMySQL:
PyMySQL 的
_execute_command()会根据MAX_PACKET_LEN=0xFFFFFF自动分包,属于真实MySQL wire protocol 测试,不是模拟 SQL 大小。
2 确认 PyMySQL 分包实现
可以执行:
python3 - <<'PY' import inspect import pymysql.connections print("MAX_PACKET_LEN =", pymysql.connections.MAX_PACKET_LEN) print(inspect.getsource(pymysql.connections.Connection._execute_command)) PY预期看到:
以及循环调用
write_packet()发送剩余 SQL 的逻辑。3 完整测试脚本
以下脚本先发送 1 MB 单 payload 对照请求,再使用新连接发送 17 MB 多 payload 请求。
python3 - <<'PY' import time import pymysql HOST = "127.0.0.1" PORT = 3308 USER = "test" PASSWORD = "PlainPass123" DATABASE = "test_b" def connect(): return pymysql.connect( host=HOST, port=PORT, user=USER, password=PASSWORD, database=DATABASE, charset="utf8mb4", autocommit=True, connect_timeout=10, read_timeout=60, write_timeout=60, ) # 1. 建表并验证 1 MB 单 payload 请求。 connection = connect() with connection.cursor() as cursor: cursor.execute("DROP TABLE IF EXISTS mysql_packet_test") cursor.execute( "CREATE TABLE mysql_packet_test (" "id INT AUTO_INCREMENT PRIMARY KEY, " "payload LONGTEXT)" ) small_payload = "x" * 1_000_000 small_query = ( "INSERT INTO mysql_packet_test(payload) VALUES ('" + small_payload + "')" ) print("small query bytes:", len(small_query.encode("utf-8"))) cursor.execute(small_query) cursor.execute( "SELECT LENGTH(payload) " "FROM mysql_packet_test ORDER BY id DESC LIMIT 1" ) print("stored small length:", cursor.fetchone()[0]) connection.close() # 2. 使用新连接发送约 17 MB 的 COM_QUERY。 connection = connect() large_payload = "x" * 17_000_000 large_query = ( "INSERT INTO mysql_packet_test(payload) VALUES ('" + large_payload + "')" ) print("large query bytes:", len(large_query.encode("utf-8"))) print("logical payload bytes:", len(large_query.encode("utf-8")) + 1) print("single payload max:", 0xFFFFFF) started = time.monotonic() try: with connection.cursor() as cursor: cursor.execute(large_query) print("insert result: SUCCESS") cursor.execute( "SELECT LENGTH(payload) " "FROM mysql_packet_test ORDER BY id DESC LIMIT 1" ) print("stored large length:", cursor.fetchone()[0]) except Exception as exception: print("insert result: ERROR") print("exception type:", type(exception).__name__) print("exception args:", repr(exception.args)) print("exception text:", str(exception)) finally: print("elapsed seconds:", round(time.monotonic() - started, 3)) print("connection open flag:", connection.open) try: connection.ping(reconnect=False) print("ping after large query: SUCCESS") except Exception as exception: print("ping after large query: ERROR") print("ping exception:", type(exception).__name__, repr(exception.args)) finally: connection.close() # 3. 使用新连接清理,避免复用可能已断开的连接。 cleanup_connection = connect() with cleanup_connection.cursor() as cursor: cursor.execute("DROP TABLE IF EXISTS mysql_packet_test") cursor.execute("SELECT 1") print("cleanup connection query:", cursor.fetchone()[0]) cleanup_connection.close() PY预期输出
成功
实际输出
报错
日志信息
提单组织
内部开发
测试代码