Bug #107114 mysqldump failed to export large field table
Submitted: 25 Apr 2022 2:06 Modified: 22 Nov 2022 22:42
Reporter: KE TWELVE Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0.25, 8.0.28 OS:Linux
Assigned to: Jon Stephens CPU Architecture:x86

[25 Apr 2022 2:06] KE TWELVE
Description:
I noticed that exporting data using mysqldump fails if the row length is greater than 1G in 8.0, even though I set max_allowed_packet to 2G. But the same scenario 5.7 doesn't happen.

How to repeat:
SELECT @@max_allowed_packet;
SET GLOBAL max_allowed_packet=2147483648;

connect (con1,localhost,root,,);
connection con1;
DROP TABLE  if exists LONGTEXT1;
CREATE TABLE IF NOT EXISTS LONGTEXT1(id int PRIMARY KEY, text LONGTEXT);

DROP PROCEDURE IF EXISTS proc_longtext;
DELIMITER $$;
CREATE PROCEDURE proc_longtext(in id_value int, in text_value longtext)
BEGIN
    INSERT INTO LONGTEXT1(id, text) values(id_value, text_value);
    SELECT length(text), CHAR_LENGTH(CAST(text AS CHAR)) from LONGTEXT1 WHERE id = id_value;
END$$
DELIMITER ;$$

CALL proc_longtext(101, concat((SELECT repeat('a',943718400)), (SELECT repeat('a',130023424))));
CALL proc_longtext(102, concat((SELECT repeat('a',943718400)), (SELECT repeat('a',130023423))));

--let $mysqldumpfile = $MYSQLTEST_VARDIR/tmp/mysqldumpfile.sql
--exec $MYSQL_DUMP --set-gtid-purged=off -A --max_allowed_packet=1073741824 > $mysqldumpfile
connection default;
DROP TABLE LONGTEXT1;
DROP PROCEDURE proc_longtext;
SET GLOBAL max_allowed_packet=default;
--remove_file $mysqldumpfile
[25 Apr 2022 6:32] MySQL Verification Team
Hello KE TWELVE,

Thank you for the report and feedback.

regards,
Umesh
[22 Nov 2022 22:12] Jon Stephens
Added a note to the description of mysqldump --max-allowed-packet that max_allowed_packet on the server takes precedence.

Closed.