Bug #20705 table truncation from one mysqld causes ERROR 1412 on other mysqld servers
Submitted: 26 Jun 2006 20:02 Modified: 3 Jul 2006 16:48
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.1.12 OS:Linux (Linux 32 bit OS)
Assigned to: Tomas Ulin CPU Architecture:Any

[26 Jun 2006 20:02] Jonathan Miller
Description:
Truncating a table on one MySQLD will cause other MySQLD's in the cluster to return 
mysql> select * from t1;
ERROR 1412 (HY000): Table definition has changed, please retry transaction

This will cause users to have to program to catch the error and retry the transaction.

Now if you use "delete from" this does not happen. But documents tell users to use truncate as a work around for when "delete from" cause the cluster to run out of transactional records.

How to repeat:
mysql#1> create table t1 (c1 INT)ENGINE=NDB;
mysql#1> insert into t1 values (4);
mysql#2> select * from t1;
+------+
| c1   |
+------+
|    4 |
+------+
mysql#1> truncate t1;
mysql#2> select * from t1;
ERROR 1412 (HY000): Table definition has changed, please retry transaction

Suggested fix:
MySQLD should refresh cache on its own and retry the transaction before sending error to user to deal with.
[27 Jun 2006 22:20] Tomas Ulin
occurs for mysqld's that don't have a binlog... others are ok
[27 Jun 2006 22:44] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/8356
[28 Jun 2006 5:49] Tomas Ulin
pushed to 5.1.12
[3 Jul 2006 16:48] Jon Stephens
Documented bugfix in 5.1.12 changelog. Closed.