Bug #30034 5.1.20 Cluster Replication UPDATE uses default values where not to
Submitted: 25 Jul 2007 13:00 Modified: 17 Mar 2008 15:04
Reporter: Erik Hoekstra Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S2 (Serious)
Version:5.1.20 OS:Linux (RedHat)
Assigned to: CPU Architecture:Any
Tags: default value, myisam, ndb, replication, UPDATE

[25 Jul 2007 13:00] Erik Hoekstra
Description:
Useing 5.1.20 on a mysql-cluster setup with a replication from 2 api's to 2 individual slave's
    
    NDB.1        NDB.2
    API.1        API.2
    Slave.1        Slave.2

Doing a update on on of the API's (which are the masters for the 2 slaves) will update the record right on the masters, but will update wrongly on the slaves; updating only the field specified by update BUT will change the none specified fields to there default values!!!

How to repeat:
On API.1;

CREATE TABLE `t1` ( 
    `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `field1` VARCHAR( 32 ) NOT NULL DEFAULT 'field1',
    `field2` MEDIUMINT( 5 ) NOT NULL DEFAULT '13' ,
    `field3` SMALLINT( 3 ) NOT NULL DEFAULT '0' 
) ENGINE = NDBCLUSTER;
INSERT INTO t1 VALUES (NULL,'',52,52);
INSERT INTO t1 VALUES (NULL,'',52,52);
INSERT INTO t1 VALUES (NULL,'',52,52);

SELECT * FROM t1;
+----+--------+--------+--------+
| id | field1 | field2 | field3 |
+----+--------+--------+--------+
|  1 |        |     51 |     51 |
|  2 |        |     52 |     52 |
|  3 |        |     53 |     53 |
+----+--------+--------+--------+

On Slave.1 (or Slave.2)

SELECT * FROM t1;
+----+--------+--------+--------+
| id | field1 | field2 | field3 |
+----+--------+--------+--------+
|  1 |        |     51 |     51 |
|  2 |        |     52 |     52 |
|  3 |        |     53 |     53 |
+----+--------+--------+--------+

Back on the master again (API.1)
mysql> update t1 set field1 = NULL where id = 3;
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> show warnings;
+---------+------+--------------------------------+
| Level   | Code | Message                        |
+---------+------+--------------------------------+
| Warning | 1048 | Column 'field1' cannot be null |
+---------+------+--------------------------------+
1 row in set (0.00 sec)

mysql> select * from t1;
+----+--------+--------+--------+
| id | field1 | field2 | field3 |
+----+--------+--------+--------+
|  1 |        |     51 |     51 |
|  2 |        |     52 |     52 |
|  3 |        |     53 |     53 |
+----+--------+--------+--------+
3 rows in set (0.00 sec)

On one of the slaves;
mysql> SELECT * FROM t1;
+----+--------+--------+--------+
| id | field1 | field2 | field3 |
+----+--------+--------+--------+
|  1 |        |     51 |     51 |
|  2 |        |     52 |     52 |
|  3 |        |     13 |      0 |
+----+--------+--------+--------+

And again;
Master(API.2)
UPDATE t1 SET field1 = 'test' WHERE id = 1;

Slave
mysql> SELECT * FROM t1;
+----+--------+--------+--------+
| id | field1 | field2 | field3 |
+----+--------+--------+--------+
|  1 | test   |     13 |      0 |
|  2 |        |     52 |     52 |
|  3 |        |     13 |      0 |
+----+--------+--------+--------+
[17 Feb 2008 15:04] Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with a newer version, 5.1.23-rc, and inform about the results.
[18 Mar 2008 0:01] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".