BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash

This patch adds functionality to row-based replication to ensure the
slave's column sizes are >= to that of the master.

It also includes some refactoring for the code from WL#3228.
parent ac1767df
......@@ -71,38 +71,47 @@ sync_slave_with_master;
############################################
## BUG22086
#--echo *** Create t2 on slave ***
#STOP SLAVE;
#RESET SLAVE;
#eval CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
# d FLOAT DEFAULT '2.00',
# e CHAR(5) DEFAULT 'TEST2')
# ENGINE=$engine_type;
#
#--echo *** Create t2 on Master ***
#connection master;
#eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
# ) ENGINE=$engine_type;
#RESET MASTER;
#
#--echo *** Start Slave ***
#connection slave;
#START SLAVE;
#
#--echo *** Master Data Insert ***
#connection master;
#
#INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
#SELECT * FROM t2 ORDER BY a;
--echo *** Create t2 on slave ***
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
ENGINE=$engine_type;
#--echo *** Select from slave ***
#sync_slave_with_master;
#SELECT * FROM t2 ORDER BY a;
--echo *** Create t2 on Master ***
connection master;
eval CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
) ENGINE=$engine_type;
RESET MASTER;
#--echo *** Drop t2 ***
#connection master;
#DROP TABLE t2;
#sync_slave_with_master;
--echo *** Master Data Insert ***
connection master;
INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
SELECT * FROM t2 ORDER BY a;
--echo *** Start Slave ***
connection slave;
START SLAVE;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
connection master;
RESET MASTER;
connection slave;
START SLAVE;
--echo *** Drop t2 ***
connection master;
DROP TABLE t2;
sync_slave_with_master;
####################################
### Try to replicate BLOB to INT ###
......@@ -140,7 +149,7 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
......@@ -185,7 +194,7 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
......@@ -230,7 +239,7 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
......@@ -276,7 +285,7 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
#START SLAVE;
......@@ -378,7 +387,7 @@ INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
#connection slave;
#wait_for_slave_to_stop;
#--replace_result $MASTER_MYPORT MASTER_PORT
#--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
#--query_vertical SHOW SLAVE STATUS
#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
#START SLAVE;
......@@ -429,7 +438,7 @@ sync_slave_with_master;
#--echo *** Select from T9 ***
#--source include/wait_for_slave_sql_to_stop.inc
#--replace_result $MASTER_MYPORT MASTER_PORT
#--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
#--query_vertical SHOW SLAVE STATUS
#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
#START SLAVE;
......@@ -471,7 +480,7 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
......@@ -515,7 +524,7 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
......@@ -725,7 +734,7 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
......@@ -834,7 +843,7 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
......
#
# include/test_fieldsize.inc
#
# This include file is designed to create a table with one column
# whose size on the master is greater than that on the slave. The
# test should fail with an error on the slave.
#
connection master;
DROP TABLE IF EXISTS t1;
sync_slave_with_master;
STOP SLAVE;
RESET SLAVE;
eval $test_table_slave;
connection master;
eval $test_table_master;
RESET MASTER;
eval $test_insert;
connection slave;
START SLAVE;
wait_for_slave_to_stop;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
# The following should be 0
SELECT COUNT(*) FROM t1;
STOP SLAVE;
RESET SLAVE;
connection master;
RESET MASTER;
connection slave;
START SLAVE;
......@@ -33,6 +33,73 @@ a b c d e
3 4 QA 2 TEST
*** Drop t1 ***
DROP TABLE t1;
*** Create t2 on slave ***
STOP SLAVE;
RESET SLAVE;
CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
ENGINE='InnoDB';
*** Create t2 on Master ***
CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
) ENGINE='InnoDB';
RESET MASTER;
*** Master Data Insert ***
INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
SELECT * FROM t2 ORDER BY a;
a b c
1 2 Kyle, TEX
2 1 JOE AUSTIN
3 4 QA TESTING
*** Start Slave ***
START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
a b c d e
RESET MASTER;
START SLAVE;
*** Drop t2 ***
DROP TABLE t2;
*** Create t3 on slave ***
STOP SLAVE;
RESET SLAVE;
......@@ -57,7 +124,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -69,7 +136,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -88,8 +155,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -119,7 +186,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -131,7 +198,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -150,8 +217,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -181,7 +248,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -193,7 +260,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -212,8 +279,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -242,7 +309,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -254,7 +321,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -273,8 +340,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
......@@ -354,7 +421,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -366,7 +433,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -385,8 +452,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -415,7 +482,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -427,7 +494,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -446,8 +513,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -605,7 +672,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -617,7 +684,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1060
......@@ -636,8 +703,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -740,7 +807,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -752,7 +819,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -771,8 +838,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......
......@@ -33,6 +33,73 @@ a b c d e
3 4 QA 2 TEST
*** Drop t1 ***
DROP TABLE t1;
*** Create t2 on slave ***
STOP SLAVE;
RESET SLAVE;
CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
ENGINE='MyISAM';
*** Create t2 on Master ***
CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
) ENGINE='MyISAM';
RESET MASTER;
*** Master Data Insert ***
INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
SELECT * FROM t2 ORDER BY a;
a b c
1 2 Kyle, TEX
2 1 JOE AUSTIN
3 4 QA TESTING
*** Start Slave ***
START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
a b c d e
RESET MASTER;
START SLAVE;
*** Drop t2 ***
DROP TABLE t2;
*** Create t3 on slave ***
STOP SLAVE;
RESET SLAVE;
......@@ -57,7 +124,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -69,7 +136,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -88,8 +155,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -119,7 +186,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -131,7 +198,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -150,8 +217,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -181,7 +248,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -193,7 +260,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -212,8 +279,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -242,7 +309,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -254,7 +321,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -273,8 +340,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
......@@ -354,7 +421,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -366,7 +433,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -385,8 +452,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -415,7 +482,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -427,7 +494,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -446,8 +513,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -605,7 +672,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -617,7 +684,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1060
......@@ -636,8 +703,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -740,7 +807,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -752,7 +819,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -771,8 +838,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......
This diff is collapsed.
##################################################################
# rpl_colSize #
# #
# This test is designed to test the changes included in WL#3228. #
# The changes include the ability to replicate with the master #
# having columns that are smaller (shorter) than the slave. #
##################################################################
-- source include/master-slave.inc
-- source include/have_binlog_format_row.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo **** Testing WL#3228 changes. ****
--echo *** Create "wider" table on slave ***
sync_slave_with_master;
#
# Check each column type to verify error 1532 fires (BUG#22086)
# This check covers only those fields that require additional
# metadata from the master to be replicated to the slave. These
# field types are:
# MYSQL_TYPE_NEWDECIMAL:
# MYSQL_TYPE_FLOAT:
# MYSQL_TYPE_BIT:
# MYSQL_TYPE_SET:
# MYSQL_TYPE_STRING:
# MYSQL_TYPE_ENUM:
# MYSQL_TYPE_VARCHAR:
# MYSQL_TYPE_BLOB:
#
# Test: Checking MYSQL_TYPE_NEWDECIMAL fields
#
--echo Checking MYSQL_TYPE_NEWDECIMAL fields
let $test_table_master = CREATE TABLE t1 (a DECIMAL(20, 10));
let $test_table_slave = CREATE TABLE t1 (a DECIMAL(5,2));
let $test_insert = INSERT INTO t1 VALUES (901251.90125);
source include/test_fieldsize.inc;
let $test_table_master = CREATE TABLE t1 (a DECIMAL(27, 18));
let $test_table_slave = CREATE TABLE t1 (a DECIMAL(27, 9));
let $test_insert = INSERT INTO t1 VALUES (901251.90125);
source include/test_fieldsize.inc;
let $test_table_master = CREATE TABLE t1 (a NUMERIC(20, 10));
let $test_table_slave = CREATE TABLE t1 (a NUMERIC(5,2));
let $test_insert = INSERT INTO t1 VALUES (901251.90125);
source include/test_fieldsize.inc;
#
# Test: Checking MYSQL_TYPE_FLOAT fields
#
--echo Checking MYSQL_TYPE_FLOAT fields
let $test_table_master = CREATE TABLE t1 (a FLOAT(47));
let $test_table_slave = CREATE TABLE t1 (a FLOAT(20));
let $test_insert = INSERT INTO t1 VALUES (901251.90125);
source include/test_fieldsize.inc;
#
# Test: Checking MYSQL_TYPE_BIT fields
#
--echo Checking MYSQL_TYPE_BIT fields
let $test_table_master = CREATE TABLE t1 (a BIT(64));
let $test_table_slave = CREATE TABLE t1 (a BIT(5));
let $test_insert = INSERT INTO t1 VALUES (B'10101');
source include/test_fieldsize.inc;
let $test_table_master = CREATE TABLE t1 (a BIT(12));
let $test_table_slave = CREATE TABLE t1 (a BIT(11));
let $test_insert = INSERT INTO t1 VALUES (B'10101');
source include/test_fieldsize.inc;
#
# Test: Checking MYSQL_TYPE_SET fields
#
--echo Checking MYSQL_TYPE_SET fields
let $test_table_master = CREATE TABLE t1 (a SET('1','2','3','4','5','6','7','8','9'));
let $test_table_slave = CREATE TABLE t1 (a SET('4'));
let $test_insert = INSERT INTO t1 VALUES ('4');
source include/test_fieldsize.inc;
#
# Test: Checking MYSQL_TYPE_STRING fields
#
--echo Checking MYSQL_TYPE_STRING fields
let $test_table_master = CREATE TABLE t1 (a CHAR(20));
let $test_table_slave = CREATE TABLE t1 (a CHAR(10));
let $test_insert = INSERT INTO t1 VALUES ('This is a test.');
source include/test_fieldsize.inc;
#
# Test: Checking MYSQL_TYPE_ENUM fields
#
--echo Checking MYSQL_TYPE_ENUM fields
let $test_table_master = CREATE TABLE t1 (a ENUM(
'01','02','03','04','05','06','07','08','09',
'11','12','13','14','15','16','17','18','19',
'21','22','23','24','25','26','27','28','29',
'31','32','33','34','35','36','37','38','39',
'41','42','43','44','45','46','47','48','49',
'51','52','53','54','55','56','57','58','59',
'61','62','63','64','65','66','67','68','69',
'71','72','73','74','75','76','77','78','79',
'81','82','83','84','85','86','87','88','89',
'91','92','93','94','95','96','97','98','99',
'101','102','103','104','105','106','107','108','109',
'111','112','113','114','115','116','117','118','119',
'121','122','123','124','125','126','127','128','129',
'131','132','133','134','135','136','137','138','139',
'141','142','143','144','145','146','147','148','149',
'151','152','153','154','155','156','157','158','159',
'161','162','163','164','165','166','167','168','169',
'171','172','173','174','175','176','177','178','179',
'181','182','183','184','185','186','187','188','189',
'191','192','193','194','195','196','197','198','199',
'201','202','203','204','205','206','207','208','209',
'211','212','213','214','215','216','217','218','219',
'221','222','223','224','225','226','227','228','229',
'231','232','233','234','235','236','237','238','239',
'241','242','243','244','245','246','247','248','249',
'251','252','253','254','255','256','257','258','259',
'261','262','263','264','265','266','267','268','269',
'271','272','273','274','275','276','277','278','279',
'281','282','283','284','285','286','287','288','289',
'291','292','293','294','295','296','297','298','299'
));
let $test_table_slave = CREATE TABLE t1 (a ENUM('44','54'));
let $test_insert = INSERT INTO t1 VALUES ('44');
source include/test_fieldsize.inc;
#
# Test: Checking MYSQL_TYPE_VARCHAR fields
#
--echo Checking MYSQL_TYPE_VARCHAR fields
let $test_table_master = CREATE TABLE t1 (a VARCHAR(2000));
let $test_table_slave = CREATE TABLE t1 (a VARCHAR(100));
let $test_insert = INSERT INTO t1 VALUES ('This is a test.');
source include/test_fieldsize.inc;
let $test_table_master = CREATE TABLE t1 (a VARCHAR(200));
let $test_table_slave = CREATE TABLE t1 (a VARCHAR(10));
let $test_insert = INSERT INTO t1 VALUES ('This is a test.');
source include/test_fieldsize.inc;
let $test_table_master = CREATE TABLE t1 (a VARCHAR(2000));
let $test_table_slave = CREATE TABLE t1 (a VARCHAR(1000));
let $test_insert = INSERT INTO t1 VALUES ('This is a test.');
source include/test_fieldsize.inc;
#
# Test: Checking MYSQL_TYPE_BLOB fields
#
--echo Checking MYSQL_TYPE_BLOB fields
let $test_table_master = CREATE TABLE t1 (a LONGBLOB);
let $test_table_slave = CREATE TABLE t1 (a TINYBLOB);
let $test_insert = INSERT INTO t1 VALUES ('This is a test.');
source include/test_fieldsize.inc;
--echo *** Cleanup ***
connection master;
DROP TABLE IF EXISTS t1;
sync_slave_with_master;
# END 5.1 Test Case
......@@ -33,6 +33,73 @@ a b c d e
3 4 QA NULL NULL
*** Drop t1 ***
DROP TABLE t1;
*** Create t2 on slave ***
STOP SLAVE;
RESET SLAVE;
CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
ENGINE='NDB';
*** Create t2 on Master ***
CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
) ENGINE='NDB';
RESET MASTER;
*** Master Data Insert ***
INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
SELECT * FROM t2 ORDER BY a;
a b c
1 2 Kyle, TEX
2 1 JOE AUSTIN
3 4 QA TESTING
*** Start Slave ***
START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
a b c d e
RESET MASTER;
START SLAVE;
*** Drop t2 ***
DROP TABLE t2;
*** Create t3 on slave ***
STOP SLAVE;
RESET SLAVE;
......@@ -57,7 +124,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -69,7 +136,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -88,8 +155,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -119,7 +186,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -131,7 +198,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -150,8 +217,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -181,7 +248,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -193,7 +260,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -212,8 +279,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -242,7 +309,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -254,7 +321,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -273,8 +340,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
......@@ -354,7 +421,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -366,7 +433,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -385,8 +452,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -415,7 +482,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -427,7 +494,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -446,8 +513,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -605,7 +672,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -617,7 +684,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1060
......@@ -636,8 +703,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1060
Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......@@ -741,7 +808,7 @@ SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
......@@ -753,7 +820,7 @@ Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1532
......@@ -772,8 +839,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1532
Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
......
This diff is collapsed.
......@@ -151,6 +151,24 @@ class Field
table, which is located on disk).
*/
virtual uint32 pack_length_in_rec() const { return pack_length(); }
virtual int compatible_field_size(uint field_metadata);
virtual uint pack_length_from_metadata(uint field_metadata)
{ return field_metadata; }
/*
This method is used to return the size of the data in a row-based
replication row record. The default implementation of returning 0 is
designed to allow fields that do not use metadata to return TRUE (1)
from compatible_field_size() which uses this function in the comparison.
The default value for field metadata for fields that do not have
metadata is 0. Thus, 0 == 0 means the fields are compatible in size.
Note: While most classes that override this method return pack_length(),
the classes Field_string, Field_varstring, and Field_blob return
field_length + 1, field_length, and pack_length_no_ptr() respectfully.
*/
virtual uint row_pack_length() { return 0; }
virtual int save_field_metadata(uchar *first_byte)
{ return do_save_field_metadata(first_byte); }
/*
data_length() return the "real size" of the data in memory.
......@@ -463,6 +481,19 @@ class Field
overridden by subclasses.
*/
virtual size_t do_last_null_byte() const;
/**
Retrieve the field metadata for fields.
This default implementation returns 0 and saves 0 in the metadata_ptr
value.
@param metadata_ptr First byte of field metadata
@returns 0 no bytes written.
*/
virtual int do_save_field_metadata(uchar *metadata_ptr)
{ return 0; }
};
......@@ -589,6 +620,8 @@ class Field_decimal :public Field_real {
/* New decimal/numeric field which use fixed point arithmetic */
class Field_new_decimal :public Field_num {
private:
int do_save_field_metadata(uchar *first_byte);
public:
/* The maximum number of decimal digits can be stored */
uint precision;
......@@ -628,6 +661,9 @@ class Field_new_decimal :public Field_num {
uint32 max_display_length() { return field_length; }
uint size_of() const { return sizeof(*this); }
uint32 pack_length() const { return (uint32) bin_size; }
uint pack_length_from_metadata(uint field_metadata);
uint row_pack_length() { return pack_length(); }
int compatible_field_size(uint field_metadata);
uint is_equal(Create_field *new_field);
virtual const uchar *unpack(uchar* to, const uchar *from, uint param_data);
};
......@@ -834,7 +870,10 @@ class Field_float :public Field_real {
int cmp(const uchar *,const uchar *);
void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return sizeof(float); }
uint row_pack_length() { return pack_length(); }
void sql_type(String &str) const;
private:
int do_save_field_metadata(uchar *first_byte);
};
......@@ -871,7 +910,10 @@ class Field_double :public Field_real {
int cmp(const uchar *,const uchar *);
void sort_string(uchar *buff,uint length);
uint32 pack_length() const { return sizeof(double); }
uint row_pack_length() { return pack_length(); }
void sql_type(String &str) const;
private:
int do_save_field_metadata(uchar *first_byte);
};
......@@ -1168,6 +1210,9 @@ class Field_string :public Field_longstr {
uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0);
virtual const uchar *unpack(uchar* to, const uchar *from, uint param_data);
const uchar *unpack(uchar* to, const uchar *from);
uint pack_length_from_metadata(uint field_metadata)
{ return (field_metadata & 0x00ff); }
uint row_pack_length() { return (field_length + 1); }
int pack_cmp(const uchar *a,const uchar *b,uint key_length,
my_bool insert_or_update);
int pack_cmp(const uchar *b,uint key_length,my_bool insert_or_update);
......@@ -1179,6 +1224,8 @@ class Field_string :public Field_longstr {
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
virtual uint get_key_image(uchar *buff,uint length, imagetype type);
private:
int do_save_field_metadata(uchar *first_byte);
};
......@@ -1214,6 +1261,7 @@ class Field_varstring :public Field_longstr {
enum_field_types type() const { return MYSQL_TYPE_VARCHAR; }
enum ha_base_keytype key_type() const;
uint row_pack_length() { return field_length; }
bool zero_pack() const { return 0; }
int reset(void) { bzero(ptr,field_length+length_bytes); return 0; }
uint32 pack_length() const { return (uint32) field_length+length_bytes; }
......@@ -1265,6 +1313,8 @@ class Field_varstring :public Field_longstr {
uint new_null_bit);
uint is_equal(Create_field *new_field);
void hash(ulong *nr, ulong *nr2);
private:
int do_save_field_metadata(uchar *first_byte);
};
......@@ -1330,10 +1380,11 @@ class Field_blob :public Field_longstr {
This is used to determine the size of the actual data in the row
buffer.
@retval The length of the raw data itself without the pointer.
@returns The length of the raw data itself without the pointer.
*/
uint32 pack_length_no_ptr() const
{ return (uint32) (packlength); }
uint row_pack_length() { return pack_length_no_ptr(); }
uint32 sort_length() const;
inline uint32 max_data_length() const
{
......@@ -1356,7 +1407,7 @@ class Field_blob :public Field_longstr {
This is used to determine the size of the data plus the
packed length portion in the row data.
@retval The length in the row plus the size of the data.
@returns The length in the row plus the size of the data.
*/
uint32 get_packed_size(const uchar *ptr)
{return packlength + get_length((const uchar *)ptr);}
......@@ -1424,6 +1475,8 @@ class Field_blob :public Field_longstr {
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
uint32 max_display_length();
uint is_equal(Create_field *new_field);
private:
int do_save_field_metadata(uchar *first_byte);
};
......@@ -1493,12 +1546,17 @@ class Field_enum :public Field_str {
void sql_type(String &str) const;
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return MYSQL_TYPE_ENUM; }
uint pack_length_from_metadata(uint field_metadata)
{ return (field_metadata & 0x00ff); }
uint row_pack_length() { return pack_length(); }
virtual bool zero_pack() const { return 0; }
bool optimize_range(uint idx, uint part) { return 0; }
bool eq_def(Field *field);
bool has_charset(void) const { return TRUE; }
/* enum and set are sorted as integers */
CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
private:
int do_save_field_metadata(uchar *first_byte);
};
......@@ -1519,6 +1577,7 @@ class Field_set :public Field_enum {
int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr) { return Field_set::store((longlong) nr, FALSE); }
int store(longlong nr, bool unsigned_val);
virtual bool zero_pack() const { return 1; }
String *val_str(String*,String *);
void sql_type(String &str) const;
......@@ -1582,6 +1641,10 @@ class Field_bit :public Field {
{ get_key_image(buff, length, itRAW); }
uint32 pack_length() const { return (uint32) (field_length + 7) / 8; }
uint32 pack_length_in_rec() const { return bytes_in_rec; }
uint pack_length_from_metadata(uint field_metadata);
uint row_pack_length()
{ return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); }
int compatible_field_size(uint field_metadata);
void sql_type(String &str) const;
uchar *pack(uchar *to, const uchar *from, uint max_length=~(uint) 0);
virtual const uchar *unpack(uchar *to, const uchar *from, uint param_data);
......@@ -1612,6 +1675,7 @@ class Field_bit :public Field {
private:
virtual size_t do_last_null_byte() const;
int do_save_field_metadata(uchar *first_byte);
};
......
......@@ -6382,63 +6382,18 @@ void Rows_log_event::print_helper(FILE *file,
Table_map_log_event member functions and support functions
**************************************************************************/
/**
* Calculate field metadata size based on the real_type of the field.
*
* @returns int Size of field metadata.
*/
#if !defined(MYSQL_CLIENT)
const int Table_map_log_event::calc_field_metadata_size()
{
DBUG_ENTER("Table_map_log_event::calc_field_metadata_size");
int size= 0;
for (unsigned int i= 0 ; i < m_table->s->fields ; i++)
{
switch (m_table->s->field[i]->real_type()) {
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_FLOAT:
{
size++; // Store one byte here.
break;
}
case MYSQL_TYPE_BIT:
case MYSQL_TYPE_NEWDECIMAL:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_SET:
{
size= size + 2; // Store short int here.
break;
}
default:
break;
}
}
m_field_metadata_size= size;
DBUG_PRINT("info", ("Table_map_log_event: %d bytes in field metadata.",
(int)m_field_metadata_size));
DBUG_RETURN(m_field_metadata_size);
}
#endif /* !defined(MYSQL_CLIENT) */
/**
@page How replication of field metadata works.
When a table map is created, the master first calls
Table_map_log_event::get_field_metadata_size() which calculates how many
Table_map_log_event::save_field_metadata() which calculates how many
values will be in the field metadata. Only those fields that require the
extra data are added (see table above). The master then loops through all
of the fields in the table calling the method
Table_map_log_event::get_field_metadata() which returns the values for the
field that will be saved in the metadata and replicated to the slave. Once
all fields have been processed, the table map is written to the binlog
adding the size of the field metadata and the field metadata to the end of
the body of the table map.
extra data are added. The method also loops through all of the fields in
the table calling the method Field::save_field_metadata() which returns the
values for the field that will be saved in the metadata and replicated to
the slave. Once all fields have been processed, the table map is written to
the binlog adding the size of the field metadata and the field metadata to
the end of the body of the table map.
When a table map is read on the slave, the field metadata is read from the
table map and passed to the table_def class constructor which saves the
......@@ -6478,64 +6433,8 @@ int Table_map_log_event::save_field_metadata()
DBUG_ENTER("Table_map_log_event::save_field_metadata");
int index= 0;
for (unsigned int i= 0 ; i < m_table->s->fields ; i++)
{
switch (m_table->s->field[i]->real_type()) {
case MYSQL_TYPE_NEWDECIMAL:
{
m_field_metadata[index++]=
(uchar)((Field_new_decimal *)m_table->s->field[i])->precision;
m_field_metadata[index++]=
(uchar)((Field_new_decimal *)m_table->s->field[i])->decimals();
break;
}
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
{
m_field_metadata[index++]=
(uchar)((Field_blob *)m_table->s->field[i])->pack_length_no_ptr();
break;
}
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_FLOAT:
{
m_field_metadata[index++]= (uchar)m_table->s->field[i]->pack_length();
break;
}
case MYSQL_TYPE_BIT:
{
m_field_metadata[index++]=
(uchar)((Field_bit *)m_table->s->field[i])->bit_len;
m_field_metadata[index++]=
(uchar)((Field_bit *)m_table->s->field[i])->bytes_in_rec;
break;
}
case MYSQL_TYPE_VARCHAR:
{
char *ptr= (char *)&m_field_metadata[index];
int2store(ptr, m_table->s->field[i]->field_length);
index= index + 2;
break;
}
case MYSQL_TYPE_STRING:
{
m_field_metadata[index++]= (uchar)m_table->s->field[i]->real_type();
m_field_metadata[index++]= m_table->s->field[i]->field_length;
break;
}
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
{
m_field_metadata[index++]= (uchar)m_table->s->field[i]->real_type();
m_field_metadata[index++]= m_table->s->field[i]->pack_length();
break;
}
default:
break;
}
}
DBUG_RETURN(0);
index+= m_table->s->field[i]->save_field_metadata(&m_field_metadata[index]);
DBUG_RETURN(index);
}
#endif /* !defined(MYSQL_CLIENT) */
......@@ -6573,16 +6472,6 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
m_data_size+= m_dblen + 2; // Include length and terminating \0
m_data_size+= m_tbllen + 2; // Include length and terminating \0
m_data_size+= 1 + m_colcnt; // COLCNT and column types
m_field_metadata_size= calc_field_metadata_size();
/*
Now set the size of the data to the size of the field metadata array
plus one or two bytes for number of elements in the field metadata array.
*/
if (m_field_metadata_size > 255)
m_data_size+= m_field_metadata_size + 2;
else
m_data_size+= m_field_metadata_size + 1;
/* If malloc fails, catched in is_valid() */
if ((m_memory= (uchar*) my_malloc(m_colcnt, MYF(MY_WME))))
......@@ -6602,17 +6491,31 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
m_data_size+= num_null_bytes;
m_meta_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
&m_null_bits, num_null_bytes,
&m_field_metadata, m_field_metadata_size,
&m_field_metadata, (m_colcnt * 2),
NULL);
bzero(m_field_metadata, (m_colcnt * 2));
/*
Create an array for the field metadata and store it.
*/
m_field_metadata_size= save_field_metadata();
DBUG_ASSERT(m_field_metadata_size <= (m_colcnt * 2));
/*
Now set the size of the data to the size of the field metadata array
plus one or two bytes for number of elements in the field metadata array.
*/
if (m_field_metadata_size > 255)
m_data_size+= m_field_metadata_size + 2;
else
m_data_size+= m_field_metadata_size + 1;
bzero(m_null_bits, num_null_bytes);
for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
if (m_table->field[i]->maybe_null())
m_null_bits[(i / 8)]+= 1 << (i % 8);
/*
Create an array for the field metadata and store it.
*/
save_field_metadata();
}
#endif /* !defined(MYSQL_CLIENT) */
......
......@@ -2049,7 +2049,6 @@ class Table_map_log_event : public Log_event
virtual int get_data_size() { return m_data_size; }
#ifndef MYSQL_CLIENT
virtual const int calc_field_metadata_size();
virtual int save_field_metadata();
virtual bool write_data_header(IO_CACHE *file);
virtual bool write_data_body(IO_CACHE *file);
......@@ -2090,7 +2089,7 @@ class Table_map_log_event : public Log_event
uchar *m_field_metadata; // buffer for field metadata
/*
The size of field metadata buffer set by calling calc_field_metadata_size()
The size of field metadata buffer set by calling save_field_metadata()
*/
ulong m_field_metadata_size;
uchar *m_null_bits;
......
......@@ -156,6 +156,25 @@ table_def::compatible_with(RELAY_LOG_INFO const *rli_arg, TABLE *table)
rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
}
/*
Check the slave's field size against that of the master.
*/
if (!error &&
!table->field[col]->compatible_field_size(field_metadata(col)))
{
error= 1;
char buf[256];
my_snprintf(buf, sizeof(buf), "Column %d size mismatch - "
"master has size %d, %s.%s on slave has size %d."
" Master's column size should be <= the slave's "
"column size.", col,
table->field[col]->pack_length_from_metadata(
m_field_metadata[col]),
tsh->db.str, tsh->table_name.str,
table->field[col]->row_pack_length());
rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
}
}
return error;
......
......@@ -61,7 +61,7 @@ class table_def
*/
table_def(field_type *types, ulong size, uchar *field_metadata,
int metadata_size, uchar *null_bitmap)
: m_size(size), m_type(0),
: m_size(size), m_type(0), m_field_metadata_size(metadata_size),
m_field_metadata(0), m_null_bits(0), m_memory(NULL)
{
m_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
......@@ -190,7 +190,7 @@ class table_def
uint16 field_metadata(uint index) const
{
DBUG_ASSERT(index < m_size);
if (m_field_metadata)
if (m_field_metadata_size)
return m_field_metadata[index];
else
return 0;
......@@ -239,6 +239,7 @@ class table_def
ulong m_size; // Number of elements in the types array
field_type *m_type; // Array of type descriptors
uint16 *m_field_metadata;
uint m_field_metadata_size;
uchar *m_null_bits;
uchar *m_memory;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment