Bug #104712 | IMPLICITLY added NOT NULL constraint missing in the binary log | ||
---|---|---|---|
Submitted: | 24 Aug 2021 16:55 | Modified: | 8 Oct 2021 15:34 |
Reporter: | Systems Engineer | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S3 (Non-critical) |
Version: | 5.7.35 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | implicit declaration not replicated |
[24 Aug 2021 16:55]
Systems Engineer
[27 Aug 2021 15:39]
MySQL Verification Team
Hi, Why would binlog need this when it will be created properly on the slave? master [localhost:20236] {msandbox} (test) > CREATE TABLE `test7` ( -> `id` INT(11) , -- No constraint -> `number` INT(11) DEFAULT NULL, -> `form` VARCHAR(255) DEFAULT NULL, -> PRIMARY KEY (`id`) -> ) ENGINE=INNODB DEFAULT CHARSET=latin1; Query OK, 0 rows affected (0.05 sec) master [localhost:20236] {msandbox} (test) > show create table test7\G *************************** 1. row *************************** Table: test7 Create Table: CREATE TABLE `test7` ( `id` int(11) NOT NULL, `number` int(11) DEFAULT NULL, `form` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec) master [localhost:20236] {msandbox} (test) > \q Bye arhimed@localdev rsandbox_5_7_35]$ ./s2 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.7.35-log MySQL Community Server (GPL) Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. slave2 [localhost:20238] {msandbox} ((none)) > use test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed slave2 [localhost:20238] {msandbox} (test) > show create table test7\G *************************** 1. row *************************** Table: test7 Create Table: CREATE TABLE `test7` ( `id` int(11) NOT NULL, `number` int(11) DEFAULT NULL, `form` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec) slave2 [localhost:20238] {msandbox} (test) >
[28 Aug 2021 5:45]
Systems Engineer
For a 5.7 Slave replicated from a 5.6 Master, it breaks the replication. The 5.6 handling of the situation is a bit different - For the primary key with DEFAULT NULL, it adds a DEFAULT 0, with a NOT NULL constraint. But in binlog it still writes it as 'int(11) DEFAULT NULL' . In 5.7 Slave 'int(11) DEFAULT NULL is errored out. This situation (usually during an upgrade process) may be averted in possibly two different methods 1) The binlog generated by master shoud have the implicitly modified statement 2) Slaves should detect that the master is on 5.6 and should fall back to the old behaviour
[30 Aug 2021 7:55]
MySQL Verification Team
Hi, So this is replication from 5.6 to 5.7 that you have issues with and fix would have to go into 5.6. Normal support for 5.6 ended in February 2021 and since then 5.6 is in sustaining support meaning security bugs, critical stuff ... I don't see this being critical bug that fix will go into 5.6. I'll check with my colleagues if we can offer some solution but I doubt we can patch 5.6 Thanks
[8 Oct 2021 15:34]
MySQL Verification Team
I did not find a proper workaround, verifying the behavior for completeness. Thanks for the report