2006-11-03 16:31:25 +01:00
|
|
|
stop slave;
|
|
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
|
|
reset master;
|
|
|
|
reset slave;
|
|
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
|
|
start slave;
|
2009-08-28 16:13:27 +02:00
|
|
|
call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
|
2006-11-03 16:31:25 +01:00
|
|
|
**** Diff Table Def Start ****
|
|
|
|
*** On Slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
WL#5151: Conversion between different types when replicating
Row-based replication requires the types of columns on the
master and slave to be approximately the same (some safe
conversions between strings are allowed), but does not
allow safe conversions between fields of similar types such
as TINYINT and INT.
This patch implement type conversions between similar fields
on the master and slave.
The conversions are controlled using a new variable
SLAVE_TYPE_CONVERSIONS of type SET('ALL_LOSSY','ALL_NON_LOSSY').
Non-lossy conversions are any conversions that do not run the
risk of losing any information, while lossy conversions can
potentially truncate the value. The column definitions are
checked to decide if the conversion is acceptable.
If neither conversion is enabled, it is required that the
definitions of the columns are identical on master and slave.
Conversion is done by creating an internal conversion table,
unpacking the master data into it, and then copy the data to
the real table on the slave.
.bzrignore:
New files added
client/Makefile.am:
New files added
client/mysqlbinlog.cc:
Functions in rpl_utility.cc is now needed by mysqlbinlog.cc.
libmysqld/Makefile.am:
New files added
mysql-test/extra/rpl_tests/check_type.inc:
Test include file to check a single type conversion.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Switching to use INT instead of TEXT for column that should not have matching types.
mysql-test/extra/rpl_tests/rpl_row_basic.test:
Adding code to enable type conversions for BIT tests since InnoDB
cannot handle them properly due to incorrect information stored as
metadata.
mysql-test/extra/rpl_tests/type_conversions.test:
Test file to check a set of type conversions
with current settings of slave_type_conversions.
mysql-test/suite/rpl/t/rpl_typeconv.test:
Test file to test conversions from master to slave with
all possible values for slave_type_conversions.
The test also checks that the slave_type_conversions
variable works as expected.
sql/field.cc:
Changing definition of compatible_field_size to both check if
two field with identical base types are compatible and give an
order between them if they are compatible.
This only implement checking on the slave, so it will not affect
replication from an old master to a new slave.
sql/field.h:
Changing prototypes for functions:
- compatible_field_size()
- init_for_tmp_table()
- row_pack_length()
sql/log_event.cc:
Changing compability checks to build a conversion table if the fields
are compatible, but does not have the same base type.
sql/log_event_old.cc:
Changing compability checks to build a conversion table if the fields
are compatible, but does not have the same base type.
sql/mysql_priv.h:
Adding global option variable for SLAVE_TYPE_CONVERSIONS
sql/mysqld.cc:
Adding SLAVE_TYPE_CONVERSIONS global server variable.
sql/rpl_record.cc:
Changing unpack_row to use the conversion table if present.
sql/rpl_rli.h:
Removing function get_tabledef and replacing it with get_table_data().
This function retrieve data for table opened for replication, not just
table definition.
sql/rpl_utility.cc:
Function table_def::compatible_with is changed to compare table on master
and slave for compatibility and generate a conversions table if they are
compatible.
Computing real type of fields from metadata for ENUM and SET types.
Computing pack_length correctly for ENUM, SET, and BLOB types.
Adding optimization to not check compatibility if no
slave type conversions are enabled.
sql/rpl_utility.h:
Changing prototypes since implementation has changed.
Modifying table_def::type() to return real type instead of stored type.
sql/set_var.cc:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/set_var.h:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/share/errmsg.txt:
Adding error messages for slave type conversions.
sql/sql_class.h:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/sql_select.cc:
Correcting create_virtual_tmp_table() to compute null bit positions
correctly in the presence of bit fields.
2009-12-14 12:04:55 +01:00
|
|
|
SET @saved_slave_type_conversions = @@slave_type_conversions;
|
|
|
|
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
|
2006-11-03 16:31:25 +01:00
|
|
|
CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(4) DEFAULT 'TEST')
|
|
|
|
ENGINE='MyISAM';
|
|
|
|
*** Create t1 on Master ***
|
|
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c CHAR(10)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
INSERT INTO t1 () VALUES(1,2,'TEXAS'),(2,1,'AUSTIN'),(3,4,'QA');
|
|
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
a b c
|
|
|
|
1 2 TEXAS
|
|
|
|
2 1 AUSTIN
|
|
|
|
3 4 QA
|
|
|
|
*** Select from slave ***
|
|
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
a b c d e
|
|
|
|
1 2 TEXAS 2 TEST
|
|
|
|
2 1 AUSTIN 2 TEST
|
|
|
|
3 4 QA 2 TEST
|
WL#5151: Conversion between different types when replicating
Row-based replication requires the types of columns on the
master and slave to be approximately the same (some safe
conversions between strings are allowed), but does not
allow safe conversions between fields of similar types such
as TINYINT and INT.
This patch implement type conversions between similar fields
on the master and slave.
The conversions are controlled using a new variable
SLAVE_TYPE_CONVERSIONS of type SET('ALL_LOSSY','ALL_NON_LOSSY').
Non-lossy conversions are any conversions that do not run the
risk of losing any information, while lossy conversions can
potentially truncate the value. The column definitions are
checked to decide if the conversion is acceptable.
If neither conversion is enabled, it is required that the
definitions of the columns are identical on master and slave.
Conversion is done by creating an internal conversion table,
unpacking the master data into it, and then copy the data to
the real table on the slave.
.bzrignore:
New files added
client/Makefile.am:
New files added
client/mysqlbinlog.cc:
Functions in rpl_utility.cc is now needed by mysqlbinlog.cc.
libmysqld/Makefile.am:
New files added
mysql-test/extra/rpl_tests/check_type.inc:
Test include file to check a single type conversion.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Switching to use INT instead of TEXT for column that should not have matching types.
mysql-test/extra/rpl_tests/rpl_row_basic.test:
Adding code to enable type conversions for BIT tests since InnoDB
cannot handle them properly due to incorrect information stored as
metadata.
mysql-test/extra/rpl_tests/type_conversions.test:
Test file to check a set of type conversions
with current settings of slave_type_conversions.
mysql-test/suite/rpl/t/rpl_typeconv.test:
Test file to test conversions from master to slave with
all possible values for slave_type_conversions.
The test also checks that the slave_type_conversions
variable works as expected.
sql/field.cc:
Changing definition of compatible_field_size to both check if
two field with identical base types are compatible and give an
order between them if they are compatible.
This only implement checking on the slave, so it will not affect
replication from an old master to a new slave.
sql/field.h:
Changing prototypes for functions:
- compatible_field_size()
- init_for_tmp_table()
- row_pack_length()
sql/log_event.cc:
Changing compability checks to build a conversion table if the fields
are compatible, but does not have the same base type.
sql/log_event_old.cc:
Changing compability checks to build a conversion table if the fields
are compatible, but does not have the same base type.
sql/mysql_priv.h:
Adding global option variable for SLAVE_TYPE_CONVERSIONS
sql/mysqld.cc:
Adding SLAVE_TYPE_CONVERSIONS global server variable.
sql/rpl_record.cc:
Changing unpack_row to use the conversion table if present.
sql/rpl_rli.h:
Removing function get_tabledef and replacing it with get_table_data().
This function retrieve data for table opened for replication, not just
table definition.
sql/rpl_utility.cc:
Function table_def::compatible_with is changed to compare table on master
and slave for compatibility and generate a conversions table if they are
compatible.
Computing real type of fields from metadata for ENUM and SET types.
Computing pack_length correctly for ENUM, SET, and BLOB types.
Adding optimization to not check compatibility if no
slave type conversions are enabled.
sql/rpl_utility.h:
Changing prototypes since implementation has changed.
Modifying table_def::type() to return real type instead of stored type.
sql/set_var.cc:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/set_var.h:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/share/errmsg.txt:
Adding error messages for slave type conversions.
sql/sql_class.h:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/sql_select.cc:
Correcting create_virtual_tmp_table() to compute null bit positions
correctly in the presence of bit fields.
2009-12-14 12:04:55 +01:00
|
|
|
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
2006-11-03 16:31:25 +01:00
|
|
|
*** Drop t1 ***
|
|
|
|
DROP TABLE t1;
|
2007-08-10 18:48:01 +02:00
|
|
|
*** 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;
|
2010-01-07 16:39:11 +01:00
|
|
|
Slave failed with Error 1677
|
2007-08-10 18:48:01 +02:00
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
SELECT * FROM t2 ORDER BY a;
|
|
|
|
a b c d e
|
|
|
|
RESET MASTER;
|
|
|
|
START SLAVE;
|
|
|
|
*** Drop t2 ***
|
|
|
|
DROP TABLE t2;
|
2006-11-03 16:31:25 +01:00
|
|
|
*** Create t3 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(5) DEFAULT 'TEST2')
|
|
|
|
ENGINE='MyISAM';
|
|
|
|
*** Create t3 on Master ***
|
|
|
|
CREATE TABLE t3 (a BLOB, b INT PRIMARY KEY, c CHAR(20)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
|
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
*** Expect slave to fail with Error 1677 ***
|
2006-11-03 16:31:25 +01:00
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
Slave failed with Error 1677
|
2006-11-03 16:31:25 +01:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
*** Drop t3 ***
|
|
|
|
DROP TABLE t3;
|
|
|
|
*** Create t4 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(5) DEFAULT 'TEST2')
|
|
|
|
ENGINE='MyISAM';
|
|
|
|
*** Create t4 on Master ***
|
|
|
|
CREATE TABLE t4 (a DECIMAL(8,2), b INT PRIMARY KEY, c CHAR(20)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
|
|
|
|
(30000.22,4,'QA TESTING');
|
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
*** Expect slave to fail with Error 1677 ***
|
2006-11-03 16:31:25 +01:00
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
Slave failed with Error 1677
|
2006-11-03 16:31:25 +01:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
*** Drop t4 ***
|
|
|
|
DROP TABLE t4;
|
|
|
|
*** Create t5 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
|
|
|
|
c FLOAT, d INT, e DOUBLE,
|
|
|
|
f DECIMAL(8,2))ENGINE='MyISAM';
|
|
|
|
*** Create t5 on Master ***
|
|
|
|
CREATE TABLE t5 (a INT PRIMARY KEY, b VARCHAR(6),
|
|
|
|
c DECIMAL(8,2), d BIT, e BLOB,
|
|
|
|
f FLOAT) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
|
|
|
|
(2,'JOE',300.01,0,'b2b2',1.0000009);
|
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
*** Expect slave to fail with Error 1677 ***
|
2006-11-03 16:31:25 +01:00
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
Slave failed with Error 1677
|
2006-11-03 16:31:25 +01:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
*** Drop t5 ***
|
|
|
|
DROP TABLE t5;
|
|
|
|
*** Create t6 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
|
|
|
|
c FLOAT, d INT)ENGINE='MyISAM';
|
|
|
|
*** Create t6 on Master ***
|
|
|
|
CREATE TABLE t6 (a INT PRIMARY KEY, b VARCHAR(6),
|
|
|
|
c DECIMAL(8,2), d BIT
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
|
|
|
|
(2,'JOE',300.01,0);
|
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
*** Expect slave to fail with Error 1677 ***
|
2006-11-03 16:31:25 +01:00
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
Slave failed with Error 1677
|
2006-11-03 16:31:25 +01:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
|
|
|
|
*** Drop t6 ***
|
|
|
|
DROP TABLE t6;
|
|
|
|
DROP TABLE t6;
|
|
|
|
START SLAVE;
|
|
|
|
**** Diff Table Def End ****
|
|
|
|
**** Extra Colums Start ****
|
|
|
|
*** Create t7 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
|
|
|
|
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
|
|
|
|
e CHAR(20) DEFAULT 'Extra Column Testing')
|
|
|
|
ENGINE='MyISAM';
|
|
|
|
*** Create t7 on Master ***
|
|
|
|
CREATE TABLE t7 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t7 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
SELECT * FROM t7 ORDER BY a;
|
|
|
|
a b c
|
|
|
|
1 b1b1 Kyle
|
|
|
|
2 b1b1 JOE
|
|
|
|
3 b1b1 QA
|
|
|
|
*** Select from slave ***
|
|
|
|
SELECT * FROM t7 ORDER BY a;
|
|
|
|
a b c d e
|
|
|
|
1 b1b1 Kyle 0000-00-00 00:00:00 Extra Column Testing
|
|
|
|
2 b1b1 JOE 0000-00-00 00:00:00 Extra Column Testing
|
|
|
|
3 b1b1 QA 0000-00-00 00:00:00 Extra Column Testing
|
|
|
|
*** Drop t7 ***
|
|
|
|
DROP TABLE t7;
|
|
|
|
*** Create t8 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
|
|
|
|
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
|
|
|
|
e INT)ENGINE='MyISAM';
|
|
|
|
*** Create t8 on Master ***
|
|
|
|
CREATE TABLE t8 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
*** Drop t8 ***
|
|
|
|
DROP TABLE t8;
|
2008-03-06 19:32:47 +01:00
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
|
|
|
|
d TIMESTAMP,
|
2009-09-29 16:04:21 +02:00
|
|
|
e INT NOT NULL,
|
|
|
|
f text not null,
|
|
|
|
g text,
|
|
|
|
h blob not null,
|
|
|
|
i blob) ENGINE='MyISAM';
|
2008-03-06 19:32:47 +01:00
|
|
|
*** Create t9 on Master ***
|
|
|
|
CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
2009-09-29 16:04:21 +02:00
|
|
|
select * from t9;
|
|
|
|
a b c d e f g h i
|
|
|
|
1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL
|
|
|
|
2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL
|
|
|
|
3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL
|
2006-11-03 16:31:25 +01:00
|
|
|
*** Create t10 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
|
|
|
|
c CHAR(5), e INT DEFAULT '1')ENGINE='MyISAM';
|
|
|
|
*** Create t10 on Master ***
|
|
|
|
CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
*** Expect slave to fail with Error 1677 ***
|
2006-11-03 16:31:25 +01:00
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
Slave failed with Error 1677
|
2006-11-03 16:31:25 +01:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
*** Drop t10 ***
|
|
|
|
DROP TABLE t10;
|
|
|
|
*** Create t11 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
WL#5151: Conversion between different types when replicating
Row-based replication requires the types of columns on the
master and slave to be approximately the same (some safe
conversions between strings are allowed), but does not
allow safe conversions between fields of similar types such
as TINYINT and INT.
This patch implement type conversions between similar fields
on the master and slave.
The conversions are controlled using a new variable
SLAVE_TYPE_CONVERSIONS of type SET('ALL_LOSSY','ALL_NON_LOSSY').
Non-lossy conversions are any conversions that do not run the
risk of losing any information, while lossy conversions can
potentially truncate the value. The column definitions are
checked to decide if the conversion is acceptable.
If neither conversion is enabled, it is required that the
definitions of the columns are identical on master and slave.
Conversion is done by creating an internal conversion table,
unpacking the master data into it, and then copy the data to
the real table on the slave.
.bzrignore:
New files added
client/Makefile.am:
New files added
client/mysqlbinlog.cc:
Functions in rpl_utility.cc is now needed by mysqlbinlog.cc.
libmysqld/Makefile.am:
New files added
mysql-test/extra/rpl_tests/check_type.inc:
Test include file to check a single type conversion.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Switching to use INT instead of TEXT for column that should not have matching types.
mysql-test/extra/rpl_tests/rpl_row_basic.test:
Adding code to enable type conversions for BIT tests since InnoDB
cannot handle them properly due to incorrect information stored as
metadata.
mysql-test/extra/rpl_tests/type_conversions.test:
Test file to check a set of type conversions
with current settings of slave_type_conversions.
mysql-test/suite/rpl/t/rpl_typeconv.test:
Test file to test conversions from master to slave with
all possible values for slave_type_conversions.
The test also checks that the slave_type_conversions
variable works as expected.
sql/field.cc:
Changing definition of compatible_field_size to both check if
two field with identical base types are compatible and give an
order between them if they are compatible.
This only implement checking on the slave, so it will not affect
replication from an old master to a new slave.
sql/field.h:
Changing prototypes for functions:
- compatible_field_size()
- init_for_tmp_table()
- row_pack_length()
sql/log_event.cc:
Changing compability checks to build a conversion table if the fields
are compatible, but does not have the same base type.
sql/log_event_old.cc:
Changing compability checks to build a conversion table if the fields
are compatible, but does not have the same base type.
sql/mysql_priv.h:
Adding global option variable for SLAVE_TYPE_CONVERSIONS
sql/mysqld.cc:
Adding SLAVE_TYPE_CONVERSIONS global server variable.
sql/rpl_record.cc:
Changing unpack_row to use the conversion table if present.
sql/rpl_rli.h:
Removing function get_tabledef and replacing it with get_table_data().
This function retrieve data for table opened for replication, not just
table definition.
sql/rpl_utility.cc:
Function table_def::compatible_with is changed to compare table on master
and slave for compatibility and generate a conversions table if they are
compatible.
Computing real type of fields from metadata for ENUM and SET types.
Computing pack_length correctly for ENUM, SET, and BLOB types.
Adding optimization to not check compatibility if no
slave type conversions are enabled.
sql/rpl_utility.h:
Changing prototypes since implementation has changed.
Modifying table_def::type() to return real type instead of stored type.
sql/set_var.cc:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/set_var.h:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/share/errmsg.txt:
Adding error messages for slave type conversions.
sql/sql_class.h:
Adding SLAVE_TYPE_CONVERSIONS variable.
sql/sql_select.cc:
Correcting create_virtual_tmp_table() to compute null bit positions
correctly in the presence of bit fields.
2009-12-14 12:04:55 +01:00
|
|
|
CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
|
2006-11-03 16:31:25 +01:00
|
|
|
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
|
|
|
|
*** Create t11 on Master ***
|
|
|
|
CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
*** Expect slave to fail with Error 1677 ***
|
2006-11-03 16:31:25 +01:00
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
Slave failed with Error 1677
|
2006-11-03 16:31:25 +01:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
*** Drop t11 ***
|
|
|
|
DROP TABLE t11;
|
|
|
|
*** Create t12 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
|
|
|
|
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
|
|
|
|
*** Create t12 on Master ***
|
|
|
|
CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t12 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
SELECT * FROM t12 ORDER BY a;
|
|
|
|
a b c
|
|
|
|
1 b1b1b1b1b1b1b1b1 Kyle
|
|
|
|
2 b1b1b1b1b1b1b1b1 JOE
|
|
|
|
3 b1b1b1b1b1b1b1b1 QA
|
|
|
|
*** Select on Slave ***
|
|
|
|
SELECT * FROM t12 ORDER BY a;
|
|
|
|
a b f c e
|
|
|
|
1 b1b1b1b1b1b1b1b1 Kyle test 1
|
|
|
|
2 b1b1b1b1b1b1b1b1 JOE test 1
|
|
|
|
3 b1b1b1b1b1b1b1b1 QA test 1
|
|
|
|
*** Drop t12 ***
|
|
|
|
DROP TABLE t12;
|
|
|
|
**** Extra Colums End ****
|
|
|
|
*** BUG 22177 Start ***
|
|
|
|
*** Create t13 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
|
|
|
|
d INT DEFAULT '1',
|
|
|
|
e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE='MyISAM';
|
|
|
|
*** Create t13 on Master ***
|
|
|
|
CREATE TABLE t13 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t13 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
|
|
|
SELECT * FROM t13 ORDER BY a;
|
|
|
|
a b c
|
|
|
|
1 b1b1b1b1b1b1b1b1 Kyle
|
|
|
|
2 b1b1b1b1b1b1b1b1 JOE
|
|
|
|
3 b1b1b1b1b1b1b1b1 QA
|
|
|
|
*** Select on Slave ****
|
|
|
|
SELECT * FROM t13 ORDER BY a;
|
|
|
|
a b c d e
|
|
|
|
1 b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
|
|
|
|
2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
|
|
|
|
3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
|
|
|
|
*** Drop t13 ***
|
|
|
|
DROP TABLE t13;
|
|
|
|
*** 22117 END ***
|
|
|
|
*** Alter Master Table Testing Start ***
|
|
|
|
*** Create t14 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
|
|
|
|
c6 INT DEFAULT '1',
|
|
|
|
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE='MyISAM';
|
|
|
|
*** Create t14 on Master ***
|
|
|
|
CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
|
|
|
|
ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
|
|
|
(2,2.00,'This Test Should work',@b1,'JOE'),
|
|
|
|
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
|
|
|
SELECT * FROM t14 ORDER BY c1;
|
|
|
|
c1 c2 c3 c4 c5
|
|
|
|
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
|
|
|
|
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
|
|
|
|
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
|
|
|
|
*** Select on Slave ****
|
|
|
|
SELECT * FROM t14 ORDER BY c1;
|
|
|
|
c1 c2 c3 c4 c5 c6 c7
|
|
|
|
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
|
|
|
|
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
|
|
|
|
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
|
2007-07-17 22:49:07 +02:00
|
|
|
*** Create t14a on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t14a (c1 INT KEY, c4 BLOB, c5 CHAR(5),
|
|
|
|
c6 INT DEFAULT '1',
|
|
|
|
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE='MyISAM';
|
|
|
|
*** Create t14a on Master ***
|
|
|
|
CREATE TABLE t14a (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t14a () VALUES(1,@b1,'Kyle'),
|
|
|
|
(2,@b1,'JOE'),
|
|
|
|
(3,@b1,'QA');
|
|
|
|
SELECT * FROM t14a ORDER BY c1;
|
|
|
|
c1 c4 c5
|
|
|
|
1 b1b1b1b1b1b1b1b1 Kyle
|
|
|
|
2 b1b1b1b1b1b1b1b1 JOE
|
|
|
|
3 b1b1b1b1b1b1b1b1 QA
|
|
|
|
*** Select on Slave ****
|
|
|
|
SELECT * FROM t14a ORDER BY c1;
|
|
|
|
c1 c4 c5 c6 c7
|
|
|
|
1 b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
|
|
|
|
2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
|
|
|
|
3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
*** Master Drop c5 ***
|
|
|
|
ALTER TABLE t14a DROP COLUMN c5;
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t14a () VALUES(4,@b1),
|
|
|
|
(5,@b1),
|
|
|
|
(6,@b1);
|
|
|
|
SELECT * FROM t14a ORDER BY c1;
|
|
|
|
c1 c4
|
|
|
|
1 b1b1b1b1b1b1b1b1
|
|
|
|
2 b1b1b1b1b1b1b1b1
|
|
|
|
3 b1b1b1b1b1b1b1b1
|
|
|
|
4 b1b1b1b1b1b1b1b1
|
|
|
|
5 b1b1b1b1b1b1b1b1
|
|
|
|
6 b1b1b1b1b1b1b1b1
|
|
|
|
*** Select on Slave ****
|
|
|
|
SELECT * FROM t14a ORDER BY c1;
|
|
|
|
c1 c4 c5 c6 c7
|
|
|
|
1 b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
|
|
|
|
2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
|
|
|
|
3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
|
|
|
|
4 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP
|
|
|
|
5 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP
|
|
|
|
6 b1b1b1b1b1b1b1b1 NULL 1 CURRENT_TIMESTAMP
|
2006-11-03 16:31:25 +01:00
|
|
|
*** connect to master and drop columns ***
|
|
|
|
ALTER TABLE t14 DROP COLUMN c2;
|
|
|
|
ALTER TABLE t14 DROP COLUMN c4;
|
|
|
|
*** Select from Master ***
|
|
|
|
SELECT * FROM t14 ORDER BY c1;
|
|
|
|
c1 c3 c5
|
|
|
|
1 Replication Testing Extra Col Kyle
|
|
|
|
2 This Test Should work JOE
|
|
|
|
3 If is does not, I will open a bug QA
|
|
|
|
*** Select from Slave ***
|
|
|
|
SELECT * FROM t14 ORDER BY c1;
|
|
|
|
c1 c3 c5 c6 c7
|
|
|
|
1 Replication Testing Extra Col Kyle 1 CURRENT_TIMESTAMP
|
|
|
|
2 This Test Should work JOE 1 CURRENT_TIMESTAMP
|
|
|
|
3 If is does not, I will open a bug QA 1 CURRENT_TIMESTAMP
|
|
|
|
*** Drop t14 ***
|
|
|
|
DROP TABLE t14;
|
|
|
|
*** Create t15 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
|
|
|
|
c4 BLOB, c5 CHAR(5),
|
|
|
|
c6 INT DEFAULT '1',
|
|
|
|
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE='MyISAM';
|
|
|
|
*** Create t15 on Master ***
|
|
|
|
CREATE TABLE t15 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
|
|
|
|
c4 BLOB, c5 CHAR(5)) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t15 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
|
|
|
(2,2.00,'This Test Should work',@b1,'JOE'),
|
|
|
|
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
|
|
|
SELECT * FROM t15 ORDER BY c1;
|
|
|
|
c1 c2 c3 c4 c5
|
|
|
|
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
|
|
|
|
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
|
|
|
|
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
|
|
|
|
*** Select on Slave ****
|
|
|
|
SELECT * FROM t15 ORDER BY c1;
|
|
|
|
c1 c2 c3 c4 c5 c6 c7
|
|
|
|
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
|
|
|
|
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
|
|
|
|
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
|
|
|
|
*** Add column on master that is a Extra on Slave ***
|
|
|
|
ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
|
|
|
|
********************************************
|
|
|
|
*** Expect slave to fail with Error 1060 ***
|
|
|
|
********************************************
|
2009-11-03 20:02:56 +01:00
|
|
|
Slave failed with Error 1060
|
2007-10-22 10:32:35 +02:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
2006-11-03 16:31:25 +01:00
|
|
|
START SLAVE;
|
|
|
|
*** Try to insert in master ****
|
|
|
|
INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
|
|
|
|
SELECT * FROM t15 ORDER BY c1;
|
|
|
|
c1 c2 c3 c4 c5 c6
|
|
|
|
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL
|
|
|
|
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL
|
|
|
|
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL
|
|
|
|
5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2
|
|
|
|
*** Try to select from slave ****
|
|
|
|
SELECT * FROM t15 ORDER BY c1;
|
|
|
|
c1 c2 c3 c4 c5 c6 c7
|
|
|
|
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
|
|
|
|
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
|
|
|
|
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
|
2007-10-22 10:32:35 +02:00
|
|
|
5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2 CURRENT_TIMESTAMP
|
2006-11-03 16:31:25 +01:00
|
|
|
*** DROP TABLE t15 ***
|
|
|
|
DROP TABLE t15;
|
|
|
|
*** Create t16 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
|
|
|
|
c4 BLOB, c5 CHAR(5),
|
|
|
|
c6 INT DEFAULT '1',
|
|
|
|
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
)ENGINE='MyISAM';
|
|
|
|
*** Create t16 on Master ***
|
|
|
|
CREATE TABLE t16 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
|
|
|
|
c4 BLOB, c5 CHAR(5))ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
set @b1 = 'b1b1b1b1';
|
|
|
|
set @b1 = concat(@b1,@b1);
|
|
|
|
INSERT INTO t16 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
|
|
|
|
(2,2.00,'This Test Should work',@b1,'JOE'),
|
|
|
|
(3,3.00,'If is does not, I will open a bug',@b1,'QA');
|
|
|
|
SELECT * FROM t16 ORDER BY c1;
|
|
|
|
c1 c2 c3 c4 c5
|
|
|
|
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle
|
|
|
|
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE
|
|
|
|
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA
|
|
|
|
*** Select on Slave ****
|
|
|
|
SELECT * FROM t16 ORDER BY c1;
|
|
|
|
c1 c2 c3 c4 c5 c6 c7
|
|
|
|
1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP
|
|
|
|
2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
|
|
|
|
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
|
|
|
|
*** Add Partition on master ***
|
|
|
|
ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4;
|
|
|
|
INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer');
|
|
|
|
SHOW CREATE TABLE t16;
|
|
|
|
Table Create Table
|
|
|
|
t16 CREATE TABLE `t16` (
|
|
|
|
`c1` int(11) NOT NULL,
|
|
|
|
`c2` decimal(8,2) DEFAULT NULL,
|
|
|
|
`c3` text,
|
|
|
|
`c4` blob,
|
|
|
|
`c5` char(5) DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`c1`)
|
2008-11-04 08:43:21 +01:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
|
|
/*!50100 PARTITION BY KEY (c1)
|
|
|
|
PARTITIONS 4 */
|
2006-11-03 16:31:25 +01:00
|
|
|
*** Show table on Slave ****
|
|
|
|
SHOW CREATE TABLE t16;
|
|
|
|
Table Create Table
|
|
|
|
t16 CREATE TABLE `t16` (
|
|
|
|
`c1` int(11) NOT NULL,
|
|
|
|
`c2` decimal(8,2) DEFAULT NULL,
|
|
|
|
`c3` text,
|
|
|
|
`c4` blob,
|
|
|
|
`c5` char(5) DEFAULT NULL,
|
|
|
|
`c6` int(11) DEFAULT '1',
|
|
|
|
`c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
PRIMARY KEY (`c1`)
|
2008-11-04 08:43:21 +01:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
|
|
/*!50100 PARTITION BY KEY (c1)
|
|
|
|
PARTITIONS 4 */
|
2006-11-03 16:31:25 +01:00
|
|
|
*** DROP TABLE t16 ***
|
|
|
|
DROP TABLE t16;
|
|
|
|
*** Alter Master End ***
|
|
|
|
*** Create t17 on slave ***
|
|
|
|
STOP SLAVE;
|
|
|
|
RESET SLAVE;
|
|
|
|
CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
|
|
|
|
d FLOAT DEFAULT '2.00',
|
|
|
|
e CHAR(5) DEFAULT 'TEST2')
|
|
|
|
ENGINE='MyISAM';
|
|
|
|
*** Create t17 on Master ***
|
|
|
|
CREATE TABLE t17 (a BIGINT PRIMARY KEY, b INT, c CHAR(10)
|
|
|
|
) ENGINE='MyISAM';
|
|
|
|
RESET MASTER;
|
|
|
|
*** Start Slave ***
|
|
|
|
START SLAVE;
|
|
|
|
*** Master Data Insert ***
|
|
|
|
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
|
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
*** Expect slave to fail with Error 1677 ***
|
2006-11-03 16:31:25 +01:00
|
|
|
********************************************
|
2010-01-07 16:39:11 +01:00
|
|
|
Slave failed with Error 1677
|
2006-11-03 16:31:25 +01:00
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
|
|
START SLAVE;
|
|
|
|
** DROP table t17 ***
|
|
|
|
DROP TABLE t17;
|