Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: blob length size less than max_allowed_packet ,but select blob reported ERROR Got packet bigger than 'max_allowed_packet' bytes #20880

Closed
1 task done
heni02 opened this issue Dec 23, 2024 · 4 comments
Assignees
Labels
kind/bug Something isn't working phase/testing severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Milestone

Comments

@heni02
Copy link
Contributor

heni02 commented Dec 23, 2024

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

2.0-dev

Commit ID

0635430

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

insert 56.9MB大小压缩文件到blob类型,insert成功后select blob列报错Got packet bigger than 'max_allowed_packet' bytes
max_allowed_packet默认值为64M

mysql> create table table_blob(c1 int primary key,c2 blob);
Query OK, 0 rows affected (0.03 sec)

mysql> insert into table_blob values(834,LOAD_FILE('/Users/heni/Downloads/blob_test_data/blob04.tar.gz'));
Query OK, 1 row affected (0.66 sec)

mysql> select length(c2) from table_blob;
+------------+
| length(c2) |
+------------+
|   56874074 |
+------------+
1 row in set (0.12 sec)

mysql> select * from table_blob;
ERROR 2020 (HY000): Got packet bigger than 'max_allowed_packet' bytes

mysql> SHOW VARIABLES like "%max_allowed_packet%";
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| max_allowed_packet | 67108864 |
+--------------------+----------+
1 row in set (0.00 sec)

mysql的客户端行为和mo不同,select blob返回NULL,也有max_allowed_packet的大小配置,参见mysql文档blob:
https://dev.mysql.com/doc/refman/8.4/en/blob.html
企业微信截图_d680dd76-6312-446b-9f2b-938e7d0b209a

Expected Behavior

No response

Steps to Reproduce

create table table_blob(c1 int primary key,c2 blob);
insert into table_blob values(834,LOAD_FILE('/Users/heni/Downloads/blob_test_data/blob04.tar.gz'));
select * from table_blob;

Additional information

No response

@heni02 heni02 added kind/bug Something isn't working severity/s0 Extreme impact: Cause the application to break down and seriously affect the use labels Dec 23, 2024
@heni02 heni02 added this to the 2.0.2 milestone Dec 23, 2024
@qingxinhome
Copy link
Contributor

该问题2.0.2估计来不及处理

@qingxinhome
Copy link
Contributor

  1. 在 MySQL 客户端中,--max-allowed-packet 选项是用来设置客户端与服务器之间允许的最大数据包大小。
    这个选项影响客户端发送和接收数据包的最大大小。 如果你在执行 SQL 查询时遇到错误,比如查询返回的数据超出了 MySQL 客户端的默认包大小限制(例如:插入 BLOB 数据时),就会报错

你可以通过这个选项增加客户端的包大小限制。查看方式如下:
mysql --help | grep max-allowed-packet

image
image
但是注意:该配置项属于mysql客户端

  1. mysql(或mo)服务器端也有相同的配置项 max_allowed_packet,需要确保客户端和服务器的设置都足够大,才能避免因包太大而导致的错误。如果你在客户端连接时指定了较大的包大小,但服务器端的设置较大,那么客户端仍然可能会拒绝请求。

@qingxinhome
Copy link
Contributor

qingxinhome commented Dec 25, 2024

mo如何修改mysql客户端的max-allowed-packet配置:
[yiming@matrixone matrixone]$ mysql -h127.0.0.1 --max-allowed-packet=67108864 -P 6001 -udump -p111
@heni02

@heni02
Copy link
Contributor Author

heni02 commented Dec 26, 2024

2.0-dev commit:947a1258b5eede197a6ed7853ea117b34cd2f438
confirm,closed
企业微信截图_1c8a76d9-84cc-4409-9438-7eff16d8c417
企业微信截图_c02c73bd-acd7-4edf-850c-5f065828654f

@heni02 heni02 closed this as completed Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working phase/testing severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Projects
None yet
Development

No branches or pull requests

3 participants