Replication with Differing Table Definitions on Master and Slave
Today, I have increased the size column varchar(5000) to varchar(10000) on slave for table.
alter table CASE_ACTIVITY modify remarks VARCHAR(10000) DEFAULT NULL;
And, start getting below error and replication is stoped,
[ERROR] Slave SQL: Column 6 of table 'db.slave' cannot be converted from type 'varchar(5000)' to type 'varchar(10000)', Error_code: 1677
MySQL error code 1677 (ER SLAVE CONVERSION FAILED): Columns of table '%-.192s.%-.192s' cannot be converted from type '%-.32s' to type '%-.32s'
As a solution I changes slave_type_conversions
alter table CASE_ACTIVITY modify remarks VARCHAR(10000) DEFAULT NULL;
And, start getting below error and replication is stoped,
[ERROR] Slave SQL: Column 6 of table 'db.slave' cannot be converted from type 'varchar(5000)' to type 'varchar(10000)', Error_code: 1677
MySQL error code 1677 (ER SLAVE CONVERSION FAILED): Columns of table '%-.192s.%-.192s' cannot be converted from type '%-.32s' to type '%-.32s'
As a solution I changes slave_type_conversions
show global variables like '%slave_type_conversions%';
MySQL> set global slave_type_conversions='ALL_NON_LOSSY'
And, it worked :)
Controlling what conversions are allowed is controlled with a new
server variable
SLAVE_TYPE_CONVERSIONS
, which is of the
type SET('ALL_LOSSY','ALL_NON_LOSSY')
, that is, it is a
set of allowed conversions. The default for this variable is
the empty set, meaning that no conversions are allowed at all.
If the
ALL_NON_LOSSY
constant is in the set, all
conversions (within each group) that do not lose any information are
allowed. For example, replicating from CHAR(32)
to
TINYTEXT
is allowed since the conversion goes to a wider
field (even if it is a different type).
If the
ALL_LOSSY
constant is in the set, all conversions
(again, within the same group) that could potentially lose information
is allowed. For example, conversion to a narrower field on the slave,
such as CHAR(32)
to CHAR(16)
is
allowed. Note that non-lossy conversions are not automatically
allowed when ALL_LOSSY
is set.
No comments:
Post a Comment