Details
-
Bug
-
Status: On Hold
-
Medium
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Quoting [email protected] , from the upstream bug report:
Description:
It may happen that you want to prepare for int column growth and change datatype from int to bigint, so you do it first on the slave.
Unfortunately, after passing maximum value for signed int (2147483647), when master has unsigned int, regardless if the slave has singed or unsigned bigint, the values get either truncated to 0 (when unsigned) or stored as negative numbers counting from -2147483647 downwards.
How to repeat:
master [localhost] {msandbox} (test) > select @@version,@@version_comment;
+------------+------------------------------+
| @@version | @@version_comment |
+------------+------------------------------+
| 5.7.14-log | MySQL Community Server (GPL) |
+------------+------------------------------+
1 row in set (0.00 sec)
master [localhost] {msandbox} (test) > create table c1 (id int unsigned NOT NULL);
Query OK, 0 rows affected (0.05 sec)
slave1 [localhost] {msandbox} (test) > alter table c1 modify id bigint NOT NULL;
Query OK, 0 rows affected (0.11 sec)
Records: 0 Duplicates: 0 Warnings: 0
master [localhost] {msandbox} (test) > insert into c1 values (1),(2147483647),(2147483649),(2147483650);
Query OK, 4 rows affected (0.01 sec)
Records: 4 Duplicates: 0 Warnings: 0
master [localhost] {msandbox} (test) > select * from test.c1;
+------------+
| id |
+------------+
| 1 |
| 2147483647 |
| 2147483649 |
| 2147483650 |
+------------+
4 rows in set (0.00 sec)
slave1 [localhost] {msandbox} (test) > select @@slave_type_conversions;
+--------------------------+
| @@slave_type_conversions |
+--------------------------+
| ALL_NON_LOSSY |
+--------------------------+
1 row in set (0.00 sec)
slave1 [localhost] {msandbox} (test) > select * from test.c1;
+-------------+
| id |
+-------------+
| 1 |
| 2147483647 |
| -2147483647 |
| -2147483646 |
+-------------+
4 rows in set (0.00 sec)