Bug #46764 Manual bug with Cluster rollbacks
Submitted: 17 Aug 2009 17:50 Modified: 6 Nov 2009 20:02
Reporter: Andrew Hutchings Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[17 Aug 2009 17:50] Andrew Hutchings
Description:
MySQL Cluster transactions are implicitly rolled back in many cases despite the manual:

http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-resolved.html
#

Rollbacks.  Prior to MySQL Cluster NDB 6.3.19, the NDBCLUSTER storage engine did not support partial transactions or partial rollbacks of transactions. A duplicate key or similar error aborted the entire transaction, and subsequent statements raised ERROR 1296 (HY000): Got error 4350 'Transaction already aborted' from NDBCLUSTER. In such cases, it was necessary to issue an explicit ROLLBACK and retry the entire transaction.

Beginning with MySQL Cluster NDB 6.3.19, this limitation has been removed, and the behavior of NDBCLUSTER is now in line with that of other transactional storage engines such as InnoDB which can roll back individual statements. (Bug#32656)
 

How to repeat:
2 examples where NDB will implicitly rollback:

mysql> create table t1 (cone varchar(20), ctwo varchar(20) not null) engine=ndb;
mysql> start transaction;
mysql> insert into t1 values ('one','test');
mysql> insert into t1 values ('two',null);
ERROR 1048 (23000): Column 'ctwo' cannot be null
mysql> show warnings\G
*************************** 1. row ***************************
  Level: Error
   Code: 1048
Message: Column 'ctwo' cannot be null
*************************** 2. row ***************************
  Level: Error
   Code: 1622
Message: Storage engine NDB does not support rollback for this statement. Transaction rolled back and must be restarted
2 rows in set (0.00 sec)

mysql> create table t3 (cone varchar(20) primary key, ctwo varchar(20) not null) engine=ndb;
mysql> start transaction;
mysql> insert into t3 values ('one','test');
mysql> insert into t3 values ('one','test2');
ERROR 1062 (23000): Duplicate entry 'one' for key 'PRIMARY'
mysql> show warnings;
*************************** 1. row ***************************
  Level: Error
   Code: 1296
Message: Got error 630 'Tuple already existed when attempting to insert' from NDB
*************************** 2. row ***************************
  Level: Error
   Code: 1062
Message: Duplicate entry 'one' for key 'PRIMARY'
*************************** 3. row ***************************
  Level: Error
   Code: 1622
Message: Storage engine NDB does not support rollback for this statement.  
3 rows in set (0.00 sec)
[21 Aug 2009 13:07] Jon Stephens
The portion of the Manual quoted above *already* says that it's no longer necessary to issue an explicit ROLLBACK in the event of duplicate-key and suchlike errors; "no longer necessary to perform explicit ROLLBACK" implies "an implicit ROLLBACK occurs instead". Any other interpretation is simply not logical (AFAICT), so I don't see what's at issue.

Thanks!
[21 Aug 2009 13:17] Jonas Oreland
i'm with andrew here, the 3 times I read the wording, i always interpreted it
as we behave like innodb, i.e don't abort transaction, but simple rollback statement.
[6 Nov 2009 20:02] Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

See also BUG#32656.