Below is the list of changes that have just been committed into a local
5.1 repository of cbell. When cbell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-05-17 16:47:08-04:00, cbell@stripped +5 -0
BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash
This patch adds code to gracefully exit the slave thread whenever a
condition where the master column data exceeds the size of the client
column for character fields.
A test was enabled to test for this condition. The test includes a step
to correct the problem and replay the replication logs.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test@stripped, 2007-05-17 16:45:16-04:00, cbell@stripped +55 -33
BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash
This patch enables a test inserted previously to detect the condition.
The test has been modified to include correction of the problem on the
slave and restarting the slave to continue replication.
mysql-test/r/rpl_extraCol_innodb.result@stripped, 2007-05-17 16:45:16-04:00, cbell@stripped +45 -0
BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash
This patch adds the results from executing the enabled test in
rpl_extraSlave_Col.test from the ./extra folder.
mysql-test/r/rpl_extraCol_myisam.result@stripped, 2007-05-17 16:45:16-04:00, cbell@stripped +46 -0
BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash
This patch adds the results from executing the enabled test in
rpl_extraSlave_Col.test from the ./extra folder.
mysql-test/r/rpl_ndb_extraCol.result@stripped, 2007-05-17 16:45:16-04:00, cbell@stripped +45 -0
BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash
This patch adds the results from executing the enabled test in
rpl_extraSlave_Col.test from the ./extra folder.
sql/rpl_record.cc@stripped, 2007-05-17 16:45:16-04:00, cbell@stripped +20 -0
BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash
This patch adds an error handler to the unpack method to detect when
a column from the master is large than that on the slave for character
fields. If there is a mismatch, an error is thrown allowing user to
correct the problem and restart replication.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: cbell
# Host: suse.vabb.com
# Root: /home/Chuck/source/mysql-5.1_BUG_22086
--- 1.1/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2006-11-03 09:03:40 -05:00
+++ 1.2/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2007-05-17 16:45:16 -04:00
@@ -67,39 +67,61 @@
### Should Stop Slave or truncate value ###
############################################
-## 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 *** Select from slave ***
-#sync_slave_with_master;
-#SELECT * FROM t2 ORDER BY a;
-
-#--echo *** Drop t2 ***
-#connection master;
-#DROP TABLE t2;
-#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,'Sam'),
+ (2,1,'Kyle, TEX'),
+ (3,5,'JOE AUSTIN'),
+ (4,4,'QA TESTING');
+SELECT * FROM t2 ORDER BY a;
+
+--echo ********************************************
+--echo *** Expect slave to fail with Error 1406 ***
+--echo ********************************************
+connection slave;
+wait_for_slave_to_stop;
+
+--echo ********************************************
+--echo *** Repair column and restart slave. ***
+--echo ********************************************
+--echo *** Select from slave ***
+SELECT * FROM t2 ORDER BY a;
+ALTER TABLE t2 CHANGE c c CHAR(10);
+START SLAVE;
+
+connection master;
+sync_slave_with_master;
+
+connection slave;
+
+--echo *** Select from slave ***
+SELECT * FROM t2 ORDER BY a;
+
+--echo *** Drop t2 ***
+connection master;
+DROP TABLE t2;
+sync_slave_with_master;
####################################
### Try to replicate BLOB to INT ###
--- 1.3/mysql-test/r/rpl_extraCol_innodb.result 2007-03-29 15:59:03 -04:00
+++ 1.4/mysql-test/r/rpl_extraCol_innodb.result 2007-05-17 16:45:16 -04:00
@@ -33,6 +33,51 @@
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;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t2 () VALUES
+(1,2,'Sam'),
+(2,1,'Kyle, TEX'),
+(3,5,'JOE AUSTIN'),
+(4,4,'QA TESTING');
+SELECT * FROM t2 ORDER BY a;
+a b c
+1 2 Sam
+2 1 Kyle, TEX
+3 5 JOE AUSTIN
+4 4 QA TESTING
+********************************************
+*** Expect slave to fail with Error 1406 ***
+********************************************
+********************************************
+*** Repair column and restart slave. ***
+********************************************
+*** Select from slave ***
+SELECT * FROM t2 ORDER BY a;
+a b c d e
+ALTER TABLE t2 CHANGE c c CHAR(10);
+START SLAVE;
+*** Select from slave ***
+SELECT * FROM t2 ORDER BY a;
+a b c d e
+1 2 Sam 2 TEST2
+2 1 Kyle, TEX 2 TEST2
+3 5 JOE AUSTIN 2 TEST2
+4 4 QA TESTING 2 TEST2
+*** Drop t2 ***
+DROP TABLE t2;
*** Create t3 on slave ***
STOP SLAVE;
RESET SLAVE;
--- 1.3/mysql-test/r/rpl_extraCol_myisam.result 2007-03-29 15:59:03 -04:00
+++ 1.4/mysql-test/r/rpl_extraCol_myisam.result 2007-05-17 16:45:16 -04:00
@@ -33,6 +33,52 @@
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;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t2 () VALUES
+(1,2,'Sam'),
+(2,1,'Kyle, TEX'),
+(3,5,'JOE AUSTIN'),
+(4,4,'QA TESTING');
+SELECT * FROM t2 ORDER BY a;
+a b c
+1 2 Sam
+2 1 Kyle, TEX
+3 5 JOE AUSTIN
+4 4 QA TESTING
+********************************************
+*** Expect slave to fail with Error 1406 ***
+********************************************
+********************************************
+*** Repair column and restart slave. ***
+********************************************
+*** Select from slave ***
+SELECT * FROM t2 ORDER BY a;
+a b c d e
+1 2 Sam 2 TEST2
+ALTER TABLE t2 CHANGE c c CHAR(10);
+START SLAVE;
+*** Select from slave ***
+SELECT * FROM t2 ORDER BY a;
+a b c d e
+1 2 Sam 2 TEST2
+2 1 Kyle, TEX 2 TEST2
+3 5 JOE AUSTIN 2 TEST2
+4 4 QA TESTING 2 TEST2
+*** Drop t2 ***
+DROP TABLE t2;
*** Create t3 on slave ***
STOP SLAVE;
RESET SLAVE;
--- 1.4/mysql-test/r/rpl_ndb_extraCol.result 2007-04-02 04:54:26 -04:00
+++ 1.5/mysql-test/r/rpl_ndb_extraCol.result 2007-05-17 16:45:16 -04:00
@@ -33,6 +33,51 @@
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;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t2 () VALUES
+(1,2,'Sam'),
+(2,1,'Kyle, TEX'),
+(3,5,'JOE AUSTIN'),
+(4,4,'QA TESTING');
+SELECT * FROM t2 ORDER BY a;
+a b c
+1 2 Sam
+2 1 Kyle, TEX
+3 5 JOE AUSTIN
+4 4 QA TESTING
+********************************************
+*** Expect slave to fail with Error 1406 ***
+********************************************
+********************************************
+*** Repair column and restart slave. ***
+********************************************
+*** Select from slave ***
+SELECT * FROM t2 ORDER BY a;
+a b c d e
+ALTER TABLE t2 CHANGE c c CHAR(10);
+START SLAVE;
+*** Select from slave ***
+SELECT * FROM t2 ORDER BY a;
+a b c d e
+1 2 Sam NULL NULL
+2 1 Kyle, TEX NULL NULL
+3 5 JOE AUSTIN NULL NULL
+4 4 QA TESTING NULL NULL
+*** Drop t2 ***
+DROP TABLE t2;
*** Create t3 on slave ***
STOP SLAVE;
RESET SLAVE;
--- 1.2/sql/rpl_record.cc 2007-04-13 13:19:07 -04:00
+++ 1.3/sql/rpl_record.cc 2007-05-17 16:45:16 -04:00
@@ -218,6 +218,26 @@
{
f->set_notnull();
+ if ((f->type() == MYSQL_TYPE_VARCHAR) ||
+ (f->type() == MYSQL_TYPE_STRING) ||
+ (f->type() == MYSQL_TYPE_VAR_STRING))
+ {
+ uint len= 0;
+
+ if (f->field_length > 255)
+ len= uint2korr(pack_ptr);
+ else
+ len= (uint)*pack_ptr;
+ if (f->field_length < len)
+ {
+ slave_print_msg(ERROR_LEVEL, rli, ER_DATA_TOO_LONG,
+ "Length mismatch for table.column '%s.%s' - "
+ "master has length %d, slave has length %d",
+ *f->table_name, f->field_name, len, f->field_length);
+ error= ER_DATA_TOO_LONG;
+ DBUG_RETURN(error);
+ }
+ }
/*
We only unpack the field if it was non-null
*/
| Thread |
|---|
| • bk commit into 5.1 tree (cbell:1.2579) BUG#22086 | cbell | 17 May |