It will be slave error when change column type on slave first.
Table definition:
[cc lang='sql']
CREATE TABLE `table_xf` (
`i` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(16) DEFAULT NULL,
PRIMARY KEY (`i`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk
select * from table_xf;
+---+------+
| i | name |
+---+------+
| 1 | a |
| 2 | b |
| 3 | c |
+---+------+
3 rows in set (0.00 sec)
[/cc]
Then do the column change on the slave first
[cc lang='sql']
root@xf_ccc 08:50:43>alter table table_xf modify column i bigint not null auto_increment;
Query OK, 3 rows affected (0.18 sec)
Records: 3 Duplicates: 0 Warnings: 0
[/cc]
When update the record on the Master,
[cc lang='sql']
root@xf_ccc 08:51:21>update table_xf set name='a1' where i=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
[/cc]
The Slave's error info in the "show slave status"
Last_Errno: 1535
 Last_Error: Table definition on master and slave does not match: Column 0 type mismatch - received type 3, xf_ccc.table_xf has type 8
After do the change on the Master and skip the erro on the Salve
SET GLOBAL SQL_slave_SKIP_COUNTER = 1;
START SLAVE;
The master and slave will be OK, but the discordant data should be corrected.
You also can set the variables for this issue.
set global slave_type_conversions=’ALL_NON_LOSSY’;
Changing the type conversion mode requires restarting the slave with the new slave_type_conversionssetting.
Then start slave.
--eof
This work is licensed under a CC A-S 4.0 International License.
