Bug #16261 LOAD TABLE FROM MASTER 4.0 to 5.0 destroys data

Submitted: 6 Jan 2006 19:12 Modified: 4 Aug 2006 9:59
Reporter: Ingo Strüwing Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:4.0.27-BK/5.0.19-BK, 4.0.18 / 5.0.16 OS:Linux (Linux)
Assigned to: MC Brown CPU Architecture:Any

[6 Jan 2006 19:12] Ingo Strüwing
Description:
Taken from the mailinglist http://lists.mysql.com/mysql-de/1089 on behalf of Hans Flug <hansflug@freenet.de>.

Loading a table from a 4.0 master to a 5.0 slave results in corrupt data in the slave table.

How to repeat:
MASTER:

CREATE TABLE `loadtable` (
  `f1` tinyint(4) NOT NULL default '0',
  `f2` tinyint(4) NOT NULL default '0'
) TYPE=MyISAM;

INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);

mysql> select * from loadtable;
+----+----+
| f1 | f2 |
+----+----+
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
+----+----+
16 rows in set (0.00 sec)

SLAVE:

mysql> DROP TABLE loadtable;
Query OK, 0 rows affected (0.00 sec)

mysql> LOAD TABLE loadtable FROM MASTER ;
Query OK, 0 rows affected, 1 warning (0.04 sec)

Warning (Code 1287): 'TYPE=storage_engine' is deprecated; use
'ENGINE=storage_engine' instead

mysql> select * from loadtable;
+----+----+
| f1 | f2 |
+----+----+
|  1 |  1 |
|  0 |  0 |
|  1 |  0 |
|  1 |  1 |
|  0 |  0 |
|  1 |  0 |
|  1 |  1 |
+----+----+
7 rows in set (0.00 sec)
[30 Jan 2006 10:55] Valeriy Kravchuk
Thank you for a bug report. Verified just as described on latest 4.0.27-BK (ChangeSet@1.2172, 2006-01-23 21:51:32+03:00) as master and 5.0.19-BK (ChangeSet@1.2011, 2006-01-28 19:44:51-06:00) as slave, on SuSE 9.3:

MASTER:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.0.27-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE TABLE `loadtable` (
    ->   `f1` tinyint(4) NOT NULL default '0',
    ->   `f2` tinyint(4) NOT NULL default '0'
    -> ) ENGINE=MyISAM;
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
Query OK, 1 row affected (0.01 sec)
...
mysql> INSERT INTO `loadtable` (`f1`, `f2`) VALUES (1, 1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from loadtable;
+----+----+
| f1 | f2 |
+----+----+
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
+----+----+
16 rows in set (0.01 sec)

mysql> select version();
+------------+
| version()  |
+------------+
| 4.0.27-log |
+------------+
1 row in set (0.01 sec)

SLAVE:

openxs@suse:~/dbs/5.0> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 5.0.19

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| loadtable      |
+----------------+
1 row in set (0.00 sec)

mysql> select * from loadtable;
+----+----+
| f1 | f2 |
+----+----+
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
|  1 |  1 |
+----+----+
16 rows in set (0.00 sec)

mysql> drop table loadtable;
Query OK, 0 rows affected (0.01 sec)

mysql> LOAD TABLE loadtable FROM MASTER ;
Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------------------------+
| Level   | Code | Message            |
+---------+------+--------------------------------------------------------------------------+
| Warning | 1287 | 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead |
+---------+------+--------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select * from loadtable;
+----+----+
| f1 | f2 |
+----+----+
|  1 |  1 |
|  0 |  0 |
|  1 |  0 |
|  1 |  1 |
|  0 |  0 |
|  1 |  0 |
|  1 |  1 |
+----+----+
7 rows in set (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.0.19    |
+-----------+
1 row in set (0.01 sec)

mysql> show slave status\G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: localhost
                Master_User: repl
                Master_Port: 3340
              Connect_Retry: 60
            Master_Log_File: mysql-bin.002
        Read_Master_Log_Pos: 2194
             Relay_Log_File: suse-relay-bin.000003
              Relay_Log_Pos: 1798
      Relay_Master_Log_File: mysql-bin.002
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB: test
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table:
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: 0
                 Last_Error:
               Skip_Counter: 0
        Exec_Master_Log_Pos: 2194
            Relay_Log_Space: 1798
            Until_Condition: None
             Until_Log_File:
              Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File:
         Master_SSL_CA_Path:
            Master_SSL_Cert:
          Master_SSL_Cipher:
             Master_SSL_Key:
      Seconds_Behind_Master: 0
1 row in set (0.00 sec)

It is a bug.

P.S.
Master configuration:

openxs@suse:~/dbs/4.0> cat var/my.cnf
[mysqld]
log-bin=mysql-bin
server-id=1
port=3340
socket=/tmp/mysql40.sock

Slave configuration:

openxs@suse:~/dbs/5.0> cat var/my.cnf
[mysqld]
server-id=2
replicate_do_db=test
openxs@suse:~/dbs/5.0> cat var/master.info
14
mysql-bin.002
2194
localhost
repl
repl
3340
60
0
[12 Jul 2006 16:44] Chad MILLER
Brian said this has sat too long, and wants me to take a try at it.
[2 Aug 2006 14:22] Chad MILLER
Sorry, we don't support this.  It should be documented, if it isn't so.
[4 Aug 2006 9:59] MC Brown
I have updated the documentation for 5.0 to state that this combination (4.1/5.0) and LOAD TABLE FROM MASTER is not supported.
[13 Sep 2006 12:34] Christian Hammers
Are you serious? Either say "ERROR: 4.x master cannot connect to 5.0 slave." without touching the data (you surely get the version numbers from the handshare) or fix it but silently corrupting the database is BAD!

Note: there was a warning given, that maybe even has to do with the cause of the corruptiong but the point is that *this* warning points out the use of a deprecated, but apparently still accepted, option. It does neither discourage the 4.0/5.0 mix nor warns it for possible data corruptions.

bye,

-christian-

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.044 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.