Bug #46696 NDB$MAX breaks with triggers
Submitted: 13 Aug 2009 13:31 Modified: 29 Oct 2009 17:32
Reporter: Andrew Hutchings Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: 6.3.25, 7.0.6

[13 Aug 2009 13:31] Andrew Hutchings
Description:
When using NDB$MAX with circular replication on a table which has a trigger to update the NDB$MAX field the conflict resolution fails after a replication break/repair.

How to repeat:
1. Setup two clusters replicating to each other
2. insert into mysql.ndb_replication values("test","t1",0,0,"NDB$MAX(X)");
3. create table t1 ( id INTEGER NOT NULL, acounter INTEGER NOT NULL, bscounter INT UNSIGNED NOT NULL, updatetime TIMESTAMP, X BIGINT UNSIGNED DEFAULT NULL, PRIMARY KEY USING HASH (id)) engine=ndb;
4. CREATE TRIGGER set_x BEFORE UPDATE ON t1
FOR EACH ROW SET NEW.X = unix_timestamp();
5. insert into t1 values (2, 9, 9, "2009-08-13 14:24:00", 1250173495);
6. STOP SLAVE on both clusters
7. Cluster1:
update t1 set acounter=acounter+1 where id=2;
8. Cluster2:
update t1 set bcounter=bcounter+1 where id=2;
9. START SLAVE on both clusters

Result is the logs fill endlessly with the following and the conflict is never resolved:

[Note] NDB Slave: missing data for NDB_MAX
[30 Oct 2009 0:00] 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".