Commit 241581fb authored by Joerg Bruehe's avatar Joerg Bruehe
Browse files

Merge 5.1.26-rc to 5.1-build for further pushing it to the main tree.

parents 0241877c 09d543ea
Loading
Loading
Loading
Loading
+148 −1
Original line number Diff line number Diff line
@@ -259,7 +259,7 @@ DELETE FROM t1;
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
sync_slave_with_master;
set @@global.slave_exec_mode= default;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
@@ -288,3 +288,150 @@ SELECT * FROM t1;
connection master;
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
sync_slave_with_master;

#
# BUG#37426: RBR breaks for CHAR() UTF8 fields > 85 chars
#

# We have 4 combinations to test with respect to the field length
# (i.e., the number of bytes) of the CHAR fields:
#
# 1. Replicating from CHAR<256 to CHAR<256 
# 2. Replicating from CHAR<256 to CHAR>255
# 3. Replicating from CHAR>255 to CHAR<256
# 4. Replicating from CHAR>255 to CHAR>255

# We also make a special case of using the max size of a field on the
# master, i.e. CHAR(255) in UTF-8, giving another three cases.
#
# 5. Replicating UTF-8 CHAR(255) to CHAR(<256)
# 6. Replicating UTF-8 CHAR(255) to CHAR(>255)
# 7. Replicating UTF-8 CHAR(255) to CHAR(255) UTF-8

connection master;
CREATE TABLE t1 (i INT NOT NULL,
                 c CHAR(16) CHARACTER SET utf8 NOT NULL,
                 j INT NOT NULL);

CREATE TABLE t2 (i INT NOT NULL,
                 c CHAR(16) CHARACTER SET utf8 NOT NULL,
                 j INT NOT NULL);

sync_slave_with_master;
ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;

connection master;
CREATE TABLE t3 (i INT NOT NULL,
                 c CHAR(128) CHARACTER SET utf8 NOT NULL,
                 j INT NOT NULL);
sync_slave_with_master;
ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;

connection master;
CREATE TABLE t4 (i INT NOT NULL,
                 c CHAR(128) CHARACTER SET utf8 NOT NULL,
                 j INT NOT NULL);

CREATE TABLE t5 (i INT NOT NULL,
                 c CHAR(255) CHARACTER SET utf8 NOT NULL,
                 j INT NOT NULL);
sync_slave_with_master;
ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;

connection master;
CREATE TABLE t6 (i INT NOT NULL,
                 c CHAR(255) CHARACTER SET utf8 NOT NULL,
                 j INT NOT NULL);
sync_slave_with_master;
ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;

connection master;
CREATE TABLE t7 (i INT NOT NULL,
                 c CHAR(255) CHARACTER SET utf8 NOT NULL,
                 j INT NOT NULL);

--echo [expecting slave to replicate correctly]
connection master;
INSERT INTO t1 VALUES (1, "", 1);
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);

let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;

--echo [expecting slave to replicate correctly]
connection master;
INSERT INTO t2 VALUES (1, "", 1);
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);

let $diff_table_1=master:test.t2;
let $diff_table_2=slave:test.t2;
source include/diff_tables.inc;

--echo [expecting slave to stop]
connection master;
INSERT INTO t3 VALUES (1, "", 1);
INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);

connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8;
START SLAVE;
source include/wait_for_slave_to_start.inc;

--echo [expecting slave to replicate correctly]
connection master;
INSERT INTO t4 VALUES (1, "", 1);
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);

let $diff_table_1=master:test.t4;
let $diff_table_2=slave:test.t4;
source include/diff_tables.inc;

--echo [expecting slave to stop]
connection master;
INSERT INTO t5 VALUES (1, "", 1);
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);

connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8;
START SLAVE;
source include/wait_for_slave_to_start.inc;

--echo [expecting slave to stop]
connection master;
INSERT INTO t6 VALUES (1, "", 1);
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);

connection slave;
source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=8;
START SLAVE;
source include/wait_for_slave_to_start.inc;

--echo [expecting slave to replicate correctly]
connection master;
INSERT INTO t7 VALUES (1, "", 1);
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);

let $diff_table_1=master:test.t7;
let $diff_table_2=slave:test.t7;
source include/diff_tables.inc;

