mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-25444 mysql --binary-mode is not able to replay some mysqlbinlog outputs
Problem:- Some binary data is inserted into the table using Jconnector. When binlog dump of the data is applied using mysql cleint it gives syntax error. Reason:- After investigating it turns out to be a issue of mysql client not able to properly handle \\\0 <0 in binary>. In all binary files where mysql client fails to insert these 2 bytes are commom (0x5c00) Solution:- I have changed mysql.cc to include for the possibility that binary string can have \\\0 in it
This commit is contained in:
committed by
Brandon Nesterenko
parent
1d57892949
commit
10cd281820
@@ -2319,8 +2319,12 @@ static bool add_line(String &buffer, char *line, size_t line_length,
|
|||||||
{
|
{
|
||||||
// Found possbile one character command like \c
|
// Found possbile one character command like \c
|
||||||
|
|
||||||
if (!(inchar = (uchar) *++pos))
|
inchar = (uchar) *++pos;
|
||||||
break; // readline adds one '\'
|
// In Binary mode , when in_string is not null \0 should not be treated as
|
||||||
|
// end statement. This can happen when we are in middle of binary data which
|
||||||
|
// can contain \0 and its quoted with ' '.
|
||||||
|
if (!real_binary_mode && !*in_string && !inchar)
|
||||||
|
break; // readline adds one '\'
|
||||||
if (*in_string || inchar == 'N') // \N is short for NULL
|
if (*in_string || inchar == 'N') // \N is short for NULL
|
||||||
{ // Don't allow commands in string
|
{ // Don't allow commands in string
|
||||||
*out++='\\';
|
*out++='\\';
|
||||||
|
6
mysql-test/main/binary_zero_insert.result
Normal file
6
mysql-test/main/binary_zero_insert.result
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
CREATE TABLE `tb` (`id` int(11) NOT NULL AUTO_INCREMENT,`cb` longblob DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)) ENGINE=myisam AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
|
||||||
|
select count(*)=2 from tb;
|
||||||
|
count(*)=2
|
||||||
|
1
|
||||||
|
drop table tb;
|
15
mysql-test/main/binary_zero_insert.test
Normal file
15
mysql-test/main/binary_zero_insert.test
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#
|
||||||
|
# MDEV-25444 mysql --binary-mode is not able to replay some mysqlbinlog outputs
|
||||||
|
#
|
||||||
|
# After investigating it turns out to be a issue of mysql client not able to properly
|
||||||
|
# handle \\\0 <0 in binary>.
|
||||||
|
# In this test case we will be pipelining binary_zero_insert.bin into mysql client.
|
||||||
|
# binary_zero_insert.bin contains insert stmt with \\\0
|
||||||
|
|
||||||
|
CREATE TABLE `tb` (`id` int(11) NOT NULL AUTO_INCREMENT,`cb` longblob DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)) ENGINE=myisam AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
--exec $MYSQL --binary-mode test < $MYSQL_TEST_DIR/std_data/binary_zero_insert.bin
|
||||||
|
select count(*)=2 from tb;
|
||||||
|
|
||||||
|
drop table tb;
|
BIN
mysql-test/std_data/binary_zero_insert.bin
Normal file
BIN
mysql-test/std_data/binary_zero_insert.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user