HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Column cannot be converted from type 'int' to type 'bigint(20) unsigned'?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
cannotcolumnunsignedtypebigintfromintconverted

Problem

I have a Percona MySQL cluster, with a master and a few slaves. Each of them is running "Ver 14.14 Distrib 5.5.40-36.1" of MySQL. Replication is row based.

I ran an alter query on one of the tables of the slave only. The plan is to run this query on all slaves and then do a master switch as we cannot afford to lock tables in master.

The query is:

ALTER TABLE order_item_units 
MODIFY parent_id BIGINT(20) unsigned ;


And post this when I checked the slave using show slave status, I see the replication is broken with following error:


Column 3 of table 'database_name.order_item_units' cannot be converted from type 'int' to type 'bigint(20) unsigned'

And when I checked the column, it did convert into BIGINT.

And now I am not able to fix this. I did stop slave and start slave, didn't help. Did stop slave and MySQL restart, didn't help. Did a skip counter, didn't help either.

Either the column should not have gotten converted, then the error would have be just, but then may be there should not have been any error at all.

And if the column did get converted, then why the error?

Any clue what am I missing here?

Solution

In your specific case setting slave_conversion_type=ALL_NON_LOSSY would help. Execute these commands on the slave:
STOP SLAVE;
SET GLOBAL SLAVE_TYPE_CONVERSIONS=ALL_NON_LOSSY;
START SLAVE;
SHOW SLAVE STATUS\G


From the documentation:

This mode permits conversions that do not require truncation or other special handling of the source value; that is, it permits conversions where the target type has a wider range than the source type.

Context

StackExchange Database Administrators Q#107125, answer score: 2

Revisions (0)

No revisions yet.