mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix for bug#41486: extra character appears in BLOB for every
~40Mb after mysqldump/import When the input string exceeds the maximum allowed size for the internal buffer, batch_readline() returns a truncated string. Since there was no way for a caller to determine whether the string was truncated or not, the command line client assumed batch_readline() to always return the whole input string and appended a newline character. This resulted in garbled data when importing dumps containing strings longer than the maximum input buffer size. Fixed by adding a flag to the batch_readline() interface to signal a truncated string to the caller. Other minor problems fixed during patch implementation: - The maximum allowed buffer size for batch_readline() was set up depending on the client's max_allowed_packet value. It does not actully make any sense, as those variables are not related. The input buffer size limit is now always set to 1 MB. - fill_buffer() did not always set the EOF flag. - The input buffer could actually grow twice as the specified limit due to insufficient checks in intern_read_line().
This commit is contained in:
@ -192,4 +192,15 @@ delimiter
|
||||
1
|
||||
1
|
||||
1
|
||||
set @old_max_allowed_packet = @@global.max_allowed_packet;
|
||||
set @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
|
||||
set @@max_allowed_packet = @@global.max_allowed_packet;
|
||||
CREATE TABLE t1(data LONGBLOB);
|
||||
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
|
||||
SELECT LENGTH(data) FROM t1;
|
||||
LENGTH(data)
|
||||
2097152
|
||||
DROP TABLE t1;
|
||||
set @@global.max_allowed_packet = @old_max_allowed_packet;
|
||||
set @@max_allowed_packet = @@global.max_allowed_packet;
|
||||
End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user