connection master;
drop table t1, t2, t3, t4, t5, t6, t7;
sync_slave_with_master;
+31 −0
Original line number Diff line number Diff line
@@ -95,3 +95,34 @@ table_28127_b CREATE TABLE `table_28127_b` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table table_28127_a;
drop table table_28127_b;
select 0b01000001;
0b01000001
A
select 0x41;
0x41
A
select b'01000001';
b'01000001'
A
select x'41', 0+x'41';
x'41'	0+x'41'
A	65
select N'abc', length(N'abc');
abc	length(N'abc')
abc	3
select N'', length(N'');
	length(N'')
	0
select '', length('');
	length('')
	0
select b'', 0+b'';
b''	0+b''
	0
select x'', 0+x'';
x''	0+x''
	0
select 0x;
ERROR 42S22: Unknown column '0x' in 'field list'
select 0b;
ERROR 42S22: Unknown column '0b' in 'field list'
+25 −1
Original line number Diff line number Diff line
@@ -66,4 +66,28 @@ a
1
1
3
drop table t1;
CREATE TABLE char128_utf8 ( 
i1 INT NOT NULL, 
c CHAR(128) CHARACTER SET utf8 NOT NULL, 
i2 INT NOT NULL);
CREATE TABLE char63_utf8 (
i1 INT NOT NULL,
c CHAR(63) CHARACTER SET utf8 NOT NULL,
i2 INT NOT NULL);
BINLOG '
MuNkSA8BAAAAZgAAAGoAAAAAAAQANS4xLjI1LXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAy42RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
';
BINLOG '
3u9kSBMBAAAANgAAAJYBAAAAABAAAAAAAAAABHRlc3QAC2NoYXI2M191dGY4AAMD/gMC/r0A
3u9kSBcBAAAAKgAAAMABAAAQABAAAAAAAAEAA//4AQAAAAMxMjMBAAAA
';
SELECT * FROM char63_utf8;
i1	c	i2
1	123	1
BINLOG '
iONkSBMBAAAANwAAAJkBAAAAABAAAAAAAAAABHRlc3QADGNoYXIxMjhfdXRmOAADA/4DAv6AAA==
iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
';
ERROR HY000: master may suffer from http://bugs.mysql.com/bug.php?id=37426 so slave stops; check error log on slave for more info
drop table t1, char63_utf8, char128_utf8;
+45 −2
Original line number Diff line number Diff line
@@ -104,6 +104,49 @@ Dl1YRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+BQAAAA==
# the above line should fail and 5 should not be in the binlog.
select * from t1;

# Test that BUG#37426 is triggered.

# clean up
drop table t1;
CREATE TABLE char128_utf8 ( 
    i1 INT NOT NULL, 
    c CHAR(128) CHARACTER SET utf8 NOT NULL, 
    i2 INT NOT NULL);
CREATE TABLE char63_utf8 (
      i1 INT NOT NULL,
      c CHAR(63) CHARACTER SET utf8 NOT NULL,
      i2 INT NOT NULL);

#
# This is the format description log event
#

BINLOG '
MuNkSA8BAAAAZgAAAGoAAAAAAAQANS4xLjI1LXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAy42RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
';

# ... this event corresponding to
#
#    INSERT INTO char63_utf8 VALUES ( 1, "123", 1 )
#
# The binlog event below shall not trigger the bug check

BINLOG '
3u9kSBMBAAAANgAAAJYBAAAAABAAAAAAAAAABHRlc3QAC2NoYXI2M191dGY4AAMD/gMC/r0A
3u9kSBcBAAAAKgAAAMABAAAQABAAAAAAAAEAA//4AQAAAAMxMjMBAAAA
';
SELECT * FROM char63_utf8;

# ... and this is an event corresponding to
#
#    INSERT INTO char128_utf8 VALUES ( 1, "123", 1 )
#
# The binlog event below shall trigger the bug check and produce an error
#

error ER_UNKNOWN_ERROR;
BINLOG '
iONkSBMBAAAANwAAAJkBAAAAABAAAAAAAAAABHRlc3QADGNoYXIxMjhfdXRmOAADA/4DAv6AAA==
iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
';

drop table t1, char63_utf8, char128_utf8;
+8 −0
Original line number Diff line number Diff line
[row]
--binlog-format=row

[stmt]
--binlog-format=statement

[mix]
--binlog-format=mixed
Loading